From c00d455ba7f0273768fe6eabe96dc5aaa79fe4ea Mon Sep 17 00:00:00 2001 From: turbocrime Date: Wed, 21 Aug 2024 13:00:57 -0700 Subject: [PATCH] optional access for getter output --- .../src/components/shared/non-native-fee-warning.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/minifront/src/components/shared/non-native-fee-warning.tsx b/apps/minifront/src/components/shared/non-native-fee-warning.tsx index afc9dc69b6..ffc6bde0a5 100644 --- a/apps/minifront/src/components/shared/non-native-fee-warning.tsx +++ b/apps/minifront/src/components/shared/non-native-fee-warning.tsx @@ -24,7 +24,7 @@ const hasTokenBalance = ({ gasPrices: GasPrices[]; stakingAssetMetadata?: Metadata; }): boolean => { - const account = getAddressIndex.optional(source).account; + const account = getAddressIndex.optional(source)?.account; if (typeof account === 'undefined') { return false; } @@ -34,8 +34,8 @@ const hasTokenBalance = ({ asset => getAssetIdFromValueView .optional(asset.balanceView) - .equals(getAssetId.optional(stakingAssetMetadata)) && - getAddressIndex.optional(asset).account === account, + ?.equals(getAssetId.optional(stakingAssetMetadata)) && + getAddressIndex.optional(asset)?.account === account, ); if (hasStakingToken) { @@ -43,7 +43,7 @@ const hasTokenBalance = ({ } const accountAssets = balancesResponses.filter( - balance => getAddressIndex.optional(balance).account === account, + balance => getAddressIndex.optional(balance)?.account === account, ); // Finds the alt tokens in the user's account balances that can be used for fees const hasAltTokens = accountAssets.some(balance => {