Skip to content

Commit

Permalink
Fix token handling logic in Balance component; update conditions for …
Browse files Browse the repository at this point in the history
…newToToken and toToken checks
  • Loading branch information
trungbach committed Jan 8, 2025
1 parent 28055db commit d389616
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/Balance/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -639,15 +639,15 @@ const Balance: React.FC<BalanceProps> = () => {
let newToToken = to;

// TODO: @haunv - why we need to find newToToken here?
if (toNetworkChainId && toToken) {
if (toNetworkChainId && !toToken) {
newToToken = [...otherChainTokens, ...oraichainTokens].find(
(flat) => flat.chainId === toNetworkChainId && flat.coinGeckoId === from.coinGeckoId
);
assert(newToToken, 'Cannot find newToToken token that matches from token to bridge!');
}

// add check to token here because current permissionless tokens are not have coingeckoId
if (toToken) {
if (!toToken) {
assert(
newToToken.coinGeckoId === from.coinGeckoId,
`From token ${from.coinGeckoId} is different from to token ${newToToken.coinGeckoId}`
Expand Down

0 comments on commit d389616

Please sign in to comment.