Repository: alchemyplatform/alchemy-sdk-js
Pull request #445 (2024-08-14 19:31:58)

Add new networks
Adding networks for `SHAPE`, `LINEA`, `FANTOM`, `ZETACHAIN`, `ARBNOVA`, `BLAST`, `MANTLE`, `SCROLL`, `GNOSIS`, `BNB`, `AVAX`, `CELO`, `METIS`, `OPBNB`. Note that these are primarily for `CoreNamespace` methods. Not all namespaces will work these networks.


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 610b4360..58c3a7a1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@
 
 ### Major Change
 
+- Added networks for `SHAPE`, `LINEA`, `FANTOM`, `ZETACHAIN`, `ARBNOVA`, `BLAST`, `MANTLE`, `SCROLL`, `GNOSIS`, `BNB`, `AVAX`, `CELO`, `METIS`, `OPBNB`. Note that these are primarily for `CoreNamespace` methods. Not all namespaces will work these networks.
 - App IDs are now a required property when calling `NotifyNamespace.createWebhook()` with `WebhookType.GRAPHQL`. This is not a Typescript breaking change, but rather a run-time breaking change. Calling the endpoint without an App ID will now throw an error instead of returning a 503.
 
 ### Minor Changes
diff --git a/README.md b/README.md
index 4dd07ec7..5b52057d 100644
--- a/README.md
+++ b/README.md
@@ -10,16 +10,30 @@ The SDK leverages Alchemy's hardened node infrastructure, guaranteeing best-in-c
 >
 > We'd love your thoughts on what would improve your web3 dev process the most! If you have 5 minutes, tell us what you want on our [Feature Request feedback form](https://alchemyapi.typeform.com/sdk-feedback), and we'd love to build it for you.
 
-The SDK currently supports the following chains:
+The SDK currently supports the following chains (chains with '(d)' after are deprecated):
 
-- **Ethereum**: Mainnet, Goerli, Sepolia
-- **Polygon**: Mainnet, Mumbai, Amoy
-- **Optimism**: Mainnet, Goerli, Kovan, Sepolia
-- **Arbitrum**: Mainnet, Goerli, Rinkeby, Sepolia
+- **Ethereum**: Mainnet, Goerli (d), Sepolia
+- **Polygon**: Mainnet, Mumbai (d), Amoy
+- **Optimism**: Mainnet, Goerli (d), Sepolia
+- **Arbitrum**: Mainnet, Goerli (d), Sepolia
 - **Astar**: Mainnet
-- **PolygonZKEVM**: Mainnet, Testnet
-- **Base**: Mainnet, Goerli, Sepolia
+- **PolygonZKEVM**: Mainnet, Testnet(d), Cardona
+- **Base**: Mainnet, Goerli (d), Sepolia
 - **Zksync**: Mainnet, Sepolia
