From c31b5de34891cac16cfba7044f7bd228d49a81fc Mon Sep 17 00:00:00 2001 From: Owen Craston Date: Mon, 20 Jan 2025 13:57:58 -0800 Subject: [PATCH] fix code fence --- app/core/Engine/Engine.ts | 4 ++-- app/selectors/multichain/multichainNonEvm.ts | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/core/Engine/Engine.ts b/app/core/Engine/Engine.ts index c6fa9c04e08d..f76b60f51880 100644 --- a/app/core/Engine/Engine.ts +++ b/app/core/Engine/Engine.ts @@ -195,12 +195,12 @@ import { import { snapKeyringBuilder } from '../SnapKeyring'; import { removeAccountsFromPermissions } from '../Permissions'; import { keyringSnapPermissionsBuilder } from '../SnapKeyring/keyringSnapsPermissions'; +import { createMultichainBalancesController } from './controllers/MultichainBalancesController/utils'; +import { createMultichainRatesController } from './controllers/RatesController/utils'; ///: END:ONLY_INCLUDE_IF ///: BEGIN:ONLY_INCLUDE_IF(preinstalled-snaps,external-snaps) import { HandleSnapRequestArgs } from '../Snaps/types'; import { handleSnapRequest } from '../Snaps/utils'; -import { createMultichainBalancesController } from './controllers/MultichainBalancesController/utils'; -import { createMultichainRatesController } from './controllers/RatesController/utils'; ///: END:ONLY_INCLUDE_IF import { getSmartTransactionMetricsProperties } from '../../util/smart-transactions'; import { trace } from '../../util/trace'; diff --git a/app/selectors/multichain/multichainNonEvm.ts b/app/selectors/multichain/multichainNonEvm.ts index 01fdf8fbb53f..77d26ebeb932 100644 --- a/app/selectors/multichain/multichainNonEvm.ts +++ b/app/selectors/multichain/multichainNonEvm.ts @@ -156,9 +156,11 @@ export const selectMultichainNetwork = createSelector( // For non-EVM, we know we have a selected account, since the logic `isEvm` is based // on having a non-EVM account being selected! const nonEvmNetworks = getMultichainNetworkProviders(); - const nonEvmNetwork = nonEvmNetworks.find((provider) => - provider.isAddressCompatible(selectedAccount.address), - ); + const nonEvmNetwork = selectedAccount + ? nonEvmNetworks.find((provider) => + provider.isAddressCompatible(selectedAccount.address), + ) + : undefined; if (!nonEvmNetwork) { throw new Error( @@ -249,6 +251,7 @@ const selectBtcCachedBalance = createDeepEqualSelector( ? MultichainNativeAssets.Bitcoin : MultichainNativeAssets.BitcoinTestnet; + if (!selectedInternalAccount) return undefined; return multichainBalances?.[selectedInternalAccount.id]?.[asset]?.amount; }, ); @@ -268,7 +271,7 @@ export const selectMultichainSelectedAccountCachedBalanceIsZero = selectMultichainIsEvm, (balance, isEvm) => { const base = isEvm ? 16 : 10; - const numericValue = parseInt(balance, base); + const numericValue = parseInt(balance || '0', base); return numericValue === 0; }, );