Skip to content

Commit

Permalink
Merge pull request #1235 from MoralisWeb3/feat/flow-mainnet-testnet
Browse files Browse the repository at this point in the history
feat: add support for flow mainnet and testnet
  • Loading branch information
Kayconfig authored Oct 2, 2024
2 parents 71d2b43 + 5d4b2eb commit beefc29
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .changeset/proud-plants-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 Flow mainnet and testnet
136 changes: 121 additions & 15 deletions packages/common/evmUtils/src/data/chaindata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,12 @@ export const chainList: EvmChainListDataEntry[] = [
],
faucets: [],
nativeCurrency: {
name: 'MATIC',
symbol: 'MATIC',
name: 'POL',
symbol: 'POL',
decimals: 18,
},
infoURL: 'https://polygon.technology/',
shortName: 'matic',
shortName: 'pol',
chainId: 137,
networkId: 137,
slip44: 966,
Expand Down Expand Up @@ -397,12 +397,66 @@ export const chainList: EvmChainListDataEntry[] = [
},
],
},
{
name: 'EVM on Flow Testnet',
chain: 'Flow',
rpc: ['https://testnet.evm.nodes.onflow.org'],
faucets: ['https://faucet.flow.com/fund-account'],
nativeCurrency: {
name: 'FLOW',
symbol: 'FLOW',
decimals: 18,
},
infoURL: 'https://developers.flow.com/evm/about',
shortName: 'flow-testnet',
chainId: 545,
networkId: 545,
icon: 'flowevm',
explorers: [
{
name: 'FlowScan Testnet',
url: 'https://evm-testnet.flowscan.io',
standard: 'EIP3091',
},
],
},
{
name: 'EVM on Flow',
chain: 'Flow',
rpc: ['https://mainnet.evm.nodes.onflow.org'],
faucets: [],
nativeCurrency: {
name: 'FLOW',
symbol: 'FLOW',
decimals: 18,
},
infoURL: 'https://developers.flow.com/evm/about',
shortName: 'flow-mainnet',
chainId: 747,
networkId: 747,
icon: 'flowevm',
explorers: [
{
name: 'FlowScan',
url: 'https://evm.flowscan.io',
standard: 'EIP3091',
},
],
},
{
name: 'Moonbeam',
chain: 'MOON',
rpc: [
'https://rpc.api.moonbeam.network',
'wss://wss.api.moonbeam.network',
'https://moonbeam.public.blastapi.io',
'wss://moonbeam.public.blastapi.io',
'https://moonbeam-rpc.dwellir.com',
'wss://moonbeam-rpc.dwellir.com',
'https://moonbeam.api.onfinality.io/public',
'wss://moonbeam.api.onfinality.io/public-ws',
'https://moonbeam.unitedbloc.com',
'wss://moonbeam.unitedbloc.com',
'https://moonbeam-rpc.publicnode.com',
'wss://moonbeam-rpc.publicnode.com',
'https://moonbeam.drpc.org',
Expand Down Expand Up @@ -432,6 +486,14 @@ export const chainList: EvmChainListDataEntry[] = [
rpc: [
'https://rpc.api.moonriver.moonbeam.network',
'wss://wss.api.moonriver.moonbeam.network',
'https://moonriver.public.blastapi.io',
'wss://moonriver.public.blastapi.io',
'https://moonriver-rpc.dwellir.com',
'wss://moonriver-rpc.dwellir.com',
'https://moonriver.api.onfinality.io/public',
'wss://moonriver.api.onfinality.io/public-ws',
'https://moonriver.unitedbloc.com',
'wss://moonriver.unitedbloc.com',
'https://moonriver-rpc.publicnode.com',
'wss://moonriver-rpc.publicnode.com',
'https://moonriver.drpc.org',
Expand Down Expand Up @@ -461,6 +523,14 @@ export const chainList: EvmChainListDataEntry[] = [
rpc: [
'https://rpc.api.moonbase.moonbeam.network',
'wss://wss.api.moonbase.moonbeam.network',
'https://moonbase-alpha.public.blastapi.io',
'wss://moonbase-alpha.public.blastapi.io',
'https://moonbase-rpc.dwellir.com',
'wss://moonbase-rpc.dwellir.com',
'https://moonbeam-alpha.api.onfinality.io/public',
'wss://moonbeam-alpha.api.onfinality.io/public-ws',
'https://moonbase.unitedbloc.com',
'wss://moonbase.unitedbloc.com',
'https://moonbase-alpha.drpc.org',
'wss://moonbase-alpha.drpc.org',
],
Expand All @@ -470,7 +540,7 @@ export const chainList: EvmChainListDataEntry[] = [
symbol: 'DEV',
decimals: 18,
},
infoURL: 'https://docs.moonbeam.network/networks/testnet/',
infoURL: 'https://docs.moonbeam.network/learn/platform/networks/moonbase/',
shortName: 'mbase',
chainId: 1287,
networkId: 1287,
Expand Down Expand Up @@ -606,6 +676,7 @@ export const chainList: EvmChainListDataEntry[] = [
'wss://ethereum-holesky-rpc.publicnode.com',
'https://holesky.drpc.org',
'wss://holesky.drpc.org',
'https://rpc-holesky.rockx.com',
],
faucets: ['https://faucet.holesky.ethpandaops.io', 'https://holesky-faucet.pk910.de'],
nativeCurrency: {
Expand Down Expand Up @@ -759,6 +830,8 @@ export const chainList: EvmChainListDataEntry[] = [
'wss://rpc.sepolia.linea.build',
'https://linea-sepolia.infura.io/v3/${INFURA_API_KEY}',
'wss://linea-sepolia.infura.io/ws/v3/${INFURA_API_KEY}',
'https://linea-sepolia-rpc.publicnode.com',
'wss://linea-sepolia-rpc.publicnode.com',
],
faucets: [],
nativeCurrency: {
Expand Down Expand Up @@ -806,6 +879,8 @@ export const chainList: EvmChainListDataEntry[] = [
'wss://rpc.linea.build',
'https://linea-mainnet.infura.io/v3/${INFURA_API_KEY}',
'wss://linea-mainnet.infura.io/ws/v3/${INFURA_API_KEY}',
'https://linea-rpc.publicnode.com',
'wss://linea-rpc.publicnode.com',
],
faucets: [],
nativeCurrency: {
Expand Down Expand Up @@ -981,24 +1056,54 @@ export const chainList: EvmChainListDataEntry[] = [
],
},
{
name: 'IVAR Chain Mainnet',
chain: 'IVAR',
icon: 'ivar',
rpc: ['https://mainnet-rpc.ivarex.com'],
faucets: ['https://faucet.ivarex.com/'],
name: 'Chiliz Spicy Testnet',
chain: 'CHZ',
rpc: ['https://spicy-rpc.chiliz.com'],
faucets: ['https://spicy-faucet.chiliz.com', 'https://tatum.io/faucets/chiliz'],
nativeCurrency: {
name: 'Ivar',
symbol: 'IVAR',
name: 'Chiliz',
symbol: 'CHZ',
decimals: 18,
},
infoURL: 'https://ivarex.com',
shortName: 'ivar',
icon: 'chilizspicy',
infoURL: 'https://www.chiliz.com/en/chain',
shortName: 'chzspicy',
chainId: 88882,
networkId: 88882,
slip44: 1,
explorers: [
{
name: 'spicy-explorer',
url: 'https://testnet.chiliscan.com',
standard: 'EIP3091',
},
],
},
{
name: 'Chiliz Chain Mainnet',
chain: 'CHZ',
icon: 'chilizchain',
rpc: ['https://rpc.chiliz.com', 'https://rpc.ankr.com/chiliz', 'https://chiliz.publicnode.com'],
faucets: ['https://spicy-faucet.chiliz.com', 'https://tatum.io/faucets/chiliz'],
nativeCurrency: {
name: 'Chiliz',
symbol: 'CHZ',
decimals: 18,
},
infoURL: 'https://chiliz.com',
shortName: 'chzmainnet',
chainId: 88888,
networkId: 88888,
redFlags: ['reusedChainId'],
explorers: [
{
name: 'ivarscan',
url: 'https://ivarscan.com',
name: 'chiliscan',
url: 'https://chiliscan.com',
standard: 'EIP3091',
},
{
name: 'chilizscan',
url: 'https://scan.chiliz.com',
standard: 'EIP3091',
},
],
Expand Down Expand Up @@ -1057,6 +1162,7 @@ export const chainList: EvmChainListDataEntry[] = [
'wss://ethereum-sepolia-rpc.publicnode.com',
'https://sepolia.drpc.org',
'wss://sepolia.drpc.org',
'https://rpc-sepolia.rockx.com',
],
faucets: ['http://fauceth.komputing.org?chain=11155111&address=${ADDRESS}'],
nativeCurrency: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ describe('EvmChain', () => {
expect(EvmChain.MOONRIVER.apiHex).toBe('0x505');
expect(EvmChain.MOONBASE.apiHex).toBe('0x507');
expect(EvmChain.LINEA_SEPOLIA.apiHex).toBe('0xe705');
expect(EvmChain.FLOW.apiHex).toBe('0x2eb');
expect(EvmChain.FLOW_TESTNET.apiHex).toBe('0x221');
});

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

/**
* Returns FLOW mainnet chain
*
* @example EvmChain.FLOW
*/
public static get FLOW() {
return EvmChain.create(747);
}

/**
* Returns FLOW testnet chain
*
* @example EvmChain.FLOW_TESTNET
*/
public static get FLOW_TESTNET() {
return EvmChain.create(0x221);
}

/**
* Create a new instance of EvmChain from any valid address input.
*
Expand Down Expand Up @@ -381,6 +399,8 @@ export class EvmChain implements EvmChainable {
EvmChain.MOONRIVER,
EvmChain.MOONBASE,
EvmChain.LINEA_SEPOLIA,
EvmChain.FLOW,
EvmChain.FLOW_TESTNET,
];
}

Expand Down Expand Up @@ -497,7 +517,9 @@ export class EvmChain implements EvmChainable {
| '0x504'
| '0x505'
| '0x507'
| '0xe705';
| '0xe705'
| '0x2eb'
| '0x221';
}

/**
Expand Down

1 comment on commit beefc29

@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: 75%
76.92% (90/117) 66.66% (6/9) 67.46% (56/83)
common-aptos-utils Coverage: 4%
4.56% (151/3306) 4.49% (25/556) 5.53% (45/813)
common-evm-utils Coverage: 53%
54.14% (2326/4296) 15% (172/1146) 35.26% (500/1418)
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.