+- **Shape**: Mainnet, Sepolia
+- **Linea**: Mainnet, Sepolia
+- **Fantom**: Mainnet, Testnet
+- **Zetachain**: Mainnet, Testnet
+- **Arbnova**: Mainnet
+- **Blast**: Mainnet, Sepolia
+- **Mantle**: Mainnet, Sepolia
+- **Scroll**: Mainnet, Sepolia
+- **Gnosis**: Mainnet, Chiado
+- **BNB**: Mainnet, Testnet
+- **Avalanche**: Mainnet, Fuji
+- **Celo**: Mainnet, Alfajores
+- **Metis**: Mainnet
+- **OpBNB**: Mainnet, Testnet
 
 You can find per-method documentation of the Alchemy SDK endpoints at the [Alchemy Docs linked in the sidebar](https://docs.alchemy.com/reference/alchemy-sdk-quickstart).
 
diff --git a/src/types/types.ts b/src/types/types.ts
index ab604370..8cd6371c 100644
--- a/src/types/types.ts
+++ b/src/types/types.ts
@@ -97,25 +97,57 @@ export interface AlchemySettings {
  */
 export enum Network {
   ETH_MAINNET = 'eth-mainnet',
+  /** @deprecated */
   ETH_GOERLI = 'eth-goerli',
   ETH_SEPOLIA = 'eth-sepolia',
   OPT_MAINNET = 'opt-mainnet',
+  /** @deprecated */
   OPT_GOERLI = 'opt-goerli',
   OPT_SEPOLIA = 'opt-sepolia',
   ARB_MAINNET = 'arb-mainnet',
+  /** @deprecated */
   ARB_GOERLI = 'arb-goerli',
   ARB_SEPOLIA = 'arb-sepolia',
   MATIC_MAINNET = 'polygon-mainnet',
+  /** @deprecated */
   MATIC_MUMBAI = 'polygon-mumbai',
   MATIC_AMOY = 'polygon-amoy',
   ASTAR_MAINNET = 'astar-mainnet',
   POLYGONZKEVM_MAINNET = 'polygonzkevm-mainnet',
+  /** @deprecated */
   POLYGONZKEVM_TESTNET = 'polygonzkevm-testnet',
+  POLYGONZKEVM_CARDONA = 'polygonzkevm-cardona',
   BASE_MAINNET = 'base-mainnet',
   BASE_GOERLI = 'base-goerli',
   BASE_SEPOLIA = 'base-sepolia',
   ZKSYNC_MAINNET = 'zksync-mainnet',
-  ZKSYNC_SEPOLIA = 'zksync-sepolia'
+  ZKSYNC_SEPOLIA = 'zksync-sepolia',
+  SHAPE_MAINNET = 'shape-mainnet',
+  SHAPE_SEPOLIA = 'shape-sepolia',
+  LINEA_MAINNET = 'linea-mainnet',
+  LINEA_SEPOLIA = 'linea-sepolia',
+  FANTOM_MAINNET = 'fantom-mainnet',
+  FANTOM_TESTNET = 'fantom-testnet',
+  ZETACHAIN_MAINNET = 'zetachain-mainnet',
+  ZETACHAIN_TESTNET = 'zetachain-testnet',
+  ARBNOVA_MAINNET = 'arbnova-mainnet',
+  BLAST_MAINNET = 'blast-mainnet',
+  BLAST_SEPOLIA = 'blast-sepolia',
+  MANTLE_MAINNET = 'mantle-mainnet',
+  MANTLE_SEPOLIA = 'mantle-sepolia',
+  SCROLL_MAINNET = 'scroll-mainnet',
+  SCROLL_SEPOLIA = 'scroll-sepolia',
+  GNOSIS_MAINNET = 'gnosis-mainnet',
+  GNOSIS_CHIADO = 'gnosis-chiado',
+  BNB_MAINNET = 'bnb-mainnet',
+  BNB_TESTNET = 'bnb-testnet',
+  AVAX_MAINNET = 'avax-mainnet',
+  AVAX_FUJI = 'avax-fuji',
+  CELO_MAINNET = 'celo-mainnet',
+  CELO_ALFAJORES = 'celo-alfajores',
+  METIS_MAINNET = 'metis-mainnet',
+  OPBNB_MAINNET = 'opbnb-mainnet',
+  OPBNB_TESTNET = 'opbnb-testnet'
 }
 
 /** Token Types for the `getTokenBalances()` endpoint. */
diff --git a/src/util/const.ts b/src/util/const.ts
index fe865351..9b877c51 100644
--- a/src/util/const.ts
+++ b/src/util/const.ts
@@ -55,11 +55,38 @@ export const EthersNetwork = {
   [Network.ASTAR_MAINNET]: 'astar-mainnet',
   [Network.POLYGONZKEVM_MAINNET]: 'polygonzkevm-mainnet',
   [Network.POLYGONZKEVM_TESTNET]: 'polygonzkevm-testnet',
+  [Network.POLYGONZKEVM_CARDONA]: 'polygonzkevm-cardona',
   [Network.BASE_MAINNET]: 'base-mainnet',
   [Network.BASE_GOERLI]: 'base-goerli',
   [Network.BASE_SEPOLIA]: 'base-sepolia',
   [Network.ZKSYNC_MAINNET]: 'zksync-mainnet',
-  [Network.ZKSYNC_SEPOLIA]: 'zksync-sepolia'
+  [Network.ZKSYNC_SEPOLIA]: 'zksync-sepolia',
+  [Network.SHAPE_MAINNET]: 'shape-mainnet',
+  [Network.SHAPE_SEPOLIA]: 'shape-sepolia',
+  [Network.LINEA_MAINNET]: 'linea-mainnet',
+  [Network.LINEA_SEPOLIA]: 'linea-sepolia',
+  [Network.FANTOM_MAINNET]: 'fantom-mainnet',
+  [Network.FANTOM_TESTNET]: 'fantom-testnet',
+  [Network.ZETACHAIN_MAINNET]: 'zetachain-mainnet',
+  [Network.ZETACHAIN_TESTNET]: 'zetachain-testnet',
+  [Network.ARBNOVA_MAINNET]: 'arbnova-mainnet',
+  [Network.BLAST_MAINNET]: 'blast-mainnet',
+  [Network.BLAST_SEPOLIA]: 'blast-sepolia',
+  [Network.MANTLE_MAINNET]: 'mantle-mainnet',
+  [Network.MANTLE_SEPOLIA]: 'mantle-sepolia',
+  [Network.SCROLL_MAINNET]: 'scroll-mainnet',
+  [Network.SCROLL_SEPOLIA]: 'scroll-sepolia',
+  [Network.GNOSIS_MAINNET]: 'gnosis-mainnet',
+  [Network.GNOSIS_CHIADO]: 'gnosis-chiado',
+  [Network.BNB_MAINNET]: 'bnb-mainnet',
+  [Network.BNB_TESTNET]: 'bnb-testnet',
+  [Network.AVAX_MAINNET]: 'avax-mainnet',
+  [Network.AVAX_FUJI]: 'avax-fuji',
+  [Network.CELO_MAINNET]: 'celo-mainnet',
+  [Network.CELO_ALFAJORES]: 'celo-alfajores',
+  [Network.METIS_MAINNET]: 'metis-mainnet',
+  [Network.OPBNB_MAINNET]: 'opbnb-mainnet',
+  [Network.OPBNB_TESTNET]: 'opbnb-testnet'
 };
 
 /**
@@ -96,6 +123,10 @@ export const CustomNetworks: { [key: string]: NetworkFromEthers } = {
     chainId: 1442,
     name: 'polygonzkevm-testnet'
   },
+  'polygonzkevm-cardona': {
+    chainId: 2442,
+    name: 'polygonzkevm-cardona'
+  },
   'base-mainnet': {
     chainId: 8453,
     name: 'base-mainnet'
@@ -119,6 +150,110 @@ export const CustomNetworks: { [key: string]: NetworkFromEthers } = {
   'zksync-sepolia': {
     chainId: 300,
     name: 'zksync-sepolia'
+  },
+  'shape-mainnet': {
+    chainId: 360,
+    name: 'shape-mainnet'
+  },
+  'shape-sepolia': {
+    chainId: 11011,
+    name: 'shape-sepolia'
+  },
+  'linea-mainnet': {
+    chainId: 59144,
+    name: 'linea-mainnet'
+  },
+  'linea-sepolia': {
+    chainId: 59141,
+    name: 'linea-sepolia'
+  },
+  'fantom-mainnet': {
+    chainId: 250,
+    name: 'fantom-mainnet'
+  },
+  'fantom-testnet': {
+    chainId: 4002,
+    name: 'fantom-testnet'
+  },
+  'zetachain-mainnet': {
+    chainId: 7000,
+    name: 'zetachain-mainnet'
+  },
+  'zetachain-testnet': {
+    chainId: 7001,
+    name: 'zetachain-testnet'
+  },
+  'arbnova-mainnet': {
+    chainId: 42170,
+    name: 'arbnova-mainnet'
+  },
+  'blast-mainnet': {
+    chainId: 81457,
+    name: 'blast-mainnet'
+  },
+  'blast-sepolia': {
+    chainId: 168587773,
+    name: 'blast-sepolia'
+  },
+  'mantle-mainnet': {
+    chainId: 5000,
+    name: 'mantle-mainnet'
+  },
+  'mantle-sepolia': {
+    chainId: 5003,
+    name: 'mantle-sepolia'
+  },
+  'scroll-mainnet': {
+    chainId: 534352,
+    name: 'scroll-mainnet'
+  },
+  'scroll-sepolia': {
+    chainId: 534351,
+    name: 'scroll-sepolia'
+  },
+  'gnosis-mainnet': {
+    chainId: 100,
+    name: 'gnosis-mainnet'
+  },
+  'gnosis-chiado': {
+    chainId: 10200,
+    name: 'gnosis-chiado'
+  },
+  'bnb-mainnet': {
+    chainId: 56,
+    name: 'bnb-mainnet'
+  },
+  'bnb-testnet': {
+    chainId: 97,
+    name: 'bnb-testnet'
+  },
+  'avax-mainnet': {
+    chainId: 43114,
+    name: 'avax-mainnet'
+  },
+  'avax-fuji': {
+    chainId: 43113,
+    name: 'avax-fuji'
+  },
+  'celo-mainnet': {
+    chainId: 42220,
+    name: 'celo-mainnet'
+  },
+  'celo-alfajores': {
+    chainId: 44787,
+    name: 'celo-alfajores'
+  },
+  'metis-mainnet': {
+    chainId: 1088,
+    name: 'metis-mainnet'
+  },
+  'opbnb-mainnet': {
+    chainId: 204,
+    name: 'opbnb-mainnet'
+  },
+  'opbnb-testnet': {
+    chainId: 5611,
+    name: 'opbnb-testnet'
   }
 };
 


Test patch:
diff --git a/test/integration/alchemy.test.ts b/test/integration/alchemy.test.ts
index 14c3fd7f..054a582e 100644
--- a/test/integration/alchemy.test.ts
+++ b/test/integration/alchemy.test.ts
@@ -8,7 +8,14 @@ describe('E2E integration tests', () => {
   });
   describe('handles networks', () => {
     // TODO(deprecation): Remove after removing deprecated networks.
-    const deprecated = ['ropsten', 'kovan', 'rinkeby'];
+    const deprecated = [
+      'ropsten',
+      'goerli',
+      'kovan',
+      'rinkeby',
+      'mumbai',
+      'polygonzkevm-testnet'
+    ];
     // Filter out deprecated networks.
     const supportedNetworks = Object.values(Network).filter(
       network => !deprecated.some(key => network.includes(key))
@@ -17,6 +24,7 @@ describe('E2E integration tests', () => {
     describe('AlchemyProvider', () => {
       function testNetwork(network: Network) {
         it(`get blockNumber on ${network}`, async () => {
+          console.log('testing network', network);
           const alchemy = new Alchemy({
             apiKey: process.env.ALCHEMY_API_KEY,
             network
@@ -31,7 +39,8 @@ describe('E2E integration tests', () => {
       }
     });
 
-    describe('AlchemyWebSocketProvider', () => {
+    // Most of the new networks don't support WS, so no point running this test.
+    describe.skip('AlchemyWebSocketProvider', () => {
       function testNetwork(network: Network) {
         it(`block subscription for ${network}`, () => {
           const alchemy = new Alchemy({