-
Notifications
You must be signed in to change notification settings - Fork 394
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
Add support for Mainnet Sepolia and Arbitrum Sepolia testnets #3633
Changes from all commits
571b6af
912b0c5
a194ea6
c039fb1
eaf5023
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ import { | |
BNB, | ||
ETH, | ||
GOERLI_ETH, | ||
SEPOLIA_ETH, | ||
ARBITRUM_SEPOLIA_ETH, | ||
MATIC, | ||
OPTIMISTIC_ETH, | ||
RBTC, | ||
|
@@ -79,13 +81,29 @@ export const OPTIMISM: EVMNetwork = { | |
} | ||
|
||
export const GOERLI: EVMNetwork = { | ||
name: "Goerli", | ||
name: "Ethereum Goerli", | ||
baseAsset: GOERLI_ETH, | ||
chainID: "5", | ||
family: "EVM", | ||
coingeckoPlatformID: "ethereum", | ||
} | ||
|
||
export const SEPOLIA: EVMNetwork = { | ||
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, | ||
|
@@ -98,6 +116,8 @@ export const DEFAULT_NETWORKS = [ | |
POLYGON, | ||
OPTIMISM, | ||
GOERLI, | ||
SEPOLIA, | ||
ARBITRUM_SEPOLIA, | ||
ARBITRUM_ONE, | ||
ROOTSTOCK, | ||
AVALANCHE, | ||
|
@@ -124,11 +144,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 +165,14 @@ export const NETWORK_BY_CHAIN_ID = { | |
[OPTIMISM.chainID]: OPTIMISM, | ||
[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].map((network) => network.chainID), | ||
[GOERLI, SEPOLIA, ARBITRUM_SEPOLIA].map((network) => network.chainID), | ||
) | ||
|
||
export const NETWORK_FOR_LEDGER_SIGNING = [ETHEREUM, POLYGON] | ||
|
@@ -162,6 +186,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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't found any official confirmation they plan to do that. But I saw a couple of people requesting this support on their Discord. I've asked them there if they plan to support it since Goerli becomes deprecated, but I didn't get a response yet. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got a response from a member of their community:
[EDIT] Another update:
|
||
[ARBITRUM_ONE.chainID]: "arbitrum.api.0x.org", | ||
[AVALANCHE.chainID]: "avalanche.api.0x.org", | ||
[BINANCE_SMART_CHAIN.chainID]: "bsc.api.0x.org", | ||
|
@@ -172,7 +197,8 @@ export const NETWORKS_SUPPORTING_SWAPS = new Set( | |
) | ||
|
||
export const ALCHEMY_SUPPORTED_CHAIN_IDS = new Set( | ||
[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, | ||
), | ||
) | ||
|
@@ -203,6 +229,8 @@ 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://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", | ||
"https://1rpc.io/avax/c", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
Comment on lines
+72
to
73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, according to the link it is also supported on Polygon Mainnet, but I didn't want to do anything about that observation, as I don't know the system well enough... |
||
category.push("internal") | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { | ||
AlchemyProvider, | ||
Network, | ||
showThrottleMessage, | ||
} from "@ethersproject/providers" | ||
import { ConnectionInfo } from "@ethersproject/web" | ||
|
||
export default class TahoAlchemyProvider extends AlchemyProvider { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's drop a comment noting why this exists. |
||
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) | ||
}, | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -545,6 +545,7 @@ | |
"beta": "Mainnet (beta)", | ||
"testnet": "Test Network", | ||
"l2": "L2 scaling solution", | ||
"l2Testnet": "L2 Test Network", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would just use |
||
"compatibleChain": "EVM-compatible blockchain", | ||
"avalanche": "Mainnet C-Chain", | ||
"connected": "Connected" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we leave these Coingecko references here and/or in the asset definitions? Wondering if these will give false prices for assets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must admit, the
coingeckoPlatformID
value slipped my attention here and I copied the value fromGOERLI
/SEPOLIA
networks. If I understand correctly, thecoingeckoPlatformID
value is used to fetch a price of the asset, so that we could show how much is the asset worth in USD. The list of supported values is here: https://api.coingecko.com/api/v3/asset_platforms. As there are no testnets listed there, I think in the extension we can either show a mainnet price (which is not a real value of the testnet asset) or not show the price at all. I prefer showing the mainnet value in that case - this allows us to test if the USD price is being shown in correct place, etc.So what I think would make sense here is changing the
coingeckoPlatformID
's value toarbitrum-one
forARBITRUM_SEPOLIA
and leaving the rest unchanged.Unless there's something I'm missing?