Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/wallet/wdk/src/sequence/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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')
Expand Down