From dc72d7e68815f16cd5d05d5891b6694d086bc07b Mon Sep 17 00:00:00 2001 From: Juanma Hidalgo Date: Tue, 6 Feb 2024 12:36:58 +0100 Subject: [PATCH] feat: Introduce new Networks and Chains --- report/schemas.api.md | 24 ++++++++++++++++++++++-- src/dapps/chain-id.ts | 17 ++++++++++++++++- src/dapps/chain-name.ts | 10 ++++++++++ src/dapps/network.ts | 7 ++++++- 4 files changed, 54 insertions(+), 4 deletions(-) diff --git a/report/schemas.api.md b/report/schemas.api.md index b34db7ed..07f32950 100644 --- a/report/schemas.api.md +++ b/report/schemas.api.md @@ -335,6 +335,12 @@ export enum CatalogSortDirection { // @alpha export enum ChainId { + // (undocumented) + ARBITRUM_MAINNET = 42161, + // (undocumented) + AVALANCHE_MAINNET = 43114, + // (undocumented) + BNB_MAINNET = 56, // (undocumented) ETHEREUM_GOERLI = 5, // (undocumented) @@ -348,9 +354,13 @@ export enum ChainId { // (undocumented) ETHEREUM_SEPOLIA = 11155111, // (undocumented) + FANTOM_MAINNET = 250, + // (undocumented) MATIC_MAINNET = 137, // (undocumented) - MATIC_MUMBAI = 80001 + MATIC_MUMBAI = 80001, + // (undocumented) + OPTIMISM_MAINNET = 10 } // @alpha (undocumented) @@ -1181,10 +1191,20 @@ export enum MintSortBy { // @alpha export enum Network { + // (undocumented) + ARBITRUM = "ARBITRUM", + // (undocumented) + AVALANCHE = "AVALANCHE", + // (undocumented) + BINANCE = "BINANCE", // (undocumented) ETHEREUM = "ETHEREUM", // (undocumented) - MATIC = "MATIC" + FANTOM = "FANTOM", + // (undocumented) + MATIC = "MATIC", + // (undocumented) + OPTIMISM = "OPTIMISM" } // @alpha (undocumented) diff --git a/src/dapps/chain-id.ts b/src/dapps/chain-id.ts index 575f31a5..2578508b 100644 --- a/src/dapps/chain-id.ts +++ b/src/dapps/chain-id.ts @@ -15,7 +15,12 @@ export enum ChainId { ETHEREUM_KOVAN = 42, ETHEREUM_SEPOLIA = 11155111, MATIC_MAINNET = 137, - MATIC_MUMBAI = 80001 + MATIC_MUMBAI = 80001, + BNB_MAINNET = 56, + OPTIMISM_MAINNET = 10, + ARBITRUM_MAINNET = 42161, + FANTOM_MAINNET = 250, + AVALANCHE_MAINNET = 43114 } /** @@ -147,6 +152,16 @@ export function getNetwork(chainId: ChainId): Network { case ChainId.MATIC_MAINNET: case ChainId.MATIC_MUMBAI: return Network.MATIC + case ChainId.BNB_MAINNET: + return Network.BINANCE + case ChainId.OPTIMISM_MAINNET: + return Network.OPTIMISM + case ChainId.ARBITRUM_MAINNET: + return Network.ARBITRUM + case ChainId.FANTOM_MAINNET: + return Network.FANTOM + case ChainId.AVALANCHE_MAINNET: + return Network.AVALANCHE } } diff --git a/src/dapps/chain-name.ts b/src/dapps/chain-name.ts index 85ab7cb3..d6326079 100644 --- a/src/dapps/chain-name.ts +++ b/src/dapps/chain-name.ts @@ -43,6 +43,16 @@ export function getChainId(chainName: ChainName): ChainId | null { return ChainId.MATIC_MAINNET case ChainName.MATIC_MUMBAI: return ChainId.MATIC_MUMBAI + case ChainName.AVALANCHE_MAINNET: + return ChainId.AVALANCHE_MAINNET + case ChainName.BINANCE_MAINNET: + return ChainId.BNB_MAINNET + case ChainName.ARBITRUM_MAINNET: + return ChainId.ARBITRUM_MAINNET + case ChainName.OPTIMISM_MAINNET: + return ChainId.OPTIMISM_MAINNET + case ChainName.FANTOM_MAINNET: + return ChainId.FANTOM_MAINNET default: return null } diff --git a/src/dapps/network.ts b/src/dapps/network.ts index 87706cdf..789c33b2 100644 --- a/src/dapps/network.ts +++ b/src/dapps/network.ts @@ -6,7 +6,12 @@ import { generateLazyValidator, JSONSchema, ValidateFunction } from '../validati */ export enum Network { ETHEREUM = 'ETHEREUM', - MATIC = 'MATIC' + MATIC = 'MATIC', + AVALANCHE = 'AVALANCHE', + BINANCE = 'BINANCE', + OPTIMISM = 'OPTIMISM', + ARBITRUM = 'ARBITRUM', + FANTOM = 'FANTOM' } /**