diff --git a/packages/cli/src/handler.ts b/packages/cli/src/handler.ts index ba61235f..dec2f1af 100644 --- a/packages/cli/src/handler.ts +++ b/packages/cli/src/handler.ts @@ -26,123 +26,144 @@ 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: ["http://127.0.0.1:8545"] + }, + public: { + http: ["http://127.0.0.1:8545"] + } + }, + testnet: true }, - rpcUrls: { - default: { - http: ["https://subnets.avax.network/defi-kingdoms/dfk-chain-testnet/rpc"] + { + id: 335, + name: "DFK Subnet Testnet", + network: "dfk-test-chain", + nativeCurrency: { + name: "JEWEL", + symbol: "JEWEL", + decimals: 18 }, - public: { - http: ["https://subnets.avax.network/defi-kingdoms/dfk-chain-testnet/rpc"] - } + 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: true -} - -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 -} - -const nautilus: Chain = { - id: 22222, - name: "Nautilus", - network: "nautilus", - nativeCurrency: { - name: "ZBC", - symbol: "ZBC", - decimals: 18 + { + id: 3163830386846714, + name: "Parallel testnet", + network: "parallel-l3-testnet", + nativeCurrency: { + name: "testnetETH", + symbol: "testnetETH", + decimals: 18, + }, + rpcUrls: { + default: { + http: [], + }, + public: { + http: [], + }, + }, + testnet: true, }, - rpcUrls: { - default: { - http: [] + { + id: 901, + name: "Lyra", + network: "lyra", + nativeCurrency: { + name: "ETH", + symbol: "ETH", + decimals: 18 }, - public: { - http: [] + rpcUrls: { + default: { + http: [] + }, + public: { + http: [] + } } - } -} - -const lyra: Chain = { - id: 901, - name: "Lyra", - network: "lyra", - nativeCurrency: { - name: "ETH", - symbol: "ETH", - decimals: 18 }, - rpcUrls: { - default: { - http: [] + { + id: 22222, + name: "Nautilus", + network: "nautilus", + nativeCurrency: { + name: "ZBC", + symbol: "ZBC", + decimals: 18 }, - public: { - http: [] + rpcUrls: { + default: { + http: [] + }, + public: { + http: [] + } } } -} +] function getChain(chainId: number): Chain { - if (chainId === 36865) { - return customTestnet - } - - if (chainId === 335) { - return dfkTestnet - } - - if (chainId === 47279324479) { - return xaiGoerliOrbit - } - - if (chainId === 22222) { - return nautilus - } - - if (chainId === 901) { - return lyra + const customChain = customChains.find((chain) => chain.id === chainId) + if (customChain) { + return customChain; } for (const chain of Object.values(chains)) {