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: Support for EVM on Flow #28825

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions app/images/flow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions app/scripts/fixtures/with-networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ export const FIXTURES_NETWORKS = {
imageUrl: './images/zk-sync.svg',
},
},
flow: {
id: 'flow',
rpcUrl: 'https://mainnet.evm.nodes.onflow.org',
chainId: '0x2eb',
ticker: 'FLOW',
nickname: 'EVM on Flow',
rpcPrefs: {
blockExplorerUrl: 'https://evm.flowscan.io/',
imageUrl: './images/flow.svg',
},
},
localhost: {
id: 'localhost',
rpcUrl: 'http://localhost:8545',
Expand Down
29 changes: 29 additions & 0 deletions shared/constants/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ export const CHAIN_IDS = {
NEAR_TESTNET: '0x18e',
GRAVITY_ALPHA_MAINNET: '0x659',
GRAVITY_ALPHA_TESTNET_SEPOLIA: '0x34c1',
EVM_ON_FLOW_MAINNET: '0x2eb',
EVM_ON_FLOW_TESTNET: '0x221',
} as const;

export const CHAINLIST_CHAIN_IDS_MAP = {
Expand Down Expand Up @@ -253,6 +255,8 @@ export const PALM_DISPLAY_NAME = 'Palm';
export const CELO_DISPLAY_NAME = 'Celo Mainnet';
export const GNOSIS_DISPLAY_NAME = 'Gnosis';
export const ZK_SYNC_ERA_DISPLAY_NAME = 'zkSync Era Mainnet';
export const EVM_ON_FLOW_MAINNET_DISPLAY_NAME = 'EVM on Flow Mainnet';
export const EVM_ON_FLOW_TESTNET_DISPLAY_NAME = 'EVM on Flow Testnet';
export const BASE_DISPLAY_NAME = 'Base Mainnet';
export const AURORA_DISPLAY_NAME = 'Aurora Mainnet';
export const CRONOS_DISPLAY_NAME = 'Cronos';
Expand Down Expand Up @@ -319,6 +323,7 @@ export const CURRENCY_SYMBOLS = {
GLIMMER: 'GLMR',
MOONRIVER: 'MOVR',
ONE: 'ONE',
FLOW: 'FLOW',
} as const;

// Non-EVM currency symbols
Expand Down Expand Up @@ -386,6 +391,7 @@ const CHAINLIST_CURRENCY_SYMBOLS_MAP = {
ACALA_NETWORK: 'ACA',
IOTEX_MAINNET: 'IOTX',
APE: 'APE',
EVM_ON_FLOW: 'FLOW',
} as const;

export const CHAINLIST_CURRENCY_SYMBOLS_MAP_NETWORK_COLLISION = {
Expand All @@ -409,6 +415,7 @@ export const PALM_TOKEN_IMAGE_URL = './images/palm.svg';
export const CELO_TOKEN_IMAGE_URL = './images/celo.svg';
export const GNOSIS_TOKEN_IMAGE_URL = './images/gnosis.svg';
export const ZK_SYNC_ERA_TOKEN_IMAGE_URL = './images/zk-sync.svg';
export const FLOW_IMAGE_URL = './images/flow.svg';
export const BASE_TOKEN_IMAGE_URL = './images/base.svg';
export const ACALA_TOKEN_IMAGE_URL = './images/acala-network-logo.svg';
export const ARBITRUM_NOVA_IMAGE_URL = './images/arbitrum-nova-logo.svg';
Expand Down Expand Up @@ -576,6 +583,8 @@ export const NETWORK_TO_NAME_MAP = {
[CHAIN_IDS.SEPOLIA]: SEPOLIA_DISPLAY_NAME,
[CHAIN_IDS.OPBNB]: OP_BNB_DISPLAY_NAME,
[CHAIN_IDS.ZKSYNC_ERA]: ZK_SYNC_ERA_DISPLAY_NAME,
[CHAIN_IDS.EVM_ON_FLOW_MAINNET]: EVM_ON_FLOW_MAINNET_DISPLAY_NAME,
[CHAIN_IDS.EVM_ON_FLOW_TESTNET]: EVM_ON_FLOW_TESTNET_DISPLAY_NAME,
[CHAIN_IDS.BERACHAIN]: BERACHAIN_DISPLAY_NAME,
[CHAIN_IDS.METACHAIN_ONE]: METACHAIN_ONE_DISPLAY_NAME,
} as const;
Expand Down Expand Up @@ -695,6 +704,10 @@ export const CHAIN_ID_TO_CURRENCY_SYMBOL_MAP = {
CHAINLIST_CURRENCY_SYMBOLS_MAP.ACALA_NETWORK,
[CHAINLIST_CHAIN_IDS_MAP.IOTEX_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.IOTEX_MAINNET,
[CHAINLIST_CHAIN_IDS_MAP.EVM_ON_FLOW_MAINNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.FLOW,
[CHAINLIST_CHAIN_IDS_MAP.EVM_ON_FLOW_TESTNET]:
CHAINLIST_CURRENCY_SYMBOLS_MAP.FLOW,
} as const;

/**
Expand Down Expand Up @@ -750,6 +763,8 @@ export const CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP = {
[CHAIN_IDS.CELO]: CELO_TOKEN_IMAGE_URL,
[CHAIN_IDS.GNOSIS]: GNOSIS_TOKEN_IMAGE_URL,
[CHAIN_IDS.ZKSYNC_ERA]: ZK_SYNC_ERA_TOKEN_IMAGE_URL,
[CHAIN_IDS.EVM_ON_FLOW_MAINNET]: FLOW_IMAGE_URL,
[CHAIN_IDS.EVM_ON_FLOW_TESTNET]: FLOW_IMAGE_URL,
[CHAIN_IDS.NEAR]: NEAR_IMAGE_URL,
[CHAIN_IDS.NEAR_TESTNET]: NEAR_IMAGE_URL,
[CHAINLIST_CHAIN_IDS_MAP.ACALA_NETWORK]: ACALA_TOKEN_IMAGE_URL,
Expand Down Expand Up @@ -1061,6 +1076,20 @@ export const FEATURED_RPCS: AddNetworkFields[] = [
blockExplorerUrls: ['https://explorer.zksync.io/'],
defaultBlockExplorerUrlIndex: 0,
},
{
chainId: CHAIN_IDS.EVM_ON_FLOW_MAINNET,
name: EVM_ON_FLOW_MAINNET_DISPLAY_NAME,
nativeCurrency: CURRENCY_SYMBOLS.FLOW,
rpcEndpoints: [
{
url: `https://mainnet.evm.nodes.onflow.org`,
type: RpcEndpointType.Custom,
},
],
defaultRpcEndpointIndex: 0,
blockExplorerUrls: ['https://evm.flowscan.io/'],
defaultBlockExplorerUrlIndex: 0,
},
{
chainId: CHAIN_IDS.BASE,
name: BASE_DISPLAY_NAME,
Expand Down
7 changes: 7 additions & 0 deletions ui/ducks/ramps/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ export const defaultBuyableChains: AggregatorNetwork[] = [
shortName: 'zkSync Era',
nativeTokenSupported: true,
},
{
active: true,
chainId: 747,
chainName: 'EVM on Flow Mainnet',
shortName: 'EVM on Flow',
nativeTokenSupported: true,
},
{
active: true,
chainId: 1101,
Expand Down
8 changes: 8 additions & 0 deletions ui/selectors/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
OPTIMISM_DISPLAY_NAME,
BASE_DISPLAY_NAME,
ZK_SYNC_ERA_DISPLAY_NAME,
EVM_ON_FLOW_MAINNET_DISPLAY_NAME,
CHAIN_ID_TOKEN_IMAGE_MAP,
LINEA_SEPOLIA_DISPLAY_NAME,
CRONOS_DISPLAY_NAME,
Expand All @@ -49,6 +50,7 @@ import {
MOONBEAM_DISPLAY_NAME,
MOONRIVER_DISPLAY_NAME,
TEST_NETWORK_IDS,
EVM_ON_FLOW_TESTNET_DISPLAY_NAME,
} from '../../shared/constants/network';
import {
WebHIDConnectedStatuses,
Expand Down Expand Up @@ -2465,6 +2467,10 @@ export const getTokenDetectionSupportNetworkByChainId = (state) => {
return BASE_DISPLAY_NAME;
case CHAIN_IDS.ZKSYNC_ERA:
return ZK_SYNC_ERA_DISPLAY_NAME;
case CHAIN_IDS.EVM_ON_FLOW_MAINNET:
return EVM_ON_FLOW_MAINNET_DISPLAY_NAME;
case CHAIN_IDS.EVM_ON_FLOW_TESTNET:
return EVM_ON_FLOW_TESTNET_DISPLAY_NAME;
case CHAIN_IDS.CRONOS:
return CRONOS_DISPLAY_NAME;
case CHAIN_IDS.CELO:
Expand Down Expand Up @@ -2503,6 +2509,8 @@ export function getIsDynamicTokenListAvailable(state) {
CHAIN_IDS.OPTIMISM,
CHAIN_IDS.BASE,
CHAIN_IDS.ZKSYNC_ERA,
CHAIN_IDS.EVM_ON_FLOW_MAINNET,
CHAIN_IDS.EVM_ON_FLOW_TESTNET,
CHAIN_IDS.CRONOS,
CHAIN_IDS.CELO,
CHAIN_IDS.GNOSIS,
Expand Down