Skip to content

Commit

Permalink
feat: add base + base testnet to EvmChain. (#1173)
Browse files Browse the repository at this point in the history
* feat: add base + base testnet to EvmChain.
  • Loading branch information
b4rtaz authored Jan 29, 2024
1 parent 56b17f2 commit 7ef1201
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .changeset/clever-shrimps-flow.md
Original file line number Diff line number Diff line change
@@ -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.
108 changes: 103 additions & 5 deletions packages/common/evmUtils/src/data/chaindata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export const chainList: EvmChainListDataEntry[] = [
shortName: 'gor',
chainId: 5,
networkId: 5,
slip44: 1,
ens: {
registry: '0x112234455c3a32fd11230c42e7bccd4a84e02010',
},
Expand Down Expand Up @@ -172,7 +173,7 @@ export const chainList: EvmChainListDataEntry[] = [
explorers: [
{
name: 'Cronos Explorer',
url: 'https://cronoscan.com',
url: 'https://explorer.cronos.org',
standard: 'none',
},
],
Expand Down Expand Up @@ -245,6 +246,7 @@ export const chainList: EvmChainListDataEntry[] = [
shortName: 'bnbt',
chainId: 97,
networkId: 97,
slip44: 1,
explorers: [
{
name: 'bscscan-testnet',
Expand Down Expand Up @@ -395,6 +397,7 @@ export const chainList: EvmChainListDataEntry[] = [
shortName: 'tftm',
chainId: 4002,
networkId: 4002,
slip44: 1,
icon: 'fantom',
explorers: [
{
Expand All @@ -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',
Expand All @@ -426,6 +472,7 @@ export const chainList: EvmChainListDataEntry[] = [
shortName: 'chi',
chainId: 10200,
networkId: 10200,
slip44: 1,
explorers: [
{
name: 'blockscout-chiadochain',
Expand Down Expand Up @@ -508,6 +555,7 @@ export const chainList: EvmChainListDataEntry[] = [
shortName: 'Fuji',
chainId: 43113,
networkId: 1,
slip44: 1,
explorers: [
{
name: 'snowtrace',
Expand Down Expand Up @@ -571,6 +619,7 @@ export const chainList: EvmChainListDataEntry[] = [
shortName: 'maticmum',
chainId: 80001,
networkId: 80001,
slip44: 1,
explorers: [
{
name: 'polygonscan',
Expand All @@ -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',
Expand Down Expand Up @@ -609,6 +700,7 @@ export const chainList: EvmChainListDataEntry[] = [
shortName: 'arb-goerli',
chain: 'ETH',
networkId: 421613,
slip44: 1,
nativeCurrency: {
name: 'Arbitrum Goerli Ether',
symbol: 'AGOR',
Expand Down Expand Up @@ -664,6 +756,7 @@ export const chainList: EvmChainListDataEntry[] = [
shortName: 'sep',
chainId: 11155111,
networkId: 11155111,
slip44: 1,
explorers: [
{
name: 'etherscan-sepolia',
Expand All @@ -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',
},
],
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
24 changes: 23 additions & 1 deletion packages/common/evmUtils/src/dataTypes/EvmChain/EvmChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -284,6 +302,8 @@ export class EvmChain implements EvmChainable {
EvmChain.CHILIZ_TESTNET,
EvmChain.GNOSIS,
EvmChain.GNOSIS_TESTNET,
EvmChain.BASE,
EvmChain.BASE_TESTNET,
];
}

Expand Down Expand Up @@ -391,7 +411,9 @@ export class EvmChain implements EvmChainable {
| '0x15b38'
| '0x15b32'
| '0x64'
| '0x27d8';
| '0x27d8'
| '0x2105'
| '0x14a33';
}

/**
Expand Down

1 comment on commit 7ef1201

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test coverage

Title Lines Statements Branches Functions
api-utils Coverage: 20%
20.6% (61/296) 20.48% (17/83) 19.04% (12/63)
auth Coverage: 89%
92.45% (98/106) 83.33% (20/24) 86.66% (26/30)
evm-api Coverage: 91%
91.83% (90/98) 66.66% (6/9) 87.5% (56/64)
common-aptos-utils Coverage: 4%
4.56% (151/3306) 4.49% (25/556) 5.53% (45/813)
common-evm-utils Coverage: 64%
65.4% (1654/2529) 25% (186/744) 44.26% (421/951)
sol-api Coverage: 97%
97.56% (40/41) 66.66% (6/9) 93.75% (15/16)
common-sol-utils Coverage: 64%
65.42% (229/350) 41.86% (18/43) 50.89% (57/112)
common-streams-utils Coverage: 90%
90.73% (1204/1327) 73.63% (363/493) 82.07% (444/541)
streams Coverage: 91%
90.54% (603/666) 72.34% (68/94) 90.97% (131/144)

Please sign in to comment.