diff --git a/token-core/tcx-atom/src/address.rs b/token-core/tcx-atom/src/address.rs index a0fe3454..1353acca 100644 --- a/token-core/tcx-atom/src/address.rs +++ b/token-core/tcx-atom/src/address.rs @@ -1,10 +1,8 @@ -use anyhow::{anyhow, format_err}; +use anyhow::anyhow; use core::str::FromStr; -use std::collections::HashMap; -use std::sync::RwLock; +use crate::hrps::CHAIN_ID_HRP_MAP; use bech32::{FromBase32, ToBase32, Variant}; -use lazy_static::lazy_static; use tcx_common::{ripemd160, sha256}; use tcx_constants::CoinInfo; use tcx_keystore::{Address, Result}; @@ -13,39 +11,18 @@ use tcx_primitive::TypedPublicKey; // size of address pub const LENGTH: usize = 20; -// pub const HRP_MAP: -lazy_static! { - static ref CHAIN_ID_HRP_MAP: RwLock> = { - let mut chain_id_hrp_map = HashMap::new(); - chain_id_hrp_map.insert("cosmoshub-4".to_string(), "cosmos".to_string()); - chain_id_hrp_map.insert("osmosis-1".to_string(), "osmo".to_string()); - chain_id_hrp_map.insert("celestia".to_string(), "celestia".to_string()); - chain_id_hrp_map.insert("neutron-1".to_string(), "neutron".to_string()); - chain_id_hrp_map.insert("noble-1".to_string(), "noble".to_string()); - chain_id_hrp_map.insert("stride-1".to_string(), "stride".to_string()); - chain_id_hrp_map.insert("stargaze-1".to_string(), "stars".to_string()); - chain_id_hrp_map.insert("axelar-dojo-1".to_string(), "axelar".to_string()); - chain_id_hrp_map.insert("juno-1".to_string(), "juno".to_string()); - chain_id_hrp_map.insert("injective-1".to_string(), "inj".to_string()); - chain_id_hrp_map.insert("dydx-mainnet-1".to_string(), "dydx".to_string()); - chain_id_hrp_map.insert("dymension_1100-1".to_string(), "dym".to_string()); - chain_id_hrp_map.insert("secret-4".to_string(), "secret".to_string()); - chain_id_hrp_map.insert("archway-1".to_string(), "archway".to_string()); - chain_id_hrp_map.insert("akashnet-2".to_string(), "akash".to_string()); - chain_id_hrp_map.insert("core-1".to_string(), "persistence".to_string()); - RwLock::new(chain_id_hrp_map) - }; -} - fn verify_hrp(coin_info: &CoinInfo) -> Result<()> { let map = CHAIN_ID_HRP_MAP.read().unwrap(); let embed_hrp = map.get(&coin_info.chain_id); - if (embed_hrp.is_some()) { - if (&coin_info.hrp != embed_hrp.unwrap()) { - return Err(anyhow!("chain_id_and_hrp_not_match")); - } + + let Some(embed_hrp) = embed_hrp else { + return Err(anyhow!("unknown_chain_id")) + }; + if (&coin_info.hrp != embed_hrp) { + Err(anyhow!("chain_id_and_hrp_not_match")) + } else { + Ok(()) } - return Ok(()); } #[derive(PartialEq, Eq, Clone)] @@ -118,7 +95,7 @@ mod tests { fn get_test_coin() -> CoinInfo { CoinInfo { - chain_id: "".to_string(), + chain_id: "cosmoshub-4".to_string(), coin: "COSMOS".to_string(), derivation_path: "m/44'/118'/0'/0/0".to_string(), curve: CurveType::SECP256k1, @@ -220,28 +197,32 @@ mod tests { let testcase = [ ( "dydx", + "dydx-mainnet-1", "m/44'/118'/0'/0/0", "dydx1m566v5rcklnac8vc0dftfu4lnvznhlu7yg830z", ), ( "osmo", + "osmosis-1", "m/44'/118'/0'/0/0", "osmo1m566v5rcklnac8vc0dftfu4lnvznhlu79269e8", ), ( "neutron", + "neutron-1", "m/44'/118'/0'/0/0", "neutron1m566v5rcklnac8vc0dftfu4lnvznhlu7fwqh4j", ), ( "stride", + "stride-1", "m/44'/118'/0'/0/0", "stride1m566v5rcklnac8vc0dftfu4lnvznhlu7w6ffme", ), ]; - for (hrp, path, expected_addr) in testcase { + for (hrp, chain_id, path, expected_addr) in testcase { let coin_info = CoinInfo { - chain_id: "".to_string(), + chain_id: chain_id.to_string(), coin: "COSMOS".to_string(), derivation_path: path.to_string(), curve: CurveType::SECP256k1, @@ -256,6 +237,7 @@ mod tests { assert_eq!(address, expected_addr) } } + #[test] fn test_chain_id_hrp_verify() { let prv_str = "80e81ea269e66a0a05b11236df7919fb7fbeedba87452d667489d7403a02f005"; @@ -279,6 +261,19 @@ mod tests { "chain_id_and_hrp_not_match" ); + let coin_info = CoinInfo { + chain_id: "unknown-chainid".to_string(), + coin: "COSMOS".to_string(), + derivation_path: "m/44'/118'/0'/0/0".to_string(), + curve: CurveType::SECP256k1, + network: "MAINNET".to_string(), + seg_wit: "NONE".to_string(), + hrp: "cosmos".to_string(), + }; + + let address = AtomAddress::from_public_key(&pub_key, &coin_info); + assert_eq!(format!("{}", address.err().unwrap()), "unknown_chain_id"); + let coin_info = CoinInfo { chain_id: "cosmoshub-4".to_string(), coin: "COSMOS".to_string(), diff --git a/token-core/tcx-atom/src/hrps.rs b/token-core/tcx-atom/src/hrps.rs new file mode 100644 index 00000000..68abcad9 --- /dev/null +++ b/token-core/tcx-atom/src/hrps.rs @@ -0,0 +1,190 @@ +use lazy_static::lazy_static; +use std::collections::HashMap; +use std::sync::RwLock; +lazy_static! { + pub static ref CHAIN_ID_HRP_MAP: RwLock> = { + let mut chain_id_hrp_map = HashMap::new(); + chain_id_hrp_map.insert("eightball-1".to_string(), "8ball".to_string()); + chain_id_hrp_map.insert("acre_9052-1".to_string(), "acre".to_string()); + chain_id_hrp_map.insert("agoric-3".to_string(), "agoric".to_string()); + chain_id_hrp_map.insert("aioz_168-1".to_string(), "aioz".to_string()); + chain_id_hrp_map.insert("akashnet-2".to_string(), "akash".to_string()); + chain_id_hrp_map.insert("akiro-1".to_string(), "akiro".to_string()); + chain_id_hrp_map.insert("althea_258432-1".to_string(), "althea".to_string()); + chain_id_hrp_map.insert("andromeda-1".to_string(), "andr".to_string()); + chain_id_hrp_map.insert("archway-1".to_string(), "archway".to_string()); + chain_id_hrp_map.insert("arkh".to_string(), "arkh".to_string()); + chain_id_hrp_map.insert("mantle-1".to_string(), "mantle".to_string()); + chain_id_hrp_map.insert("aura_6322-2".to_string(), "aura".to_string()); + chain_id_hrp_map.insert("xstaxy-1".to_string(), "aura".to_string()); + chain_id_hrp_map.insert("axelar-dojo-1".to_string(), "axelar".to_string()); + chain_id_hrp_map.insert("laozi-mainnet".to_string(), "band".to_string()); + chain_id_hrp_map.insert("beezee-1".to_string(), "bze".to_string()); + chain_id_hrp_map.insert("bitcanna-1".to_string(), "bcna".to_string()); + chain_id_hrp_map.insert("bitsong-2b".to_string(), "bitsong".to_string()); + chain_id_hrp_map.insert("blockx_19191-1".to_string(), "blockx".to_string()); + chain_id_hrp_map.insert("bluechip-1".to_string(), "bcp".to_string()); + chain_id_hrp_map.insert("bluzelle-9".to_string(), "bluzelle".to_string()); + chain_id_hrp_map.insert("bostrom".to_string(), "bostrom".to_string()); + chain_id_hrp_map.insert("canto_7700-1".to_string(), "canto".to_string()); + chain_id_hrp_map.insert("carbon-1".to_string(), "swth".to_string()); + chain_id_hrp_map.insert("celestia".to_string(), "celestia".to_string()); + chain_id_hrp_map.insert("cerberus-chain-1".to_string(), "cerberus".to_string()); + chain_id_hrp_map.insert("perun-1".to_string(), "c4e".to_string()); + chain_id_hrp_map.insert("cheqd-mainnet-1".to_string(), "cheqd".to_string()); + chain_id_hrp_map.insert("chihuahua-1".to_string(), "chihuahua".to_string()); + chain_id_hrp_map.insert("chimba".to_string(), "chimba".to_string()); + chain_id_hrp_map.insert("morocco-1".to_string(), "chronic".to_string()); + chain_id_hrp_map.insert("cifer-2".to_string(), "cife".to_string()); + chain_id_hrp_map.insert("cifer-1".to_string(), "cife".to_string()); + chain_id_hrp_map.insert("cnho_stables-1".to_string(), "cnho".to_string()); + chain_id_hrp_map.insert("comdex-1".to_string(), "comdex".to_string()); + chain_id_hrp_map.insert("commercio-3".to_string(), "did:com:".to_string()); + chain_id_hrp_map.insert("centauri-1".to_string(), "pica".to_string()); + chain_id_hrp_map.insert("cvn_2032-1".to_string(), "cvn".to_string()); + chain_id_hrp_map.insert("coreum-mainnet-1".to_string(), "core".to_string()); + chain_id_hrp_map.insert("cosmoshub-4".to_string(), "cosmos".to_string()); + chain_id_hrp_map.insert("coss-1".to_string(), "coss".to_string()); + chain_id_hrp_map.insert("crescent-1".to_string(), "cre".to_string()); + chain_id_hrp_map.insert("cronosmainnet_25-1".to_string(), "crc".to_string()); + chain_id_hrp_map.insert("crypto-org-chain-mainnet-1".to_string(), "cro".to_string()); + chain_id_hrp_map.insert("cudos-1".to_string(), "cudos".to_string()); + chain_id_hrp_map.insert("mainnet-3".to_string(), "decentr".to_string()); + chain_id_hrp_map.insert("desmos-mainnet".to_string(), "desmos".to_string()); + chain_id_hrp_map.insert("dhealth".to_string(), "dh".to_string()); + chain_id_hrp_map.insert("dig-1".to_string(), "dig".to_string()); + chain_id_hrp_map.insert("vota-ash".to_string(), "dora".to_string()); + chain_id_hrp_map.insert("dydx-mainnet-1".to_string(), "dydx".to_string()); + chain_id_hrp_map.insert("dymension_1100-1".to_string(), "dym".to_string()); + chain_id_hrp_map.insert("dyson-mainnet-01".to_string(), "dys".to_string()); + chain_id_hrp_map.insert("echelon_3000-3".to_string(), "echelon".to_string()); + chain_id_hrp_map.insert("emoney-3".to_string(), "emoney".to_string()); + chain_id_hrp_map.insert("empowerchain-1".to_string(), "empower".to_string()); + chain_id_hrp_map.insert("ethos_7003-1".to_string(), "ethos".to_string()); + chain_id_hrp_map.insert("evmos_9001-2".to_string(), "evmos".to_string()); + chain_id_hrp_map.insert("fetchhub-4".to_string(), "fetch".to_string()); + chain_id_hrp_map.insert("finschia-2".to_string(), "link".to_string()); + chain_id_hrp_map.insert("colosseum-1".to_string(), "firma".to_string()); + chain_id_hrp_map.insert("furya-1".to_string(), "furya".to_string()); + chain_id_hrp_map.insert("fxcore".to_string(), "fx".to_string()); + chain_id_hrp_map.insert("galaxy-1".to_string(), "galaxy".to_string()); + chain_id_hrp_map.insert("wormchain".to_string(), "wormhole".to_string()); + chain_id_hrp_map.insert("genesis_29-2".to_string(), "genesis".to_string()); + chain_id_hrp_map.insert("gitopia".to_string(), "gitopia".to_string()); + chain_id_hrp_map.insert("govgen-1".to_string(), "govgen".to_string()); + chain_id_hrp_map.insert("gravity-bridge-3".to_string(), "gravity".to_string()); + chain_id_hrp_map.insert("haqq_11235-1".to_string(), "haqq".to_string()); + chain_id_hrp_map.insert("helichain".to_string(), "heli".to_string()); + chain_id_hrp_map.insert("highbury_710-1".to_string(), "fury".to_string()); + chain_id_hrp_map.insert("humans_1089-1".to_string(), "human".to_string()); + chain_id_hrp_map.insert("Antora".to_string(), "idep".to_string()); + chain_id_hrp_map.insert("ixo-5".to_string(), "ixo".to_string()); + chain_id_hrp_map.insert("imversed_5555555-1".to_string(), "imv".to_string()); + chain_id_hrp_map.insert("injective-1".to_string(), "inj".to_string()); + chain_id_hrp_map.insert("irishub-1".to_string(), "iaa".to_string()); + chain_id_hrp_map.insert("jackal-1".to_string(), "jkl".to_string()); + chain_id_hrp_map.insert("joltify_1729-1".to_string(), "jolt".to_string()); + chain_id_hrp_map.insert("juno-1".to_string(), "juno".to_string()); + chain_id_hrp_map.insert("kava_2222-10".to_string(), "kava".to_string()); + chain_id_hrp_map.insert("kichain-2".to_string(), "ki".to_string()); + chain_id_hrp_map.insert("darchub".to_string(), "darc".to_string()); + chain_id_hrp_map.insert("kaiyo-1".to_string(), "kujira".to_string()); + chain_id_hrp_map.insert("kyve-1".to_string(), "kyve".to_string()); + chain_id_hrp_map.insert("lambda_92000-1".to_string(), "lamb".to_string()); + chain_id_hrp_map.insert("lava-mainnet-1".to_string(), "lava@".to_string()); + chain_id_hrp_map.insert("likecoin-mainnet-2".to_string(), "like".to_string()); + chain_id_hrp_map.insert("logos_7002-1".to_string(), "logos".to_string()); + chain_id_hrp_map.insert("loop-1".to_string(), "loop".to_string()); + chain_id_hrp_map.insert("loyal-main-02".to_string(), "loyal".to_string()); + chain_id_hrp_map.insert("LumenX".to_string(), "lumen".to_string()); + chain_id_hrp_map.insert("lum-network-1".to_string(), "lum".to_string()); + chain_id_hrp_map.insert("mande_18071918-1".to_string(), "mande".to_string()); + chain_id_hrp_map.insert("mars-1".to_string(), "mars".to_string()); + chain_id_hrp_map.insert("mayachain-mainnet-v1".to_string(), "maya".to_string()); + chain_id_hrp_map.insert("medasdigital-1".to_string(), "medas".to_string()); + chain_id_hrp_map.insert("meme-1".to_string(), "meme".to_string()); + chain_id_hrp_map.insert("microtick-1".to_string(), "micro".to_string()); + chain_id_hrp_map.insert("migaloo-1".to_string(), "migaloo".to_string()); + chain_id_hrp_map.insert("mainnet".to_string(), "mises".to_string()); + chain_id_hrp_map.insert("mtgbp-1".to_string(), "mtgbp".to_string()); + chain_id_hrp_map.insert("mun-1".to_string(), "mun".to_string()); + chain_id_hrp_map.insert("mythos_7001-1".to_string(), "mythos".to_string()); + chain_id_hrp_map.insert("neura_266-1".to_string(), "neura".to_string()); + chain_id_hrp_map.insert("Neutaro-1".to_string(), "neutaro".to_string()); + chain_id_hrp_map.insert("neutron-1".to_string(), "neutron".to_string()); + chain_id_hrp_map.insert("cataclysm-1".to_string(), "nibi".to_string()); + chain_id_hrp_map.insert("nim_1122-1".to_string(), "nim".to_string()); + chain_id_hrp_map.insert("noble-1".to_string(), "noble".to_string()); + chain_id_hrp_map.insert("nois-1".to_string(), "nois".to_string()); + chain_id_hrp_map.insert("pirin-1".to_string(), "nolus".to_string()); + chain_id_hrp_map.insert("nomic-stakenet-3".to_string(), "nomic".to_string()); + chain_id_hrp_map.insert("nyx".to_string(), "n".to_string()); + chain_id_hrp_map.insert("octa".to_string(), "octa".to_string()); + chain_id_hrp_map.insert("odin-mainnet-freya".to_string(), "odin".to_string()); + chain_id_hrp_map.insert("exchain-66".to_string(), "ex".to_string()); + chain_id_hrp_map.insert("omniflixhub-1".to_string(), "omniflix".to_string()); + chain_id_hrp_map.insert("onex-mainnet-1".to_string(), "onomy".to_string()); + chain_id_hrp_map.insert("onomy-mainnet-1".to_string(), "onomy".to_string()); + chain_id_hrp_map.insert("Oraichain".to_string(), "orai".to_string()); + chain_id_hrp_map.insert("osmosis-1".to_string(), "osmo".to_string()); + chain_id_hrp_map.insert("tumbler".to_string(), "paloma".to_string()); + chain_id_hrp_map.insert("panacea-3".to_string(), "panacea".to_string()); + chain_id_hrp_map.insert("passage-2".to_string(), "pasg".to_string()); + chain_id_hrp_map.insert("passage-1".to_string(), "pasg".to_string()); + chain_id_hrp_map.insert("core-1".to_string(), "persistence".to_string()); + chain_id_hrp_map.insert("planq_7070-2".to_string(), "plq".to_string()); + chain_id_hrp_map.insert("point_10687-1".to_string(), "point".to_string()); + chain_id_hrp_map.insert("pio-mainnet-1".to_string(), "pb".to_string()); + chain_id_hrp_map.insert("pryzm-1".to_string(), "pryzm".to_string()); + chain_id_hrp_map.insert("PUNDIX".to_string(), "px".to_string()); + chain_id_hrp_map.insert("pylons-mainnet-1".to_string(), "pylo".to_string()); + chain_id_hrp_map.insert("qfs-1".to_string(), "qfs".to_string()); + chain_id_hrp_map.insert("quasar-1".to_string(), "quasar".to_string()); + chain_id_hrp_map.insert("quicksilver-2".to_string(), "quick".to_string()); + chain_id_hrp_map.insert("qwoyn-1".to_string(), "qwoyn".to_string()); + chain_id_hrp_map.insert("realionetwork_3301-1".to_string(), "realio".to_string()); + chain_id_hrp_map.insert("reb_1111-1".to_string(), "rebus".to_string()); + chain_id_hrp_map.insert("regen-1".to_string(), "regen".to_string()); + chain_id_hrp_map.insert("titan-1".to_string(), "rizon".to_string()); + chain_id_hrp_map.insert("ssc-1".to_string(), "saga".to_string()); + chain_id_hrp_map.insert("scorum-1".to_string(), "scorum".to_string()); + chain_id_hrp_map.insert("secret-4".to_string(), "secret".to_string()); + chain_id_hrp_map.insert("seda-1".to_string(), "seda".to_string()); + chain_id_hrp_map.insert("pacific-1".to_string(), "sei".to_string()); + chain_id_hrp_map.insert("self-1".to_string(), "self".to_string()); + chain_id_hrp_map.insert("sentinelhub-2".to_string(), "sent".to_string()); + chain_id_hrp_map.insert("sgenet-1".to_string(), "sge".to_string()); + chain_id_hrp_map.insert( + "ShareRing-VoyagerNet".to_string(), + "shareledger".to_string(), + ); + chain_id_hrp_map.insert("shentu-2.2".to_string(), "shentu".to_string()); + chain_id_hrp_map.insert("shido_9008-1".to_string(), "shido".to_string()); + chain_id_hrp_map.insert("sifchain-1".to_string(), "sif".to_string()); + chain_id_hrp_map.insert("sixnet".to_string(), "6x".to_string()); + chain_id_hrp_map.insert("sommelier-3".to_string(), "somm".to_string()); + chain_id_hrp_map.insert("source-1".to_string(), "source".to_string()); + chain_id_hrp_map.insert("stafihub-1".to_string(), "stafi".to_string()); + chain_id_hrp_map.insert("stargaze-1".to_string(), "stars".to_string()); + chain_id_hrp_map.insert("iov-mainnet-ibc".to_string(), "star".to_string()); + chain_id_hrp_map.insert("stratos-1".to_string(), "st".to_string()); + chain_id_hrp_map.insert("stride-1".to_string(), "stride".to_string()); + chain_id_hrp_map.insert("sunrise-1".to_string(), "sunrise".to_string()); + chain_id_hrp_map.insert("taketitan-12".to_string(), "taketitan".to_string()); + chain_id_hrp_map.insert("tenet_1559-1".to_string(), "tenet".to_string()); + chain_id_hrp_map.insert("teritori-1".to_string(), "tori".to_string()); + chain_id_hrp_map.insert("columbus-5".to_string(), "terra".to_string()); + chain_id_hrp_map.insert("phoenix-1".to_string(), "terra".to_string()); + chain_id_hrp_map.insert("tgrade-mainnet-1".to_string(), "tgrade".to_string()); + chain_id_hrp_map.insert("thorchain-mainnet-v1".to_string(), "thor".to_string()); + chain_id_hrp_map.insert("titan_18888-1".to_string(), "titan".to_string()); + chain_id_hrp_map.insert("umee-1".to_string(), "umee".to_string()); + chain_id_hrp_map.insert("FUND-MainNet-2".to_string(), "und".to_string()); + chain_id_hrp_map.insert("ununifi-beta-v1".to_string(), "ununifi".to_string()); + chain_id_hrp_map.insert("uptick_117-1".to_string(), "uptick".to_string()); + chain_id_hrp_map.insert("vidulum-1".to_string(), "vdl".to_string()); + chain_id_hrp_map.insert("dimension_37-1".to_string(), "xpla".to_string()); + chain_id_hrp_map.insert("zetachain_7000-1".to_string(), "zeta".to_string()); + RwLock::new(chain_id_hrp_map) + }; +} diff --git a/token-core/tcx-atom/src/lib.rs b/token-core/tcx-atom/src/lib.rs index 13e34b68..ad718ad6 100644 --- a/token-core/tcx-atom/src/lib.rs +++ b/token-core/tcx-atom/src/lib.rs @@ -1,4 +1,5 @@ pub mod address; +mod hrps; pub mod signer; pub mod transaction; diff --git a/token-core/tcx/src/reset_password.rs b/token-core/tcx/src/reset_password.rs index 85078197..94dbd18b 100644 --- a/token-core/tcx/src/reset_password.rs +++ b/token-core/tcx/src/reset_password.rs @@ -68,7 +68,11 @@ fn parse_coin_info_from_legacy_ks(value: Value) -> Result<(CoinInfo, String)> { }; let coin_info = CoinInfo { - chain_id: "".to_string(), + chain_id: if chain_str.eq_ignore_ascii_case("cosmos") { + "cosmoshub-4".to_string() + } else { + "".to_string() + }, coin: chain_str.to_string(), derivation_path, curve: CurveType::SECP256k1, diff --git a/token-core/tcx/tests/derive_test.rs b/token-core/tcx/tests/derive_test.rs index 61484b42..4203e8c7 100644 --- a/token-core/tcx/tests/derive_test.rs +++ b/token-core/tcx/tests/derive_test.rs @@ -128,7 +128,7 @@ pub fn test_derive_accounts() { path: "m/44'/118'/0'/0/0".to_string(), network: "MAINNET".to_string(), seg_wit: "".to_string(), - chain_id: "".to_string(), + chain_id: "cosmoshub-4".to_string(), curve: "secp256k1".to_string(), hrp: "cosmos".to_string(), }, @@ -608,14 +608,14 @@ pub fn test_derive_cosmos_sub_accounts() { path: "m/44'/118'/0'/0/0".to_string(), network: "MAINNET".to_string(), seg_wit: "".to_string(), - chain_id: "".to_string(), + chain_id: "cosmoshub-4".to_string(), curve: "secp256k1".to_string(), hrp: "cosmos".to_string(), }; let (_, accounts) = import_and_derive(derivation); let params = DeriveSubAccountsParam { - chain_id: "".to_string(), + chain_id: "cosmoshub-4".to_string(), chain_type: "COSMOS".to_string(), curve: "secp256k1".to_string(), network: "MAINNET".to_string(), @@ -637,7 +637,7 @@ pub fn test_derive_cosmos_sub_accounts() { ); let params = DeriveSubAccountsParam { - chain_id: "".to_string(), + chain_id: "osmosis-1".to_string(), chain_type: "COSMOS".to_string(), curve: "secp256k1".to_string(), network: "MAINNET".to_string(), diff --git a/token-core/tcx/tests/export_test.rs b/token-core/tcx/tests/export_test.rs index 0d293f48..c76b6b50 100644 --- a/token-core/tcx/tests/export_test.rs +++ b/token-core/tcx/tests/export_test.rs @@ -487,7 +487,7 @@ pub fn test_chain_cannot_export_private_key() { path: "m/44'/118'/0'/0/0".to_string(), network: "MAINNET".to_string(), seg_wit: "".to_string(), - chain_id: "".to_string(), + chain_id: "cosmoshub-4".to_string(), curve: "secp256k1".to_string(), hrp: "".to_string(), }]; diff --git a/token-core/tcx/tests/import_test.rs b/token-core/tcx/tests/import_test.rs index d4fcc82c..7bdd9d69 100644 --- a/token-core/tcx/tests/import_test.rs +++ b/token-core/tcx/tests/import_test.rs @@ -253,9 +253,9 @@ pub fn test_import_private_key() { path: "pk_not_need_path".to_string(), network: "".to_string(), seg_wit: "".to_string(), - chain_id: "".to_string(), + chain_id: "cosmoshub-4".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), + hrp: "cosmos".to_string(), }, Derivation { chain_type: "EOS".to_string(), @@ -1449,6 +1449,7 @@ pub fn test_reset_password_mnemonic_old_tcx_ks() { password_hint: "".to_string(), overwrite_id: overwrite_id.to_string(), }; + dbg!(overwrite_id.clone()); let ret = call_api("import_mnemonic", import_param).unwrap(); let import_result: KeystoreResult = KeystoreResult::decode(ret.as_slice()).unwrap();