Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for flow mainnet and testnet #1235

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading