Skip to content

Commit

Permalink
170 Bugfix: Two MATIC options are displayed on “Select a token” pop-up (
Browse files Browse the repository at this point in the history
  • Loading branch information
yuli-ferna committed Aug 29, 2023
1 parent 3f3542e commit 1196e00
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/hooks/useGetSourceParsedTokenAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2003,13 +2003,23 @@ function useGetAvailableTokens(nft: boolean = false) {
output.isFetching = output.isFetching || ethNativeAccountLoading;
output.error = output.error || ethNativeAccountError;

// To avoid have two MATIC in the list (issue: https://github.com/XLabs/portal-bridge-ui/issues/170)
if (
lookupChain === CHAIN_ID_POLYGON &&
ethNativeAccount?.symbol === output.data[0]?.symbol &&
ethNativeAccount?.amount === output.data[0]?.amount
) {
output.data && output.data.shift();
}
ethNativeAccount && output.data && output.data.unshift(ethNativeAccount);

return output;
}, [
ethNativeAccount,
tokenAccounts,
ethNativeAccountLoading,
ethNativeAccountError,
tokenAccounts,
ethNativeAccount,
lookupChain,
]);

return lookupChain === CHAIN_ID_SOLANA
Expand Down

0 comments on commit 1196e00

Please sign in to comment.