diff --git a/src/services/prices/price-sources/alchemy-price-source.ts b/src/services/prices/price-sources/alchemy-price-source.ts index 29c41c03..7b2cf808 100644 --- a/src/services/prices/price-sources/alchemy-price-source.ts +++ b/src/services/prices/price-sources/alchemy-price-source.ts @@ -18,7 +18,16 @@ export class AlchemyPriceSource implements IPriceSource { getBulkHistoricalPrices: false, getChart: false, }; - const entries = Object.entries(ALCHEMY_NETWORKS).map(([chainId]) => [chainId, support]); + const entries = Object.entries(ALCHEMY_NETWORKS) + .filter( + ([ + _, + { + price: { supported }, + }, + ]) => supported + ) + .map(([chainId]) => [chainId, support]); return Object.fromEntries(entries); } diff --git a/src/services/providers/provider-sources/alchemy-provider.ts b/src/services/providers/provider-sources/alchemy-provider.ts index b4939ead..abc7a5d3 100644 --- a/src/services/providers/provider-sources/alchemy-provider.ts +++ b/src/services/providers/provider-sources/alchemy-provider.ts @@ -25,7 +25,14 @@ export class AlchemyProviderSource extends BaseHttpProvider { export function alchemySupportedChains(args?: { onlyFree?: boolean }): ChainId[] { return Object.entries(ALCHEMY_NETWORKS) - .filter(([_, { onlyPaid }]) => !onlyPaid || !args?.onlyFree) + .filter( + ([ + _, + { + rpc: { tier }, + }, + ]) => tier === 'free' || !args?.onlyFree + ) .map(([chainId]) => Number(chainId)); } diff --git a/src/shared/alchemy.ts b/src/shared/alchemy.ts index a7776d3f..ab88e5a9 100644 --- a/src/shared/alchemy.ts +++ b/src/shared/alchemy.ts @@ -1,31 +1,25 @@ import { Chains } from '@chains'; import { ChainId } from '@types'; -export const ALCHEMY_NETWORKS: Record = { - [Chains.ETHEREUM.chainId]: { key: 'eth-mainnet' }, - [Chains.ETHEREUM_SEPOLIA.chainId]: { key: 'eth-sepolia' }, - [Chains.OPTIMISM.chainId]: { key: 'opt-mainnet' }, - // [Chains.OPTIMISM_SEPOLIA.chainId]: { key: 'opt-sepolia' }, - [Chains.ARBITRUM.chainId]: { key: 'arb-mainnet' }, - // [Chains.ARBITRUM_SEPOLIA.chainId]: { key: 'arb-sepolia' }, - [Chains.POLYGON.chainId]: { key: 'polygon-mainnet' }, - [Chains.POLYGON_MUMBAI.chainId]: { key: 'polygon-mumbai' }, - [Chains.ASTAR.chainId]: { key: 'astar-mainnet' }, - [Chains.BLAST.chainId]: { key: 'blast-mainnet' }, - [Chains.BNB_CHAIN.chainId]: { key: 'bnb-mainnet', onlyPaid: true }, - [Chains.AVALANCHE.chainId]: { key: 'avax-mainnet', onlyPaid: true }, - [Chains.FANTOM.chainId]: { key: 'fantom-mainnet' }, - [Chains.METIS_ANDROMEDA.chainId]: { key: 'metis-mainnet', onlyPaid: true }, - [Chains.POLYGON_ZKEVM.chainId]: { key: 'polygonzkevm-mainnet' }, - // [Chains.POLYGON_ZKEVM_TESTNET.chainId]: { key: 'polygonzkevm-testnet' }, - [Chains.BASE.chainId]: { key: 'base-mainnet' }, - [Chains.GNOSIS.chainId]: { key: 'gnosis-mainnet', onlyPaid: true }, - [Chains.SCROLL.chainId]: { key: 'scroll-mainnet' }, - [Chains.opBNB.chainId]: { key: 'opbnb-mainnet', onlyPaid: true }, - // [Chains.BASE_SEPOLIA.chainId]: { key: 'base-sepolia' }, - // [Chains.ZKSYNC.chainId]: { key: 'zksync-mainnet' }, - // [Chains.ZKSYNC_SEPOLIA.chainId]: { key: 'zksync-sepolia' }, - [Chains.MANTLE.chainId]: { key: 'mantle-mainnet' }, - [Chains.ROOTSTOCK.chainId]: { key: 'rootstock-mainnet' }, - [Chains.LINEA.chainId]: { key: 'linea-mainnet' }, +export const ALCHEMY_NETWORKS: Record = { + [Chains.ETHEREUM.chainId]: { key: 'eth-mainnet', rpc: { tier: 'free' }, price: { supported: true } }, + [Chains.ETHEREUM_SEPOLIA.chainId]: { key: 'eth-sepolia', rpc: { tier: 'free' }, price: { supported: false } }, + [Chains.OPTIMISM.chainId]: { key: 'opt-mainnet', rpc: { tier: 'free' }, price: { supported: true } }, + [Chains.ARBITRUM.chainId]: { key: 'arb-mainnet', rpc: { tier: 'free' }, price: { supported: true } }, + [Chains.POLYGON.chainId]: { key: 'polygon-mainnet', rpc: { tier: 'free' }, price: { supported: true } }, + [Chains.POLYGON_MUMBAI.chainId]: { key: 'polygon-mumbai', rpc: { tier: 'free' }, price: { supported: false } }, + [Chains.ASTAR.chainId]: { key: 'astar-mainnet', rpc: { tier: 'free' }, price: { supported: false } }, + [Chains.BLAST.chainId]: { key: 'blast-mainnet', rpc: { tier: 'free' }, price: { supported: true } }, + [Chains.BNB_CHAIN.chainId]: { key: 'bnb-mainnet', rpc: { tier: 'paid' }, price: { supported: true } }, + [Chains.AVALANCHE.chainId]: { key: 'avax-mainnet', rpc: { tier: 'paid' }, price: { supported: true } }, + [Chains.FANTOM.chainId]: { key: 'fantom-mainnet', rpc: { tier: 'free' }, price: { supported: true } }, + [Chains.METIS_ANDROMEDA.chainId]: { key: 'metis-mainnet', rpc: { tier: 'paid' }, price: { supported: true } }, + [Chains.POLYGON_ZKEVM.chainId]: { key: 'polygonzkevm-mainnet', rpc: { tier: 'free' }, price: { supported: true } }, + [Chains.BASE.chainId]: { key: 'base-mainnet', rpc: { tier: 'free' }, price: { supported: true } }, + [Chains.GNOSIS.chainId]: { key: 'gnosis-mainnet', rpc: { tier: 'paid' }, price: { supported: true } }, + [Chains.SCROLL.chainId]: { key: 'scroll-mainnet', rpc: { tier: 'free' }, price: { supported: true } }, + [Chains.opBNB.chainId]: { key: 'opbnb-mainnet', rpc: { tier: 'paid' }, price: { supported: true } }, + [Chains.MANTLE.chainId]: { key: 'mantle-mainnet', rpc: { tier: 'free' }, price: { supported: false } }, + [Chains.ROOTSTOCK.chainId]: { key: 'rootstock-mainnet', rpc: { tier: 'free' }, price: { supported: false } }, + [Chains.LINEA.chainId]: { key: 'linea-mainnet', rpc: { tier: 'free' }, price: { supported: true } }, };