Skip to content

Commit

Permalink
Merge pull request #1103 from oraidex/fix/display-balance
Browse files Browse the repository at this point in the history
refactor: replace tokenMap with flattenTokens for balance display cal…
  • Loading branch information
haunv3 authored Dec 30, 2024
2 parents 965c567 + 09ead1c commit c3e8423
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/libs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { isMobile } from '@walletconnect/browser-utils';
import WalletConnectProvider from '@walletconnect/ethereum-provider';
import bech32 from 'bech32';
import { CoinGeckoPrices } from 'hooks/useCoingecko';
import { chainInfos, cosmosTokens, network, oraichainTokens, tokenMap } from 'initCommon';
import { chainInfos, cosmosTokens, flattenTokens, network, oraichainTokens, tokenMap } from 'initCommon';
import { getCosmWasmClient } from 'libs/cosmjs';
import { NetworkChainId } from '@oraichain/common';
import { store } from 'store/configure';
Expand Down Expand Up @@ -75,14 +75,8 @@ export const toSumDisplay = (amounts: AmountDetails): number => {
// update later
const balance = amounts[denom];
if (!balance) continue;
// amount += toDisplay(balance, tokenMap[denom]?.decimals);

const storage = store.getState();
const allOraichainTokens = storage.token.allOraichainTokens || [];
amount += toDisplay(
balance,
allOraichainTokens.find((t) => t.contractAddress === denom || t.denom === denom)?.decimals
);
amount += toDisplay(balance, flattenTokens.find((t) => t.contractAddress === denom || t.denom === denom)?.decimals);
}
return amount;
};
Expand Down

0 comments on commit c3e8423

Please sign in to comment.