Skip to content

Commit

Permalink
optional access for getter output
Browse files Browse the repository at this point in the history
  • Loading branch information
turbocrime committed Aug 21, 2024
1 parent 4ee1a2a commit c00d455
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -34,16 +34,16 @@ 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) {
return false;
}

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 => {
Expand Down

0 comments on commit c00d455

Please sign in to comment.