From 425341d354f4641dcb8b6e5d13c87f920fffafe5 Mon Sep 17 00:00:00 2001 From: XuNeal Date: Thu, 5 Sep 2024 20:16:50 +0800 Subject: [PATCH] feat: cosmos derive account by chainId --- token-core/tcx-atom/src/address.rs | 38 +++-------- token-core/tcx-atom/src/signer.rs | 1 - token-core/tcx-btc-kin/src/address.rs | 6 -- token-core/tcx-btc-kin/src/bch_address.rs | 2 - token-core/tcx-btc-kin/src/message.rs | 6 -- token-core/tcx-btc-kin/src/psbt.rs | 2 - token-core/tcx-btc-kin/src/signer.rs | 1 - token-core/tcx-ckb/src/address.rs | 5 -- token-core/tcx-ckb/src/signer.rs | 8 --- .../tcx-constants/src/btc_fork_network.rs | 1 - token-core/tcx-constants/src/coin_info.rs | 43 +----------- token-core/tcx-eth/src/address.rs | 2 - token-core/tcx-filecoin/src/address.rs | 2 - token-core/tcx-keystore/src/keystore/hd.rs | 21 ------ token-core/tcx-keystore/src/keystore/mod.rs | 3 - .../tcx-keystore/src/keystore/private.rs | 1 - token-core/tcx-migration/src/migration.rs | 7 -- token-core/tcx-proto/src/params.proto | 29 +------- token-core/tcx-substrate/src/address.rs | 5 -- token-core/tcx-tezos/src/address.rs | 3 - token-core/tcx-tron/src/address.rs | 2 - token-core/tcx/src/api.rs | 11 --- token-core/tcx/src/handler.rs | 3 - token-core/tcx/src/reset_password.rs | 6 -- token-core/tcx/tests/derive_test.rs | 67 +++---------------- token-core/tcx/tests/export_test.rs | 14 ---- token-core/tcx/tests/import_test.rs | 28 -------- token-core/tcx/tests/sign_test.rs | 3 - 28 files changed, 23 insertions(+), 297 deletions(-) diff --git a/token-core/tcx-atom/src/address.rs b/token-core/tcx-atom/src/address.rs index 1353acca..32056425 100644 --- a/token-core/tcx-atom/src/address.rs +++ b/token-core/tcx-atom/src/address.rs @@ -11,18 +11,15 @@ use tcx_primitive::TypedPublicKey; // size of address pub const LENGTH: usize = 20; -fn verify_hrp(coin_info: &CoinInfo) -> Result<()> { +fn find_hrp(chain_id: &str) -> Result { let map = CHAIN_ID_HRP_MAP.read().unwrap(); - let embed_hrp = map.get(&coin_info.chain_id); + let embed_hrp = map.get(chain_id); - 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")) + return if embed_hrp.is_some() { + Ok(embed_hrp.unwrap().to_string()) } else { - Ok(()) - } + Err(anyhow!("unknown_chain_id")) + }; } #[derive(PartialEq, Eq, Clone)] @@ -34,15 +31,10 @@ impl Address for AtomAddress { let mut bytes = [0u8; LENGTH]; let pub_key_hash = ripemd160(&sha256(&pub_key_bytes)); bytes.copy_from_slice(&pub_key_hash[..LENGTH]); - verify_hrp(&coin)?; - let hrp = if coin.hrp.is_empty() { - "cosmos" - } else { - coin.hrp.as_str() - }; + let hrp = find_hrp(&coin.chain_id)?; Ok(AtomAddress(bech32::encode( - hrp, + &hrp, bytes.to_base32(), Variant::Bech32, )?)) @@ -54,10 +46,6 @@ impl Address for AtomAddress { let (hrp, data, _) = val; let data = Vec::from_base32(&data).unwrap(); - if coin.hrp != hrp.as_str() { - return false; - } - if data.len() != 20 { return false; } @@ -101,7 +89,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "cosmos".to_string(), } } @@ -179,7 +166,6 @@ mod tests { 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) .unwrap() @@ -228,7 +214,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: hrp.to_string(), }; let address = AtomAddress::from_public_key(&pub_key, &coin_info) @@ -252,13 +237,12 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "cosmos-wrong".to_string(), }; let address = AtomAddress::from_public_key(&pub_key, &coin_info); assert_eq!( - format!("{}", address.err().unwrap()), - "chain_id_and_hrp_not_match" + format!("{}", address.unwrap().to_string()), + "cosmos1hsk6jryyqjfhp5dhc55tc9jtckygx0eph6dd02" ); let coin_info = CoinInfo { @@ -268,7 +252,6 @@ mod tests { 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); @@ -281,7 +264,6 @@ mod tests { 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); diff --git a/token-core/tcx-atom/src/signer.rs b/token-core/tcx-atom/src/signer.rs index a0b59ba5..0ceaca7f 100644 --- a/token-core/tcx-atom/src/signer.rs +++ b/token-core/tcx-atom/src/signer.rs @@ -51,7 +51,6 @@ mod tests { curve: CurveType::SECP256k1, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let mut guard = KeystoreGuard::unlock_by_password(&mut keystore, TEST_PASSWORD).unwrap(); diff --git a/token-core/tcx-btc-kin/src/address.rs b/token-core/tcx-btc-kin/src/address.rs index 10030800..19874b93 100644 --- a/token-core/tcx-btc-kin/src/address.rs +++ b/token-core/tcx-btc-kin/src/address.rs @@ -361,7 +361,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let ltc_xprv_str = BtcKinAddress::extended_private_key(&anprv, &coin_info).unwrap(); assert_eq!("xprv9yrdwPSRnvomqFK4u1y5uW2SaXS2Vnr3pAYTjJjbyRZR8p9BwoadRsCxtgUFdAKeRPbwvGRcCSYMV69nNK4N2kadevJ6L5iQVy1SwGKDTHQ", ltc_xprv_str); @@ -382,7 +381,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let ltc_xprv_str = BtcKinAddress::extended_public_key(&anpub, &coin_info).unwrap(); assert_eq!("xpub6JeaAjhtvtjCDnEo4Bjr7uEbGccaHnJtLY4aBnMaAYGjkBRB3fP9XvjcCbNjMiU1n5tt7dYKVgHPGzh3t3W6eLBxavxABTaoQ2jhbiQrfe4", ltc_xprv_str); @@ -475,7 +473,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let address = BtcKinAddress::from_public_key(&pub_key, &coin_info) .unwrap() @@ -513,7 +510,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }) .unwrap(); assert_eq!(account.address, "DQ4tVEqdPWHc1aVBm4Sfwft8XyNRPMEchR"); @@ -545,7 +541,6 @@ mod tests { curve: CurveType::SECP256k1, network: network.to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let account = hd.derive_coin::(&coin_info).unwrap(); assert_eq!(account.ext_pub_key, xpub); @@ -567,7 +562,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "VERSION_0".to_string(), - hrp: "".to_string(), }; let address = BtcKinAddress::from_public_key(&pub_key, &coin_info) .unwrap() diff --git a/token-core/tcx-btc-kin/src/bch_address.rs b/token-core/tcx-btc-kin/src/bch_address.rs index 0eea854b..38f76ff1 100644 --- a/token-core/tcx-btc-kin/src/bch_address.rs +++ b/token-core/tcx-btc-kin/src/bch_address.rs @@ -197,7 +197,6 @@ mod tests { curve: CurveType::SECP256k1, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let ret = BchAddress::from_public_key(&pk, &wrong_coin_info); assert_eq!(format!("{}", ret.err().unwrap()), "missing_network"); @@ -290,7 +289,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let address = BchAddress::from_public_key(&pub_key, &coin_info) .unwrap() diff --git a/token-core/tcx-btc-kin/src/message.rs b/token-core/tcx-btc-kin/src/message.rs index faf7fdc2..26573fc2 100644 --- a/token-core/tcx-btc-kin/src/message.rs +++ b/token-core/tcx-btc-kin/src/message.rs @@ -109,7 +109,6 @@ impl MessageSigner for Keystore { curve: CurveType::SECP256k1, network: params.network.to_string(), seg_wit: params.seg_wit.to_string(), - hrp: "".to_string(), }; let address = BtcKinAddress::from_public_key(&public_key, &coin_info)?; @@ -160,7 +159,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "VERSION_0".to_string(), - hrp: "".to_string(), }; let account = ks.derive_coin::(&coin_info).unwrap(); @@ -185,7 +183,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "P2WPKH".to_string(), - hrp: "".to_string(), }; let account = ks.derive_coin::(&coin_info).unwrap(); @@ -222,7 +219,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let account = ks.derive_coin::(&coin_info).unwrap(); @@ -260,7 +256,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "VERSION_0".to_string(), - hrp: "".to_string(), }; let account = ks.derive_coin::(&coin_info).unwrap(); @@ -297,7 +292,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "VERSION_1".to_string(), - hrp: "".to_string(), }; let account = ks.derive_coin::(&coin_info).unwrap(); diff --git a/token-core/tcx-btc-kin/src/psbt.rs b/token-core/tcx-btc-kin/src/psbt.rs index 28a07c2b..ff1e9c7c 100644 --- a/token-core/tcx-btc-kin/src/psbt.rs +++ b/token-core/tcx-btc-kin/src/psbt.rs @@ -446,7 +446,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "VERSION_1".to_string(), - hrp: "".to_string(), }; let account = hd.derive_coin::(&coin_info).unwrap(); @@ -487,7 +486,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "VERSION_1".to_string(), - hrp: "".to_string(), }; let account = hd.derive_coin::(&coin_info).unwrap(); diff --git a/token-core/tcx-btc-kin/src/signer.rs b/token-core/tcx-btc-kin/src/signer.rs index 46432cb7..63043ac4 100644 --- a/token-core/tcx-btc-kin/src/signer.rs +++ b/token-core/tcx-btc-kin/src/signer.rs @@ -254,7 +254,6 @@ impl> KinTransaction curve: params.curve, network: params.network.clone(), seg_wit: params.seg_wit.clone(), - hrp: "".to_string(), }; let change_script = if let Some(change_address_index) = self.change_address_index && keystore.derivable() { diff --git a/token-core/tcx-ckb/src/address.rs b/token-core/tcx-ckb/src/address.rs index e5307662..3219466e 100644 --- a/token-core/tcx-ckb/src/address.rs +++ b/token-core/tcx-ckb/src/address.rs @@ -105,7 +105,6 @@ mod tests { curve: CurveType::SECP256k1, network: network.to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let pub_key = TypedPublicKey::from_slice( @@ -135,7 +134,6 @@ mod tests { curve: CurveType::SECP256k1, network: network.to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; assert!(CkbAddress::is_valid(address, &coin_info)); } @@ -152,7 +150,6 @@ mod tests { curve: CurveType::SECP256k1, network: network.to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; assert!(!CkbAddress::is_valid(address, &coin_info)); } @@ -174,7 +171,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; assert!(!CkbAddress::is_valid(invalid_address, &coin_info)); } @@ -201,7 +197,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let address = CkbAddress::from_public_key(&pub_key, &coin_info) .unwrap() diff --git a/token-core/tcx-ckb/src/signer.rs b/token-core/tcx-ckb/src/signer.rs index b24c8510..3f6775f3 100644 --- a/token-core/tcx-ckb/src/signer.rs +++ b/token-core/tcx-ckb/src/signer.rs @@ -305,7 +305,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let mut ks = @@ -442,7 +441,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let _account = ks.derive_coin::(&coin_info).unwrap().clone(); @@ -526,7 +524,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let mut ks = @@ -593,7 +590,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let mut ks = @@ -664,7 +660,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let mut ks = @@ -703,7 +698,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let mut ks = @@ -751,7 +745,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let mut ks = @@ -899,7 +892,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let mut ks = diff --git a/token-core/tcx-constants/src/btc_fork_network.rs b/token-core/tcx-constants/src/btc_fork_network.rs index 600124cd..e8b2cab9 100644 --- a/token-core/tcx-constants/src/btc_fork_network.rs +++ b/token-core/tcx-constants/src/btc_fork_network.rs @@ -255,7 +255,6 @@ mod test { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }) .unwrap(); diff --git a/token-core/tcx-constants/src/coin_info.rs b/token-core/tcx-constants/src/coin_info.rs index db600675..ad29c989 100644 --- a/token-core/tcx-constants/src/coin_info.rs +++ b/token-core/tcx-constants/src/coin_info.rs @@ -21,7 +21,6 @@ pub struct CoinInfo { pub curve: CurveType, pub network: String, pub seg_wit: String, - pub hrp: String, pub chain_id: String, } @@ -33,7 +32,7 @@ impl Default for CoinInfo { curve: CurveType::SECP256k1, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), + chain_id: "".to_string(), } } @@ -49,7 +48,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -58,7 +56,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -67,7 +64,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "P2WPKH".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -76,7 +72,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "P2WPKH".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -85,7 +80,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "VERSION_0".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -94,7 +88,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "VERSION_0".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -103,7 +96,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "VERSION_1".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -112,7 +104,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "VERSION_1".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -121,7 +112,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -130,7 +120,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -139,7 +128,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -148,7 +136,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -157,7 +144,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "P2WPKH".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -166,7 +152,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "P2WPKH".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -175,7 +160,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -184,7 +168,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -193,7 +176,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -202,7 +184,6 @@ lazy_static! { curve: CurveType::SR25519, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -211,7 +192,6 @@ lazy_static! { curve: CurveType::SR25519, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -220,7 +200,6 @@ lazy_static! { curve: CurveType::ED25519, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -229,7 +208,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -238,7 +216,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -247,7 +224,6 @@ lazy_static! { curve: CurveType::BLS, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -256,7 +232,6 @@ lazy_static! { curve: CurveType::BLS, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -265,7 +240,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -274,7 +248,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -283,7 +256,6 @@ lazy_static! { curve: CurveType::BLS, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -292,7 +264,6 @@ lazy_static! { curve: CurveType::BLS, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -301,7 +272,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -310,7 +280,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -319,7 +288,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -328,7 +296,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -337,7 +304,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -346,7 +312,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -355,7 +320,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "P2WPKH".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -364,7 +328,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "P2WPKH".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -373,7 +336,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "VERSION_0".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -382,7 +344,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "VERSION_0".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -391,7 +352,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "VERSION_1".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -400,7 +360,6 @@ lazy_static! { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "VERSION_1".to_string(), - hrp: "".to_string(), }, ]; diff --git a/token-core/tcx-eth/src/address.rs b/token-core/tcx-eth/src/address.rs index 96f7c169..5f01b2ce 100644 --- a/token-core/tcx-eth/src/address.rs +++ b/token-core/tcx-eth/src/address.rs @@ -133,7 +133,6 @@ mod test { curve: CurveType::SECP256k1, network: "testnet".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let address = EthAddress::from_public_key(&typed_public_key, &coin_info).unwrap(); assert_eq!( @@ -215,7 +214,6 @@ mod test { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let address = EthAddress::from_public_key(&pub_key, &coin_info) .unwrap() diff --git a/token-core/tcx-filecoin/src/address.rs b/token-core/tcx-filecoin/src/address.rs index 9ff1a5ec..7a57b526 100644 --- a/token-core/tcx-filecoin/src/address.rs +++ b/token-core/tcx-filecoin/src/address.rs @@ -167,7 +167,6 @@ mod tests { curve: CurveType::BLS, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; for (input, expected) in test_cases { @@ -264,7 +263,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; for (input, expected) in test_cases { diff --git a/token-core/tcx-keystore/src/keystore/hd.rs b/token-core/tcx-keystore/src/keystore/hd.rs index f17d1578..27fbab46 100644 --- a/token-core/tcx-keystore/src/keystore/hd.rs +++ b/token-core/tcx-keystore/src/keystore/hd.rs @@ -347,7 +347,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -356,7 +355,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "P2WPKH".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -365,7 +363,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "VERSION_0".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -374,7 +371,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "VERSION_1".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -383,7 +379,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -392,7 +387,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "P2WPKH".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -401,7 +395,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "VERSION_0".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -410,7 +403,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "VERSION_1".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -419,7 +411,6 @@ mod tests { curve: CurveType::ED25519, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, ]; @@ -453,7 +444,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let _ = keystore .unlock(&Key::Password(TEST_PASSWORD.to_owned())) @@ -563,7 +553,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let _ = keystore .unlock(&Key::Password(TEST_PASSWORD.to_owned())) @@ -631,7 +620,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let _ = keystore .unlock(&Key::Password(TEST_PASSWORD.to_owned())) @@ -676,7 +664,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; m.iter(|| { @@ -701,7 +688,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -710,7 +696,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -719,7 +704,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -728,7 +712,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "VERSION_0".to_string(), - hrp: "".to_string(), }, CoinInfo { chain_id: "".to_string(), @@ -737,7 +720,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "VERSION_1".to_string(), - hrp: "".to_string(), }, ]; @@ -770,7 +752,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let acc = keystore.derive_coin::(&coin_info).unwrap(); assert_eq!(acc.ext_pub_key, "tpubDD7tXK8KeQ3YY83yWq755fHY2JW8Ha8Q765tknUM5rSvjPcGWfUppDFMpQ1ScziKfW3ZNtZvAD7M3u7bSs7HofjTD3KP3YxPK7X6hwV8Rk2"); @@ -782,7 +763,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let acc = keystore.derive_coin::(&coin_info).unwrap(); assert_eq!( @@ -806,7 +786,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let acc = keystore.derive_coin::(&coin_info).unwrap(); assert_eq!(acc.ext_pub_key, "xpub6CatWdiZiodmUeTDp8LT5or8nmbKNcuyvz7WyksVFkKB4RHwCD3XyuvPEbvqAQY3rAPshWcMLoP2fMFMKHPJ4ZeZXYVUhLv1VMrjPC7PW6V"); diff --git a/token-core/tcx-keystore/src/keystore/mod.rs b/token-core/tcx-keystore/src/keystore/mod.rs index 11326590..ab04b1b6 100644 --- a/token-core/tcx-keystore/src/keystore/mod.rs +++ b/token-core/tcx-keystore/src/keystore/mod.rs @@ -903,7 +903,6 @@ pub(crate) mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let k1_pub_key = Secp256k1PublicKey::from_slice( @@ -977,7 +976,6 @@ pub(crate) mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let k1_pub_key = Secp256k1PublicKey::from_slice( @@ -1023,7 +1021,6 @@ pub(crate) mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let typed_pk = TypedDeterministicPublicKey::from_hex(CurveType::SECP256k1, "03a25f12b68000000044efc688fe25a1a677765526ed6737b4bfcfb0122589caab7ca4b223ffa9bb37029d23439ecb195eb06a0d44a608960d18702fd97e19c53451f0548f568207af77").unwrap(); diff --git a/token-core/tcx-keystore/src/keystore/private.rs b/token-core/tcx-keystore/src/keystore/private.rs index b67be6bc..6a3cc333 100644 --- a/token-core/tcx-keystore/src/keystore/private.rs +++ b/token-core/tcx-keystore/src/keystore/private.rs @@ -271,7 +271,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }]; let excepts = ["0280c98b8ea7cab630defb0c09a4295c2193cdee016c1d5b9b0cb18572b9c370fe"]; diff --git a/token-core/tcx-migration/src/migration.rs b/token-core/tcx-migration/src/migration.rs index ed7992a1..256ecf5b 100644 --- a/token-core/tcx-migration/src/migration.rs +++ b/token-core/tcx-migration/src/migration.rs @@ -402,7 +402,6 @@ mod tests { curve: CurveType::SECP256k1, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; keystore.unlock(&key).unwrap(); @@ -461,7 +460,6 @@ mod tests { curve: CurveType::SECP256k1, network: "TESTNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; keystore.unlock_by_password("imtoken1").unwrap(); @@ -489,7 +487,6 @@ mod tests { curve: CurveType::SECP256k1, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; keystore.unlock(&key).unwrap(); @@ -516,7 +513,6 @@ mod tests { curve: CurveType::SECP256k1, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; keystore.unlock(&key).unwrap(); @@ -541,7 +537,6 @@ mod tests { curve: CurveType::SECP256k1, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; keystore.unlock(&key).unwrap(); @@ -566,7 +561,6 @@ mod tests { curve: CurveType::SECP256k1, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; keystore.unlock(&key).unwrap(); @@ -595,7 +589,6 @@ mod tests { curve: CurveType::SECP256k1, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; keystore.unlock(&key).unwrap(); diff --git a/token-core/tcx-proto/src/params.proto b/token-core/tcx-proto/src/params.proto index b7ae81e9..ea672cf1 100644 --- a/token-core/tcx-proto/src/params.proto +++ b/token-core/tcx-proto/src/params.proto @@ -75,7 +75,6 @@ message DeriveAccountsParam { string segWit = 4; string chainId = 5; string curve = 6; - string hrp = 7; } repeated Derivation derivations = 4; } @@ -111,17 +110,6 @@ message ExportJsonResult { string json = 2; } -// // only support two types -// enum KeyType { -// MNEMONIC = 0; -// PRIVATE_KEY = 1; -// } - -/// Private Key Store - -// FUNCTION: import_private_key(ImportPrivateKeyParam): KeystoreResult -// -// create a new private key keystore by a private key message ImportPrivateKeyParam { string privateKey = 1; string password = 2; @@ -131,15 +119,6 @@ message ImportPrivateKeyParam { string overwriteId = 6; } -// FUNCTION: keystore_common_exists(KeystoreCommonExistsParam): ExistsKeystoreResult -// -// Check is there a keystore was generate by the special privateKey or mnemonic -// message KeystoreCommonExistsParam { -// KeyType type = 1; -// string value = 2; -// string encoding = 3; -// } - message ExistsMnemonicParam { string mnemonic = 1; } @@ -164,12 +143,7 @@ message ImportJsonParam { bool overwrite = 3; } -/// Sign Transaction -// FUNCTION: sign_tx(SignParam) -// -// Sign transaction. This api is used for sign any chain_type, you should build the right TxInput instance and -// put it in the `input` field message SignParam { string id = 1; oneof key { @@ -191,8 +165,7 @@ message DeriveSubAccountsParam { string segWit = 4; repeated string relativePaths = 5; string extendedPublicKey = 6; - string hrp = 7; - string chain_id = 8; + string chain_id = 7; } message DeriveSubAccountsResult { diff --git a/token-core/tcx-substrate/src/address.rs b/token-core/tcx-substrate/src/address.rs index 472e1990..1decc03c 100644 --- a/token-core/tcx-substrate/src/address.rs +++ b/token-core/tcx-substrate/src/address.rs @@ -77,7 +77,6 @@ mod test_super { curve: CurveType::SR25519, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, ), ( @@ -89,7 +88,6 @@ mod test_super { curve: CurveType::SR25519, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, ), ]; @@ -109,7 +107,6 @@ mod test_super { curve: CurveType::SR25519, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let addr = SubstrateAddress::from_public_key(&typed_key, &kusama_coin_info).unwrap(); assert_eq!( @@ -131,7 +128,6 @@ mod test_super { curve: CurveType::SR25519, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let addresses = vec![ "FwMF8FdFKxPtt9enzZ2Zf7dJCxiu4HqK6GhRAsKCvbNkSqx", @@ -160,7 +156,6 @@ mod test_super { curve: CurveType::SR25519, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let addresses = vec![ "3BMEXohjFLZJGBLkCbF9zreee1eJjoM3ZB", diff --git a/token-core/tcx-tezos/src/address.rs b/token-core/tcx-tezos/src/address.rs index bc844c9b..06afda5f 100644 --- a/token-core/tcx-tezos/src/address.rs +++ b/token-core/tcx-tezos/src/address.rs @@ -96,7 +96,6 @@ mod test { curve: CurveType::ED25519, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let pub_key = TypedPublicKey::from_slice( @@ -136,7 +135,6 @@ mod test { curve: CurveType::ED25519, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let address = "tz1dLEU3WfzCrDq2bvoEz4cfLP5wg4S7xNo9"; //valid address let valid_result = TezosAddress::is_valid(address, &coin_info); @@ -160,7 +158,6 @@ mod test { curve: CurveType::ED25519, network: "MAINNET".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; let pub_key = TypedPublicKey::from_slice( diff --git a/token-core/tcx-tron/src/address.rs b/token-core/tcx-tron/src/address.rs index a23f1550..2158a70d 100644 --- a/token-core/tcx-tron/src/address.rs +++ b/token-core/tcx-tron/src/address.rs @@ -67,7 +67,6 @@ mod tests { curve: CurveType::SECP256k1, network: "".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }; assert_eq!( @@ -136,7 +135,6 @@ mod tests { curve: CurveType::SECP256k1, network: "MAINNET".to_string(), seg_wit: "NONE".to_string(), - hrp: "".to_string(), }; let address = TronAddress::from_public_key(&pub_key, &coin_info) .unwrap() diff --git a/token-core/tcx/src/api.rs b/token-core/tcx/src/api.rs index 5fed7ccc..f7564f28 100644 --- a/token-core/tcx/src/api.rs +++ b/token-core/tcx/src/api.rs @@ -380,8 +380,6 @@ pub mod derive_accounts_param { pub chain_id: ::prost::alloc::string::String, #[prost(string, tag = "6")] pub curve: ::prost::alloc::string::String, - #[prost(string, tag = "7")] - pub hrp: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] @@ -443,9 +441,6 @@ pub struct ExportJsonResult { #[prost(string, tag = "2")] pub json: ::prost::alloc::string::String, } -/// FUNCTION: import_private_key(ImportPrivateKeyParam): KeystoreResult -/// -/// create a new private key keystore by a private key #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ImportPrivateKeyParam { @@ -500,10 +495,6 @@ pub struct ImportJsonParam { #[prost(bool, tag = "3")] pub overwrite: bool, } -/// FUNCTION: sign_tx(SignParam) -/// -/// Sign transaction. This api is used for sign any chain_type, you should build the right TxInput instance and -/// put it in the `input` field #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SignParam { @@ -551,8 +542,6 @@ pub struct DeriveSubAccountsParam { #[prost(string, tag = "6")] pub extended_public_key: ::prost::alloc::string::String, #[prost(string, tag = "7")] - pub hrp: ::prost::alloc::string::String, - #[prost(string, tag = "8")] pub chain_id: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/token-core/tcx/src/handler.rs b/token-core/tcx/src/handler.rs index ce936983..f28717af 100644 --- a/token-core/tcx/src/handler.rs +++ b/token-core/tcx/src/handler.rs @@ -104,7 +104,6 @@ fn derive_account(keystore: &mut Keystore, derivation: &Derivation) -> Result Result> { if !derivation.path.is_empty() { coin_info.derivation_path = derivation.path; } - coin_info.hrp = derivation.hrp; let enc_xpub = if account.ext_pub_key.is_empty() { Ok("".to_string()) @@ -1298,7 +1296,6 @@ pub fn derive_sub_accounts(data: &[u8]) -> Result> { ¶m.curve, )?; coin_info.derivation_path = relative_path.to_string(); - coin_info.hrp = param.hrp.to_string(); coin_info.chain_id = param.chain_id.to_string(); let acc: Account = derive_sub_account(&xpub, &coin_info)?; diff --git a/token-core/tcx/src/reset_password.rs b/token-core/tcx/src/reset_password.rs index 94dbd18b..3190269d 100644 --- a/token-core/tcx/src/reset_password.rs +++ b/token-core/tcx/src/reset_password.rs @@ -78,11 +78,6 @@ fn parse_coin_info_from_legacy_ks(value: Value) -> Result<(CoinInfo, String)> { curve: CurveType::SECP256k1, network, seg_wit, - hrp: if chain_str.eq_ignore_ascii_case("cosmos") { - "cosmos".to_string() - } else { - "".to_string() - }, }; return Ok((coin_info, address)); } else { @@ -153,7 +148,6 @@ fn parse_coin_info_from_legacy_tcx_ks(legacy_tcx_ks: Value) -> Result<(CoinInfo, curve, network, seg_wit, - hrp: "".to_string(), }; return Ok((coin_info, address)); } else { diff --git a/token-core/tcx/tests/derive_test.rs b/token-core/tcx/tests/derive_test.rs index 4203e8c7..80beab6c 100644 --- a/token-core/tcx/tests/derive_test.rs +++ b/token-core/tcx/tests/derive_test.rs @@ -49,7 +49,6 @@ pub fn test_derive_accounts() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "LITECOIN".to_string(), @@ -58,7 +57,6 @@ pub fn test_derive_accounts() { seg_wit: "P2WPKH".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "LITECOIN".to_string(), @@ -67,7 +65,6 @@ pub fn test_derive_accounts() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "TRON".to_string(), @@ -76,7 +73,6 @@ pub fn test_derive_accounts() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "NERVOS".to_string(), @@ -85,7 +81,6 @@ pub fn test_derive_accounts() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "KUSAMA".to_string(), @@ -94,7 +89,6 @@ pub fn test_derive_accounts() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "sr25519".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "POLKADOT".to_string(), @@ -103,7 +97,6 @@ pub fn test_derive_accounts() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "sr25519".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "FILECOIN".to_string(), @@ -112,7 +105,6 @@ pub fn test_derive_accounts() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "FILECOIN".to_string(), @@ -121,7 +113,6 @@ pub fn test_derive_accounts() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "bls12-381".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "COSMOS".to_string(), @@ -130,7 +121,6 @@ pub fn test_derive_accounts() { seg_wit: "".to_string(), chain_id: "cosmoshub-4".to_string(), curve: "secp256k1".to_string(), - hrp: "cosmos".to_string(), }, Derivation { chain_type: "EOS".to_string(), @@ -139,7 +129,6 @@ pub fn test_derive_accounts() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "ETHEREUM".to_string(), @@ -148,7 +137,6 @@ pub fn test_derive_accounts() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -157,7 +145,6 @@ pub fn test_derive_accounts() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -166,7 +153,6 @@ pub fn test_derive_accounts() { seg_wit: "P2WPKH".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -175,7 +161,6 @@ pub fn test_derive_accounts() { seg_wit: "VERSION_0".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -184,7 +169,6 @@ pub fn test_derive_accounts() { seg_wit: "VERSION_1".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "TEZOS".to_string(), @@ -193,7 +177,6 @@ pub fn test_derive_accounts() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "ed25519".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "DOGECOIN".to_string(), @@ -202,7 +185,6 @@ pub fn test_derive_accounts() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "DOGECOIN".to_string(), @@ -211,7 +193,6 @@ pub fn test_derive_accounts() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "DOGECOIN".to_string(), @@ -220,7 +201,6 @@ pub fn test_derive_accounts() { seg_wit: "VERSION_1".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, ]; @@ -349,7 +329,6 @@ pub fn test_hd_store_derive_invalid_param() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "LITECOIN".to_string(), @@ -358,7 +337,6 @@ pub fn test_hd_store_derive_invalid_param() { seg_wit: "P2WPKH".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "LITECOIN".to_string(), @@ -367,7 +345,6 @@ pub fn test_hd_store_derive_invalid_param() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }, ]; for derivation in invalid_derivations { @@ -485,7 +462,6 @@ pub fn test_derive_btc_legacy_sub_accounts() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }; let (_wallet, accounts) = import_and_derive(derivation); @@ -497,7 +473,6 @@ pub fn test_derive_btc_legacy_sub_accounts() { seg_wit: "NONE".to_string(), relative_paths: vec!["0/0".to_string(), "0/1".to_string(), "1/0".to_string()], extended_public_key: accounts.accounts[0].extended_public_key.to_string(), - hrp: "".to_string(), }; let result_bytes = derive_sub_accounts(&encode_message(params).unwrap()).unwrap(); @@ -528,7 +503,6 @@ pub fn test_derive_btc_p2wpkh_sub_accounts() { seg_wit: "P2WPKH".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }; let (_wallet, accounts) = import_and_derive(derivation); @@ -540,7 +514,6 @@ pub fn test_derive_btc_p2wpkh_sub_accounts() { seg_wit: "P2WPKH".to_string(), relative_paths: vec!["0/0".to_string(), "0/1".to_string(), "1/0".to_string()], extended_public_key: accounts.accounts[0].extended_public_key.to_string(), - hrp: "".to_string(), }; let result_bytes = derive_sub_accounts(&encode_message(params).unwrap()).unwrap(); @@ -571,7 +544,6 @@ pub fn test_derive_eth_sub_accounts() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }; let (_, accounts) = import_and_derive(derivation); @@ -583,7 +555,6 @@ pub fn test_derive_eth_sub_accounts() { seg_wit: "".to_string(), relative_paths: vec!["0/0".to_string(), "0/1".to_string()], extended_public_key: accounts.accounts[0].extended_public_key.to_string(), - hrp: "".to_string(), }; let result_bytes = derive_sub_accounts(&encode_message(params).unwrap()).unwrap(); @@ -610,7 +581,6 @@ pub fn test_derive_cosmos_sub_accounts() { seg_wit: "".to_string(), chain_id: "cosmoshub-4".to_string(), curve: "secp256k1".to_string(), - hrp: "cosmos".to_string(), }; let (_, accounts) = import_and_derive(derivation); @@ -622,7 +592,6 @@ pub fn test_derive_cosmos_sub_accounts() { seg_wit: "".to_string(), relative_paths: vec!["0/0".to_string(), "0/1".to_string()], extended_public_key: accounts.accounts[0].extended_public_key.to_string(), - hrp: "cosmos".to_string(), }; let result_bytes = derive_sub_accounts(&encode_message(params).unwrap()).unwrap(); @@ -644,7 +613,6 @@ pub fn test_derive_cosmos_sub_accounts() { seg_wit: "".to_string(), relative_paths: vec!["0/0".to_string(), "0/1".to_string()], extended_public_key: accounts.accounts[0].extended_public_key.to_string(), - hrp: "osmo".to_string(), }; let result_bytes = derive_sub_accounts(&encode_message(params).unwrap()).unwrap(); @@ -669,9 +637,8 @@ pub fn test_derive_verify_hrp() { path: "m/44'/118'/0'/0/0".to_string(), network: "MAINNET".to_string(), seg_wit: "".to_string(), - chain_id: "osmosis-1".to_string(), + chain_id: "osmosis-2".to_string(), curve: "secp256k1".to_string(), - hrp: "cosmos".to_string(), }; let wallet = import_default_wallet(); @@ -683,10 +650,7 @@ pub fn test_derive_verify_hrp() { }; let result = derive_accounts(&encode_message(derivation_param).unwrap()); - assert_eq!( - format!("{}", result.err().unwrap()), - "chain_id_and_hrp_not_match" - ); + assert_eq!(format!("{}", result.err().unwrap()), "unknown_chain_id"); let derivation = Derivation { chain_type: "COSMOS".to_string(), @@ -695,7 +659,6 @@ pub fn test_derive_verify_hrp() { seg_wit: "".to_string(), chain_id: "cosmoshub-4".to_string(), curve: "secp256k1".to_string(), - hrp: "cosmos".to_string(), }; let derivation_param = DeriveAccountsParam { @@ -707,6 +670,11 @@ pub fn test_derive_verify_hrp() { let result = derive_accounts(&encode_message(derivation_param).unwrap()).unwrap(); let account = DeriveAccountsResult::decode(result.as_slice()).unwrap(); + assert_eq!( + account.accounts[0].address, + "cosmos1ajz9y0x3wekez7tz2td2j6l2dftn28v26dd992" + ); + let params = DeriveSubAccountsParam { chain_id: "osmosis-1".to_string(), chain_type: "COSMOS".to_string(), @@ -715,13 +683,13 @@ pub fn test_derive_verify_hrp() { seg_wit: "".to_string(), relative_paths: vec!["0/0".to_string(), "0/1".to_string()], extended_public_key: account.accounts[0].extended_public_key.to_string(), - hrp: "cosmos".to_string(), }; - let result = derive_sub_accounts(&encode_message(params).unwrap()); + let result = derive_sub_accounts(&encode_message(params).unwrap()).unwrap(); + let account = DeriveAccountsResult::decode(result.as_slice()).unwrap(); assert_eq!( - format!("{}", result.err().unwrap()), - "chain_id_and_hrp_not_match" + account.accounts[0].address, + "osmo1ajz9y0x3wekez7tz2td2j6l2dftn28v2jk74nc" ); }) } @@ -807,7 +775,6 @@ fn polkadotjs_cross_test() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "sr25519".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "POLKADOT".to_string(), @@ -816,7 +783,6 @@ fn polkadotjs_cross_test() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "sr25519".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "POLKADOT".to_string(), @@ -825,7 +791,6 @@ fn polkadotjs_cross_test() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "sr25519".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "KUSAMA".to_string(), @@ -834,7 +799,6 @@ fn polkadotjs_cross_test() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "sr25519".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "KUSAMA".to_string(), @@ -843,7 +807,6 @@ fn polkadotjs_cross_test() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "sr25519".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "KUSAMA".to_string(), @@ -852,7 +815,6 @@ fn polkadotjs_cross_test() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "sr25519".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "KUSAMA".to_string(), @@ -861,7 +823,6 @@ fn polkadotjs_cross_test() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "sr25519".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "POLKADOT".to_string(), @@ -870,7 +831,6 @@ fn polkadotjs_cross_test() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "sr25519".to_string(), - hrp: "".to_string(), }, ]; let param = DeriveAccountsParam { @@ -925,7 +885,6 @@ fn test_derive_other_curve_on_pk_keystore() { network: "".to_string(), curve: "secp256k1".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "FILECOIN".to_string(), @@ -934,7 +893,6 @@ fn test_derive_other_curve_on_pk_keystore() { network: "".to_string(), curve: "secp256k1".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }, ], key: Some(api::derive_accounts_param::Key::Password( @@ -961,7 +919,6 @@ fn test_derive_other_curve_on_pk_keystore() { network: "".to_string(), curve: "ed25519".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }], key: Some(api::derive_accounts_param::Key::Password( TEST_PASSWORD.to_string(), @@ -982,7 +939,6 @@ fn test_derive_other_curve_on_pk_keystore() { network: "".to_string(), curve: "sr25519".to_string(), seg_wit: "".to_string(), - hrp: "".to_string(), }], key: Some(api::derive_accounts_param::Key::Password( TEST_PASSWORD.to_string(), @@ -1020,7 +976,6 @@ fn test_derive_mainnet_account_on_test_wif() { network: "TESTNET".to_string(), curve: "secp256k1".to_string(), seg_wit: "VERSION_1".to_string(), - hrp: "".to_string(), }], key: Some(api::derive_accounts_param::Key::Password( TEST_PASSWORD.to_string(), diff --git a/token-core/tcx/tests/export_test.rs b/token-core/tcx/tests/export_test.rs index c76b6b50..da1f67e9 100644 --- a/token-core/tcx/tests/export_test.rs +++ b/token-core/tcx/tests/export_test.rs @@ -85,7 +85,6 @@ pub fn test_tezos_import_private_key_export() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }]; let param = DeriveAccountsParam { id: import_result.id.to_string(), @@ -166,7 +165,6 @@ pub fn test_tezos_hd_private_key_export() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "ed25519".to_string(), - hrp: "".to_string(), }]; let param = DeriveAccountsParam { id: import_result.id.to_string(), @@ -278,7 +276,6 @@ pub fn test_export_private_key() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOINCASH".to_string(), @@ -287,7 +284,6 @@ pub fn test_export_private_key() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "TRON".to_string(), @@ -296,7 +292,6 @@ pub fn test_export_private_key() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "ETHEREUM".to_string(), @@ -305,7 +300,6 @@ pub fn test_export_private_key() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "FILECOIN".to_string(), @@ -314,7 +308,6 @@ pub fn test_export_private_key() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -323,7 +316,6 @@ pub fn test_export_private_key() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -332,7 +324,6 @@ pub fn test_export_private_key() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -341,7 +332,6 @@ pub fn test_export_private_key() { seg_wit: "P2WPKH".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -350,7 +340,6 @@ pub fn test_export_private_key() { seg_wit: "VERSION_0".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -359,7 +348,6 @@ pub fn test_export_private_key() { seg_wit: "VERSION_1".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "EOS".to_string(), @@ -368,7 +356,6 @@ pub fn test_export_private_key() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, ]; let pks = vec![ @@ -489,7 +476,6 @@ pub fn test_chain_cannot_export_private_key() { seg_wit: "".to_string(), chain_id: "cosmoshub-4".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }]; let export_info = vec![ diff --git a/token-core/tcx/tests/import_test.rs b/token-core/tcx/tests/import_test.rs index 7bdd9d69..6a73c837 100644 --- a/token-core/tcx/tests/import_test.rs +++ b/token-core/tcx/tests/import_test.rs @@ -83,7 +83,6 @@ pub fn test_import_mnemonic() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }; let param = DeriveAccountsParam { id: import_result.id.to_string(), @@ -152,7 +151,6 @@ pub fn test_import_mnemonic_ltc() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }; let param = DeriveAccountsParam { id: import_result.id.to_string(), @@ -201,7 +199,6 @@ pub fn test_import_private_key() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "LITECOIN".to_string(), @@ -210,7 +207,6 @@ pub fn test_import_private_key() { seg_wit: "P2WPKH".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "LITECOIN".to_string(), @@ -219,7 +215,6 @@ pub fn test_import_private_key() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "TRON".to_string(), @@ -228,7 +223,6 @@ pub fn test_import_private_key() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "NERVOS".to_string(), @@ -237,7 +231,6 @@ pub fn test_import_private_key() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "ETHEREUM".to_string(), @@ -246,7 +239,6 @@ pub fn test_import_private_key() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "COSMOS".to_string(), @@ -255,7 +247,6 @@ pub fn test_import_private_key() { seg_wit: "".to_string(), chain_id: "cosmoshub-4".to_string(), curve: "secp256k1".to_string(), - hrp: "cosmos".to_string(), }, Derivation { chain_type: "EOS".to_string(), @@ -264,7 +255,6 @@ pub fn test_import_private_key() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -273,7 +263,6 @@ pub fn test_import_private_key() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -282,7 +271,6 @@ pub fn test_import_private_key() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -291,7 +279,6 @@ pub fn test_import_private_key() { seg_wit: "P2WPKH".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -300,7 +287,6 @@ pub fn test_import_private_key() { seg_wit: "VERSION_0".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "BITCOIN".to_string(), @@ -309,7 +295,6 @@ pub fn test_import_private_key() { seg_wit: "VERSION_1".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, Derivation { chain_type: "DOGECOIN".to_string(), @@ -318,7 +303,6 @@ pub fn test_import_private_key() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }, ]; let param = DeriveAccountsParam { @@ -414,7 +398,6 @@ pub fn test_import_private_key() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }]; let param = DeriveAccountsParam { id: import_result.id.to_string(), @@ -460,7 +443,6 @@ pub fn test_filecoin_private_key_secp256k1_import() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }]; let param = DeriveAccountsParam { id: import_result.id.to_string(), @@ -527,7 +509,6 @@ pub fn test_filecoin_private_key_bls_import() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "bls12-381".to_string(), - hrp: "".to_string(), }]; let param = DeriveAccountsParam { id: import_result.id.to_string(), @@ -595,7 +576,6 @@ pub fn test_fil_bls_tezos_reimport() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: case.2.to_string(), - hrp: "".to_string(), }]; let param = DeriveAccountsParam { id: hd_import_result.id.to_string(), @@ -641,7 +621,6 @@ pub fn test_fil_bls_tezos_reimport() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: case.2.to_string(), - hrp: "".to_string(), }]; let param = DeriveAccountsParam { id: pk_import_result.id.to_string(), @@ -690,7 +669,6 @@ pub fn test_import_sr25519_private_key() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "sr25519".to_string(), - hrp: "".to_string(), }]; let param = DeriveAccountsParam { id: import_result.id.to_string(), @@ -769,7 +747,6 @@ pub fn test_import_to_pk_which_from_hd() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }; let derive_param = DeriveAccountsParam { @@ -869,7 +846,6 @@ pub fn test_import_substrate_keystore() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }; let param = DeriveAccountsParam { @@ -961,7 +937,6 @@ pub fn test_import_substrate_keystore_v3() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "sr25519".to_string(), - hrp: "".to_string(), }; let param = DeriveAccountsParam { @@ -1045,7 +1020,6 @@ pub fn test_import_multi_curve() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }; let param = DeriveAccountsParam { @@ -1071,7 +1045,6 @@ pub fn test_import_multi_curve() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }; let param = DeriveAccountsParam { @@ -1137,7 +1110,6 @@ pub fn test_import_wif() { seg_wit: "NONE".to_string(), chain_id: "".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }; let param = DeriveAccountsParam { id: import_result.id.to_string(), diff --git a/token-core/tcx/tests/sign_test.rs b/token-core/tcx/tests/sign_test.rs index 8776be55..3dda9bde 100644 --- a/token-core/tcx/tests/sign_test.rs +++ b/token-core/tcx/tests/sign_test.rs @@ -321,7 +321,6 @@ pub fn test_sign_tron_tx_by_pk() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }; let param = DeriveAccountsParam { id: import_result.id.to_string(), @@ -702,7 +701,6 @@ pub fn test_lock_after_sign() { seg_wit: "".to_string(), chain_id: "".to_string(), curve: "".to_string(), - hrp: "".to_string(), }; let (wallet, _acc_rsp) = import_and_derive(derivation); @@ -912,7 +910,6 @@ pub fn test_sign_ethereum_legacy_tx() { seg_wit: "".to_string(), chain_id: "1".to_string(), curve: "secp256k1".to_string(), - hrp: "".to_string(), }; let (wallet, acc_rsp) = import_and_derive(derivation);