"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildTokenId = exports.isNativeCosmWasmDenom = exports.isNativeDenomCelestia = exports.isNativeDenomKujira = exports.isNativeDenomEvmos = exports.isNativeDenomCosmosHub = exports.isNativeDenomOsmosis = exports.isNativeDenomWormchain = exports.isNativeDenomSei = exports.isNativeDenomXpla = exports.isNativeDenomInjective = void 0;
const utils_1 = require("ethers/lib/utils");
const terra_1 = require("../terra");
const utils_2 = require("../utils");
const isNativeDenomInjective = (denom) => denom === "inj";
exports.isNativeDenomInjective = isNativeDenomInjective;
const isNativeDenomXpla = (denom) => denom === "axpla";
exports.isNativeDenomXpla = isNativeDenomXpla;
const isNativeDenomSei = (denom) => denom === "usei";
exports.isNativeDenomSei = isNativeDenomSei;
const isNativeDenomWormchain = (denom) => denom === "uworm";
exports.isNativeDenomWormchain = isNativeDenomWormchain;
const isNativeDenomOsmosis = (denom) => denom === "uosmo";
exports.isNativeDenomOsmosis = isNativeDenomOsmosis;
const isNativeDenomCosmosHub = (denom) => denom === "uatom";
exports.isNativeDenomCosmosHub = isNativeDenomCosmosHub;
const isNativeDenomEvmos = (denom) => denom === "aevmos" || denom === "atevmos";
exports.isNativeDenomEvmos = isNativeDenomEvmos;
const isNativeDenomKujira = (denom) => denom === "ukuji";
exports.isNativeDenomKujira = isNativeDenomKujira;
const isNativeDenomCelestia = (denom) => denom === "utia";
exports.isNativeDenomCelestia = isNativeDenomCelestia;
function isNativeCosmWasmDenom(chainId, address) {
    return ((utils_2.isTerraChain(chainId) && terra_1.isNativeDenom(address)) ||
        (chainId === utils_2.CHAIN_ID_INJECTIVE && exports.isNativeDenomInjective(address)) ||
        (chainId === utils_2.CHAIN_ID_XPLA && exports.isNativeDenomXpla(address)) ||
        (chainId === utils_2.CHAIN_ID_SEI && exports.isNativeDenomSei(address)) ||
        (chainId === utils_2.CHAIN_ID_WORMCHAIN && exports.isNativeDenomWormchain(address)) ||
        (chainId === utils_2.CHAIN_ID_OSMOSIS && exports.isNativeDenomOsmosis(address)) ||
        (chainId === utils_2.CHAIN_ID_COSMOSHUB && exports.isNativeDenomCosmosHub(address)) ||
        (chainId === utils_2.CHAIN_ID_EVMOS && exports.isNativeDenomEvmos(address)) ||
        (chainId === utils_2.CHAIN_ID_KUJIRA && exports.isNativeDenomKujira(address)) ||
        (chainId === utils_2.CHAIN_ID_CELESTIA && exports.isNativeDenomCelestia(address)));
}
exports.isNativeCosmWasmDenom = isNativeCosmWasmDenom;
function buildTokenId(chain, address) {
    const chainId = utils_2.coalesceCosmWasmChainId(chain);
    return ((isNativeCosmWasmDenom(chainId, address) ? "01" : "00") +
        utils_1.keccak256(Buffer.from(address, "utf-8")).substring(4));
}
exports.buildTokenId = buildTokenId;
