From 76495d156302b25381e638b04b272e467f81e748 Mon Sep 17 00:00:00 2001 From: Corban Riley Date: Mon, 27 Oct 2025 11:11:16 -0400 Subject: [PATCH] Allow to logout a wallet with skipRemoveDevice even if the wallet is not in a ready state to allow force removing of wallets --- packages/wallet/wdk/src/sequence/wallets.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/wallet/wdk/src/sequence/wallets.ts b/packages/wallet/wdk/src/sequence/wallets.ts index a859ca797e..e05d81ae15 100644 --- a/packages/wallet/wdk/src/sequence/wallets.ts +++ b/packages/wallet/wdk/src/sequence/wallets.ts @@ -1159,12 +1159,6 @@ export class Wallets implements WalletsInterface { throw new Error('wallet-not-found') } - // Prevent starting logout if already logging out or not ready - if (walletEntry.status !== 'ready') { - console.warn(`Logout called on wallet ${wallet} with status ${walletEntry.status}. Aborting.`) - throw new Error(`Wallet is not in 'ready' state for logout (current: ${walletEntry.status})`) - } - if (options?.skipRemoveDevice) { await Promise.all([ this.shared.databases.manager.del(wallet), @@ -1173,6 +1167,12 @@ export class Wallets implements WalletsInterface { return undefined as any } + // Prevent starting logout if already logging out or not ready + if (walletEntry.status !== 'ready') { + console.warn(`Logout called on wallet ${wallet} with status ${walletEntry.status}. Aborting.`) + throw new Error(`Wallet is not in 'ready' state for logout (current: ${walletEntry.status})`) + } + const device = await this.shared.modules.devices.get(walletEntry.device) if (!device) { throw new Error('device-not-found')