From 8ddf0ccd2322dd32a3b218438b5744cf4d85009a Mon Sep 17 00:00:00 2001 From: Alex Ni <12097569+nialexsan@users.noreply.github.com> Date: Fri, 29 Nov 2024 15:45:28 -0500 Subject: [PATCH 1/2] feat: Support for EVM on Flow --- app/images/flow.svg | 1 + app/scripts/fixtures/with-networks.js | 11 ++++++++++ shared/constants/network.ts | 29 +++++++++++++++++++++++++++ ui/ducks/ramps/constants.ts | 7 +++++++ ui/selectors/selectors.js | 8 ++++++++ 5 files changed, 56 insertions(+) create mode 100644 app/images/flow.svg diff --git a/app/images/flow.svg b/app/images/flow.svg new file mode 100644 index 000000000000..dba3e6ef30b6 --- /dev/null +++ b/app/images/flow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/scripts/fixtures/with-networks.js b/app/scripts/fixtures/with-networks.js index 1efb15e25f3c..787f67f114f8 100644 --- a/app/scripts/fixtures/with-networks.js +++ b/app/scripts/fixtures/with-networks.js @@ -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', diff --git a/shared/constants/network.ts b/shared/constants/network.ts index 41f1d9fd0d95..2dd8202f073c 100644 --- a/shared/constants/network.ts +++ b/shared/constants/network.ts @@ -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 = { @@ -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'; @@ -319,6 +323,7 @@ export const CURRENCY_SYMBOLS = { GLIMMER: 'GLMR', MOONRIVER: 'MOVR', ONE: 'ONE', + FLOW: 'FLOW', } as const; // Non-EVM currency symbols @@ -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 = { @@ -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'; @@ -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; @@ -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; /** @@ -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, @@ -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, diff --git a/ui/ducks/ramps/constants.ts b/ui/ducks/ramps/constants.ts index 7a451658807e..3795c07b0811 100644 --- a/ui/ducks/ramps/constants.ts +++ b/ui/ducks/ramps/constants.ts @@ -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, diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index deb18c1c5309..878296df6816 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -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, @@ -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, @@ -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: @@ -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, From eefd3ed5356a575317ef7a0c38751575b5b51047 Mon Sep 17 00:00:00 2001 From: Alex Ni <12097569+nialexsan@users.noreply.github.com> Date: Fri, 29 Nov 2024 16:55:43 -0500 Subject: [PATCH 2/2] linting --- shared/constants/network.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/constants/network.ts b/shared/constants/network.ts index 2dd8202f073c..c902f3e5a790 100644 --- a/shared/constants/network.ts +++ b/shared/constants/network.ts @@ -391,7 +391,7 @@ const CHAINLIST_CURRENCY_SYMBOLS_MAP = { ACALA_NETWORK: 'ACA', IOTEX_MAINNET: 'IOTX', APE: 'APE', - EVM_ON_FLOW: 'FLOW' + EVM_ON_FLOW: 'FLOW', } as const; export const CHAINLIST_CURRENCY_SYMBOLS_MAP_NETWORK_COLLISION = {