diff --git a/packages/core/src/assets/fetchUserHoldings/fetchErc1155s.ts b/packages/core/src/assets/fetchUserHoldings/fetchErc1155s.ts index dce2f83..4e06b64 100644 --- a/packages/core/src/assets/fetchUserHoldings/fetchErc1155s.ts +++ b/packages/core/src/assets/fetchUserHoldings/fetchErc1155s.ts @@ -1,14 +1,13 @@ import config from '@nftx/config'; -import { createQuery, gql, querySubgraph } from '@nftx/subgraph'; +import { createQuery, querySubgraph } from '@nftx/subgraph'; import type { Address, ERC1155, TokenId } from '@nftx/types'; import { getChainConstant } from '@nftx/utils'; import { createCursor, parseCursor } from './cursor'; import type { Holding } from './types'; -import { Network } from '@nftx/constants'; type QuerySubgraph = typeof querySubgraph; -const fetchErc1155sMainnet = async ({ +const fetchErc1155s = async ({ userAddress, lastId, network, @@ -60,10 +59,6 @@ const fetchErc1155sMainnet = async ({ return [holdings, nextId] as const; }; -const fetchErc1155sSepolia = fetchErc1155sMainnet; - -const fetchErc1155sArbitrum = fetchErc1155sMainnet; - export const makeFetchErc1155s = ({ querySubgraph }: { querySubgraph: QuerySubgraph }) => async ({ @@ -79,37 +74,13 @@ export const makeFetchErc1155s = cursor?: string; }> => { const { lastId } = parseCursor('1155', cursor); - let holdings: Array = []; - let nextId: string | undefined; - switch (network) { - case Network.Mainnet: - [holdings, nextId] = await fetchErc1155sMainnet({ - lastId, - network, - userAddress, - querySubgraph, - }); - break; - case Network.Sepolia: - [holdings, nextId] = await fetchErc1155sSepolia({ - lastId, - network, - userAddress, - querySubgraph, - }); - break; - case Network.Arbitrum: - [holdings, nextId] = await fetchErc1155sArbitrum({ - lastId, - network, - userAddress, - querySubgraph, - }); - break; - default: - break; - } + const [holdings, nextId] = await fetchErc1155s({ + lastId, + network, + querySubgraph, + userAddress, + }); return { holdings, diff --git a/packages/core/src/assets/fetchUserHoldings/fetchErc721s.ts b/packages/core/src/assets/fetchUserHoldings/fetchErc721s.ts index f417053..52ef70d 100644 --- a/packages/core/src/assets/fetchUserHoldings/fetchErc721s.ts +++ b/packages/core/src/assets/fetchUserHoldings/fetchErc721s.ts @@ -1,14 +1,13 @@ import { Address, ERC721, TokenId } from '@nftx/types'; import { createCursor, parseCursor } from './cursor'; -import { Network } from '@nftx/constants'; -import { createQuery, gql, querySubgraph } from '@nftx/subgraph'; +import { createQuery, querySubgraph } from '@nftx/subgraph'; import { getChainConstant } from '@nftx/utils'; import config from '@nftx/config'; import type { Holding } from './types'; type QuerySubgraph = typeof querySubgraph; -const fetchErc721sMainnet = async ({ +const fetchErc721s = async ({ lastId, network, userAddress, @@ -50,10 +49,6 @@ const fetchErc721sMainnet = async ({ return [holdings, nextId] as const; }; -const fetchErc721sSepolia = fetchErc721sMainnet; - -const fetchErc721sArbitrum = fetchErc721sMainnet; - export const makeFetchErc721s = ({ querySubgraph }: { querySubgraph: QuerySubgraph }) => async ({ @@ -69,37 +64,13 @@ export const makeFetchErc721s = cursor?: string; }> => { const { lastId } = parseCursor('721', cursor); - let holdings: Array = []; - let nextId: string | undefined; - switch (network) { - case Network.Mainnet: - [holdings, nextId] = await fetchErc721sMainnet({ - lastId, - network, - userAddress, - querySubgraph, - }); - break; - case Network.Sepolia: - [holdings, nextId] = await fetchErc721sSepolia({ - lastId, - network, - userAddress, - querySubgraph, - }); - break; - case Network.Arbitrum: - [holdings, nextId] = await fetchErc721sArbitrum({ - lastId, - network, - userAddress, - querySubgraph, - }); - break; - default: - break; - } + const [holdings, nextId] = await fetchErc721s({ + lastId, + network, + querySubgraph, + userAddress, + }); return { holdings,