Skip to content

Commit

Permalink
constants: Add Dymension to cosmwasm chains (wormhole-foundation#3763)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnjamin authored Feb 1, 2024
1 parent c311f07 commit 7f0a2a2
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 89 deletions.
182 changes: 93 additions & 89 deletions node/pkg/proto/publicrpc/v1/publicrpc.pb.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions node/pkg/watchers/ibc/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ var (
vaa.ChainIDCelestia,
vaa.ChainIDStargaze,
vaa.ChainIDSeda,
vaa.ChainIDDymension,
}

// features is the feature string to be published in the gossip heartbeat messages. It will include all chains that are actually enabled on IBC.
Expand Down
1 change: 1 addition & 0 deletions proto/publicrpc/v1/publicrpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ enum ChainID {
CHAIN_ID_CELESTIA = 4004;
CHAIN_ID_STARGAZE = 4005;
CHAIN_ID_SEDA = 4006;
CHAIN_ID_DYMENSION = 4007;
CHAIN_ID_SEPOLIA = 10002;
CHAIN_ID_ARBITRUM_SEPOLIA = 10003;
CHAIN_ID_BASE_SEPOLIA = 10004;
Expand Down
2 changes: 2 additions & 0 deletions sdk/js/src/cosmwasm/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
CHAIN_ID_CELESTIA,
CHAIN_ID_STARGAZE,
CHAIN_ID_SEDA,
CHAIN_ID_DYMENSION,
} from "../utils";

export const isNativeDenomInjective = (denom: string) => denom === "inj";
Expand All @@ -35,6 +36,7 @@ export const isNativeDenomNeutron = (denom: string) => denom === "untrn";
export const isNativeDenomCelestia = (denom: string) => denom === "utia";
export const isNativeDenomStargaze = (denom: string) => denom === "ustars";
export const isNativeDenomSeda = (denom: string) => denom === "aseda";
export const isNativeDenomDymension = (denom: string) => denom === "adym";

export function isNativeCosmWasmDenom(
chainId: CosmWasmChainId,
Expand Down
5 changes: 5 additions & 0 deletions sdk/js/src/utils/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
CHAIN_ID_CELESTIA,
CHAIN_ID_STARGAZE,
CHAIN_ID_SEDA,
CHAIN_ID_DYMENSION,
} from "./consts";
import { hashLookup } from "./near";
import { getExternalAddressFromType, isValidAptosType } from "./aptos";
Expand Down Expand Up @@ -141,6 +142,8 @@ export const tryUint8ArrayToNative = (
throw Error("uint8ArrayToNative: Stargaze not supported yet.");
} else if (chainId === CHAIN_ID_SEDA) {
throw Error("uint8ArrayToNative: Seda not supported yet.");
} else if (chainId === CHAIN_ID_DYMENSION) {
throw Error("uint8ArrayToNative: Dymension not supported yet.");
} else if (chainId === CHAIN_ID_SUI) {
throw Error("uint8ArrayToNative: Sui not supported yet.");
} else if (chainId === CHAIN_ID_APTOS) {
Expand Down Expand Up @@ -292,6 +295,8 @@ export const tryNativeToHexString = (
throw Error("nativeToHexString: Stargaze not supported yet.");
} else if (chainId === CHAIN_ID_SEDA) {
throw Error("nativeToHexString: Seda not supported yet.");
} else if (chainId === CHAIN_ID_DYMENSION) {
throw Error("nativeToHexString: Dymension not supported yet.");
} else if (chainId === CHAIN_ID_SUI) {
if (!isValidSuiType(address) && isValidSuiAddress(address)) {
return uint8ArrayToHex(
Expand Down
18 changes: 18 additions & 0 deletions sdk/js/src/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const CHAINS = {
celestia: 4004,
stargaze: 4005,
seda: 4006,
dymension: 4007,
sepolia: 10002,
arbitrum_sepolia: 10003,
base_sepolia: 10004,
Expand Down Expand Up @@ -106,6 +107,7 @@ export const CosmWasmChainNames = [
"celestia",
"stargaze",
"seda",
"dymension",
] as const;
export type CosmWasmChainName = typeof CosmWasmChainNames[number];

Expand Down Expand Up @@ -373,6 +375,11 @@ const MAINNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
dymension: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
};

const TESTNET = {
Expand Down Expand Up @@ -618,6 +625,11 @@ const TESTNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
dymension: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
};

const DEVNET = {
Expand Down Expand Up @@ -862,6 +874,11 @@ const DEVNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
dymension: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
};

/**
Expand Down Expand Up @@ -945,6 +962,7 @@ export const CHAIN_ID_NEUTRON = CHAINS["neutron"];
export const CHAIN_ID_CELESTIA = CHAINS["celestia"];
export const CHAIN_ID_STARGAZE = CHAINS["stargaze"];
export const CHAIN_ID_SEDA = CHAINS["seda"];
export const CHAIN_ID_DYMENSION = CHAINS["dymension"];
export const CHAIN_ID_SEPOLIA = CHAINS["sepolia"];
export const CHAIN_ID_ARBITRUM_SEPOLIA = CHAINS["arbitrum_sepolia"];
export const CHAIN_ID_BASE_SEPOLIA = CHAINS["base_sepolia"];
Expand Down
7 changes: 7 additions & 0 deletions sdk/vaa/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ func (c ChainID) String() string {
return "stargaze"
case ChainIDSeda:
return "seda"
case ChainIDDymension:
return "dymension"
case ChainIDSepolia:
return "sepolia"
case ChainIDArbitrumSepolia:
Expand Down Expand Up @@ -312,6 +314,8 @@ func ChainIDFromString(s string) (ChainID, error) {
return ChainIDStargaze, nil
case "seda":
return ChainIDSeda, nil
case "dymension":
return ChainIDDymension, nil
case "sepolia":
return ChainIDSepolia, nil
case "arbitrum_sepolia":
Expand Down Expand Up @@ -369,6 +373,7 @@ func GetAllNetworkIDs() []ChainID {
ChainIDCelestia,
ChainIDStargaze,
ChainIDSeda,
ChainIDDymension,
ChainIDSepolia,
ChainIDArbitrumSepolia,
ChainIDBaseSepolia,
Expand Down Expand Up @@ -460,6 +465,8 @@ const (
ChainIDStargaze ChainID = 4005
// ChainIDSeda is the ChainID of Seda
ChainIDSeda ChainID = 4006
// ChainIDSeda is the ChainID of Dymension
ChainIDDymension ChainID = 4007
// ChainIDSepolia is the ChainID of Sepolia
ChainIDSepolia ChainID = 10002
// ChainIDArbitrumSepolia is the ChainID of Arbitrum on Sepolia
Expand Down
1 change: 1 addition & 0 deletions sdk/vaa/structs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func TestChainIDFromString(t *testing.T) {
{input: "celestia", output: ChainIDCelestia},
{input: "stargaze", output: ChainIDStargaze},
{input: "seda", output: ChainIDSeda},
{input: "dymension", output: ChainIDDymension},
{input: "sepolia", output: ChainIDSepolia},
{input: "arbitrum_sepolia", output: ChainIDArbitrumSepolia},
{input: "base_sepolia", output: ChainIDBaseSepolia},
Expand Down

0 comments on commit 7f0a2a2

Please sign in to comment.