From 47a3e399034493550dae9b58dac24fe6f31ff66f Mon Sep 17 00:00:00 2001 From: Nikita Melnikov Date: Thu, 30 Nov 2023 21:27:45 +0100 Subject: [PATCH] add Parallel testnet --- packages/cli/src/handler.ts | 177 +++++++++++++++++++----------------- 1 file changed, 92 insertions(+), 85 deletions(-) diff --git a/packages/cli/src/handler.ts b/packages/cli/src/handler.ts index 278c652a..6d7d5c1f 100644 --- a/packages/cli/src/handler.ts +++ b/packages/cli/src/handler.ts @@ -27,101 +27,108 @@ const preFlightChecks = async (publicClient: PublicClient, arg } } -const customTestnet: Chain = { - id: 36865, - name: "Custom Testnet", - network: "custom-testnet", - nativeCurrency: { - name: "Ether", - symbol: "ETH", - decimals: 18 - }, - rpcUrls: { - default: { - http: ["http://127.0.0.1:8545"] +const customChains: Chain[] = [ + { + id: 36865, + name: "Custom Testnet", + network: "custom-testnet", + nativeCurrency: { + name: "Ether", + symbol: "ETH", + decimals: 18 }, - public: { - http: ["http://127.0.0.1:8545"] - } - }, - testnet: true -} - -const dfkTestnet: Chain = { - id: 335, - name: "DFK Subnet Testnet", - network: "dfk-test-chain", - nativeCurrency: { - name: "JEWEL", - symbol: "JEWEL", - decimals: 18 - }, - rpcUrls: { - default: { - http: ["https://subnets.avax.network/defi-kingdoms/dfk-chain-testnet/rpc"] + rpcUrls: { + default: { + http: ["http://127.0.0.1:8545"] + }, + public: { + http: ["http://127.0.0.1:8545"] + } }, - public: { - http: ["https://subnets.avax.network/defi-kingdoms/dfk-chain-testnet/rpc"] - } + testnet: true }, - testnet: true -} - -const linea: Chain = { - id: 59144, - name: "Linea Mainnet", - network: "linea", - nativeCurrency: { - name: "ETH", - symbol: "ETH", - decimals: 18 - }, - rpcUrls: { - default: { - http: [] + { + id: 335, + name: "DFK Subnet Testnet", + network: "dfk-test-chain", + nativeCurrency: { + name: "JEWEL", + symbol: "JEWEL", + decimals: 18 }, - public: { - http: [] - } + rpcUrls: { + default: { + http: ["https://subnets.avax.network/defi-kingdoms/dfk-chain-testnet/rpc"] + }, + public: { + http: ["https://subnets.avax.network/defi-kingdoms/dfk-chain-testnet/rpc"] + } + }, + testnet: true }, - testnet: false -} - -const xaiGoerliOrbit: Chain = { - id: 47279324479, - name: "Xai Goerli Orbit", - network: "xai-goerli-orbit", - nativeCurrency: { - name: "ETH", - symbol: "ETH", - decimals: 18 + { + id: 59144, + name: "Linea Mainnet", + network: "linea", + nativeCurrency: { + name: "ETH", + symbol: "ETH", + decimals: 18 + }, + rpcUrls: { + default: { + http: [] + }, + public: { + http: [] + } + }, + testnet: false }, - rpcUrls: { - default: { - http: [] + { + id: 47279324479, + name: "Xai Goerli Orbit", + network: "xai-goerli-orbit", + nativeCurrency: { + name: "ETH", + symbol: "ETH", + decimals: 18 }, - public: { - http: [] - } + rpcUrls: { + default: { + http: [] + }, + public: { + http: [] + } + }, + testnet: false }, - testnet: false -} - -function getChain(chainId: number): Chain { - if (chainId === 36865) { - return customTestnet - } - - if (chainId === 335) { - return dfkTestnet - } - - if (chainId === 59144) { - return linea + { + id: 3163830386846714, + name: "Parallel testnet", + network: "parallel-l3-testnet", + nativeCurrency: { + name: "testnetETH", + symbol: "testnetETH", + decimals: 18, + }, + rpcUrls: { + default: { + http: [], + }, + public: { + http: [], + }, + }, + testnet: true, } +] - if (chainId === 47279324479) { - return xaiGoerliOrbit +function getChain(chainId: number): Chain { + const customChain = customChains.find((chain) => chain.id === chainId) + if (customChain) { + return customChain; } for (const chain of Object.values(chains)) {