diff --git a/Cargo.lock b/Cargo.lock index 028a2873..16f3215c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -840,6 +840,7 @@ dependencies = [ "bytes", "failure", "forest_address", + "forest_bigint", "forest_cid", "forest_crypto", "forest_encoding", @@ -2789,6 +2790,7 @@ version = "0.1.0" dependencies = [ "aes", "bitcoin", + "byteorder 1.4.3", "bytes", "cbc", "failure", diff --git a/imkey-core/ikc-common/Cargo.toml b/imkey-core/ikc-common/Cargo.toml index 937e1192..df37a57d 100644 --- a/imkey-core/ikc-common/Cargo.toml +++ b/imkey-core/ikc-common/Cargo.toml @@ -23,7 +23,7 @@ num-integer = "=0.1.45" prost = "=0.11.2" bytes = "=1.4.0" prost-types = "=0.11.2" -secp256k1 = {version = "=0.24.3", features = ["rand", "recovery"] } +secp256k1 = { version = "=0.24.3", features = ["rand", "recovery"] } failure = "=0.1.8" lazy_static = "=1.4.0" aes = "=0.8.3" diff --git a/imkey-core/ikc-common/src/utility.rs b/imkey-core/ikc-common/src/utility.rs index e4f1b679..3acad73a 100644 --- a/imkey-core/ikc-common/src/utility.rs +++ b/imkey-core/ikc-common/src/utility.rs @@ -1,5 +1,9 @@ use crate::Result; use bitcoin::hashes::{sha256, Hash}; +use bitcoin::util::base58; +use bitcoin::util::bip32::ExtendedPubKey; +use byteorder::BigEndian; +use byteorder::ByteOrder; use num_bigint::BigInt; use num_integer::Integer; use num_traits::{FromPrimitive, Num, Zero}; diff --git a/token-core/tcx-proto/src/params.proto b/token-core/tcx-proto/src/params.proto index a0d47bce..ac36982b 100644 --- a/token-core/tcx-proto/src/params.proto +++ b/token-core/tcx-proto/src/params.proto @@ -180,13 +180,12 @@ message SignParam { } message DeriveSubAccountsParam { - string id = 1; - string chainType = 2; - string curve = 3; - string network = 4; - string segWit = 5; - repeated string relativePaths = 6; - string extendedPublicKey = 7; + string chainType = 1; + string curve = 2; + string network = 3; + string segWit = 4; + repeated string relativePaths = 5; + string extendedPublicKey = 6; } message DeriveSubAccountsResult { diff --git a/token-core/tcx/src/api.rs b/token-core/tcx/src/api.rs index 2da60919..0f80df8e 100644 --- a/token-core/tcx/src/api.rs +++ b/token-core/tcx/src/api.rs @@ -490,18 +490,16 @@ pub mod sign_param { #[derive(Clone, PartialEq, ::prost::Message)] pub struct DeriveSubAccountsParam { #[prost(string, tag = "1")] - pub id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] pub chain_type: ::prost::alloc::string::String, - #[prost(string, tag = "3")] + #[prost(string, tag = "2")] pub curve: ::prost::alloc::string::String, - #[prost(string, tag = "4")] + #[prost(string, tag = "3")] pub network: ::prost::alloc::string::String, - #[prost(string, tag = "5")] + #[prost(string, tag = "4")] pub seg_wit: ::prost::alloc::string::String, - #[prost(string, repeated, tag = "6")] + #[prost(string, repeated, tag = "5")] pub relative_paths: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(string, tag = "7")] + #[prost(string, tag = "6")] pub extended_public_key: ::prost::alloc::string::String, } #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/token-core/tcx/src/lib.rs b/token-core/tcx/src/lib.rs index 1ea1f7d6..e0b9f799 100644 --- a/token-core/tcx/src/lib.rs +++ b/token-core/tcx/src/lib.rs @@ -224,7 +224,7 @@ mod tests { use tcx_tron::transaction::{TronMessageInput, TronMessageOutput, TronTxInput, TronTxOutput}; static OTHER_MNEMONIC: &'static str = - "inject kidney empty canal shadow pact comfort wife crush horse wife sketch"; + "calm release clay imitate top extend close draw quiz refuse shuffle injury"; fn _to_c_char(str: &str) -> *const c_char { CString::new(str).unwrap().into_raw() @@ -3405,7 +3405,6 @@ mod tests { let (wallet, accounts) = import_and_derive(derivation); let params = DeriveSubAccountsParam { - id: wallet.id.to_string(), chain_type: "BITCOIN".to_string(), curve: "secp256k1".to_string(), network: "MAINNET".to_string(), @@ -3447,7 +3446,6 @@ mod tests { let (wallet, accounts) = import_and_derive(derivation); let params = DeriveSubAccountsParam { - id: wallet.id.to_string(), chain_type: "BITCOIN".to_string(), curve: "secp256k1".to_string(), network: "MAINNET".to_string(), @@ -3489,7 +3487,6 @@ mod tests { let (wallet, accounts) = import_and_derive(derivation); let params = DeriveSubAccountsParam { - id: wallet.id.to_string(), chain_type: "ETHEREUM".to_string(), curve: "secp256k1".to_string(), network: "MAINNET".to_string(),