Skip to content

Commit

Permalink
fix: error when finding and claiming shimmer
Browse files Browse the repository at this point in the history
  • Loading branch information
cpl121 committed Oct 10, 2023
1 parent e228afa commit d38c0f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/shared/lib/core/account/utils/getBoundAccount.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { IAccount, UnableToGetBoundAccountError } from '@core/account'
import { WalletRsError } from '@core/error'
import { createAccount, getAccount, profileManager as _profileManager } from '@core/profile-manager'

export async function getBoundAccount(
Expand All @@ -16,7 +15,8 @@ export async function getBoundAccount(
const account = await getAccount(accountIndex ?? 0, profileManager)
return account
} catch (err) {
if (err?.type === WalletRsError?.AccountNotFound && createAccountsIfNotFound) {
// TODO: Update error type when sdk Error enum has been updated
if (err?.type === 'wallet' && createAccountsIfNotFound) {
for (let indexToCreateAccount = 0; indexToCreateAccount < accountIndex; indexToCreateAccount++) {
const account = await createAccount({}, profileManager)
if (account?.getMetadata()?.index === accountIndex) {
Expand Down

0 comments on commit d38c0f9

Please sign in to comment.