From 7ef12018e1a9a14a6db2d7a2df776bda811180de Mon Sep 17 00:00:00 2001 From: Bart Tadych Date: Mon, 29 Jan 2024 11:52:58 +0100 Subject: [PATCH] feat: add base + base testnet to EvmChain. (#1173) * feat: add base + base testnet to EvmChain. --- .changeset/clever-shrimps-flow.md | 8 ++ .../common/evmUtils/src/data/chaindata.ts | 108 +++++++++++++++++- .../src/dataTypes/EvmChain/EvmChain.test.ts | 2 + .../src/dataTypes/EvmChain/EvmChain.ts | 24 +++- 4 files changed, 136 insertions(+), 6 deletions(-) create mode 100644 .changeset/clever-shrimps-flow.md diff --git a/.changeset/clever-shrimps-flow.md b/.changeset/clever-shrimps-flow.md new file mode 100644 index 0000000000..49d3ba265f --- /dev/null +++ b/.changeset/clever-shrimps-flow.md @@ -0,0 +1,8 @@ +--- +'@moralisweb3/common-evm-utils': patch +'@moralisweb3/evm-api': patch +'@moralisweb3/evm-utils': patch +'moralis': patch +--- + +This version adds `BASE` and `BASE_TESTNET` to the `EvmChain` class. diff --git a/packages/common/evmUtils/src/data/chaindata.ts b/packages/common/evmUtils/src/data/chaindata.ts index fb6351f337..5b3883c4f6 100644 --- a/packages/common/evmUtils/src/data/chaindata.ts +++ b/packages/common/evmUtils/src/data/chaindata.ts @@ -93,6 +93,7 @@ export const chainList: EvmChainListDataEntry[] = [ shortName: 'gor', chainId: 5, networkId: 5, + slip44: 1, ens: { registry: '0x112234455c3a32fd11230c42e7bccd4a84e02010', }, @@ -172,7 +173,7 @@ export const chainList: EvmChainListDataEntry[] = [ explorers: [ { name: 'Cronos Explorer', - url: 'https://cronoscan.com', + url: 'https://explorer.cronos.org', standard: 'none', }, ], @@ -245,6 +246,7 @@ export const chainList: EvmChainListDataEntry[] = [ shortName: 'bnbt', chainId: 97, networkId: 97, + slip44: 1, explorers: [ { name: 'bscscan-testnet', @@ -395,6 +397,7 @@ export const chainList: EvmChainListDataEntry[] = [ shortName: 'tftm', chainId: 4002, networkId: 4002, + slip44: 1, icon: 'fantom', explorers: [ { @@ -405,6 +408,49 @@ export const chainList: EvmChainListDataEntry[] = [ }, ], }, + { + name: 'Base', + chain: 'ETH', + rpc: [ + 'https://mainnet.base.org/', + 'https://developer-access-mainnet.base.org/', + 'https://base.gateway.tenderly.co', + 'wss://base.gateway.tenderly.co', + 'https://base.publicnode.com', + 'wss://base.publicnode.com', + ], + faucets: [], + nativeCurrency: { + name: 'Ether', + symbol: 'ETH', + decimals: 18, + }, + infoURL: 'https://base.org', + shortName: 'base', + chainId: 8453, + networkId: 8453, + icon: 'base', + explorers: [ + { + name: 'basescan', + url: 'https://basescan.org', + standard: 'none', + }, + { + name: 'basescout', + url: 'https://base.blockscout.com', + icon: 'blockscout', + standard: 'EIP3091', + }, + { + name: 'dexguru', + url: 'https://base.dex.guru', + icon: 'dexguru', + standard: 'EIP3091', + }, + ], + status: 'active', + }, { name: 'Gnosis Chiado Testnet', chain: 'GNO', @@ -426,6 +472,7 @@ export const chainList: EvmChainListDataEntry[] = [ shortName: 'chi', chainId: 10200, networkId: 10200, + slip44: 1, explorers: [ { name: 'blockscout-chiadochain', @@ -508,6 +555,7 @@ export const chainList: EvmChainListDataEntry[] = [ shortName: 'Fuji', chainId: 43113, networkId: 1, + slip44: 1, explorers: [ { name: 'snowtrace', @@ -571,6 +619,7 @@ export const chainList: EvmChainListDataEntry[] = [ shortName: 'maticmum', chainId: 80001, networkId: 80001, + slip44: 1, explorers: [ { name: 'polygonscan', @@ -579,6 +628,48 @@ export const chainList: EvmChainListDataEntry[] = [ }, ], }, + { + name: 'Base Goerli Testnet', + chain: 'ETH', + rpc: [ + 'https://goerli.base.org', + 'https://base-goerli.gateway.tenderly.co', + 'wss://base-goerli.gateway.tenderly.co', + 'https://base-goerli.publicnode.com', + 'wss://base-goerli.publicnode.com', + ], + faucets: ['https://www.coinbase.com/faucets/base-ethereum-goerli-faucet'], + nativeCurrency: { + name: 'Goerli Ether', + symbol: 'ETH', + decimals: 18, + }, + infoURL: 'https://base.org', + shortName: 'basegor', + chainId: 84531, + networkId: 84531, + slip44: 1, + icon: 'baseTestnet', + explorers: [ + { + name: 'basescan', + url: 'https://goerli.basescan.org', + standard: 'none', + }, + { + name: 'basescout', + url: 'https://base-goerli.blockscout.com', + icon: 'blockscout', + standard: 'EIP3091', + }, + { + name: 'dexguru', + url: 'https://base-goerli.dex.guru', + icon: 'dexguru', + standard: 'EIP3091', + }, + ], + }, { name: 'IVAR Chain Mainnet', chain: 'IVAR', @@ -609,6 +700,7 @@ export const chainList: EvmChainListDataEntry[] = [ shortName: 'arb-goerli', chain: 'ETH', networkId: 421613, + slip44: 1, nativeCurrency: { name: 'Arbitrum Goerli Ether', symbol: 'AGOR', @@ -664,6 +756,7 @@ export const chainList: EvmChainListDataEntry[] = [ shortName: 'sep', chainId: 11155111, networkId: 11155111, + slip44: 1, explorers: [ { name: 'etherscan-sepolia', @@ -681,23 +774,28 @@ export const chainList: EvmChainListDataEntry[] = [ name: 'Palm', chain: 'Palm', icon: 'palm', - rpc: ['https://palm-mainnet.infura.io/v3/${INFURA_API_KEY}'], + rpc: ['https://palm-mainnet.infura.io/v3/${INFURA_API_KEY}', 'https://palm-mainnet.public.blastapi.io'], faucets: [], nativeCurrency: { name: 'PALM', symbol: 'PALM', decimals: 18, }, - infoURL: 'https://palm.io', + infoURL: 'https://palm.network', shortName: 'palm', chainId: 11297108109, networkId: 11297108109, explorers: [ { - name: 'Palm Explorer', - url: 'https://explorer.palm.io', + name: 'Chainlens', + url: 'https://palm.chainlens.com', standard: 'EIP3091', }, + { + name: 'Dora', + url: 'https://www.ondora.xyz/network/palm', + standard: 'none', + }, ], }, ]; diff --git a/packages/common/evmUtils/src/dataTypes/EvmChain/EvmChain.test.ts b/packages/common/evmUtils/src/dataTypes/EvmChain/EvmChain.test.ts index 6243758a18..50d43a194f 100644 --- a/packages/common/evmUtils/src/dataTypes/EvmChain/EvmChain.test.ts +++ b/packages/common/evmUtils/src/dataTypes/EvmChain/EvmChain.test.ts @@ -119,6 +119,8 @@ describe('EvmChain', () => { expect(EvmChain.CHILIZ_TESTNET.apiHex).toBe('0x15b32'); expect(EvmChain.GNOSIS.apiHex).toBe('0x64'); expect(EvmChain.GNOSIS_TESTNET.apiHex).toBe('0x27d8'); + expect(EvmChain.BASE.apiHex).toBe('0x2105'); + expect(EvmChain.BASE_TESTNET.apiHex).toBe('0x14a33'); }); describe('metadata', () => { diff --git a/packages/common/evmUtils/src/dataTypes/EvmChain/EvmChain.ts b/packages/common/evmUtils/src/dataTypes/EvmChain/EvmChain.ts index 9f7d2d2ddc..53a1869227 100644 --- a/packages/common/evmUtils/src/dataTypes/EvmChain/EvmChain.ts +++ b/packages/common/evmUtils/src/dataTypes/EvmChain/EvmChain.ts @@ -208,6 +208,24 @@ export class EvmChain implements EvmChainable { return EvmChain.create(10200); } + /** + * Returns BASE chain + * + * @example EvmChain.BASE + */ + public static get BASE() { + return EvmChain.create(8453); + } + + /** + * Returns BASE_TESTNET chain + * + * @example EvmChain.BASE_TESTNET + */ + public static get BASE_TESTNET() { + return EvmChain.create(84531); + } + /** * Create a new instance of EvmChain from any valid address input. * @@ -284,6 +302,8 @@ export class EvmChain implements EvmChainable { EvmChain.CHILIZ_TESTNET, EvmChain.GNOSIS, EvmChain.GNOSIS_TESTNET, + EvmChain.BASE, + EvmChain.BASE_TESTNET, ]; } @@ -391,7 +411,9 @@ export class EvmChain implements EvmChainable { | '0x15b38' | '0x15b32' | '0x64' - | '0x27d8'; + | '0x27d8' + | '0x2105' + | '0x14a33'; } /**