Skip to content

Commit 7bef40e

Browse files
authored
Allow to logout a wallet with skipRemoveDevice even if the wallet is not in a ready state to allow force removing of wallets (#906)
1 parent 9c2f3a1 commit 7bef40e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/wallet/wdk/src/sequence/wallets.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,12 +1159,6 @@ export class Wallets implements WalletsInterface {
11591159
throw new Error('wallet-not-found')
11601160
}
11611161

1162-
// Prevent starting logout if already logging out or not ready
1163-
if (walletEntry.status !== 'ready') {
1164-
console.warn(`Logout called on wallet ${wallet} with status ${walletEntry.status}. Aborting.`)
1165-
throw new Error(`Wallet is not in 'ready' state for logout (current: ${walletEntry.status})`)
1166-
}
1167-
11681162
if (options?.skipRemoveDevice) {
11691163
await Promise.all([
11701164
this.shared.databases.manager.del(wallet),
@@ -1173,6 +1167,12 @@ export class Wallets implements WalletsInterface {
11731167
return undefined as any
11741168
}
11751169

1170+
// Prevent starting logout if already logging out or not ready
1171+
if (walletEntry.status !== 'ready') {
1172+
console.warn(`Logout called on wallet ${wallet} with status ${walletEntry.status}. Aborting.`)
1173+
throw new Error(`Wallet is not in 'ready' state for logout (current: ${walletEntry.status})`)
1174+
}
1175+
11761176
const device = await this.shared.modules.devices.get(walletEntry.device)
11771177
if (!device) {
11781178
throw new Error('device-not-found')

0 commit comments

Comments
 (0)