Skip to content

Commit

Permalink
fix: simplify fetchBridgeTokens nativeToken logic
Browse files Browse the repository at this point in the history
  • Loading branch information
micaelae committed Oct 3, 2024
1 parent f991543 commit d24e8b1
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions ui/pages/bridge/bridge.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,10 @@ export async function fetchBridgeTokens(
functionName: 'fetchBridgeTokens',
});

const isSwapsChainId = (
c: string,
): c is keyof typeof SWAPS_CHAINID_DEFAULT_TOKEN_MAP =>
Object.keys(SWAPS_CHAINID_DEFAULT_TOKEN_MAP).includes(c);
const nativeToken = isSwapsChainId(chainId)
? SWAPS_CHAINID_DEFAULT_TOKEN_MAP[chainId]
: null;
const nativeToken =
SWAPS_CHAINID_DEFAULT_TOKEN_MAP[
chainId as keyof typeof SWAPS_CHAINID_DEFAULT_TOKEN_MAP
];

const transformedTokens: Record<string, SwapsTokenObject> = {};
if (nativeToken) {
Expand Down

0 comments on commit d24e8b1

Please sign in to comment.