diff --git a/packages/web3-shared/base/src/utils/token.ts b/packages/web3-shared/base/src/utils/token.ts index 84d50edbee52..ceaab6eb1581 100644 --- a/packages/web3-shared/base/src/utils/token.ts +++ b/packages/web3-shared/base/src/utils/token.ts @@ -1,3 +1,4 @@ +import { keyBy, mapValues } from 'lodash-unified' import { FungibleToken, NonFungibleToken, @@ -7,7 +8,6 @@ import { TokenType, } from '../specs' import type { Constants } from './types' -import { chain } from 'lodash-unified' export function createFungibleToken( chainId: ChainId, @@ -118,22 +118,20 @@ export function createFungibleTokensFromConstants, C symbol: string | ((chainId: ChainId) => string), decimals: number | ((chainId: ChainId) => number), ) => { - return chain(chainIds) - .keyBy('value') - .mapValues>(({ key: chainName, value: chainId }) => { - const evaluator = (f: ((chainId: ChainId) => R) | R): R => - // @ts-ignore - typeof f === 'function' ? f(chainId as ChainId) : f + const chainIdGroup = keyBy(chainIds, 'value') + return mapValues(chainIdGroup, ({ key: chainName, value: chainId }) => { + const evaluator = (f: ((chainId: ChainId) => R) | R): R => + // @ts-ignore + typeof f === 'function' ? f(chainId as ChainId) : f - return createFungibleToken( - chainId, - schema, - constants[key][chainName as 'Mainnet'] ?? '', - evaluator(name), - evaluator(symbol), - evaluator(decimals), - ) - }) - .value() + return createFungibleToken( + chainId, + schema, + constants[key][chainName as 'Mainnet'] ?? '', + evaluator(name), + evaluator(symbol), + evaluator(decimals), + ) + }) } }