diff --git a/clients/js/README.md b/clients/js/README.md index c93149a4f..93cfa8622 100644 --- a/clients/js/README.md +++ b/clients/js/README.md @@ -154,6 +154,10 @@ $ worm evm info -c bsc -n mainnet -m TokenBridge "klaytn": "0x0000000000000000000000005b08ac39eaed75c0439fc750d9fe7e1f9dd0193f", "celo": "0x000000000000000000000000796dff6d74f3e27060b71255fe517bfb23c93eed", "near": "0x0000000000000000000000000000000000000000000000000000000000000000", + "injective": "0x0000000000000000000000000000000000000000000000000000000000000000", + "osmosis": "0x0000000000000000000000000000000000000000000000000000000000000000", + "sui": "0x0000000000000000000000000000000000000000000000000000000000000000", + "aptos": "0x0000000000000000000000000000000000000000000000000000000000000000", "moonbeam": "0x0000000000000000000000000000000000000000000000000000000000000000", "neon": "0x0000000000000000000000000000000000000000000000000000000000000000", "terra2": "0xa463ad028fb79679cfc8ce1efba35ac0e77b35080a1abe9bebe83461f176b0a3", diff --git a/clients/js/main.ts b/clients/js/main.ts index fd7677d36..e117dab68 100644 --- a/clients/js/main.ts +++ b/clients/js/main.ts @@ -513,6 +513,14 @@ yargs(hideBin(process.argv)) throw Error("Algorand is not supported yet"); } else if (chain === "near") { throw Error("NEAR is not supported yet"); + } else if (chain === "injective") { + throw Error("INJECTIVE is not supported yet"); + } else if (chain === "osmosis") { + throw Error("OSMOSIS is not supported yet"); + } else if (chain === "sui") { + throw Error("SUI is not supported yet"); + } else if (chain === "aptos") { + throw Error("APTOS 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 @@ -543,6 +551,14 @@ function parseAddress(chain: ChainName, address: string): string { return "0x" + evm_address(address) } else if (chain === "near") { throw Error("NEAR is not supported yet") + } else if (chain === "injective") { + throw Error("INJECTIVE is not supported yet"); + } else if (chain === "osmosis") { + throw Error("OSMOSIS is not supported yet"); + } else if (chain === "sui") { + throw Error("SUI is not supported yet") + } else if (chain === "aptos") { + throw Error("APTOS is not supported yet") } else { impossible(chain) } diff --git a/clients/js/networks.ts b/clients/js/networks.ts index fb2c2a412..034a2b7c6 100644 --- a/clients/js/networks.ts +++ b/clients/js/networks.ts @@ -82,6 +82,22 @@ const MAINNET = { rpc: undefined, key: undefined, }, + injective: { + rpc: undefined, + key: undefined, + }, + osmosis: { + rpc: undefined, + key: undefined, + }, + aptos: { + rpc: undefined, + key: undefined, + }, + sui: { + rpc: undefined, + key: undefined, + }, moonbeam: { rpc: undefined, key: undefined, @@ -167,6 +183,22 @@ const TESTNET = { rpc: undefined, key: undefined, }, + injective: { + rpc: undefined, + key: undefined, + }, + osmosis: { + rpc: undefined, + key: undefined, + }, + aptos: { + rpc: undefined, + key: undefined, + }, + sui: { + rpc: undefined, + key: undefined, + }, moonbeam: { rpc: "https://rpc.api.moonbase.moonbeam.network", key: get_env_var("ETH_KEY_TESTNET"), @@ -252,6 +284,22 @@ const DEVNET = { rpc: undefined, key: undefined, }, + injective: { + rpc: undefined, + key: undefined, + }, + osmosis: { + rpc: undefined, + key: undefined, + }, + aptos: { + rpc: undefined, + key: undefined, + }, + sui: { + rpc: undefined, + key: undefined, + }, moonbeam: { rpc: undefined, key: "0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d", diff --git a/proto/publicrpc/v1/publicrpc.proto b/proto/publicrpc/v1/publicrpc.proto index 80dfcec0b..3c3117ffd 100644 --- a/proto/publicrpc/v1/publicrpc.proto +++ b/proto/publicrpc/v1/publicrpc.proto @@ -28,6 +28,9 @@ enum ChainID { CHAIN_ID_NEON = 17; CHAIN_ID_TERRA2 = 18; CHAIN_ID_INJECTIVE = 19; + CHAIN_ID_OSMOSIS = 20; + CHAIN_ID_SUI = 21; + CHAIN_ID_APTOS = 22; // 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; diff --git a/sdk/js/CHANGELOG.md b/sdk/js/CHANGELOG.md index 2bcca7614..0d1711224 100644 --- a/sdk/js/CHANGELOG.md +++ b/sdk/js/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.5.1 + +### Changed + +Added chain ids for Injective, Osmosis, Sui, and Aptos + ## 0.5.0 ### Changed diff --git a/sdk/js/package.json b/sdk/js/package.json index 3b01424b9..bea9ac87f 100644 --- a/sdk/js/package.json +++ b/sdk/js/package.json @@ -1,6 +1,6 @@ { "name": "@certusone/wormhole-sdk", - "version": "0.5.0", + "version": "0.5.1", "description": "SDK for interacting with Wormhole", "homepage": "https://wormholenetwork.com", "main": "./lib/cjs/index.js", diff --git a/sdk/js/src/utils/array.ts b/sdk/js/src/utils/array.ts index 03aca5878..f8406c053 100644 --- a/sdk/js/src/utils/array.ts +++ b/sdk/js/src/utils/array.ts @@ -13,6 +13,10 @@ import { ChainName, CHAIN_ID_ALGORAND, CHAIN_ID_NEAR, + CHAIN_ID_INJECTIVE, + CHAIN_ID_OSMOSIS, + CHAIN_ID_SUI, + CHAIN_ID_APTOS, CHAIN_ID_SOLANA, CHAIN_ID_TERRA, CHAIN_ID_TERRA2, @@ -85,6 +89,14 @@ export const tryUint8ArrayToNative = ( return uint8ArrayToNativeStringAlgorand(a); } else if (chainId === CHAIN_ID_NEAR) { throw Error("uint8ArrayToNative: Near not supported yet."); + } else if (chainId === CHAIN_ID_INJECTIVE) { + throw Error("uint8ArrayToNative: Injective not supported yet."); + } else if (chainId === CHAIN_ID_OSMOSIS) { + throw Error("uint8ArrayToNative: Osmosis not supported yet."); + } else if (chainId === CHAIN_ID_SUI) { + throw Error("uint8ArrayToNative: Sui not supported yet."); + } else if (chainId === CHAIN_ID_APTOS) { + throw Error("uint8ArrayToNative: Aptos not supported yet."); } else if (chainId === CHAIN_ID_UNSET) { throw Error("uint8ArrayToNative: Chain id unset"); } else { @@ -195,6 +207,14 @@ export const tryNativeToHexString = ( return nativeStringToHexAlgorand(address); } else if (chainId === CHAIN_ID_NEAR) { throw Error("hexToNativeString: Near not supported yet."); + } else if (chainId === CHAIN_ID_INJECTIVE) { + throw Error("hexToNativeString: Injective not supported yet."); + } else if (chainId === CHAIN_ID_OSMOSIS) { + throw Error("hexToNativeString: Osmosis not supported yet."); + } else if (chainId === CHAIN_ID_SUI) { + throw Error("hexToNativeString: Sui not supported yet."); + } else if (chainId === CHAIN_ID_APTOS) { + throw Error("hexToNativeString: Aptos not supported yet."); } else if (chainId === CHAIN_ID_UNSET) { throw Error("hexToNativeString: Chain id unset"); } else { diff --git a/sdk/js/src/utils/consts.ts b/sdk/js/src/utils/consts.ts index 39d531f8b..8e48dcead 100644 --- a/sdk/js/src/utils/consts.ts +++ b/sdk/js/src/utils/consts.ts @@ -18,6 +18,10 @@ export const CHAINS = { moonbeam: 16, neon: 17, terra2: 18, + injective: 19, + osmosis: 20, + sui: 21, + aptos: 22, ropsten: 10001, } as const; @@ -137,6 +141,26 @@ const MAINNET = { token_bridge: undefined, nft_bridge: undefined, }, + injective: { + core: undefined, + token_bridge: undefined, + nft_bridge: undefined, + }, + osmosis: { + core: undefined, + token_bridge: undefined, + nft_bridge: undefined, + }, + aptos: { + core: undefined, + token_bridge: undefined, + nft_bridge: undefined, + }, + sui: { + core: undefined, + token_bridge: undefined, + nft_bridge: undefined, + }, moonbeam: { core: undefined, token_bridge: undefined, @@ -241,6 +265,26 @@ const TESTNET = { token_bridge: undefined, nft_bridge: undefined, }, + injective: { + core: undefined, + token_bridge: undefined, + nft_bridge: undefined, + }, + osmosis: { + core: undefined, + token_bridge: undefined, + nft_bridge: undefined, + }, + aptos: { + core: undefined, + token_bridge: undefined, + nft_bridge: undefined, + }, + sui: { + core: undefined, + token_bridge: undefined, + nft_bridge: undefined, + }, moonbeam: { core: "0xa5B7D85a8f27dd7907dc8FdC21FA5657D5E2F901", token_bridge: "0xbc976D4b9D57E57c3cA52e1Fd136C45FF7955A96", @@ -345,6 +389,26 @@ const DEVNET = { token_bridge: undefined, nft_bridge: undefined, }, + injective: { + core: undefined, + token_bridge: undefined, + nft_bridge: undefined, + }, + osmosis: { + core: undefined, + token_bridge: undefined, + nft_bridge: undefined, + }, + aptos: { + core: undefined, + token_bridge: undefined, + nft_bridge: undefined, + }, + sui: { + core: undefined, + token_bridge: undefined, + nft_bridge: undefined, + }, moonbeam: { core: undefined, token_bridge: undefined, @@ -424,6 +488,10 @@ export const CHAIN_ID_NEAR = CHAINS["near"]; export const CHAIN_ID_MOONBEAM = CHAINS["moonbeam"]; export const CHAIN_ID_NEON = CHAINS["neon"]; export const CHAIN_ID_TERRA2 = CHAINS["terra2"]; +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_ETHEREUM_ROPSTEN = CHAINS["ropsten"]; // This inverts the [[CHAINS]] object so that we can look up a chain by id