From adc8f13daa8c1b0dd9ec7983206d72039ef01623 Mon Sep 17 00:00:00 2001 From: thunderbiscuit Date: Thu, 5 Oct 2023 14:29:43 -0400 Subject: [PATCH] Temp 16: Revert back to uniffi 0.23.0 --- .github/workflows/cont_integration.yml | 21 +- .github/workflows/publish-android.yaml | 4 +- .github/workflows/publish-jvm.yaml | 12 +- .github/workflows/test-android.yaml | 4 +- .github/workflows/test-jvm.yaml | 10 +- .github/workflows/test-swift.yaml | 20 +- .../plugins/UniFfiAndroidPlugin.kt | 10 +- bdk-ffi/Cargo.lock | 360 +++++++++--------- bdk-ffi/Cargo.toml | 6 +- bdk-ffi/src/descriptor.rs | 39 +- bdk-ffi/src/keys.rs | 42 +- bdk-ffi/src/lib.rs | 27 +- bdk-ffi/src/wallet.rs | 8 +- .../bitcoindevkit/plugins/UniFfiJvmPlugin.kt | 22 +- bdk-python/scripts/generate-linux.sh | 2 +- bdk-python/scripts/generate-macos-arm64.sh | 2 +- bdk-python/scripts/generate-macos-x86_64.sh | 2 +- bdk-python/scripts/generate-windows.sh | 2 +- .../BitcoinDevKitTests.swift | 7 +- bdk-swift/build-local-swift.sh | 8 +- 20 files changed, 307 insertions(+), 301 deletions(-) diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index 24375132..a72c2ba0 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -9,12 +9,15 @@ on: jobs: build-test: - name: Build and test + name: "Build and test" runs-on: ubuntu-20.04 + defaults: + run: + working-directory: bdk-ffi strategy: matrix: rust: - - version: 1.72.1 # STABLE + - version: 1.67.0 clippy: true # TODO: Should we keep this? We'll need to pin dependencies # - version: 1.61.0 # MSRV @@ -34,26 +37,26 @@ jobs: target key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} - - name: Set default toolchain + - name: "Set default toolchain" run: rustup default ${{ matrix.rust.version }} - - name: Set profile + - name: "Set profile" run: rustup set profile minimal - - name: Add clippy + - name: "Add clippy" if: ${{ matrix.rust.clippy }} run: rustup component add clippy - - name: Update toolchain + - name: "Update toolchain" run: rustup update - - name: Pin dependencies for MSRV + - name: "Pin dependencies for MSRV" if: matrix.rust.version == '1.61.0' run: | cargo update -p hashlink --precise "0.8.1" cargo update -p tokio --precise "1.29.1" cargo update -p flate2 --precise "1.0.26" - - name: Build + - name: "Build" run: cargo build - name: Clippy @@ -64,7 +67,7 @@ jobs: run: CLASSPATH=./tests/jna/jna-5.8.0.jar cargo test --features uniffi/bindgen-tests fmt: - name: Rust fmt + name: "Rust fmt" runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/publish-android.yaml b/.github/workflows/publish-android.yaml index 57c4df24..b62f559b 100644 --- a/.github/workflows/publish-android.yaml +++ b/.github/workflows/publish-android.yaml @@ -37,8 +37,8 @@ jobs: distribution: temurin java-version: 11 - - name: "Set default Rust version to 1.72.1" - run: rustup default 1.72.1 + - name: "Set default Rust version to 1.67.0" + run: rustup default 1.67.0 - name: "Install Rust Android targets" run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi diff --git a/.github/workflows/publish-jvm.yaml b/.github/workflows/publish-jvm.yaml index fb4b8850..02a1553e 100644 --- a/.github/workflows/publish-jvm.yaml +++ b/.github/workflows/publish-jvm.yaml @@ -24,8 +24,8 @@ jobs: distribution: temurin java-version: 11 - - name: "Set default Rust version to 1.72.1" - run: rustup default 1.72.1 + - name: "Set default Rust version to 1.67.0" + run: rustup default 1.67.0 - name: "Install aarch64 Rust target" run: rustup target add aarch64-apple-darwin @@ -54,8 +54,8 @@ jobs: distribution: temurin java-version: 11 - - name: "Set default Rust version to 1.72.1" - run: rustup default 1.72.1 + - name: "Set default Rust version to 1.67.0" + run: rustup default 1.67.0 - name: "Install x86_64-pc-windows-msvc Rust target" run: rustup target add x86_64-pc-windows-msvc @@ -94,8 +94,8 @@ jobs: distribution: temurin java-version: 11 - - name: "Set default Rust version to 1.72.1" - run: rustup default 1.72.1 + - name: "Set default Rust version to 1.67.0" + run: rustup default 1.67.0 - name: "Build bdk-jvm library" run: | diff --git a/.github/workflows/test-android.yaml b/.github/workflows/test-android.yaml index fe935e92..c5ef1bcc 100644 --- a/.github/workflows/test-android.yaml +++ b/.github/workflows/test-android.yaml @@ -46,8 +46,8 @@ jobs: distribution: temurin java-version: 11 - - name: "Set default Rust version to 1.72.1" - run: rustup default 1.72.1 + - name: "Set default Rust version to 1.67.0" + run: rustup default 1.67.0 - name: "Install Rust Android targets" run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi diff --git a/.github/workflows/test-jvm.yaml b/.github/workflows/test-jvm.yaml index afb161c7..caf07a54 100644 --- a/.github/workflows/test-jvm.yaml +++ b/.github/workflows/test-jvm.yaml @@ -32,16 +32,10 @@ jobs: distribution: temurin java-version: 11 - - name: "Set default Rust version to 1.72.1" - run: rustup default 1.72.1 + - name: "Set default Rust version to 1.67.0" + run: rustup default 1.67.0 - name: "Run JVM tests" run: | cd bdk-jvm - ./gradlew buildJvmLib ./gradlew test - - - name: "Print directory structure" - run: | - pwd - ls -R diff --git a/.github/workflows/test-swift.yaml b/.github/workflows/test-swift.yaml index f3ff94de..f46e7f3f 100644 --- a/.github/workflows/test-swift.yaml +++ b/.github/workflows/test-swift.yaml @@ -14,34 +14,34 @@ jobs: build: runs-on: macos-12 steps: - - name: Checkout + - name: "Checkout" uses: actions/checkout@v3 - - name: "Set default Rust version to 1.72.1" - run: rustup default 1.72.1 + - name: "Set default Rust version to 1.67.0" + run: rustup default 1.67.0 - - name: Install Rust targets + - name: "Install Rust targets" run: | rustup install nightly-x86_64-apple-darwin rustup component add rust-src --toolchain nightly-x86_64-apple-darwin rustup target add aarch64-apple-darwin x86_64-apple-darwin - - name: Run bdk-ffi-bindgen + - name: "Run bdk-ffi-bindgen" working-directory: bdk-ffi run: cargo run --bin uniffi-bindgen generate src/bdk.udl --language swift --out-dir ../bdk-swift/Sources/BitcoinDevKit --no-format - - name: Build bdk-ffi for x86_64-apple-darwin + - name: "Build bdk-ffi for x86_64-apple-darwin" run: cargo build --package bdk-ffi --profile release-smaller --target x86_64-apple-darwin - - name: Build bdk-ffi for aarch64-apple-darwin + - name: "Build bdk-ffi for aarch64-apple-darwin" run: cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-darwin - - name: Create lipo-macos + - name: "Create lipo-macos" run: | mkdir -p target/lipo-macos/release-smaller lipo target/aarch64-apple-darwin/release-smaller/libbdkffi.a target/x86_64-apple-darwin/release-smaller/libbdkffi.a -create -output target/lipo-macos/release-smaller/libbdkffi.a - - name: Create bdkFFI.xcframework + - name: "Create bdkFFI.xcframework" working-directory: bdk-swift run: | mv Sources/BitcoinDevKit/bdk.swift Sources/BitcoinDevKit/BitcoinDevKit.swift @@ -50,6 +50,6 @@ jobs: rm Sources/BitcoinDevKit/bdkFFI.h rm Sources/BitcoinDevkit/bdkFFI.modulemap - - name: Run Swift tests + - name: "Run Swift tests" working-directory: bdk-swift run: swift test diff --git a/bdk-android/plugins/src/main/kotlin/org/bitcoindevkit/plugins/UniFfiAndroidPlugin.kt b/bdk-android/plugins/src/main/kotlin/org/bitcoindevkit/plugins/UniFfiAndroidPlugin.kt index 1770981d..186dd939 100644 --- a/bdk-android/plugins/src/main/kotlin/org/bitcoindevkit/plugins/UniFfiAndroidPlugin.kt +++ b/bdk-android/plugins/src/main/kotlin/org/bitcoindevkit/plugins/UniFfiAndroidPlugin.kt @@ -137,10 +137,14 @@ internal class UniFfiAndroidPlugin : Plugin { val generateAndroidBindings by tasks.register("generateAndroidBindings") { dependsOn(moveNativeAndroidLibs) - val libraryPath = "${project.projectDir}/../../bdk-ffi/target/aarch64-linux-android/release-smaller/libbdkffi.so" - workingDir("${project.projectDir}/../../bdk-ffi") + // val libraryPath = "${project.projectDir}/../../bdk-ffi/target/aarch64-linux-android/release-smaller/libbdkffi.so" + // workingDir("${project.projectDir}/../../bdk-ffi") + // val cargoArgs: List = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "../bdk-android/lib/src/main/kotlin", "--no-format") - val cargoArgs: List = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "../bdk-android/lib/src/main/kotlin", "--no-format") + // The code above worked for uniffi 0.24.3 using the --library flag + // The code below works for uniffi 0.23.0 + workingDir("${project.projectDir}/../../bdk-ffi") + val cargoArgs: List = listOf("run", "--bin", "uniffi-bindgen", "generate", "src/bdk.udl", "--language", "kotlin", "--out-dir", "../bdk-android/lib/src/main/kotlin", "--no-format") executable("cargo") args(cargoArgs) diff --git a/bdk-ffi/Cargo.lock b/bdk-ffi/Cargo.lock index d5968858..8ddcd13a 100644 --- a/bdk-ffi/Cargo.lock +++ b/bdk-ffi/Cargo.lock @@ -2,54 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "anstream" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" - -[[package]] -name = "anstyle-parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" -dependencies = [ - "anstyle", - "windows-sys", -] - [[package]] name = "anyhow" version = "1.0.75" @@ -58,28 +10,24 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "askama" -version = "0.12.1" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28" +checksum = "fb98f10f371286b177db5eeb9a6e5396609555686a35e1d4f7b9a9c6d8af0139" dependencies = [ "askama_derive", "askama_escape", + "askama_shared", ] [[package]] name = "askama_derive" -version = "0.12.2" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a0fc7dcf8bd4ead96b1d36b41df47c14beedf7b0301fc543d8f2384e66a2ec0" +checksum = "87bf87e6e8b47264efa9bde63d6225c6276a52e05e91bf37eaa8afd0032d6b71" dependencies = [ - "askama_parser", - "basic-toml", - "mime", - "mime_guess", + "askama_shared", "proc-macro2", - "quote", - "serde", - "syn", + "syn 1.0.109", ] [[package]] @@ -89,12 +37,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" [[package]] -name = "askama_parser" -version = "0.1.1" +name = "askama_shared" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c268a96e01a4c47c8c5c2472aaa570707e006a875ea63e819f75474ceedaf7b4" +checksum = "bf722b94118a07fcbc6640190f247334027685d4e218b794dbfe17c32bf38ed0" dependencies = [ + "askama_escape", + "mime", + "mime_guess", "nom", + "proc-macro2", + "quote", + "serde", + "syn 1.0.109", + "toml", ] [[package]] @@ -104,19 +60,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] -name = "base64" -version = "0.13.1" +name = "atty" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] [[package]] -name = "basic-toml" -version = "0.1.4" +name = "autocfg" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bfc506e7a2370ec239e1d072507b2a80c833083699d3c6fa176fbb4de8448c6" -dependencies = [ - "serde", -] +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "bdk" @@ -229,6 +193,12 @@ dependencies = [ "serde", ] +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bumpalo" version = "3.14.0" @@ -290,49 +260,42 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.4.6" +version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ - "clap_builder", + "atty", + "bitflags", "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" -dependencies = [ - "anstream", - "anstyle", "clap_lex", + "indexmap", + "once_cell", "strsim", + "termcolor", + "textwrap", ] [[package]] name = "clap_derive" -version = "4.4.2" +version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" dependencies = [ "heck", + "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] [[package]] name = "fs-err" @@ -368,18 +331,43 @@ dependencies = [ "scroll", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hex_lit" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", +] + [[package]] name = "itoa" version = "1.0.9" @@ -468,6 +456,12 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "os_str_bytes" +version = "6.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" + [[package]] name = "paste" version = "1.0.14" @@ -486,6 +480,30 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" version = "1.0.67" @@ -563,7 +581,7 @@ checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.37", ] [[package]] @@ -613,7 +631,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.37", ] [[package]] @@ -654,6 +672,17 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.37" @@ -665,6 +694,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "termcolor" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" + [[package]] name = "thiserror" version = "1.0.49" @@ -682,7 +726,7 @@ checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.37", ] [[package]] @@ -720,9 +764,9 @@ dependencies = [ [[package]] name = "uniffi" -version = "0.24.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e835154c561cd75f253008093a908c06fb1f14327afb0ffea88eac72e534cc0" +checksum = "f71cc01459bc34cfe43fabf32b39f1228709bc6db1b3a664a92940af3d062376" dependencies = [ "anyhow", "camino", @@ -735,15 +779,14 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.24.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f91fdcd44de3aab35847bf80485f412879dcdd92b5140ee67f948e5eed750e" +checksum = "dbbba5103051c18f10b22f80a74439ddf7100273f217a547005d2735b2498994" dependencies = [ "anyhow", "askama", + "bincode", "camino", - "cargo_metadata", - "clap", "fs-err", "glob", "goblin", @@ -760,9 +803,9 @@ dependencies = [ [[package]] name = "uniffi_build" -version = "0.24.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b20f693fb51c21a21b9816bed5522f0231cc769d8ba38821a05ab7d39dad51d" +checksum = "0ee1a28368ff3d83717e3d3e2e15a66269c43488c3f036914131bb68892f29fb" dependencies = [ "anyhow", "camino", @@ -771,19 +814,19 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" -version = "0.24.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1b354a9bd654cc6547d461ccd60a10eb6c7473178f12d8ff91cf4340ae947e8" +checksum = "03de61393a42b4ad4984a3763c0600594ac3e57e5aaa1d05cede933958987c03" dependencies = [ "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "uniffi_core" -version = "0.24.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32793120650ceda4f4e0d8eacd784c1a736834b2cca7b12e2550d3a190553af4" +checksum = "7a2b4852d638d74ca2d70e450475efb6d91fe6d54a7cd8d6bd80ad2ee6cd7daa" dependencies = [ "anyhow", "bytes", @@ -797,9 +840,9 @@ dependencies = [ [[package]] name = "uniffi_macros" -version = "0.24.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c65987b46a026ab1dfff218963d34c45375355dd6f1995618262e1e038507ba3" +checksum = "fa03394de21e759e0022f1ea8d992d2e39290d735b9ed52b1f74b20a684f794e" dependencies = [ "bincode", "camino", @@ -808,7 +851,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn", + "syn 1.0.109", "toml", "uniffi_build", "uniffi_meta", @@ -816,12 +859,10 @@ dependencies = [ [[package]] name = "uniffi_meta" -version = "0.24.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f815bba89a6585954c089c53a775d166c0334c907be0e462bf0f0ac0494656e7" +checksum = "66fdab2c436aed7a6391bec64204ec33948bfed9b11b303235740771f85c4ea6" dependencies = [ - "anyhow", - "bytes", "serde", "siphasher", "uniffi_checksum_derive", @@ -829,9 +870,9 @@ dependencies = [ [[package]] name = "uniffi_testing" -version = "0.24.3" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1048d7c54816dc27ed4041fe952d42c7cb88e711cf3299e36ee70df7692c4a39" +checksum = "92b0570953ec41d97ce23e3b92161ac18231670a1f97523258a6d2ab76d7f76c" dependencies = [ "anyhow", "camino", @@ -842,12 +883,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - [[package]] name = "version_check" version = "0.9.4" @@ -881,7 +916,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.37", "wasm-bindgen-shared", ] @@ -903,7 +938,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.37", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -924,67 +959,32 @@ dependencies = [ ] [[package]] -name = "windows-sys" -version = "0.48.0" +name = "winapi" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ - "windows-targets", + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", ] [[package]] -name = "windows-targets" -version = "0.48.5" +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" +name = "winapi-util" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] [[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/bdk-ffi/Cargo.toml b/bdk-ffi/Cargo.toml index d6c8fe25..5b00a996 100644 --- a/bdk-ffi/Cargo.toml +++ b/bdk-ffi/Cargo.toml @@ -20,13 +20,13 @@ default = ["uniffi/cli"] bdk = { git = "https://github.com/bitcoindevkit/bdk.git", rev = "59fc1b341ba94212b2ea3e888e51fb6fcd00589f", features = ["all-keys", "keys-bip39"] } bdk_file_store = { git = "https://github.com/bitcoindevkit/bdk.git", rev = "59fc1b341ba94212b2ea3e888e51fb6fcd00589f" } # bdk_chain = { git = "https://github.com/bitcoindevkit/bdk.git", rev = "59fc1b341ba94212b2ea3e888e51fb6fcd00589f" } -uniffi = { version = "0.24.3" } +uniffi = { version = "=0.23.0" } [build-dependencies] -uniffi = { version = "0.24.3", features = ["build"] } +uniffi = { version = "=0.23.0", features = ["build"] } [dev-dependencies] -uniffi = { version = "0.24.3", features = ["bindgen-tests"] } +uniffi = { version = "=0.23.0", features = ["bindgen-tests"] } assert_matches = "1.5.0" [profile.release-smaller] diff --git a/bdk-ffi/src/descriptor.rs b/bdk-ffi/src/descriptor.rs index d8336d98..58edafed 100644 --- a/bdk-ffi/src/descriptor.rs +++ b/bdk-ffi/src/descriptor.rs @@ -13,19 +13,22 @@ // use std::str::FromStr; // use std::sync::Arc; -use std::str::FromStr; -use std::sync::Arc; +use bdk::bitcoin::bip32::Fingerprint; use bdk::bitcoin::key::Secp256k1; use bdk::descriptor::{ExtendedDescriptor, IntoWalletDescriptor}; -use bdk::keys::{DescriptorSecretKey as BdkDescriptorSecretKey, KeyMap}; use bdk::keys::DescriptorPublicKey as BdkDescriptorPublicKey; -use bdk::{Error as BdkError}; -use bdk::bitcoin::bip32::Fingerprint; +use bdk::keys::{DescriptorSecretKey as BdkDescriptorSecretKey, KeyMap}; +use bdk::template::{ + Bip44, Bip44Public, Bip49, Bip49Public, Bip84, Bip84Public, Bip86, Bip86Public, + DescriptorTemplate, +}; +use bdk::Error as BdkError; use bdk::KeychainKind; -use bdk::template::{Bip44, Bip44Public, Bip49, Bip49Public, Bip84, Bip84Public, Bip86, Bip86Public, DescriptorTemplate}; +use std::str::FromStr; +use std::sync::Arc; -use crate::keys::DescriptorSecretKey; use crate::keys::DescriptorPublicKey; +use crate::keys::DescriptorSecretKey; use crate::Network; #[derive(Debug)] @@ -37,7 +40,8 @@ pub(crate) struct Descriptor { impl Descriptor { pub(crate) fn new(descriptor: String, network: Network) -> Result { let secp = Secp256k1::new(); - let (extended_descriptor, key_map) = descriptor.into_wallet_descriptor(&secp, network.into())?; + let (extended_descriptor, key_map) = + descriptor.into_wallet_descriptor(&secp, network.into())?; Ok(Self { extended_descriptor, key_map, @@ -57,7 +61,9 @@ impl Descriptor { } BdkDescriptorSecretKey::XPrv(descriptor_x_key) => { let derivable_key = descriptor_x_key.xkey; - let (extended_descriptor, key_map, _) = Bip44(derivable_key, keychain_kind).build(network.into()).unwrap(); + let (extended_descriptor, key_map, _) = Bip44(derivable_key, keychain_kind) + .build(network.into()) + .unwrap(); Self { extended_descriptor, key_map, @@ -113,8 +119,9 @@ impl Descriptor { } BdkDescriptorSecretKey::XPrv(descriptor_x_key) => { let derivable_key = descriptor_x_key.xkey; - let (extended_descriptor, key_map, _) = - Bip49(derivable_key, keychain_kind).build(network.into()).unwrap(); + let (extended_descriptor, key_map, _) = Bip49(derivable_key, keychain_kind) + .build(network.into()) + .unwrap(); Self { extended_descriptor, key_map, @@ -170,8 +177,9 @@ impl Descriptor { } BdkDescriptorSecretKey::XPrv(descriptor_x_key) => { let derivable_key = descriptor_x_key.xkey; - let (extended_descriptor, key_map, _) = - Bip84(derivable_key, keychain_kind).build(network.into()).unwrap(); + let (extended_descriptor, key_map, _) = Bip84(derivable_key, keychain_kind) + .build(network.into()) + .unwrap(); Self { extended_descriptor, key_map, @@ -227,8 +235,9 @@ impl Descriptor { } BdkDescriptorSecretKey::XPrv(descriptor_x_key) => { let derivable_key = descriptor_x_key.xkey; - let (extended_descriptor, key_map, _) = - Bip86(derivable_key, keychain_kind).build(network.into()).unwrap(); + let (extended_descriptor, key_map, _) = Bip86(derivable_key, keychain_kind) + .build(network.into()) + .unwrap(); Self { extended_descriptor, key_map, diff --git a/bdk-ffi/src/keys.rs b/bdk-ffi/src/keys.rs index 10ce121f..52ae2e99 100644 --- a/bdk-ffi/src/keys.rs +++ b/bdk-ffi/src/keys.rs @@ -1,23 +1,19 @@ -use std::ops::Deref; -use std::str::FromStr; -use std::sync::{Arc, Mutex}; -use bdk::Error as BdkError; use bdk::bitcoin::bip32::DerivationPath as BdkDerivationPath; use bdk::bitcoin::key::Secp256k1; use bdk::bitcoin::secp256k1::rand; use bdk::bitcoin::secp256k1::rand::Rng; +use bdk::keys::bip39::WordCount; +use bdk::keys::bip39::{Language, Mnemonic as BdkMnemonic}; use bdk::keys::{ - DerivableKey, - DescriptorSecretKey as BdkDescriptorSecretKey, - DescriptorPublicKey as BdkDescriptorPublicKey, - ExtendedKey, - GeneratableKey, - GeneratedKey + DerivableKey, DescriptorPublicKey as BdkDescriptorPublicKey, + DescriptorSecretKey as BdkDescriptorSecretKey, ExtendedKey, GeneratableKey, GeneratedKey, }; -use bdk::keys::bip39::{Language, Mnemonic as BdkMnemonic}; -use bdk::keys::bip39::WordCount; -use bdk::miniscript::BareCtx; use bdk::miniscript::descriptor::{DescriptorXKey, Wildcard}; +use bdk::miniscript::BareCtx; +use bdk::Error as BdkError; +use std::ops::Deref; +use std::str::FromStr; +use std::sync::{Arc, Mutex}; use crate::Network; @@ -35,10 +31,8 @@ impl Mnemonic { let mut entropy = [0u8; 32]; rng.fill(&mut entropy); - let generated_key: GeneratedKey<_, BareCtx> = BdkMnemonic::generate_with_entropy( - (word_count, Language::English), - entropy - ).unwrap(); + let generated_key: GeneratedKey<_, BareCtx> = + BdkMnemonic::generate_with_entropy((word_count, Language::English), entropy).unwrap(); let mnemonic = BdkMnemonic::parse_in(Language::English, generated_key.to_string()).unwrap(); Mnemonic { inner: mnemonic } } @@ -132,7 +126,7 @@ impl DescriptorSecretKey { } BdkDescriptorSecretKey::MultiXPrv(_) => Err(BdkError::Generic( "Cannot derive from a multi key".to_string(), - )) + )), } } @@ -154,10 +148,10 @@ impl DescriptorSecretKey { Ok(Arc::new(Self { inner: extended_descriptor_secret_key, })) - }, + } BdkDescriptorSecretKey::MultiXPrv(_) => Err(BdkError::Generic( "Cannot derive from a multi key".to_string(), - )) + )), } } @@ -230,10 +224,10 @@ impl DescriptorPublicKey { Ok(Arc::new(Self { inner: derived_descriptor_public_key, })) - }, + } BdkDescriptorPublicKey::MultiXPub(_) => Err(BdkError::Generic( "Cannot derive from a multi xpub".to_string(), - )) + )), } } @@ -255,10 +249,10 @@ impl DescriptorPublicKey { Ok(Arc::new(Self { inner: extended_descriptor_public_key, })) - }, + } BdkDescriptorPublicKey::MultiXPub(_) => Err(BdkError::Generic( "Cannot derive from a multi xpub".to_string(), - )) + )), } } diff --git a/bdk-ffi/src/lib.rs b/bdk-ffi/src/lib.rs index a750119c..646b7332 100644 --- a/bdk-ffi/src/lib.rs +++ b/bdk-ffi/src/lib.rs @@ -5,24 +5,24 @@ mod keys; mod psbt; mod wallet; -use std::sync::Arc; -use bdk::bitcoin::{Network as BdkNetwork}; +use bdk::bitcoin::address::{NetworkChecked, NetworkUnchecked}; +use bdk::bitcoin::Address as BdkAddress; +use bdk::bitcoin::Network as BdkNetwork; use bdk::wallet::AddressIndex as BdkAddressIndex; use bdk::wallet::AddressInfo as BdkAddressInfo; -use bdk::bitcoin::Address as BdkAddress; -use bdk::bitcoin::address::{NetworkChecked, NetworkUnchecked}; -use bdk::KeychainKind; use bdk::Error as BdkError; +use bdk::KeychainKind; +use std::sync::Arc; // TODO 6: Why are these imports required? +use crate::descriptor::Descriptor; use crate::keys::DerivationPath; -use bdk::keys::bip39::WordCount; -use crate::keys::Mnemonic; use crate::keys::DescriptorPublicKey; use crate::keys::DescriptorSecretKey; -use crate::descriptor::Descriptor; +use crate::keys::Mnemonic; use crate::wallet::Wallet; use crate::wallet::WalletType; +use bdk::keys::bip39::WordCount; uniffi::include_scaffolding!("bdk"); @@ -42,7 +42,7 @@ impl From for BdkNetwork { match network { Network::Bitcoin => BdkNetwork::Bitcoin, Network::Testnet => BdkNetwork::Testnet, - Network::Signet => BdkNetwork::Signet, + Network::Signet => BdkNetwork::Signet, Network::Regtest => BdkNetwork::Regtest, } } @@ -53,9 +53,9 @@ impl From for Network { match network { BdkNetwork::Bitcoin => Network::Bitcoin, BdkNetwork::Testnet => Network::Testnet, - BdkNetwork::Signet => Network::Signet, + BdkNetwork::Signet => Network::Signet, BdkNetwork::Regtest => Network::Regtest, - _ => panic!("Network {} not supported", network), + _ => panic!("Network {} not supported", network), } } } @@ -395,10 +395,7 @@ pub struct Address { } impl Address { - fn new( - address: String, - network: Network, - ) -> Result { + fn new(address: String, network: Network) -> Result { Ok(Address { inner: address .parse::>() diff --git a/bdk-ffi/src/wallet.rs b/bdk-ffi/src/wallet.rs index df97de59..176901c9 100644 --- a/bdk-ffi/src/wallet.rs +++ b/bdk-ffi/src/wallet.rs @@ -28,12 +28,12 @@ // RbfValue, Script, ScriptAmount, TransactionDetails, TxBuilderResult, // }; -use std::sync::{Arc, Mutex, MutexGuard}; -use bdk::Wallet as BdkWallet; use crate::descriptor::Descriptor; use crate::{AddressIndex, AddressInfo, Network}; use bdk::wallet::AddressIndex as BdkAddressIndex; use bdk::Error as BdkError; +use bdk::Wallet as BdkWallet; +use std::sync::{Arc, Mutex, MutexGuard}; #[derive(Debug)] pub(crate) struct Wallet { @@ -92,7 +92,9 @@ impl Wallet { } fn get_internal_address(&mut self, address_index: AddressIndex) -> AddressInfo { - self.get_wallet().get_internal_address(address_index.into()).into() + self.get_wallet() + .get_internal_address(address_index.into()) + .into() } // fn get_balance(&self) -> Balance { diff --git a/bdk-jvm/plugins/src/main/kotlin/org/bitcoindevkit/plugins/UniFfiJvmPlugin.kt b/bdk-jvm/plugins/src/main/kotlin/org/bitcoindevkit/plugins/UniFfiJvmPlugin.kt index badb286c..815d005d 100644 --- a/bdk-jvm/plugins/src/main/kotlin/org/bitcoindevkit/plugins/UniFfiJvmPlugin.kt +++ b/bdk-jvm/plugins/src/main/kotlin/org/bitcoindevkit/plugins/UniFfiJvmPlugin.kt @@ -112,16 +112,20 @@ internal class UniFfiJvmPlugin : Plugin { // TODO 2: Is the Windows name the correct one? // TODO 3: This will not work on mac Intel (x86_64 architecture) - val libraryPath = when (operatingSystem) { - OS.LINUX -> "./target/x86_64-unknown-linux-gnu/release-smaller/libbdkffi.so" - OS.MAC -> "./target/aarch64-apple-darwin/release-smaller/libbdkffi.dylib" - OS.WINDOWS -> "./target/x86_64-pc-windows-msvc/release-smaller/bdkffi.dll" - else -> throw Exception("Unsupported OS") - } - + // val libraryPath = when (operatingSystem) { + // OS.LINUX -> "./target/x86_64-unknown-linux-gnu/release-smaller/libbdkffi.so" + // OS.MAC -> "./target/aarch64-apple-darwin/release-smaller/libbdkffi.dylib" + // OS.WINDOWS -> "./target/x86_64-pc-windows-msvc/release-smaller/bdkffi.dll" + // else -> throw Exception("Unsupported OS") + // } + + // workingDir("${project.projectDir}/../../bdk-ffi/") + // val cargoArgs: List = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "../bdk-jvm/lib/src/main/kotlin/", "--no-format") + + // The code above was for the migration to uniffi 0.24.3 using the --library flag + // The code below works with uniffi 0.23.0 workingDir("${project.projectDir}/../../bdk-ffi/") - val cargoArgs: List = listOf("run", "--bin", "uniffi-bindgen", "generate", "--library", libraryPath, "--language", "kotlin", "--out-dir", "../bdk-jvm/lib/src/main/kotlin/", "--no-format") - + val cargoArgs: List = listOf("run", "--bin", "uniffi-bindgen", "generate", "src/bdk.udl", "--language", "kotlin", "--out-dir", "../bdk-jvm/lib/src/main/kotlin", "--no-format") executable("cargo") args(cargoArgs) diff --git a/bdk-python/scripts/generate-linux.sh b/bdk-python/scripts/generate-linux.sh index 1e4eebe6..5efd84f9 100644 --- a/bdk-python/scripts/generate-linux.sh +++ b/bdk-python/scripts/generate-linux.sh @@ -13,6 +13,6 @@ rustup default 1.67.0 cargo build --profile release-smaller echo "Copying linux libbdkffi.so..." -cp ../target/release-smaller/libbdkffi.so ../bdk-python/src/bdkpython/libbdkffi.so +cp ./target/release-smaller/libbdkffi.so ../bdk-python/src/bdkpython/libbdkffi.so echo "All done!" diff --git a/bdk-python/scripts/generate-macos-arm64.sh b/bdk-python/scripts/generate-macos-arm64.sh index 87a8c356..43baa4c7 100644 --- a/bdk-python/scripts/generate-macos-arm64.sh +++ b/bdk-python/scripts/generate-macos-arm64.sh @@ -14,6 +14,6 @@ rustup target add aarch64-apple-darwin cargo build --profile release-smaller --target aarch64-apple-darwin echo "Copying libraries libbdkffi.dylib..." -cp ../target/aarch64-apple-darwin/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib +cp ./target/aarch64-apple-darwin/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib echo "All done!" diff --git a/bdk-python/scripts/generate-macos-x86_64.sh b/bdk-python/scripts/generate-macos-x86_64.sh index 07788daf..1d5dc95d 100644 --- a/bdk-python/scripts/generate-macos-x86_64.sh +++ b/bdk-python/scripts/generate-macos-x86_64.sh @@ -13,6 +13,6 @@ rustup target add x86_64-apple-darwin cargo build --profile release-smaller --target x86_64-apple-darwin echo "Copying libraries libbdkffi.dylib..." -cp ../target/x86_64-apple-darwin/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib +cp ./target/x86_64-apple-darwin/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib echo "All done!" diff --git a/bdk-python/scripts/generate-windows.sh b/bdk-python/scripts/generate-windows.sh index 16ec0aba..7de032c4 100644 --- a/bdk-python/scripts/generate-windows.sh +++ b/bdk-python/scripts/generate-windows.sh @@ -14,6 +14,6 @@ rustup target add x86_64-pc-windows-msvc cargo build --profile release-smaller --target x86_64-pc-windows-msvc echo "Copying libraries bdkffi.dll..." -cp ../target/x86_64-pc-windows-msvc/release-smaller/bdkffi.dll ../bdk-python/src/bdkpython/bdkffi.dll +cp ./target/x86_64-pc-windows-msvc/release-smaller/bdkffi.dll ../bdk-python/src/bdkpython/bdkffi.dll echo "All done!" diff --git a/bdk-swift/Tests/BitcoinDevKitTests/BitcoinDevKitTests.swift b/bdk-swift/Tests/BitcoinDevKitTests/BitcoinDevKitTests.swift index e845cc8e..de3d3a7f 100644 --- a/bdk-swift/Tests/BitcoinDevKitTests/BitcoinDevKitTests.swift +++ b/bdk-swift/Tests/BitcoinDevKitTests/BitcoinDevKitTests.swift @@ -7,9 +7,8 @@ final class BitcoinDevKitTests: XCTestCase { descriptor: "wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8Tm4jsS3iuEmKjTiEGjG6KnuFNKKJb5A6ZUCUZKdvLdSDWofKi4ToRCwb9poe1XdqfUnP4jaJjCB2Zwv11ZLgSbnZSNecE/0/*)", network: Network.regtest ) - let databaseConfig = DatabaseConfig.memory - let wallet = try Wallet.init(descriptor: desc, changeDescriptor: nil, network: Network.regtest, databaseConfig: databaseConfig) - let addressInfo = try wallet.getAddress(addressIndex: AddressIndex.new) - XCTAssertEqual(addressInfo.address.asString(), "bcrt1qzg4mckdh50nwdm9hkzq06528rsu73hjxytqkxs") + let wallet = try Wallet(descriptor: desc, changeDescriptor: nil, network: .testnet, walletType: .memory) + let addressInfo = wallet.getAddress(addressIndex: AddressIndex.lastUnused) + XCTAssertEqual(addressInfo.address.asString(), "tb1qzg4mckdh50nwdm9hkzq06528rsu73hjxxzem3e") } } diff --git a/bdk-swift/build-local-swift.sh b/bdk-swift/build-local-swift.sh index ba2806e2..5fac451e 100755 --- a/bdk-swift/build-local-swift.sh +++ b/bdk-swift/build-local-swift.sh @@ -14,7 +14,6 @@ rustup target add aarch64-apple-darwin x86_64-apple-darwin pushd bdk-ffi mkdir -p Sources/BitcoinDevKit cargo run --bin uniffi-bindgen generate src/bdk.udl --language swift --out-dir ../bdk-swift/Sources/BitcoinDevKit --no-format -popd cargo build --package bdk-ffi --profile release-smaller --target x86_64-apple-darwin cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-darwin @@ -27,14 +26,15 @@ lipo target/aarch64-apple-ios-sim/release-smaller/libbdkffi.a target/x86_64-appl mkdir -p target/lipo-macos/release-smaller lipo target/aarch64-apple-darwin/release-smaller/libbdkffi.a target/x86_64-apple-darwin/release-smaller/libbdkffi.a -create -output target/lipo-macos/release-smaller/libbdkffi.a +popd pushd bdk-swift mv Sources/BitcoinDevKit/bdk.swift Sources/BitcoinDevKit/BitcoinDevKit.swift cp Sources/BitcoinDevKit/bdkFFI.h bdkFFI.xcframework/ios-arm64/bdkFFI.framework/Headers cp Sources/BitcoinDevKit/bdkFFI.h bdkFFI.xcframework/ios-arm64_x86_64-simulator/bdkFFI.framework/Headers cp Sources/BitcoinDevKit/bdkFFI.h bdkFFI.xcframework/macos-arm64_x86_64/bdkFFI.framework/Headers -cp ../target/aarch64-apple-ios/release-smaller/libbdkffi.a bdkFFI.xcframework/ios-arm64/bdkFFI.framework/bdkFFI -cp ../target/lipo-ios-sim/release-smaller/libbdkffi.a bdkFFI.xcframework/ios-arm64_x86_64-simulator/bdkFFI.framework/bdkFFI -cp ../target/lipo-macos/release-smaller/libbdkffi.a bdkFFI.xcframework/macos-arm64_x86_64/bdkFFI.framework/bdkFFI +cp ../bdk-ffi/target/aarch64-apple-ios/release-smaller/libbdkffi.a bdkFFI.xcframework/ios-arm64/bdkFFI.framework/bdkFFI +cp ../bdk-ffi/target/lipo-ios-sim/release-smaller/libbdkffi.a bdkFFI.xcframework/ios-arm64_x86_64-simulator/bdkFFI.framework/bdkFFI +cp ../bdk-ffi/target/lipo-macos/release-smaller/libbdkffi.a bdkFFI.xcframework/macos-arm64_x86_64/bdkFFI.framework/bdkFFI rm Sources/BitcoinDevKit/bdkFFI.h rm Sources/BitcoinDevKit/bdkFFI.modulemap #rm bdkFFI.xcframework.zip || true