From b95c759b6f724654ceeb0b11566f05aae34f073d Mon Sep 17 00:00:00 2001 From: igmahl Date: Wed, 10 Dec 2025 23:57:18 +0200 Subject: [PATCH] improve nametag availability check and fix UX flow --- src/components/wallet/L3/onboarding/CreateWalletFlow.tsx | 5 +---- src/components/wallet/L3/services/NametagService.ts | 9 +++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/wallet/L3/onboarding/CreateWalletFlow.tsx b/src/components/wallet/L3/onboarding/CreateWalletFlow.tsx index 3ea1894a9..dcb635554 100644 --- a/src/components/wallet/L3/onboarding/CreateWalletFlow.tsx +++ b/src/components/wallet/L3/onboarding/CreateWalletFlow.tsx @@ -226,20 +226,17 @@ export function CreateWalletFlow() { setIsBusy(true); setError(null); - setStep('processing'); try { const cleanTag = nametagInput.trim().replace('@', ''); const isNametagAvailable = await checkNametagAvailability(cleanTag); - console.log(isNametagAvailable) if(!isNametagAvailable) { - console.log("Setting error") setError(`${cleanTag} already exists.`); - setStep('nametag') return; } + setStep('processing'); await mintNametag(cleanTag); // Successfully minted nametag - reload to reinitialize with new nametag // This ensures React Query refreshes and the app transitions to main wallet view diff --git a/src/components/wallet/L3/services/NametagService.ts b/src/components/wallet/L3/services/NametagService.ts index 2a040d38d..247a3ef4e 100644 --- a/src/components/wallet/L3/services/NametagService.ts +++ b/src/components/wallet/L3/services/NametagService.ts @@ -41,11 +41,12 @@ export class NametagService { } async isNametagAvailable(nametag: string): Promise { - const client = ServiceProvider.stateTransitionClient; - const rootTrustBase = ServiceProvider.getRootTrustBase(); const nametagTokenId = await TokenId.fromNameTag(nametag); - - return await !client.isMinted(rootTrustBase, nametagTokenId); + const isAlreadyMinted = await ServiceProvider.stateTransitionClient.isMinted( + ServiceProvider.getRootTrustBase(), + nametagTokenId + ); + return !isAlreadyMinted; } async mintNametagAndPublish(nametag: string): Promise {