diff --git a/packages/scaffold-ui/src/views/w3m-register-account-name-view/index.ts b/packages/scaffold-ui/src/views/w3m-register-account-name-view/index.ts index b6fcdd9d87..2c61f1494b 100644 --- a/packages/scaffold-ui/src/views/w3m-register-account-name-view/index.ts +++ b/packages/scaffold-ui/src/views/w3m-register-account-name-view/index.ts @@ -33,6 +33,8 @@ export class W3mRegisterAccountNameView extends LitElement { @state() private registered = false + @state() private profileName = AccountController.state.profileName + public constructor() { super() this.usubscribe.push( @@ -40,6 +42,12 @@ export class W3mRegisterAccountNameView extends LitElement { EnsController.subscribe(val => { this.suggestions = val.suggestions this.loading = val.loading + }), + AccountController.subscribeKey('profileName', val => { + this.profileName = val + if (val) { + this.error = 'You already own a name' + } }) ] ) @@ -170,7 +178,13 @@ export class W3mRegisterAccountNameView extends LitElement { } private isAllowedToSubmit() { - return !this.loading && !this.registered && !this.error && EnsController.validateName(this.name) + return ( + !this.loading && + !this.registered && + !this.error && + !this.profileName && + EnsController.validateName(this.name) + ) } private async onSubmitName() {