Add read only chain IDs (#1370)

* Add read only chain IDs

* Should be treated as EVMs
This commit is contained in:
bruce-riley 2022-07-19 13:05:40 -05:00 committed by GitHub
parent 7a1b1344a1
commit 53efeb8c87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 117 additions and 0 deletions

View File

@ -161,6 +161,9 @@ $ worm evm info -c bsc -n mainnet -m TokenBridge
"moonbeam": "0x0000000000000000000000000000000000000000000000000000000000000000",
"neon": "0x0000000000000000000000000000000000000000000000000000000000000000",
"terra2": "0xa463ad028fb79679cfc8ce1efba35ac0e77b35080a1abe9bebe83461f176b0a3",
"arbitrum": "0x0000000000000000000000000000000000000000000000000000000000000000",
"optimism": "0x0000000000000000000000000000000000000000000000000000000000000000",
"gnosis": "0x0000000000000000000000000000000000000000000000000000000000000000",
"ropsten": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
}

View File

@ -521,6 +521,12 @@ yargs(hideBin(process.argv))
throw Error("SUI is not supported yet");
} else if (chain === "aptos") {
throw Error("APTOS is not supported yet");
} else if (chain === "arbitrum") {
throw Error("ARBITRUM is not supported yet");
} else if (chain === "optimism") {
throw Error("OPTIMISM is not supported yet");
} else if (chain === "gnosis") {
throw Error("GNOSIS is not supported yet");
} else {
// If you get a type error here, hover over `chain`'s type and it tells you
// which cases are not handled
@ -559,6 +565,12 @@ function parseAddress(chain: ChainName, address: string): string {
throw Error("SUI is not supported yet")
} else if (chain === "aptos") {
throw Error("APTOS is not supported yet")
} else if (chain === "arbitrum") {
throw Error("ARBITRUM is not supported yet")
} else if (chain === "optimism") {
throw Error("OPTIMISM is not supported yet")
} else if (chain === "gnosis") {
throw Error("GNOSIS is not supported yet")
} else {
impossible(chain)
}

View File

@ -111,6 +111,18 @@ const MAINNET = {
chain_id: "phoenix-1",
key: get_env_var("TERRA_MNEMONIC"),
},
arbitrum: {
rpc: undefined,
key: undefined,
},
optimism: {
rpc: undefined,
key: undefined,
},
gnosis: {
rpc: undefined,
key: undefined,
},
ropsten: {
rpc: `https://rpc.ankr.com/eth_ropsten`,
key: get_env_var("ETH_KEY"),
@ -212,6 +224,18 @@ const TESTNET = {
chain_id: "pisco-1",
key: get_env_var("TERRA_MNEMONIC"),
},
arbitrum: {
rpc: undefined,
key: undefined,
},
optimism: {
rpc: undefined,
key: undefined,
},
gnosis: {
rpc: undefined,
key: undefined,
},
ropsten: {
rpc: `https://rpc.ankr.com/eth_ropsten`,
key: get_env_var("ETH_KEY_TESTNET"),
@ -313,6 +337,18 @@ const DEVNET = {
chain_id: "phoenix-1",
key: "notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius",
},
arbitrum: {
rpc: undefined,
key: undefined,
},
optimism: {
rpc: undefined,
key: undefined,
},
gnosis: {
rpc: undefined,
key: undefined,
},
ropsten: {
rpc: undefined,
key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d",

View File

@ -31,6 +31,9 @@ enum ChainID {
CHAIN_ID_OSMOSIS = 20;
CHAIN_ID_SUI = 21;
CHAIN_ID_APTOS = 22;
CHAIN_ID_ARBITRUM = 23;
CHAIN_ID_OPTIMISM = 24;
CHAIN_ID_GNOSIS = 25;
// Special case - Eth has two testnets. CHAIN_ID_ETHEREUM is Goerli,
// but we also want to connect to Ropsten, so we add a separate chain.
CHAIN_ID_ETHEREUM_ROPSTEN = 10001;

View File

@ -1,5 +1,11 @@
# Changelog
## 0.5.2
### Changed
Added chain ids for Arbitrum, Optimism, and Gnosis
## 0.5.1
### Changed

View File

@ -22,6 +22,9 @@ export const CHAINS = {
osmosis: 20,
sui: 21,
aptos: 22,
arbitrum: 23,
optimism: 24,
gnosis: 25,
ropsten: 10001,
} as const;
@ -46,6 +49,9 @@ export type EVMChainName =
| "celo"
| "moonbeam"
| "neon"
| "arbitrum"
| "optimism"
| "gnosis"
| "ropsten";
export type TerraChainName = "terra" | "terra2";
@ -177,6 +183,21 @@ const MAINNET = {
"terra153366q50k7t8nn7gec00hg66crnhkdggpgdtaxltaq6xrutkkz3s992fw9",
nft_bridge: undefined,
},
arbitrum: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
optimism: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
gnosis: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
ropsten: {
core: undefined,
token_bridge: undefined,
@ -301,6 +322,21 @@ const TESTNET = {
"terra1c02vds4uhgtrmcw7ldlg75zumdqxr8hwf7npseuf2h58jzhpgjxsgmwkvk",
nft_bridge: undefined,
},
arbitrum: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
optimism: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
gnosis: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
ropsten: {
core: "0x210c5F5e2AF958B4defFe715Dc621b7a3BA888c5",
token_bridge: "0xF174F9A837536C449321df1Ca093Bb96948D5386",
@ -424,6 +460,21 @@ const DEVNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
arbitrum: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
optimism: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
gnosis: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
ropsten: {
core: undefined,
token_bridge: undefined,
@ -492,6 +543,9 @@ export const CHAIN_ID_INJECTIVE = CHAINS["injective"];
export const CHAIN_ID_OSMOSIS = CHAINS["osmosis"];
export const CHAIN_ID_SUI = CHAINS["sui"];
export const CHAIN_ID_APTOS = CHAINS["aptos"];
export const CHAIN_ID_ARBITRUM = CHAINS["arbitrum"];
export const CHAIN_ID_OPTIMISM = CHAINS["optimism"];
export const CHAIN_ID_GNOSIS = CHAINS["gnosis"];
export const CHAIN_ID_ETHEREUM_ROPSTEN = CHAINS["ropsten"];
// This inverts the [[CHAINS]] object so that we can look up a chain by id
@ -603,6 +657,9 @@ export function isEVMChain(
chainId === CHAIN_ID_CELO ||
chainId === CHAIN_ID_MOONBEAM ||
chainId === CHAIN_ID_NEON ||
chainId === CHAIN_ID_ARBITRUM ||
chainId === CHAIN_ID_OPTIMISM ||
chainId === CHAIN_ID_GNOSIS ||
chainId === CHAIN_ID_ETHEREUM_ROPSTEN
) {
return isEVM(chainId);