Skip to content

Commit

Permalink
Merge pull request #1191 from MoralisWeb3/feat/linea-chain
Browse files Browse the repository at this point in the history
Add support for Linea Mainnet
  • Loading branch information
Kayconfig authored Apr 11, 2024
2 parents f05d64e + 5a62ed2 commit 37d5235
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/moody-planes-flash.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 Linea mainnet chain
52 changes: 52 additions & 0 deletions packages/common/evmUtils/src/data/chaindata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,58 @@ export const chainList: EvmChainListDataEntry[] = [
},
],
},
{
name: 'Linea',
title: 'Linea Mainnet',
chain: 'ETH',
rpc: [
'https://rpc.linea.build',
'wss://rpc.linea.build',
'https://linea-mainnet.infura.io/v3/${INFURA_API_KEY}',
'wss://linea-mainnet.infura.io/ws/v3/${INFURA_API_KEY}',
],
faucets: [],
nativeCurrency: {
name: 'Linea Ether',
symbol: 'ETH',
decimals: 18,
},
infoURL: 'https://linea.build',
shortName: 'linea',
chainId: 59144,
networkId: 59144,
icon: 'linea',
parent: {
type: 'L2',
chain: 'eip155-1',
bridges: [
{
url: 'https://bridge.linea.build',
},
],
},
explorers: [
{
name: 'Etherscan',
url: 'https://lineascan.build',
standard: 'EIP3091',
icon: 'linea',
},
{
name: 'Blockscout',
url: 'https://explorer.linea.build',
standard: 'EIP3091',
icon: 'linea',
},
{
name: 'L2scan',
url: 'https://linea.l2scan.co',
standard: 'EIP3091',
icon: 'linea',
},
],
status: 'active',
},
{
name: 'Mumbai',
title: 'Polygon Testnet Mumbai',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ describe('EvmChain', () => {
expect(EvmChain.BASE_TESTNET.apiHex).toBe('0x14a33');
expect(EvmChain.HOLESKY.apiHex).toBe('0x4268');
expect(EvmChain.POLYGON_AMOY.apiHex).toBe('0x13882');
expect(EvmChain.LINEA.apiHex).toBe('0xe708');
});

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 @@ -253,6 +253,15 @@ export class EvmChain implements EvmChainable {
return EvmChain.create(80002);
}

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

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

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

/**
Expand Down

1 comment on commit 37d5235

@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: 84%
85.71% (90/105) 66.66% (6/9) 78.87% (56/71)
common-aptos-utils Coverage: 4%
4.56% (151/3306) 4.49% (25/556) 5.53% (45/813)
common-evm-utils Coverage: 61%
61.94% (1807/2917) 23.04% (194/842) 41.76% (441/1056)
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.