From 571b6afa61c24711bf8f0dfcf3ba3c87f7909d05 Mon Sep 17 00:00:00 2001 From: Michalina Date: Thu, 21 Sep 2023 16:21:48 +0200 Subject: [PATCH 1/5] Add support for Mainnet Sepolia testnet Although it was previously possible to add Sepolia testnet as a custom network, we want to add it to the list of networks automatically added to the networks list upon switching on the 'Show testnet networks' setting. We want that because the only testnet currently added to that list is Goerli, which will become deprecated at the end of 2023 (see https://ethereum-magicians.org/t/proposal-predictable-ethereum-testnet-lifecycle/11575). So far we want to still keep Goerli on the list, as it is still widely used. We'll need to remove it once it'll reach end of its life. As at the moment `0x` project which we use for swaps does not support Sepolia, the sweep functionality will be disabled on this testnet. We need to enable it once the support is added. --- background/constants/base-assets.ts | 10 ++++++++ background/constants/currencies.ts | 6 +++++ background/constants/networks.ts | 23 +++++++++++++++--- background/lib/alchemy.ts | 2 +- background/lib/utils/index.ts | 6 ++++- background/redux-slices/dapp.ts | 2 ++ background/services/name/resolvers/ens.ts | 2 ++ ui/components/TopMenu/TopMenuProtocolList.tsx | 6 +++++ .../images/networks/sepolia-square@2x.png | Bin 0 -> 2438 bytes ui/public/images/networks/sepolia@2x.png | Bin 0 -> 2438 bytes ui/utils/constants.ts | 5 ++++ 11 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 ui/public/images/networks/sepolia-square@2x.png create mode 100644 ui/public/images/networks/sepolia@2x.png diff --git a/background/constants/base-assets.ts b/background/constants/base-assets.ts index ec3bbef94d..18ff637b83 100644 --- a/background/constants/base-assets.ts +++ b/background/constants/base-assets.ts @@ -47,6 +47,15 @@ const GOERLI_ETH: NetworkBaseAsset = { }, } +const SEPOLIA_ETH: NetworkBaseAsset = { + ...ETH, + chainID: "11155111", + metadata: { + coinGeckoID: "ethereum", + tokenLists: [], + }, +} + const RBTC: NetworkBaseAsset = { chainID: "30", name: "RSK Token", @@ -109,6 +118,7 @@ export const BASE_ASSETS_BY_CUSTOM_NAME = { ARBITRUM_NOVA_ETH, OPTIMISTIC_ETH, GOERLI_ETH, + SEPOLIA_ETH, ZK_SYNC_ETH, } diff --git a/background/constants/currencies.ts b/background/constants/currencies.ts index ac28f0e583..6ce30c74cf 100644 --- a/background/constants/currencies.ts +++ b/background/constants/currencies.ts @@ -59,6 +59,11 @@ export const GOERLI_ETH: NetworkBaseAsset & Required = { ...ETH_DATA, } +export const SEPOLIA_ETH: NetworkBaseAsset & Required = { + ...BASE_ASSETS_BY_CUSTOM_NAME.SEPOLIA_ETH, + ...ETH_DATA, +} + export const ZK_SYNC_ETH: NetworkBaseAsset & Required = { ...BASE_ASSETS_BY_CUSTOM_NAME.ZK_SYNC_ETH, ...ETH_DATA, @@ -103,6 +108,7 @@ export const BUILT_IN_NETWORK_BASE_ASSETS = [ ARBITRUM_ONE_ETH, ARBITRUM_NOVA_ETH, GOERLI_ETH, + SEPOLIA_ETH, AVAX, BNB, ] diff --git a/background/constants/networks.ts b/background/constants/networks.ts index 9d55718bf1..eb90d1fd1e 100644 --- a/background/constants/networks.ts +++ b/background/constants/networks.ts @@ -7,6 +7,7 @@ import { BNB, ETH, GOERLI_ETH, + SEPOLIA_ETH, MATIC, OPTIMISTIC_ETH, RBTC, @@ -86,6 +87,14 @@ export const GOERLI: EVMNetwork = { coingeckoPlatformID: "ethereum", } +export const SEPOLIA: EVMNetwork = { + name: "Sepolia", + baseAsset: SEPOLIA_ETH, + chainID: "11155111", + family: "EVM", + coingeckoPlatformID: "ethereum", +} + export const ZK_SYNC: EVMNetwork = { name: "zkSync Era", baseAsset: ZK_SYNC_ETH, @@ -98,6 +107,7 @@ export const DEFAULT_NETWORKS = [ POLYGON, OPTIMISM, GOERLI, + SEPOLIA, ARBITRUM_ONE, ROOTSTOCK, AVALANCHE, @@ -124,11 +134,13 @@ export const FORK: EVMNetwork = { } export const EIP_1559_COMPLIANT_CHAIN_IDS = new Set( - [ETHEREUM, POLYGON, GOERLI, AVALANCHE].map((network) => network.chainID), + [ETHEREUM, POLYGON, GOERLI, SEPOLIA, AVALANCHE].map( + (network) => network.chainID, + ), ) export const CHAINS_WITH_MEMPOOL = new Set( - [ETHEREUM, POLYGON, AVALANCHE, GOERLI, BINANCE_SMART_CHAIN].map( + [ETHEREUM, POLYGON, AVALANCHE, GOERLI, SEPOLIA, BINANCE_SMART_CHAIN].map( (network) => network.chainID, ), ) @@ -143,12 +155,13 @@ export const NETWORK_BY_CHAIN_ID = { [OPTIMISM.chainID]: OPTIMISM, [BINANCE_SMART_CHAIN.chainID]: BINANCE_SMART_CHAIN, [GOERLI.chainID]: GOERLI, + [SEPOLIA.chainID]: SEPOLIA, [FORK.chainID]: FORK, [ZK_SYNC.chainID]: ZK_SYNC, } export const TEST_NETWORK_BY_CHAIN_ID = new Set( - [GOERLI].map((network) => network.chainID), + [GOERLI, SEPOLIA].map((network) => network.chainID), ) export const NETWORK_FOR_LEDGER_SIGNING = [ETHEREUM, POLYGON] @@ -162,6 +175,7 @@ export const CHAIN_ID_TO_0X_API_BASE: { [POLYGON.chainID]: "polygon.api.0x.org", [OPTIMISM.chainID]: "optimism.api.0x.org", [GOERLI.chainID]: "goerli.api.0x.org", + // TODO: Add Swap API for Sepolia once 0x supports it. [ARBITRUM_ONE.chainID]: "arbitrum.api.0x.org", [AVALANCHE.chainID]: "avalanche.api.0x.org", [BINANCE_SMART_CHAIN.chainID]: "bsc.api.0x.org", @@ -172,6 +186,8 @@ export const NETWORKS_SUPPORTING_SWAPS = new Set( ) export const ALCHEMY_SUPPORTED_CHAIN_IDS = new Set( + // TODO: Add `SEPOLIA` once `ethersproject` adds support for it to v5 (see + // https://github.com/ethers-io/ethers.js/issues/4374). [ETHEREUM, POLYGON, ARBITRUM_ONE, OPTIMISM, GOERLI].map( (network) => network.chainID, ), @@ -203,6 +219,7 @@ export const CHAIN_ID_TO_RPC_URLS: { ], [ARBITRUM_NOVA.chainID]: ["https://nova.arbitrum.io/rpc "], [GOERLI.chainID]: ["https://ethereum-goerli-rpc.allthatnode.com"], + [SEPOLIA.chainID]: ["https://ethereum-sepolia-rpc.allthatnode.com"], [AVALANCHE.chainID]: [ "https://api.avax.network/ext/bc/C/rpc", "https://1rpc.io/avax/c", diff --git a/background/lib/alchemy.ts b/background/lib/alchemy.ts index 845d536c53..7851ef15f3 100644 --- a/background/lib/alchemy.ts +++ b/background/lib/alchemy.ts @@ -69,7 +69,7 @@ export async function getAssetTransfers( const category = ["external", "erc20"] if (addressOnNetwork.network.name === "Ethereum") { - // "internal" is supported only on Ethereum Mainnet and Goerli atm + // "internal" is supported only on Ethereum Mainnet, Goerli and Sepolia atm // https://docs.alchemy.com/alchemy/enhanced-apis/transfers-api#alchemy_getassettransfers-testnets-and-layer-2s category.push("internal") } diff --git a/background/lib/utils/index.ts b/background/lib/utils/index.ts index b0615c27b3..5d3087167e 100644 --- a/background/lib/utils/index.ts +++ b/background/lib/utils/index.ts @@ -2,7 +2,7 @@ import { BigNumber, ethers, utils } from "ethers" import { normalizeHexAddress, toChecksumAddress } from "@tallyho/hd-keyring" import { NormalizedEVMAddress, UNIXTime } from "../../types" import { EVMNetwork } from "../../networks" -import { ETHEREUM, GOERLI } from "../../constants" +import { ETHEREUM, GOERLI, SEPOLIA } from "../../constants" import { AddressOnNetwork } from "../../accounts" export function isValidChecksumAddress( @@ -161,6 +161,10 @@ export function getEthereumNetwork(): EVMNetwork { return GOERLI } + if (ethereumNetwork === "SEPOLIA") { + return SEPOLIA + } + // Default to mainnet return ETHEREUM } diff --git a/background/redux-slices/dapp.ts b/background/redux-slices/dapp.ts index 0f6baf86c5..dca8cbed82 100644 --- a/background/redux-slices/dapp.ts +++ b/background/redux-slices/dapp.ts @@ -9,6 +9,7 @@ import { BINANCE_SMART_CHAIN, ETHEREUM, GOERLI, + SEPOLIA, OPTIMISM, POLYGON, ROOTSTOCK, @@ -135,6 +136,7 @@ const dappSlice = createSlice({ AVALANCHE, BINANCE_SMART_CHAIN, GOERLI, + SEPOLIA, ARBITRUM_NOVA, ].map((network) => ({ ...permission, diff --git a/background/services/name/resolvers/ens.ts b/background/services/name/resolvers/ens.ts index 68de4668a3..c53c9c569d 100644 --- a/background/services/name/resolvers/ens.ts +++ b/background/services/name/resolvers/ens.ts @@ -6,6 +6,7 @@ import { BINANCE_SMART_CHAIN, ETHEREUM, GOERLI, + SEPOLIA, OPTIMISM, POLYGON, } from "../../../constants" @@ -18,6 +19,7 @@ const ENS_SUPPORTED_NETWORKS = [ OPTIMISM, ARBITRUM_ONE, GOERLI, + SEPOLIA, AVALANCHE, BINANCE_SMART_CHAIN, ] diff --git a/ui/components/TopMenu/TopMenuProtocolList.tsx b/ui/components/TopMenu/TopMenuProtocolList.tsx index 4dccb0180e..2c9e6531b6 100644 --- a/ui/components/TopMenu/TopMenuProtocolList.tsx +++ b/ui/components/TopMenu/TopMenuProtocolList.tsx @@ -6,6 +6,7 @@ import { BINANCE_SMART_CHAIN, ETHEREUM, GOERLI, + SEPOLIA, isBuiltInNetwork, OPTIMISM, POLYGON, @@ -40,6 +41,11 @@ const testNetworks = [ info: i18n.t("protocol.testnet"), isDisabled: false, }, + { + network: SEPOLIA, + info: i18n.t("protocol.testnet"), + isDisabled: false, + }, ] type TopMenuProtocolListProps = { diff --git a/ui/public/images/networks/sepolia-square@2x.png b/ui/public/images/networks/sepolia-square@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..2af27d97bc4a78e8000ba6461b8a5aa41b47f9c8 GIT binary patch literal 2438 zcmV;133>L3P)EX>4Tx04R}tkv&MmKpe$iQ%j3f6zm}4kfAzR5EXIMDionYs1;guFuC*#ni!H4 z7e~Rh;NZt%)xpJCR|i)?5c~jfbaGO3krMxx6k5c1aNLh~_a1le0HIN3n$%ovd`>)S(glehxvqHp#<}FOz%yfJHZw;YBNj^?taLCdn;P*Xaa`4O$`^7T ztDLtuYtq2l^-JVZ$W;L& z$2>NmL3aJ%fAG6ot2i<4B}J1!=*4k9hJo-d(5ySo_p#$NPk`VvaHY5X8x3Iklk|F9 ziyr~K+rY(jTT}Lc%N=0g$&gLim4Y;dVi9;hqi@Os{kK5(s@Gd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%MMyBVO?rfS;H>zlClg zc@MqSQFYt*!Rsx(-;oK&C8C_!wmJg$nP7O@YRw#5R8RoO$!|=TWceBxa}`NBKzz)3 z*U`FZ(<&bHq!ddey$bML^$Vk{YflBEL??Jx5|*aDfYj-S#Ovwl-xDB8_ap02SY2X1 z6%74?TH}*jX!|WOvgUiwpSu@;d#kMGZNbtlsJCg-IPV1zj7y=LnxyXzs&2s?tgEYh z0Fu}RKs?C#npxjFnxto|>dWKH1{46gI?6vK;^F{i(|Wil>w2j432BL3 z*U9p3fZm=L5qzP_YCaoET|!>;s0fb*z!!6+ON1g9gj$b~gLZZv9M*ws05hfXbs>1i zp?zBhmpv!|be}5w5D?Q!RfXW%gQey_heL<3m71rfIFAAN&}Us<@eIY)giC(demnpG zITqU^67W&_V`~V|pRBUJ_!(Ae+ihunrLN`O9pRSyf5NiQA>YB?r~m)}07*qoM6N<$ Eg7P7Tvj6}9 literal 0 HcmV?d00001 diff --git a/ui/public/images/networks/sepolia@2x.png b/ui/public/images/networks/sepolia@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..2af27d97bc4a78e8000ba6461b8a5aa41b47f9c8 GIT binary patch literal 2438 zcmV;133>L3P)EX>4Tx04R}tkv&MmKpe$iQ%j3f6zm}4kfAzR5EXIMDionYs1;guFuC*#ni!H4 z7e~Rh;NZt%)xpJCR|i)?5c~jfbaGO3krMxx6k5c1aNLh~_a1le0HIN3n$%ovd`>)S(glehxvqHp#<}FOz%yfJHZw;YBNj^?taLCdn;P*Xaa`4O$`^7T ztDLtuYtq2l^-JVZ$W;L& z$2>NmL3aJ%fAG6ot2i<4B}J1!=*4k9hJo-d(5ySo_p#$NPk`VvaHY5X8x3Iklk|F9 ziyr~K+rY(jTT}Lc%N=0g$&gLim4Y;dVi9;hqi@Os{kK5(s@Gd0+>pB|00006VoOIv0RI600RN!9r;`8x010qNS#tmY z3ljhU3ljkVnw%H_000McNliru<_HH62MQA0{q6t&2ZKpOK~!ko-J5G{RM!#5|8wu% zU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q!ddey$bML^$Vk{YflBEL??Jx5|*aDfYj-S#Ovwl-xDB8_ap02SY2X1 z6%74?TH}*jX!|WOvgUiwpSu@;d#kMGZNbtlsJCg-IPV1zj7y=LnxyXzs&2s?tgEYh z0Fu}RKs?C#npxjFnxto|>dWKH1{46gI?6vK;^F{i(|Wil>w2j432BL3 z*U9p3fZm=L5qzP_YCaoET|!>;s0fb*z!!6+ON1g9gj$b~gLZZv9M*ws05hfXbs>1i zp?zBhmpv!|be}5w5D?Q!RfXW%gQey_heL<3m71rfIFAAN&}Us<@eIY)giC(demnpG zITqU^67W&_V`~V|pRBUJ_!(Ae+ihunrLN`O9pRSyf5NiQA>YB?r~m)}07*qoM6N<$ Eg7P7Tvj6}9 literal 0 HcmV?d00001 diff --git a/ui/utils/constants.ts b/ui/utils/constants.ts index 832af62529..2561ece8ab 100644 --- a/ui/utils/constants.ts +++ b/ui/utils/constants.ts @@ -5,6 +5,7 @@ import { BINANCE_SMART_CHAIN, ETHEREUM, GOERLI, + SEPOLIA, OPTIMISM, POLYGON, ROOTSTOCK, @@ -23,6 +24,10 @@ export const blockExplorer = { }, [POLYGON.chainID]: { title: "Polygonscan", url: "https://polygonscan.com" }, [GOERLI.chainID]: { title: "Etherscan", url: "https://goerli.etherscan.io/" }, + [SEPOLIA.chainID]: { + title: "Etherscan", + url: "https://sepolia.etherscan.io/", + }, [ARBITRUM_ONE.chainID]: { title: "Arbiscan", url: "https://arbiscan.io/" }, [AVALANCHE.chainID]: { title: "Snowtrace", url: "https://snowtrace.io/" }, [BINANCE_SMART_CHAIN.chainID]: { From 912b0c51525c18d035b0181f908820b5687bcaab Mon Sep 17 00:00:00 2001 From: Michalina Date: Fri, 22 Sep 2023 14:15:04 +0200 Subject: [PATCH 2/5] Add support for Arbitrum Sepolia testnet We're adding support for Arbitrum Sepolia testnet network. Thanks to this change, Arbitrum Sepolia will be available on the list of networks after user chooses 'Show testnet networks' setting. We're also renaming our previously supported testnets to avoid confusion. --- background/constants/base-assets.ts | 10 ++++++++++ background/constants/currencies.ts | 7 +++++++ background/constants/networks.ts | 18 +++++++++++++++--- background/redux-slices/dapp.ts | 2 ++ background/services/name/resolvers/ens.ts | 2 ++ e2e-tests/regular/transactions.spec.ts | 12 ++++++------ ui/_locales/en/messages.json | 1 + ui/components/TopMenu/TopMenuProtocolList.tsx | 6 ++++++ .../networks/arbitrumsepolia-square@2x.png | Bin 0 -> 3394 bytes .../images/networks/arbitrumsepolia@2x.png | Bin 0 -> 3394 bytes ...re@2x.png => ethereumgoerli-square@2x.png} | Bin .../{goerli@2x.png => ethereumgoerli@2x.png} | Bin ...e@2x.png => ethereumsepolia-square@2x.png} | Bin ...{sepolia@2x.png => ethereumsepolia@2x.png} | Bin ui/utils/constants.ts | 5 +++++ 15 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 ui/public/images/networks/arbitrumsepolia-square@2x.png create mode 100644 ui/public/images/networks/arbitrumsepolia@2x.png rename ui/public/images/networks/{goerli-square@2x.png => ethereumgoerli-square@2x.png} (100%) rename ui/public/images/networks/{goerli@2x.png => ethereumgoerli@2x.png} (100%) rename ui/public/images/networks/{sepolia-square@2x.png => ethereumsepolia-square@2x.png} (100%) rename ui/public/images/networks/{sepolia@2x.png => ethereumsepolia@2x.png} (100%) diff --git a/background/constants/base-assets.ts b/background/constants/base-assets.ts index 18ff637b83..77f62aff87 100644 --- a/background/constants/base-assets.ts +++ b/background/constants/base-assets.ts @@ -56,6 +56,15 @@ const SEPOLIA_ETH: NetworkBaseAsset = { }, } +const ARBITRUM_SEPOLIA_ETH: NetworkBaseAsset = { + ...ETH, + chainID: "421614", + metadata: { + coinGeckoID: "ethereum", + tokenLists: [], + }, +} + const RBTC: NetworkBaseAsset = { chainID: "30", name: "RSK Token", @@ -119,6 +128,7 @@ export const BASE_ASSETS_BY_CUSTOM_NAME = { OPTIMISTIC_ETH, GOERLI_ETH, SEPOLIA_ETH, + ARBITRUM_SEPOLIA_ETH, ZK_SYNC_ETH, } diff --git a/background/constants/currencies.ts b/background/constants/currencies.ts index 6ce30c74cf..d40d8dbeed 100644 --- a/background/constants/currencies.ts +++ b/background/constants/currencies.ts @@ -64,6 +64,12 @@ export const SEPOLIA_ETH: NetworkBaseAsset & Required = { ...ETH_DATA, } +export const ARBITRUM_SEPOLIA_ETH: NetworkBaseAsset & Required = + { + ...BASE_ASSETS_BY_CUSTOM_NAME.ARBITRUM_SEPOLIA_ETH, + ...ETH_DATA, + } + export const ZK_SYNC_ETH: NetworkBaseAsset & Required = { ...BASE_ASSETS_BY_CUSTOM_NAME.ZK_SYNC_ETH, ...ETH_DATA, @@ -109,6 +115,7 @@ export const BUILT_IN_NETWORK_BASE_ASSETS = [ ARBITRUM_NOVA_ETH, GOERLI_ETH, SEPOLIA_ETH, + ARBITRUM_SEPOLIA_ETH, AVAX, BNB, ] diff --git a/background/constants/networks.ts b/background/constants/networks.ts index eb90d1fd1e..255e069ae6 100644 --- a/background/constants/networks.ts +++ b/background/constants/networks.ts @@ -8,6 +8,7 @@ import { ETH, GOERLI_ETH, SEPOLIA_ETH, + ARBITRUM_SEPOLIA_ETH, MATIC, OPTIMISTIC_ETH, RBTC, @@ -80,7 +81,7 @@ export const OPTIMISM: EVMNetwork = { } export const GOERLI: EVMNetwork = { - name: "Goerli", + name: "Ethereum Goerli", baseAsset: GOERLI_ETH, chainID: "5", family: "EVM", @@ -88,13 +89,21 @@ export const GOERLI: EVMNetwork = { } export const SEPOLIA: EVMNetwork = { - name: "Sepolia", + name: "Ethereum Sepolia", baseAsset: SEPOLIA_ETH, chainID: "11155111", family: "EVM", coingeckoPlatformID: "ethereum", } +export const ARBITRUM_SEPOLIA: EVMNetwork = { + name: "Arbitrum Sepolia", + baseAsset: ARBITRUM_SEPOLIA_ETH, + chainID: "421614", + family: "EVM", + coingeckoPlatformID: "ethereum", +} + export const ZK_SYNC: EVMNetwork = { name: "zkSync Era", baseAsset: ZK_SYNC_ETH, @@ -108,6 +117,7 @@ export const DEFAULT_NETWORKS = [ OPTIMISM, GOERLI, SEPOLIA, + ARBITRUM_SEPOLIA, ARBITRUM_ONE, ROOTSTOCK, AVALANCHE, @@ -156,12 +166,13 @@ export const NETWORK_BY_CHAIN_ID = { [BINANCE_SMART_CHAIN.chainID]: BINANCE_SMART_CHAIN, [GOERLI.chainID]: GOERLI, [SEPOLIA.chainID]: SEPOLIA, + [ARBITRUM_SEPOLIA.chainID]: ARBITRUM_SEPOLIA, [FORK.chainID]: FORK, [ZK_SYNC.chainID]: ZK_SYNC, } export const TEST_NETWORK_BY_CHAIN_ID = new Set( - [GOERLI, SEPOLIA].map((network) => network.chainID), + [GOERLI, SEPOLIA, ARBITRUM_SEPOLIA].map((network) => network.chainID), ) export const NETWORK_FOR_LEDGER_SIGNING = [ETHEREUM, POLYGON] @@ -220,6 +231,7 @@ export const CHAIN_ID_TO_RPC_URLS: { [ARBITRUM_NOVA.chainID]: ["https://nova.arbitrum.io/rpc "], [GOERLI.chainID]: ["https://ethereum-goerli-rpc.allthatnode.com"], [SEPOLIA.chainID]: ["https://ethereum-sepolia-rpc.allthatnode.com"], + [ARBITRUM_SEPOLIA.chainID]: ["https://sepolia-rollup.arbitrum.io/rpc"], [AVALANCHE.chainID]: [ "https://api.avax.network/ext/bc/C/rpc", "https://1rpc.io/avax/c", diff --git a/background/redux-slices/dapp.ts b/background/redux-slices/dapp.ts index dca8cbed82..73be259f3a 100644 --- a/background/redux-slices/dapp.ts +++ b/background/redux-slices/dapp.ts @@ -10,6 +10,7 @@ import { ETHEREUM, GOERLI, SEPOLIA, + ARBITRUM_SEPOLIA, OPTIMISM, POLYGON, ROOTSTOCK, @@ -137,6 +138,7 @@ const dappSlice = createSlice({ BINANCE_SMART_CHAIN, GOERLI, SEPOLIA, + ARBITRUM_SEPOLIA, ARBITRUM_NOVA, ].map((network) => ({ ...permission, diff --git a/background/services/name/resolvers/ens.ts b/background/services/name/resolvers/ens.ts index c53c9c569d..86f8e49060 100644 --- a/background/services/name/resolvers/ens.ts +++ b/background/services/name/resolvers/ens.ts @@ -20,6 +20,8 @@ const ENS_SUPPORTED_NETWORKS = [ ARBITRUM_ONE, GOERLI, SEPOLIA, + // TODO: Add ARBITRUM_SEPOLIA once the support is added (tracked in + // https://github.com/ProjectOpenSea/opensea-js/issues/1201). AVALANCHE, BINANCE_SMART_CHAIN, ] diff --git a/e2e-tests/regular/transactions.spec.ts b/e2e-tests/regular/transactions.spec.ts index d7a637d1db..69b91cae7d 100644 --- a/e2e-tests/regular/transactions.spec.ts +++ b/e2e-tests/regular/transactions.spec.ts @@ -49,11 +49,11 @@ test.describe("Transactions", () => { */ await popup.getByTestId("top_menu_network_switcher").last().click() await popup - .getByText(/^Goerli$/) + .getByText(/^Ethereum Goerli$/) .last() .click() await walletPageHelper.assertCommonElements( - /^Goerli$/, + /^Ethereum Goerli$/, true, account2.name, ) @@ -82,7 +82,7 @@ test.describe("Transactions", () => { * isn't active. */ await transactionsHelper.assertUnfilledSendAssetScreen( - /^Goerli$/, + /^Ethereum Goerli$/, account2.name, "ETH", "(\\d|,)+(\\.\\d{0,4})*", @@ -118,7 +118,7 @@ test.describe("Transactions", () => { * Check if "Transfer" has opened and verify elements on the page. */ await transactionsHelper.assertTransferScreen( - "Goerli", + "Ethereum Goerli", "testertesting\\.eth", "0x47745a7252e119431ccf973c0ebd4279638875a6", "0x4774…875a6", @@ -150,7 +150,7 @@ test.describe("Transactions", () => { */ await expect(popup.getByTestId("activity_list")).toHaveCount(1) await assetsHelper.assertAssetDetailsPage( - /^Goerli$/, + /^Ethereum Goerli$/, account2.name, /^ETH$/, /^(\d|,)+(\.\d{0,4})*$/, @@ -207,7 +207,7 @@ test.describe("Transactions", () => { * Verify elements on the activity screen */ await walletPageHelper.assertCommonElements( - /^Goerli$/, + /^Ethereum Goerli$/, true, account2.name, ) diff --git a/ui/_locales/en/messages.json b/ui/_locales/en/messages.json index b9cada0d77..ce6aa7a228 100644 --- a/ui/_locales/en/messages.json +++ b/ui/_locales/en/messages.json @@ -545,6 +545,7 @@ "beta": "Mainnet (beta)", "testnet": "Test Network", "l2": "L2 scaling solution", + "l2Testnet": "L2 Test Network", "compatibleChain": "EVM-compatible blockchain", "avalanche": "Mainnet C-Chain", "connected": "Connected" diff --git a/ui/components/TopMenu/TopMenuProtocolList.tsx b/ui/components/TopMenu/TopMenuProtocolList.tsx index 2c9e6531b6..49989587a0 100644 --- a/ui/components/TopMenu/TopMenuProtocolList.tsx +++ b/ui/components/TopMenu/TopMenuProtocolList.tsx @@ -7,6 +7,7 @@ import { ETHEREUM, GOERLI, SEPOLIA, + ARBITRUM_SEPOLIA, isBuiltInNetwork, OPTIMISM, POLYGON, @@ -46,6 +47,11 @@ const testNetworks = [ info: i18n.t("protocol.testnet"), isDisabled: false, }, + { + network: ARBITRUM_SEPOLIA, + info: i18n.t("protocol.l2Testnet"), + isDisabled: false, + }, ] type TopMenuProtocolListProps = { diff --git a/ui/public/images/networks/arbitrumsepolia-square@2x.png b/ui/public/images/networks/arbitrumsepolia-square@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..4935d181be44c24bd19e1b463b5072518e927e8a GIT binary patch literal 3394 zcmV-I4ZZS-P)EX>4Tx04R}tkv&MmKp2MKrb>%c6zrhlkfAzR5EXIMDionYs1;guFuC+cXws0R zxHt-~1qXi?s}3&Cx;nTDg5VE`qmz@Oi%UJ*tJy|fO<%ra&rDFxs0b&mkw@8UemzwXb`t>!HT1VrK)W|%hdI`Pz| zZE)TvjznMuzPM~TH^8!K(hN~T6UNgPu(o$`gO z$13M7&RV(3n)l={jO6v@C9cyPLJ|vDgai=^s@OmoHsZAFq*zGPdBVp(==vpcDdgG! zBgZ@{&>*{h@IUz7TdOcJ?j=PMK-x)-?O~0}m&1e-Wn$^Z)<=24YJ`L;(K){{a7>y{D4^000SaNLh0L z01FcU01FcV0GgZ_00007bV*G`2j&O|5D6BTUW_jQ01G}zL_t(&-p!hOTvb&T$G`jB zdwHq61OXKULGzJ{im6BjzRmYInwl@H9MO*{ebQ$7R6>2GX+AThrju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HtbEz@3bm?36?Z!82WZ&~wmm z8augErk4=m5n;9eyQEGvS1F}0s8I>Ycc&$%-?yTlg``u7oQ^+0Ud~<3={j8plP%28tkM((Cn$%oepGM@tJY)^?%_5jiK!?_7QAQ2##w z#;5rzSfW%ZrfG;6v8dq@1M6-lPZdyUr6)cuP@*ofNJ0fTBQT<}#!gX|gopWMH`KcS Y2W{akMa$iJu>b%707*qoM6N<$f)4P7NB{r; literal 0 HcmV?d00001 diff --git a/ui/public/images/networks/arbitrumsepolia@2x.png b/ui/public/images/networks/arbitrumsepolia@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..4935d181be44c24bd19e1b463b5072518e927e8a GIT binary patch literal 3394 zcmV-I4ZZS-P)EX>4Tx04R}tkv&MmKp2MKrb>%c6zrhlkfAzR5EXIMDionYs1;guFuC+cXws0R zxHt-~1qXi?s}3&Cx;nTDg5VE`qmz@Oi%UJ*tJy|fO<%ra&rDFxs0b&mkw@8UemzwXb`t>!HT1VrK)W|%hdI`Pz| zZE)TvjznMuzPM~TH^8!K(hN~T6UNgPu(o$`gO z$13M7&RV(3n)l={jO6v@C9cyPLJ|vDgai=^s@OmoHsZAFq*zGPdBVp(==vpcDdgG! zBgZ@{&>*{h@IUz7TdOcJ?j=PMK-x)-?O~0}m&1e-Wn$^Z)<=24YJ`L;(K){{a7>y{D4^000SaNLh0L z01FcU01FcV0GgZ_00007bV*G`2j&O|5D6BTUW_jQ01G}zL_t(&-p!hOTvb&T$G`jB zdwHq61OXKULGzJ{im6BjzRmYInwl@H9MO*{ebQ$7R6>2GX+AThrjuzUn2wK>e7{ly z&BS+>CO9Zu^MQa5kcV)&_w4xth0Eh0AXxja^Vxfyz1Q#T-&$+0wU3~I+Oh*Fp?aNe zkwgXxa2A4dQk6?1`Uk|)fKAl*ge&$Y`AQp`#X>MzV@V@YjczDl^#&+r>rc*w&d&3s zl=B7B`B8siK|XmoIk3di^F;->LRy?7^`PEW^PedyMAKn42}Mx;49qJP`i zCjz8pCk46pI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$f)4P7NB{r; literal 0 HcmV?d00001 diff --git a/ui/public/images/networks/goerli-square@2x.png b/ui/public/images/networks/ethereumgoerli-square@2x.png similarity index 100% rename from ui/public/images/networks/goerli-square@2x.png rename to ui/public/images/networks/ethereumgoerli-square@2x.png diff --git a/ui/public/images/networks/goerli@2x.png b/ui/public/images/networks/ethereumgoerli@2x.png similarity index 100% rename from ui/public/images/networks/goerli@2x.png rename to ui/public/images/networks/ethereumgoerli@2x.png diff --git a/ui/public/images/networks/sepolia-square@2x.png b/ui/public/images/networks/ethereumsepolia-square@2x.png similarity index 100% rename from ui/public/images/networks/sepolia-square@2x.png rename to ui/public/images/networks/ethereumsepolia-square@2x.png diff --git a/ui/public/images/networks/sepolia@2x.png b/ui/public/images/networks/ethereumsepolia@2x.png similarity index 100% rename from ui/public/images/networks/sepolia@2x.png rename to ui/public/images/networks/ethereumsepolia@2x.png diff --git a/ui/utils/constants.ts b/ui/utils/constants.ts index 2561ece8ab..0ba4d8b261 100644 --- a/ui/utils/constants.ts +++ b/ui/utils/constants.ts @@ -6,6 +6,7 @@ import { ETHEREUM, GOERLI, SEPOLIA, + ARBITRUM_SEPOLIA, OPTIMISM, POLYGON, ROOTSTOCK, @@ -28,6 +29,10 @@ export const blockExplorer = { title: "Etherscan", url: "https://sepolia.etherscan.io/", }, + [ARBITRUM_SEPOLIA.chainID]: { + title: "Arbiscan", + url: "https://sepolia.arbiscan.io/", + }, [ARBITRUM_ONE.chainID]: { title: "Arbiscan", url: "https://arbiscan.io/" }, [AVALANCHE.chainID]: { title: "Snowtrace", url: "https://snowtrace.io/" }, [BINANCE_SMART_CHAIN.chainID]: { From a194ea6abdebcff132d7f8e760a50093c49ac431 Mon Sep 17 00:00:00 2001 From: Michalina Date: Mon, 25 Sep 2023 16:26:32 +0200 Subject: [PATCH 3/5] Update integration tests after adding new supported networks As a support for two new networks was added, we need to update tests that assert the number of supported networks. --- background/services/chain/tests/index.integration.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/background/services/chain/tests/index.integration.test.ts b/background/services/chain/tests/index.integration.test.ts index 5d419bb312..6023ce431a 100644 --- a/background/services/chain/tests/index.integration.test.ts +++ b/background/services/chain/tests/index.integration.test.ts @@ -197,7 +197,7 @@ describe("ChainService", () => { it("Should properly update supported networks", async () => { chainService.supportedNetworks = [] await chainService.updateSupportedNetworks() - expect(chainService.supportedNetworks.length).toBe(8) + expect(chainService.supportedNetworks.length).toBe(10) }) }) @@ -205,9 +205,9 @@ describe("ChainService", () => { // prettier-ignore const FANTOM_CHAIN_PARAMS = { chainId: "250", blockExplorerUrl: "https://ftmscan.com", chainName: "Fantom Opera", nativeCurrency: { name: "Fantom", symbol: "FTM", decimals: 18, }, rpcUrls: [ "https://fantom-mainnet.gateway.pokt.network/v1/lb/62759259ea1b320039c9e7ac", "https://rpc.ftm.tools", "https://rpc.ankr.com/fantom", "https://rpc.fantom.network", "https://rpc2.fantom.network", "https://rpc3.fantom.network", "https://rpcapi.fantom.network", "https://fantom-mainnet.public.blastapi.io", "https://1rpc.io/ftm", ], blockExplorerUrls: ["https://ftmscan.com"], } it("should update supported networks after adding a chain", async () => { - expect(chainService.supportedNetworks.length).toBe(8) + expect(chainService.supportedNetworks.length).toBe(10) await chainService.addCustomChain(FANTOM_CHAIN_PARAMS) - expect(chainService.supportedNetworks.length).toBe(9) + expect(chainService.supportedNetworks.length).toBe(11) }) it("should create a provider for the new chain", async () => { From c039fb1e965b08ff19672f8a78ac689ce615c3ae Mon Sep 17 00:00:00 2001 From: Michalina Date: Mon, 25 Sep 2023 17:00:31 +0200 Subject: [PATCH 4/5] Switch to more reliable RPC Previously used RPC was sometimes causing errors in the logs and wrong recognition of type of transaction (`Contract interaction` instead of `Send`). --- background/constants/networks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/background/constants/networks.ts b/background/constants/networks.ts index 255e069ae6..bbf6a2c49b 100644 --- a/background/constants/networks.ts +++ b/background/constants/networks.ts @@ -230,7 +230,7 @@ export const CHAIN_ID_TO_RPC_URLS: { ], [ARBITRUM_NOVA.chainID]: ["https://nova.arbitrum.io/rpc "], [GOERLI.chainID]: ["https://ethereum-goerli-rpc.allthatnode.com"], - [SEPOLIA.chainID]: ["https://ethereum-sepolia-rpc.allthatnode.com"], + [SEPOLIA.chainID]: ["https://endpoints.omniatech.io/v1/eth/sepolia/public"], [ARBITRUM_SEPOLIA.chainID]: ["https://sepolia-rollup.arbitrum.io/rpc"], [AVALANCHE.chainID]: [ "https://api.avax.network/ext/bc/C/rpc", From eaf502300ad4f905fd0acd90d44fd63d1288cd87 Mon Sep 17 00:00:00 2001 From: Michalina Date: Fri, 29 Sep 2023 17:45:56 +0200 Subject: [PATCH 5/5] Add Sepolia to the list of Alchemy-supported chains We want to add Sepolia to the list of Alchemy-supported chains. This will allow the extension to fill the list of historical transactions on that chain. We can't just add `SEPOLIA` to `ALCHEMY_SUPPORTED_CHAIN_IDS` because the `@ethersproject/providers@5.7.2` package that we use as a dependency does not support Sepolia yet (no `sepolia` case in the `getUrl` function of `./src.ts/alchemy-provider.ts`). The support is planned to be added in the upcoming patch, but as it's release date is unknown, we're adding the Sepolia support by creating `TahoAlchemyProvider` class that handles this case. In the future we may want to add there another case, for `arbitrum-epolia`, but we can't do that yet, as Alchemy dos not offers an RPC for Arbitrum Sepolia yet. --- background/constants/networks.ts | 5 ++-- .../chain/serial-fallback-provider.ts | 13 ++------ background/services/chain/taho-provider.ts | 30 +++++++++++++++++++ 3 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 background/services/chain/taho-provider.ts diff --git a/background/constants/networks.ts b/background/constants/networks.ts index bbf6a2c49b..bca27482ff 100644 --- a/background/constants/networks.ts +++ b/background/constants/networks.ts @@ -197,9 +197,8 @@ export const NETWORKS_SUPPORTING_SWAPS = new Set( ) export const ALCHEMY_SUPPORTED_CHAIN_IDS = new Set( - // TODO: Add `SEPOLIA` once `ethersproject` adds support for it to v5 (see - // https://github.com/ethers-io/ethers.js/issues/4374). - [ETHEREUM, POLYGON, ARBITRUM_ONE, OPTIMISM, GOERLI].map( + // TODO: Add `ARBITRUM_SEPOLIA` once Alchemy creates a dedicated RPC. + [ETHEREUM, POLYGON, ARBITRUM_ONE, OPTIMISM, GOERLI, SEPOLIA].map( (network) => network.chainID, ), ) diff --git a/background/services/chain/serial-fallback-provider.ts b/background/services/chain/serial-fallback-provider.ts index 82d87b2d9e..9abc72ef8a 100644 --- a/background/services/chain/serial-fallback-provider.ts +++ b/background/services/chain/serial-fallback-provider.ts @@ -1,6 +1,4 @@ import { - AlchemyProvider, - AlchemyWebSocketProvider, EventType, JsonRpcBatchProvider, JsonRpcProvider, @@ -27,6 +25,7 @@ import { } from "../../lib/alchemy" import { FeatureFlags, isEnabled } from "../../features" import { RpcConfig } from "./db" +import TahoAlchemyProvider from "./taho-provider" export type ProviderCreator = { type: "alchemy" | "custom" | "generic" @@ -1097,15 +1096,7 @@ export function makeSerialFallbackProvider( { type: "alchemy" as const, creator: () => - new AlchemyProvider(getNetwork(Number(chainID)), ALCHEMY_KEY), - }, - { - type: "alchemy" as const, - creator: () => - new AlchemyWebSocketProvider( - getNetwork(Number(chainID)), - ALCHEMY_KEY, - ), + new TahoAlchemyProvider(getNetwork(Number(chainID)), ALCHEMY_KEY), }, ] : [] diff --git a/background/services/chain/taho-provider.ts b/background/services/chain/taho-provider.ts new file mode 100644 index 0000000000..224c35d75a --- /dev/null +++ b/background/services/chain/taho-provider.ts @@ -0,0 +1,30 @@ +import { + AlchemyProvider, + Network, + showThrottleMessage, +} from "@ethersproject/providers" +import { ConnectionInfo } from "@ethersproject/web" + +export default class TahoAlchemyProvider extends AlchemyProvider { + static override getUrl(network: Network, apiKey: string): ConnectionInfo { + let host = null + switch (network.name) { + case "sepolia": + host = "eth-sepolia.g.alchemy.com/v2/" + break + default: + return AlchemyProvider.getUrl(network, apiKey) + } + + return { + allowGzip: true, + url: `https://${host}${apiKey}`, + throttleCallback: () => { + if (apiKey === "0") { + showThrottleMessage() + } + return Promise.resolve(true) + }, + } + } +}