Skip to content

Commit

Permalink
Merge pull request #1196 from MoralisWeb3/feat/moonbeam-chain
Browse files Browse the repository at this point in the history
Feat: add support for moonbeam chain
  • Loading branch information
Kayconfig authored Apr 19, 2024
2 parents 7d08ba5 + 279f98a commit 56aba6d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changeset/purple-rocks-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@moralisweb3/common-evm-utils': patch
'@moralisweb3/evm-api': patch
'moralis': patch
---

Add support for moonbeam chain
31 changes: 30 additions & 1 deletion packages/common/evmUtils/src/data/chaindata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,35 @@ export const chainList: EvmChainListDataEntry[] = [
},
],
},
{
name: 'Moonbeam',
chain: 'MOON',
rpc: [
'https://rpc.api.moonbeam.network',
'wss://wss.api.moonbeam.network',
'https://moonbeam-rpc.publicnode.com',
'wss://moonbeam-rpc.publicnode.com',
'https://moonbeam.drpc.org',
'wss://moonbeam.drpc.org',
],
faucets: [],
nativeCurrency: {
name: 'Glimmer',
symbol: 'GLMR',
decimals: 18,
},
infoURL: 'https://moonbeam.network/networks/moonbeam/',
shortName: 'mbeam',
chainId: 1284,
networkId: 1284,
explorers: [
{
name: 'moonscan',
url: 'https://moonbeam.moonscan.io',
standard: 'none',
},
],
},
{
name: 'Fantom Testnet',
chain: 'FTM',
Expand Down Expand Up @@ -753,7 +782,7 @@ export const chainList: EvmChainListDataEntry[] = [
chain: 'Polygon',
icon: 'polygon',
rpc: [
'https://https://rpc-amoy.polygon.technology',
'https://rpc-amoy.polygon.technology',
'https://polygon-amoy-bor-rpc.publicnode.com',
'wss://polygon-amoy-bor-rpc.publicnode.com',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ describe('EvmChain', () => {
expect(EvmChain.HOLESKY.apiHex).toBe('0x4268');
expect(EvmChain.POLYGON_AMOY.apiHex).toBe('0x13882');
expect(EvmChain.LINEA.apiHex).toBe('0xe708');
expect(EvmChain.MOONBEAM.apiHex).toBe('0x504');
});

describe('metadata', () => {
Expand Down
13 changes: 12 additions & 1 deletion packages/common/evmUtils/src/dataTypes/EvmChain/EvmChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,15 @@ export class EvmChain implements EvmChainable {
return EvmChain.create(59144);
}

/**
* Returns MOONBEAM chain
*
* @example EvmChain.MOONBEAM
*/
public static get MOONBEAM() {
return EvmChain.create(1284);
}

/**
* Create a new instance of EvmChain from any valid address input.
*
Expand Down Expand Up @@ -344,6 +353,7 @@ export class EvmChain implements EvmChainable {
EvmChain.HOLESKY,
EvmChain.POLYGON_AMOY,
EvmChain.LINEA,
EvmChain.MOONBEAM,
];
}

Expand Down Expand Up @@ -456,7 +466,8 @@ export class EvmChain implements EvmChainable {
| '0x14a33'
| '0x4268'
| '0x13882'
| '0xe708';
| '0xe708'
| '0x504';
}

/**
Expand Down

1 comment on commit 56aba6d

@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: 83%
84.9% (90/106) 66.66% (6/9) 77.77% (56/72)
common-aptos-utils Coverage: 4%
4.56% (151/3306) 4.49% (25/556) 5.53% (45/813)
common-evm-utils Coverage: 58%
59.55% (1894/3180) 20% (172/860) 40.23% (451/1121)
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.