Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent account not found error on disconnect #2073

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/scaffold/src/modal/w3m-account-button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export class W3mAccountButton extends LitElement {
<wui-account-button
.disabled=${Boolean(this.disabled)}
.isUnsupportedChain=${this.isUnsupportedChain}
address=${ifDefined(this.profileName ?? this.address)}
address=${ifDefined(this.address)}
profileName=${ifDefined(this.profileName)}
?isProfileName=${Boolean(this.profileName)}
networkSrc=${ifDefined(networkImage)}
avatarSrc=${ifDefined(this.profileImage)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class W3mAccountDefaultWidget extends LitElement {
this.profileName = val.profileName
this.balance = val.balance
this.balanceSymbol = val.balanceSymbol
} else {
} else if (!this.disconnecting) {
SnackController.showError('Account not found')
}
})
Expand Down
4 changes: 3 additions & 1 deletion packages/ui/src/composites/wui-account-button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export class WuiAccountButton extends LitElement {

@property() public address = ''

@property() public profileName = ''

@property() public charsStart = 4

@property() public charsEnd = 6
Expand All @@ -50,7 +52,7 @@ export class WuiAccountButton extends LitElement {
></wui-avatar>
<wui-text variant="paragraph-600" color="inherit">
${UiHelperUtil.getTruncateString({
string: this.address,
string: this.isProfileName ? this.profileName : this.address,
charsStart: this.isProfileName ? 18 : this.charsStart,
charsEnd: this.isProfileName ? 0 : this.charsEnd,
truncate: this.isProfileName ? 'end' : 'middle'
Expand Down