Skip to content

Commit

Permalink
import SUPPORTED_CHAIN_IDS correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanmino committed Sep 10, 2024
1 parent d9cd7db commit 0f370c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/__swaps__/screens/Swap/resources/assets/userAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import { QueryConfigWithSelect, QueryFunctionArgs, QueryFunctionResult, createQu

import { RainbowError, logger } from '@/logger';
import { RainbowFetchClient } from '@/rainbow-fetch';
import { SupportedCurrencyKey, SUPPORTED_CHAIN_IDS } from '@/references';
import { SupportedCurrencyKey } from '@/references';
import { ParsedAssetsDictByChain, ZerionAsset } from '@/__swaps__/types/assets';
import { ChainId } from '@/chains/types';
import { AddressAssetsReceivedMessage } from '@/__swaps__/types/refraction';
import { parseUserAsset } from '@/__swaps__/utils/assets';
import { greaterThan } from '@/__swaps__/utils/numbers';

import { fetchUserAssetsByChain } from './userAssetsByChain';
import { fetchHardhatBalances, fetchHardhatBalancesByChainId } from '@/resources/assets/hardhatAssets';
import { fetchHardhatBalancesByChainId } from '@/resources/assets/hardhatAssets';
import { SUPPORTED_CHAIN_IDS } from '@/chains';
import { useConnectedToHardhatStore } from '@/state/connectedToHardhat';

const addysHttp = new RainbowFetchClient({
Expand Down Expand Up @@ -112,7 +113,7 @@ async function userAssetsQueryFunction({
const cachedUserAssets = (cache.find(userAssetsQueryKey({ address, currency, testnetMode }))?.state?.data ||
{}) as ParsedAssetsDictByChain;
try {
const url = `/${SUPPORTED_CHAIN_IDS({ testnetMode }).join(',')}/${address}/assets`;
const url = `/${SUPPORTED_CHAIN_IDS.join(',')}/${address}/assets`;
const res = await addysHttp.get<AddressAssetsReceivedMessage>(url, {
params: {
currency: currency.toLowerCase(),
Expand Down
5 changes: 3 additions & 2 deletions src/resources/assets/hardhatAssets.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Contract } from '@ethersproject/contracts';
import { keyBy, mapValues } from 'lodash';
import { getProvider } from '@/handlers/web3';
import { balanceCheckerContractAbi, chainAssets, ETH_ADDRESS, SUPPORTED_CHAIN_IDS } from '@/references';
import { balanceCheckerContractAbi, chainAssets, ETH_ADDRESS } from '@/references';
import { parseAddressAsset } from './assets';
import { RainbowAddressAssets } from './types';
import { logger, RainbowError } from '@/logger';
import { AddressOrEth, UniqueId, ZerionAsset } from '@/__swaps__/types/assets';
import { AddressZero } from '@ethersproject/constants';
import chainAssetsByChainId from '@/references/testnet-assets-by-chain';
import { ChainId, ChainName, Network } from '@/chains/types';
import { SUPPORTED_CHAIN_IDS } from '@/chains';

const MAINNET_BALANCE_CHECKER = '0x4dcf4562268dd384fe814c00fad239f06c2a0c2b';

Expand Down Expand Up @@ -124,6 +125,6 @@ export const fetchHardhatBalancesByChainId = async (

return {
assets: updatedAssets,
chainIdsInResponse: SUPPORTED_CHAIN_IDS({ testnetMode: true }),
chainIdsInResponse: SUPPORTED_CHAIN_IDS,
};
};

0 comments on commit 0f370c7

Please sign in to comment.