From dc0bd94b7aba7d58847c7625becdbad77381397b Mon Sep 17 00:00:00 2001 From: Hoang Dinh Date: Tue, 26 Nov 2024 16:00:02 +1000 Subject: [PATCH] fix(kmd): prompt for password twice when the password is an empty string When using KMD wallet for localnet, it's common that the password is set to an empty string. In this case, the memoised logic failed to detect the existing password. To fix this: - the password field is initialised to null - the memoised logic returns the password if it is not null --- packages/use-wallet/src/wallets/kmd.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/use-wallet/src/wallets/kmd.ts b/packages/use-wallet/src/wallets/kmd.ts index 6db0b4d3..4f29b43e 100644 --- a/packages/use-wallet/src/wallets/kmd.ts +++ b/packages/use-wallet/src/wallets/kmd.ts @@ -60,7 +60,7 @@ export class KmdWallet extends BaseWallet { private options: KmdConstructor private walletName: string private walletId: string = '' - private password: string = '' + private password: string | null = null protected store: Store @@ -302,7 +302,7 @@ export class KmdWallet extends BaseWallet { } private getPassword(): string { - if (this.password) { + if (this.password !== null) { return this.password } const password = prompt('KMD password') || ''