trustwallet / wallet-core

Cross-platform, cross-blockchain wallet library.
https://developer.trustwallet.com/wallet-core
Apache License 2.0
2.78k stars 1.57k forks source link

[TapRoot support] have any plan support expose generate taproot's address #3309

Closed weixuefeng closed 1 year ago

weixuefeng commented 1 year ago

have any plan support expose generate taproot's address, sign taproot transaction?

Milerius commented 1 year ago

yes, taproot will be exposed once we move Bitcoin implementation to rust.

weixuefeng commented 1 year ago

how can i build the same file like official release package. my build command is:

./tools/install-dependencies
./tools/install-rust-dependencies
./tools/install-wasm-dependencies

./tools/generate-files ios
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug
 make -Cbuild && ./tools/ios-build && ./tools/ios-xcframework

then i got

./swift/build/WalletCore.xcframework/
./swift/build/SwiftProtobuf.xcframework/

then i import WalletCore.xcframework & SwiftProtobuf.xcframework to my ios project, all code is:

//
//  ContentView.swift
//  wallet
//
//  Created by 卫雪峰 on 2023/7/20.
//

import SwiftUI
import WalletCore
struct ContentView: View {
    var json = """
                {"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"5fe1054ca4ca68c5f8ee1346cd062239"},"ciphertext":"ae7db4237ec6913241dcf7bcfb6e06671ae381906a2866b04771082ed0204ac4","kdf":"scrypt","kdfparams":{"dklen":32,"n":16384,"p":4,"r":8,"salt":""},"mac":"9ed6e105ebcc39ba38706166a24f03ebfa153fc41bc028418dafb08518d6ebae"},"id":"b4c58a86-f609-4c12-88bd-666cc2ee73be","name":"name","type":"private-key","version":3}
""";
    var body: some View {

        VStack {
            Image(systemName: "globe")
                .imageScale(.large)
                .foregroundColor(.accentColor)
            Text("Hello, world!")
            Button("click") {

                print(SegwitAddress.isValidString(string: "bc1qyd9ky0n2dh8nggk8m4thllh0qh0w2ea2asvtl5"))
                print(SegwitAddress.isValidString(string: "1CFx8Qvd3ioDHYWHJMSMNeredCCkW96wAA"))
                let storedKey = StoredKey.importJSON(json: json.data(using: String.Encoding.utf8)!)!

                let privatekey = storedKey.decryptPrivateKey(password: "password".data(using: String.Encoding.utf8)!)

                print(privatekey?.hexString)
            }
        }
        .padding()
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

then i click click, i can not decrypt keystore, privateKeyHex is nil. but when i use official package, i can decrypt then same keystore, so , is there have some problem about my build flow?