Add new chain id for Celestia

This commit is contained in:
M-Picco 2023-10-26 23:58:56 -03:00 committed by Evan Gray
parent 2e31789c70
commit 61f34510f8
4 changed files with 30 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@certusone/wormhole-sdk",
"version": "0.10.5",
"version": "0.10.6",
"description": "SDK for interacting with Wormhole",
"homepage": "https://wormhole.com",
"main": "./lib/cjs/index.js",

View File

@ -16,6 +16,7 @@ import {
isTerraChain,
CHAIN_ID_KUJIRA,
CHAIN_ID_OSMOSIS,
CHAIN_ID_CELESTIA,
} from "../utils";
export const isNativeDenomInjective = (denom: string) => denom === "inj";
@ -24,8 +25,10 @@ export const isNativeDenomSei = (denom: string) => denom === "usei";
export const isNativeDenomWormchain = (denom: string) => denom === "uworm";
export const isNativeDenomOsmosis = (denom: string) => denom === "uosmo";
export const isNativeDenomCosmosHub = (denom: string) => denom === "uatom";
export const isNativeDenomEvmos = (denom: string) => denom === "aevmos";
export const isNativeDenomEvmos = (denom: string) =>
denom === "aevmos" || denom === "atevmos";
export const isNativeDenomKujira = (denom: string) => denom === "ukuji";
export const isNativeDenomCelestia = (denom: string) => denom === "utia";
export function isNativeCosmWasmDenom(
chainId: CosmWasmChainId,
@ -40,7 +43,8 @@ export function isNativeCosmWasmDenom(
(chainId === CHAIN_ID_OSMOSIS && isNativeDenomOsmosis(address)) ||
(chainId === CHAIN_ID_COSMOSHUB && isNativeDenomCosmosHub(address)) ||
(chainId === CHAIN_ID_EVMOS && isNativeDenomEvmos(address)) ||
(chainId === CHAIN_ID_KUJIRA && isNativeDenomKujira(address))
(chainId === CHAIN_ID_KUJIRA && isNativeDenomKujira(address)) ||
(chainId === CHAIN_ID_CELESTIA && isNativeDenomCelestia(address))
);
}

View File

@ -35,6 +35,7 @@ import {
CHAIN_ID_COSMOSHUB,
CHAIN_ID_EVMOS,
CHAIN_ID_KUJIRA,
CHAIN_ID_CELESTIA,
} from "./consts";
import { hashLookup } from "./near";
import { getExternalAddressFromType, isValidAptosType } from "./aptos";
@ -129,6 +130,8 @@ export const tryUint8ArrayToNative = (
throw Error("uint8ArrayToNative: Evmos not supported yet.");
} else if (chainId === CHAIN_ID_KUJIRA) {
throw Error("uint8ArrayToNative: Kujira not supported yet.");
} else if (chainId === CHAIN_ID_CELESTIA) {
throw Error("uint8ArrayToNative: Celestia not supported yet.");
} else if (chainId === CHAIN_ID_SUI) {
throw Error("uint8ArrayToNative: Sui not supported yet.");
} else if (chainId === CHAIN_ID_APTOS) {
@ -272,6 +275,8 @@ export const tryNativeToHexString = (
throw Error("nativeToHexString: Evmos not supported yet.");
} else if (chainId === CHAIN_ID_KUJIRA) {
throw Error("nativeToHexString: Kujira not supported yet.");
} else if (chainId === CHAIN_ID_CELESTIA) {
throw Error("nativeToHexString: Celestia not supported yet.");
} else if (chainId === CHAIN_ID_SUI) {
if (!isValidSuiType(address) && isValidSuiAddress(address)) {
return uint8ArrayToHex(

View File

@ -35,6 +35,7 @@ export const CHAINS = {
cosmoshub: 4000,
evmos: 4001,
kujira: 4002,
celestia: 4004,
sepolia: 10002,
} as const;
@ -86,6 +87,7 @@ export const CosmWasmChainNames = [
"evmos",
"cosmoshub",
"kujira",
"celestia",
] as const;
export type CosmWasmChainName = typeof CosmWasmChainNames[number];
@ -299,6 +301,11 @@ const MAINNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
celestia: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
};
const TESTNET = {
@ -494,6 +501,11 @@ const TESTNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
celestia: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
};
const DEVNET = {
@ -687,6 +699,11 @@ const DEVNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
celestia: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
};
/**
@ -764,6 +781,7 @@ export const CHAIN_ID_GATEWAY = CHAIN_ID_WORMCHAIN;
export const CHAIN_ID_COSMOSHUB = CHAINS["cosmoshub"];
export const CHAIN_ID_EVMOS = CHAINS["evmos"];
export const CHAIN_ID_KUJIRA = CHAINS["kujira"];
export const CHAIN_ID_CELESTIA = CHAINS["celestia"];
export const CHAIN_ID_SEPOLIA = CHAINS["sepolia"];
// This inverts the [[CHAINS]] object so that we can look up a chain by id