diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 000000000..a9c46d08f --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,52 @@ +export const nativeMainnetChainIdentifiers: string[] = [ + "cosmoshub", + "osmosis", + "juno", + "agoric", + "akashnet", + "axelar-dojo", + "bostrom", + "core", + "emoney", + "evmos_9001", + "gravity-bridge", + "ixo", + "iov-mainnet-ibc", + "irishub", + "kava_2222", + "regen", + "secret", + "sentinelhub", + "shentu-2.2", + "sifchain", + "sommelier", + "stargaze", + "stride", + "tgrade-mainnet", + "umee", + "crypto-org-chain-mainnet", + "quicksilver", + "columbus", + "phoenix", + "mars", + "quasar", + "noble", + "injective", + "omniflixhub", + "kyve", + "neutron", + "gitopia", + "likecoin-mainnet", +]; + +export const nativeTestnetChainIdentifiers: string[] = [ + "ares", + "axelar-testnet-lisbon", + "atlantic", + "blockspacerace", + "mocha", + "elfagar", + "osmo-test", + "pion", + "theta-testnet", +]; diff --git a/src/index.ts b/src/index.ts index d5b9961b1..85f0e104b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,10 @@ import { checkImageSize, validateChainInfoFromPath } from "./validate"; import libPath from "path"; import { ChainIdHelper } from "@keplr-wallet/cosmos"; +import { + nativeMainnetChainIdentifiers, + nativeTestnetChainIdentifiers, +} from "./constants"; const main = async () => { // get file name @@ -16,67 +20,17 @@ const main = async () => { const chainInfo = await validateChainInfoFromPath(path); const isNativeSupported = (() => { - const nativeChains: string[] = [ - "cosmoshub", - "osmosis", - "juno", - "agoric", - "akashnet", - "axelar-dojo", - "bostrom", - "core", - "emoney", - "evmos_9001", - "gravity-bridge", - "ixo", - "iov-mainnet-ibc", - "irishub", - "kava_2222", - "regen", - "secret", - "sentinelhub", - "shentu-2.2", - "sifchain", - "sommelier", - "stargaze", - "stride", - "tgrade-mainnet", - "umee", - "crypto-org-chain-mainnet", - "quicksilver", - "columbus", - "phoenix", - "mars", - "quasar", - "noble", - "injective", - "omniflixhub", - "kyve", - "neutron", - "gitopia", - "likecoin-mainnet", - ]; const chainIdentifier = ChainIdHelper.parse(chainInfo.chainId).identifier; - return nativeChains.map((s) => s.trim()).includes(chainIdentifier); + return nativeMainnetChainIdentifiers + .map((s) => s.trim()) + .includes(chainIdentifier); })(); const isTestnetChain = (() => { - const testNetChains: string[] = [ - "ares", - "axelar-testnet-lisbon", - "atlantic", - "blockspacerace", - "mocha", - "elfagar", - "osmo-test", - "pion", - "theta-testnet", - ]; - const chainIdentifier = ChainIdHelper.parse(chainInfo.chainId).identifier; - return testNetChains + return nativeTestnetChainIdentifiers .map((s) => s.trim()) .some((s) => s === chainIdentifier); })();