Skip to content

Commit

Permalink
dk keystore migrate feature (#47)
Browse files Browse the repository at this point in the history
* feat: add calc external address

* feat: add keystore dk migration

* fix: ios and android keystore inconsistency

* feat: integrate ios dk keystore migration

* feat: implement the functions about identity

* chore: rename tcx_chain to tcx_keystore
  • Loading branch information
XuNeal authored Oct 12, 2023
1 parent cc5e8e9 commit 2f54561
Show file tree
Hide file tree
Showing 83 changed files with 2,846 additions and 1,658 deletions.
67 changes: 21 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members=[
"token-core/tcx-constants",
"token-core/tcx-primitive",
"token-core/tcx-crypto",
"token-core/tcx-chain",
"token-core/tcx-keystore",
"token-core/tcx-tron",
"token-core/tcx-btc-kin",
"token-core/tcx-ckb",
Expand All @@ -17,7 +17,6 @@ members=[
"token-core/tcx-tezos",
"token-core/tcx-tester",
"token-core/tcx-eth2",
"token-core/tcx-identity",
"token-core/tcx-eth",
"token-core/zksync-crypto",
"token-core/tcx-common",
Expand Down
2 changes: 1 addition & 1 deletion token-core/tcx-atom/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
tcx-crypto = { path = "../tcx-crypto" }
tcx-chain = { path = "../tcx-chain" }
tcx-keystore = { path = "../tcx-keystore" }
tcx-primitive = { path = "../tcx-primitive" }
tcx-constants = { path = "../tcx-constants" }

Expand Down
4 changes: 2 additions & 2 deletions token-core/tcx-atom/src/address.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use core::str::FromStr;

use bech32::{FromBase32, ToBase32, Variant};
use tcx_chain::{Address, ChainFactory, PublicKeyEncoder, Result};
use tcx_constants::CoinInfo;
use tcx_crypto::hash;
use tcx_keystore::{Address, ChainFactory, PublicKeyEncoder, Result};
use tcx_primitive::TypedPublicKey;

// size of address
Expand Down Expand Up @@ -77,7 +77,7 @@ impl ChainFactory for AtomChainFactory {
mod tests {

use crate::address::AtomAddress;
use tcx_chain::Address;
use tcx_keystore::Address;

use tcx_constants::{CoinInfo, CurveType};
use tcx_crypto::hex;
Expand Down
2 changes: 1 addition & 1 deletion token-core/tcx-atom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ pub mod signer;
pub mod transaction;

pub mod cosmos {
use tcx_chain::{Account, Keystore};
use tcx_constants::{CoinInfo, CurveType};
use tcx_keystore::{Account, Keystore};

pub const CHAINS: [&'static str; 1] = ["COSMOS"];

Expand Down
5 changes: 2 additions & 3 deletions token-core/tcx-atom/src/signer.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::transaction::{AtomTxInput, AtomTxOutput};
use tcx_chain::{ChainSigner, Keystore, Result, TransactionSigner as TraitTransactionSigner};
use tcx_keystore::{ChainSigner, Keystore, Result, TransactionSigner as TraitTransactionSigner};

use tcx_crypto::{hash, hex};

Expand Down Expand Up @@ -31,9 +31,9 @@ mod tests {
use super::*;
use crate::address::AtomAddress;

use tcx_chain::{HdKeystore, Keystore, KeystoreGuard, Metadata};
use tcx_constants::{CoinInfo, TEST_PASSWORD};
use tcx_constants::{CurveType, TEST_MNEMONIC};
use tcx_keystore::{HdKeystore, Keystore, KeystoreGuard, Metadata};

#[test]
fn sign_transaction() -> core::result::Result<(), failure::Error> {
Expand All @@ -57,7 +57,6 @@ mod tests {
let ks = guard.keystore_mut();

let account = ks.derive_coin::<AtomAddress>(&coin_info).unwrap().clone();
println!("account {:?}", account);

let signed_tx: AtomTxOutput = ks.sign_transaction("COSMOS", &account.address, &tx)?;

Expand Down
2 changes: 1 addition & 1 deletion token-core/tcx-btc-kin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"

[dependencies]
tcx-crypto = { path = "../tcx-crypto" }
tcx-chain = { path = "../tcx-chain" }
tcx-keystore = { path = "../tcx-keystore" }
tcx-primitive = { path = "../tcx-primitive" }
tcx-constants = { path = "../tcx-constants" }
tcx-common = { path = "../tcx-common" }
Expand Down
4 changes: 2 additions & 2 deletions token-core/tcx-btc-kin/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use bitcoin::{Address as LibAddress, Script};
use bitcoin_hashes::Hash;
use secp256k1::Secp256k1;

use tcx_chain::Address;
use tcx_constants::CoinInfo;
use tcx_keystore::Address;
use tcx_primitive::{Ss58Codec, TypedPrivateKey, TypedPublicKey};

use crate::network::BtcKinNetwork;
Expand Down Expand Up @@ -294,7 +294,7 @@ mod tests {
use tcx_primitive::{Bip32DeterministicPrivateKey, Derive, DeterministicPrivateKey, Ss58Codec};

use crate::address::BtcKinAddress;
use crate::tcx_chain::Address;
use crate::tcx_keystore::Address;
use crate::BtcKinNetwork;

#[test]
Expand Down
4 changes: 2 additions & 2 deletions token-core/tcx-btc-kin/src/bch_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use core::result;

use std::fmt::{Display, Formatter};
use std::str::FromStr;
use tcx_chain::Address;
use tcx_constants::CoinInfo;
use tcx_keystore::Address;
use tcx_primitive::TypedPublicKey;

fn remove_bch_prefix(addr: &str) -> String {
Expand Down Expand Up @@ -108,9 +108,9 @@ mod tests {
use super::{remove_bch_prefix, BchAddress};

use crate::address::WIFDisplay;
use tcx_chain::Address;
use tcx_constants::coin_info::coin_info_from_param;
use tcx_constants::{CoinInfo, CurveType};
use tcx_keystore::Address;
use tcx_primitive::{PrivateKey, Secp256k1PrivateKey, TypedPublicKey};
use tcx_primitive::{PublicKey, TypedPrivateKey};

Expand Down
Loading

0 comments on commit 2f54561

Please sign in to comment.