Skip to content

Commit

Permalink
fix: error when finding and claiming shimmer (#7568)
Browse files Browse the repository at this point in the history
* fix: error when finding and claiming shimmer

* fix: coin type in buildProfileManagerOptionsFromProfileData

---------

Co-authored-by: Begoña Álvarez de la Cruz <balvarez@boxfish.studio>
  • Loading branch information
cpl121 and begonaalvarezd authored Oct 11, 2023
1 parent 8cb5111 commit 5a390e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function buildProfileManagerOptionsFromProfileData(
): Promise<ProfileManagerOptions> {
const { id, type, network } = profileData
const storagePath = await getStorageDirectoryOfProfile(id)
const coinType = network?.coinType ?? network ? COIN_TYPE[network?.id] ?? 1 : 1
const coinType = network?.coinType ? network?.coinType : network ? COIN_TYPE[network?.id] ?? 1 : 1
const useDefaultClientOptions =
!profileData?.clientOptions ||
!profileData?.clientOptions?.nodes ||
Expand Down

0 comments on commit 5a390e8

Please sign in to comment.