Compare commits

...

52 Commits

Author SHA1 Message Date
thunderbiscuit
599bd8ff06 chore: update libraries to official release versions 2023-09-08 09:09:10 -04:00
thunderbiscuit
fbec953149 docs: update docs for new pinned dependency 2023-09-06 14:51:00 -04:00
thunderbiscuit
0b07b8ed05 docs: update Kotlin API docs 2023-09-06 13:52:48 -04:00
thunderbiscuit
b59327e5ea chore: pin flate2 to 1.0.26 when building with 1.61 2023-09-06 10:40:29 -04:00
thunderbiscuit
e6500baae7 chore: update library version to 0.30.0 2023-09-06 10:25:25 -04:00
thunderbiscuit
85f220b953 build: update webpki dependency as per RUSTSEC-2023-0052 2023-09-05 14:38:16 -04:00
thunderbiscuit
106d31c9c3 Refactor: Remove unused Mutex on DescriptorSecretKey inner field 2023-08-18 13:34:28 -04:00
thunderbiscuit
4ae169f860 Refactor: Remove unused Mutex on DescriptorPublicKey inner field 2023-08-18 12:58:11 -04:00
Matthew
7717ebb097 refactor: rename inner field names 2023-08-16 15:37:33 -05:00
Matthew
c3e8469686 feat(descriptor): add bip-86 template 2023-08-11 12:09:21 -05:00
Steve Myers
faf23b7d25 Merge bitcoindevkit/bdk-ffi#389: ci: fix to work with bdk 0.28.2 and msrv 1.61.0
1da01b4a0b ci: change rust stable version to 0.71.0 (Steve Myers)
f1ba03bf50 ci: fix to work with bdk 0.28.1 and msrv 1.61.0 (Steve Myers)

Pull request description:

  ### Description

  Fixes CI to work with BDK 0.28.x and MSRV 1.61.0. For MSRV had to pin two dependencies.

  ### Notes to the reviewers

  I also updated in CI our 'stable" version of rust to be current stable which is `1.71.0`.

  ### Changelog notice

  None, only CI changes.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

ACKs for top commit:
  thunderbiscuit:
    ACK 1da01b4a0b.

Tree-SHA512: 72f7d8dbef791daebf3f4d9d92722f1f3780d173501673ca6f47af39dd2102c85944ba603e4e9213d44a294ab1cec43dff82213fe53c5dea663279473be64a15
2023-08-10 14:03:52 -05:00
Steve Myers
1da01b4a0b ci: change rust stable version to 0.71.0 2023-08-10 11:54:33 -05:00
Steve Myers
f1ba03bf50 ci: fix to work with bdk 0.28.1 and msrv 1.61.0 2023-08-10 11:28:36 -05:00
thunderbiscuit
bc182c7164 Update CI actions to their latest versions
* checkout (v3)
* setup-java (v3)
* cache (v3)
* upload-artifact (v3)
* setup-python (v4)
2023-07-05 14:03:42 -04:00
thunderbiscuit
5fc189717d Fix CI bdk-jvm 2023-07-04 16:19:55 -04:00
thunderbiscuit
849bfe79c1 Add Windows target to Kotlin/JVM published library 2023-07-04 12:32:00 -04:00
thunderbiscuit
dc79b78b2d Fix Python readme and integrate new scripts 2023-06-30 16:18:27 -04:00
thunderbiscuit
7cc08f1d6f Fix publishing Python CI workflow 2023-06-30 16:17:46 -04:00
thunderbiscuit
031fcb02da Run Python Windows tests in CI 2023-06-30 16:01:01 -04:00
thunderbiscuit
5f9b5682e5 Use macos-13 image to test and publish Python libraries 2023-06-23 14:42:36 -04:00
thunderbiscuit
d0a7315c9d Remove patch release issue template 2023-06-16 22:28:32 -04:00
thunderbiscuit
0bfc56b0e8 Fix minor release issue template 2023-06-16 22:28:09 -04:00
thunderbiscuit
3dd6c203e8 Bump snapshot and dev versions of libraries 2023-06-16 22:11:12 -04:00
thunderbiscuit
76acbf575b Add release 0.29.0 to changelog 2023-06-16 22:09:14 -04:00
thunderbiscuit
039b64de5c Update JVM readme with specific Rust version 2023-06-15 11:10:28 -04:00
thunderbiscuit
fe7e4e21c0 Update Android readme with specific Rust and NDK versions 2023-06-15 11:09:48 -04:00
thunderbiscuit
77f89afc68 Update library version to 0.29.0 2023-06-15 10:15:23 -04:00
thunderbiscuit
25033f6bd6 Add Kotlin API docs for Script.toBytes 2023-06-12 13:36:50 -04:00
thunderbiscuit
3cb2c2c394 Expose Script.to_bytes() method 2023-06-12 13:36:44 -04:00
Steve Myers
5092987b26 [swift] suppress keyword escape warnings 2023-06-06 14:17:30 -05:00
Steve Myers
aea25dbf21 Update bdk-swift local build script 2023-06-05 16:45:29 -05:00
thunderbiscuit
ed67eba910 Align JVM target version for Kotlin and Java compile tasks
This commit resolves a build error related to mismatched JVM target
versions for the Kotlin and Java compile tasks. Previously, the
'compileJava' task was targeting JVM 11, while the 'compileKotlin'
task was targeting JVM 8.

Both tasks have now been set to target JVM 11, ensuring consistency
and eliminating the build error.
2023-06-05 10:35:23 -04:00
thunderbiscuit
90606b2455 Small style cleanups in JVM Gradle plugin 2023-06-05 10:09:27 -04:00
yellowhatpro
49e8fe461e added support for x86_64-pc-windows-msvc 64-bit MSVC 2023-06-05 10:09:14 -04:00
Matthew
de88184b8c github: add feature request issue template 2023-05-30 15:27:34 -05:00
thunderbiscuit
3be2c0495f Clean up is_mine method body 2023-05-15 09:01:39 -04:00
thunderbiscuit
2c4c64515f Fix Clippy warning 2023-05-03 15:13:22 -04:00
thunderbiscuit
17323d3184 Add Kotlin API docs for isMine method 2023-05-03 14:21:37 -04:00
thunderbiscuit
b382511a9e Add is_mine method on Wallet type
Closes #354
2023-05-03 14:19:50 -04:00
Steve Myers
d3895441d3 Update bdk-swift/build-local-swift.sh for aarch64-apple-ios-sim to use release-smaller profile 2023-05-01 11:37:05 -05:00
Steve Myers
269512a673 Fix bdk-swift/build-local-swift.sh for aarch64-apple-ios-sim 2023-05-01 10:40:07 -05:00
thunderbiscuit
d27206787a Add supported Python library changes to changelog 2023-04-28 09:00:37 -04:00
thunderbiscuit
c1b1fd6f5d Update changelog for 0.28.0 release 2023-04-28 08:57:11 -04:00
thunderbiscuit
7062fbd047 Update minor_release and patch_release templates 2023-04-28 08:56:58 -04:00
thunderbiscuit
0e34a6bacf Bump snapshot and dev versions of libraries 2023-04-28 08:56:47 -04:00
thunderbiscuit
89e85a20cf Fix Python libraries' names to prepare for releasing 2023-04-25 13:53:27 -04:00
David Sterling
d8718c3f05 Update bdk-jvm README build instructions
The current build instructions for bdk-jvm are insufficient for someone to build bdk-jvm from scratch. It's not outlined that JDK 11 and Rust is required on the system.
2023-04-25 13:48:32 -04:00
thunderbiscuit
871a06d1ce Add library build task to Android test CI workflow 2023-04-24 14:17:58 -04:00
thunderbiscuit
b820d6a2ba Remove support for Python 3.6 and 3.7 2023-04-24 13:57:12 -04:00
thunderbiscuit
79d9fa2909 Use ubuntu-20.04 image for all Linux CI runs 2023-04-24 13:53:56 -04:00
thunderbiscuit
a0e0467d39 Add workflow dispatch to all test workflows 2023-04-24 13:52:42 -04:00
thunderbiscuit
f2296704e6 Pin Rust version in CI workflows to 1.67 2023-04-24 13:51:37 -04:00
42 changed files with 1145 additions and 742 deletions

View File

@@ -0,0 +1,17 @@
---
name: Enhancement request
about: Request a new feature or change to an existing feature
title: ''
labels: 'enhancement'
assignees: ''
---
**Describe the enhancement**
<!-- A clear and concise description of what you would like added or changed. -->
**Use case**
<!-- Tell us how you or others will use this new feature or change to an existing feature. -->
**Additional context**
<!-- Add any other context about the enhancement here. -->

View File

@@ -7,77 +7,81 @@ assignees: ''
--- ---
## Create a new minor release ## Create a new minor release
### _Main Workflow_ ## Bumping BDK Rust Version
1. - [ ] Open a PR with an update to `Cargo.toml` to the new bdk release candidate and ensure all CI workflows run correctly. Fix errors if necessary. 1. - [ ] Open a PR with an update to `Cargo.toml` to the new bdk release candidate and ensure all CI workflows run correctly. Fix errors if necessary.
2. - [ ] Once the new bdk release is out, update the PR to replace the release candidate with the full release and merge. 2. - [ ] Once the new bdk release is out, update the PR to replace the release candidate with the full release and merge.
3. - [ ] Update the Android, JVM, Python, and Swift libraries as per the ["**_Sub-Workflows_**" section below](#Sub-Workflows). Open a single PR on master for all of these changes called `Prepare language bindings libraries for 0.X release`
18. - [ ] Create a new branch off of `master` called `release/version`
19. - [ ] Checkout that branch and open a PR to update the Android, JVM, and Python libraries' versions
- [ ] Update bdk-android version from `SNAPSHOT` version to release version
- [ ] Update bdk-jvm version from `SNAPSHOT` version to release version
- [ ] Update bdk-python version from `.dev` version to release version
20. - [ ] Merge the PR updating all of the languages to their release versions
21. - [ ] Create the tag and make sure to add the changelog info to the tag (works better if you prepare the tag message on the side in a text editor) and push it to GitHub.
```sh
git tag v0.6.0 --sign --edit
git push upstream v0.6.0
```
22. - [ ] Make release on GitHub (set as pre-release and generate auto release notes between the previous tag and the new one)
23. - [ ] Trigger manual releases for all 4 libraries (for Swift, simply add the version number in the text field when running the workflow manually. Note that the version number must not contain the `v`, i.e. `0.26.0`)
24. - [ ] Bump the versions on master from `0.9.0-SNAPSHOT` to `0.10.0-SNAPSHOT`, `0.6.0.dev0` to `0.7.0.dev0`
25. - [ ] Build and publish API docs for JVM, Android, and Java on the website
```bash!
./gradlew dokkaHtml # bdk-jvm (Dokka)
./gradlew dokkaJavadoc # bdk-jvm (java-style documentation)
./gradlew dokkaHtml # bdk-android (Dokka)
```
26. - [ ] Tweet about the library
27. - [ ] Post in the announcement channel
### _Sub Workflows_ ### Specific Libraries' Workflows
#### _Android_ #### _Android_
4. - [ ] Update the API docs to reflect the changes in the API 3. - [ ] Update the API docs to reflect the changes in the API
5. - [ ] Delete the `target` directory in bdk-ffi and all previous artifacts to make sure you're building the library from scratch 4. - [ ] Delete the `target` directory in bdk-ffi and all previous artifacts to make sure you're building the library from scratch.
6. - [ ] Build the library and run the tests, and adjust if necessary. 5. - [ ] Build the library and run the tests, and adjust if necessary.
```sh ```shell
# start an emulator prior to running the tests # start an emulator prior to running the tests
cd bdk-android cd ./bdk-android/
./gradlew buildAndroidLib ./gradlew buildAndroidLib
./gradlew connectedAndroidTest ./gradlew connectedAndroidTest
``` ```
7. - [ ] Update the readme if necessary 6. - [ ] Update the readme if necessary
#### _JVM_ #### _JVM_
8. - [ ] Update the API docs to reflect the changes in the API 7. - [ ] Update the API docs to reflect the changes in the API
9. - [ ] Delete the `target` directory in bdk-ffi and all previous artifacts to make sure you're building the library from scratch 8. - [ ] Delete the `target` directory in bdk-ffi and all previous artifacts to make sure you're building the library from scratch
10. - [ ] Build the library and run the tests, and adjust if necessary 9. - [ ] Build the library and run the tests, and adjust if necessary
```sh ```shell
cd bdk-jvm cd ./bdk-jvm/
./gradlew buildJvmLib ./gradlew buildJvmLib
./gradlew test ./gradlew test
``` ```
11. - [ ] Update the readme if necessary 10. - [ ] Update the readme if necessary
#### _Swift_ #### _Swift_
12. - [ ] Run the tests and adjust if necessary 11. - [ ] Run the tests and adjust if necessary
```sh ```shell
./bdk-swift/build-local-swift.sh ./bdk-swift/build-local-swift.sh
cd bdk-swift cd ./bdk-swift/
swift test swift test
``` ```
13. - [ ] Update the readme if necessary 12. - [ ] Update the readme if necessary
#### _Python_ #### _Python_
14. - [ ] Delete the `.tox`, `dist`, `build`, and `bdkpython.egg-info` and rust `target` directories to make sure you are building the library from scratch without any caches 13. - [ ] Delete the `.tox`, `dist`, `build`, and `bdkpython.egg-info` and rust `target` directories to make sure you are building the library from scratch without any caches
15. - [ ] Build the library 14. - [ ] Build the library
```shell ```shell
cd ./bdk-python/
pip3 install --requirement requirements.txt pip3 install --requirement requirements.txt
bash ./generate.sh bash ./generate.sh
python3 setup.py --verbose bdist_wheel python3 setup.py --verbose bdist_wheel
``` ```
16. - [ ] Run the tests and adjust if necessary 15. - [ ] Run the tests and adjust if necessary
```shell ```shell
pip3 install ./dist/bdkpython-<yourversion>-py3-none-any.whl pip3 install ./dist/bdkpython-<yourversion>-py3-none-any.whl --force-reinstall
python -m unittest --verbose tests/test_bdk.py python -m unittest --verbose tests/test_bdk.py
``` ```
17. - [ ] Update the readme and `setup.py` if necessary 16. - [ ] Update the readme and `setup.py` if necessary
### Release Workflow
17. - [ ] Update the Android, JVM, Python, and Swift libraries as per the _Specific Libraries' Workflows_ section above. Open a single PR on master for all of these changes called `Prepare language bindings libraries for 0.X release`. See [example PR here](https://github.com/bitcoindevkit/bdk-ffi/pull/315).
18. - [ ] Create a new branch off of `master` called `release/version`
19. - [ ] Update bdk-android version from `SNAPSHOT` version to release version
20. - [ ] Update bdk-jvm version from `SNAPSHOT` version to release version
21. - [ ] Update bdk-python version from `.dev` version to release version
22. - [ ] Open a PR to that release branch that updates the Android, JVM, and Python libraries' versions in step 19, 20, and 21. See [example PR here](https://github.com/bitcoindevkit/bdk-ffi/pull/316).
23. - [ ] Get a review and ACK and merge the PR updating all the languages to their release versions
24. - [ ] Create the tag for the release and make sure to add the changelog info to the tag (works better if you prepare the tag message on the side in a text editor). Push the tag to GitHub.
```shell
git tag v0.6.0 --sign --edit
git push upstream v0.6.0
```
25. - [ ] Trigger manual releases for all 4 libraries (for Swift, trigger the release on `master` and simply add the version number in the text field when running the workflow manually. Note that the version number must not contain the `v`, i.e. `0.26.0`)
26. - [ ] Make sure the released libraries work and contain the artifacts you would expect
27. - [ ] Aggregate all the changelog notices from the PRs and add them to the changelog file
28. - [ ] Bump the versions on master from `0.9.0-SNAPSHOT` to `0.10.0-SNAPSHOT`, `0.6.0.dev0` to `0.7.0.dev0`
29. - [ ] Apply changes to the minor_release and patch_release issue templates if they need any
30. - [ ] Open a PR on master with the changes in steps 29, 30, and 31. See [example PR here](https://github.com/bitcoindevkit/bdk-ffi/pull/317). Get a review and merge the PR.
31. - [ ] Make release on GitHub (set as pre-release and generate auto release notes between the previous tag and the new one)
32. - [ ] Build and publish API docs for JVM, Android, and Java on the website
```shell
./gradlew dokkaHtml # bdk-jvm (Dokka)
./gradlew dokkaJavadoc # bdk-jvm (java-style documentation)
./gradlew dokkaHtml # bdk-android (Dokka)
```
33. - [ ] Post in the announcement channel
34. - [ ] Tweet about the library

View File

@@ -1,84 +0,0 @@
---
name: Patch Release
about: Create a new patch release [for release managers only]
title: 'Release MAJOR.MINOR.PATCH+1'
labels: 'release'
assignees: ''
---
# Creating a new patch release
## Bumping BDK Rust Version
1. - [ ] Open a PR with an update to `Cargo.toml` to the new bdk release candidate and ensure all CI workflows run correctly. Fix errors if necessary.
2. - [ ] Once the new bdk release is out, update the PR to replace the release candidate with the full release and merge.
### Specific Libraries' Workflows
#### _Android_
3. - [ ] Update the API docs to reflect the changes in the API
4. - [ ] Delete the `target` directory in bdk-ffi and all previous artifacts to make sure you're building the library from scratch.
5. - [ ] Build the library and run the tests, and adjust if necessary.
```sh
# start an emulator prior to running the tests
cd ./bdk-android/
./gradlew buildAndroidLib
./gradlew connectedAndroidTest
```
6. - [ ] Update the readme if necessary
#### _JVM_
7. - [ ] Update the API docs to reflect the changes in the API
8. - [ ] Delete the `target` directory in bdk-ffi and all previous artifacts to make sure you're building the library from scratch
9. - [ ] Build the library and run the tests, and adjust if necessary
```sh
cd ./bdk-jvm/
./gradlew buildJvmLib
./gradlew test
```
10. - [ ] Update the readme if necessary
#### _Swift_
11. - [ ] Run the tests and adjust if necessary
```sh
./bdk-swift/build-local-swift.sh
cd ./bdk-swift/
swift test
```
12. - [ ] Update the readme if necessary
#### _Python_
13. - [ ] Delete the `.tox`, `dist`, `build`, and `bdkpython.egg-info` and rust `target` directories to make sure you are building the library from scratch without any caches
14. - [ ] Build the library
```shell
cd ./bdk-python/
pip3 install --requirement requirements.txt
bash ./generate.sh
python3 setup.py --verbose bdist_wheel
```
15. - [ ] Run the tests and adjust if necessary
```shell
pip3 install ./dist/bdkpython-<yourversion>-py3-none-any.whl --force-reinstall
python -m unittest --verbose tests/test_bdk.py
```
16. - [ ] Update the readme and `setup.py` if necessary
### Release Workflow
17. - [ ] Update the Android, JVM, Python, and Swift libraries as per the _Specific Libraries' Workflows_ section above. Open a single PR on master for all of these changes called `Prepare language bindings libraries for 0.X release`
- [ ] Create a new branch off of `master` called `release/version`
18. - [ ] Checkout that branch and open a PR to update the Android, JVM, and Python libraries' versions
- [ ] Update bdk-android version from `SNAPSHOT` version to release version
- [ ] Update bdk-jvm version from `SNAPSHOT` version to release version
- [ ] Update bdk-python version from `.dev` version to release version
19. - [ ] Merge the PR updating all of the languages to their release versions
20. - [ ] Create the tag and make sure to add the changelog info to the tag (works better if you prepare the tag message on the side in a text editor) and push it to GitHub.
```sh
git tag v0.6.0 --sign --edit
git push upstream v0.6.0
```
21. - [ ] Make release on GitHub (set as pre-release and generate auto release notes between the previous tag and the new one)
22. - [ ] Trigger manual releases for all 4 libraries (for Swift, simply add the version number in the text field when running the workflow manually. Note that the version number must not contain the `v`, i.e. `0.26.0`)
23. - [ ] Bump the versions on master from `0.9.0-SNAPSHOT` to `0.10.0-SNAPSHOT`, `0.6.0.dev0` to `0.7.0.dev0`
24. - [ ] Build and publish API docs for JVM, Android, and Java on the website
```bash!
./gradlew dokkaHtml # bdk-jvm (Dokka)
./gradlew dokkaJavadoc # bdk-jvm (java-style documentation)
./gradlew dokkaHtml # bdk-android (Dokka)
```
25. - [ ] Tweet about the library
26. - [ ] Post in the announcement channel

View File

@@ -13,7 +13,7 @@ jobs:
name: Security audit name: Security audit
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions-rs/audit-check@v1 - uses: actions-rs/audit-check@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -14,18 +14,18 @@ jobs:
strategy: strategy:
matrix: matrix:
rust: rust:
- version: 1.63.0 # STABLE - version: 1.71.0 # STABLE
clippy: true clippy: true
- version: 1.61.0 # MSRV - version: 1.61.0 # MSRV
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Generate cache key - name: Generate cache key
run: echo "${{ matrix.rust.version }} ${{ matrix.features }}" | tee .cache_key run: echo "${{ matrix.rust.version }} ${{ matrix.features }}" | tee .cache_key
- name: Cache - name: Cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/.cargo/registry ~/.cargo/registry
@@ -46,6 +46,12 @@ jobs:
- name: Update toolchain - name: Update toolchain
run: rustup update run: rustup update
- 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 run: cargo build
@@ -61,7 +67,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Set default toolchain - name: Set default toolchain
run: rustup default nightly run: rustup default nightly

View File

@@ -10,7 +10,7 @@ env:
jobs: jobs:
build: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
steps: steps:
- name: "Install Android NDK 21.4.7075529" - name: "Install Android NDK 21.4.7075529"
run: | run: |
@@ -20,10 +20,10 @@ jobs:
echo "y" | $SDKMANAGER "ndk;21.4.7075529" echo "y" | $SDKMANAGER "ndk;21.4.7075529"
- name: "Check out PR branch" - name: "Check out PR branch"
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: "Cache" - name: "Cache"
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/.cargo/registry ~/.cargo/registry
@@ -32,11 +32,14 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- name: "Set up JDK" - name: "Set up JDK"
uses: actions/setup-java@v2 uses: actions/setup-java@v3
with: with:
distribution: temurin distribution: temurin
java-version: 11 java-version: 11
- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0
- name: "Install Rust Android targets" - name: "Install Rust Android targets"
run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi

View File

@@ -2,14 +2,14 @@ name: Publish bdk-jvm to Maven Central
on: [workflow_dispatch] on: [workflow_dispatch]
jobs: jobs:
build-jvm-macOS-M1-native-lib: build-macOS-native-libs:
name: "Create M1 and x86_64 JVM native binaries" name: "Create M1 and x86_64 native binaries"
runs-on: macos-12 runs-on: macos-12
steps: steps:
- name: "Checkout publishing branch" - name: "Checkout publishing branch"
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Cache - name: "Cache"
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: | path: |
@@ -18,42 +18,68 @@ jobs:
./target ./target
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- name: Set up JDK - name: "Set up JDK"
uses: actions/setup-java@v2 uses: actions/setup-java@v3
with: with:
distribution: temurin distribution: temurin
java-version: 11 java-version: 11
- name: Install aarch64 Rust target - 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 run: rustup target add aarch64-apple-darwin
- name: Build bdk-jvm library - name: "Build bdk-jvm library"
run: | run: |
cd bdk-jvm cd bdk-jvm
./gradlew buildJvmLib ./gradlew buildJvmLib
# build aarch64 + x86_64 native libraries and upload - name: "Upload macOS native libraries for reuse in publishing job"
- name: Upload macOS native libraries for reuse in publishing job
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
# name: no name is required because we upload the entire directory name: artifact-macos
# the default name "artifact" will be used
path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-jvm/lib/src/main/resources/ path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-jvm/lib/src/main/resources/
build-jvm-full-library: build-windows-native-lib:
name: Create full bdk-jvm library name: "Create Windows native binaries"
needs: [build-jvm-macOS-M1-native-lib] runs-on: windows-2022
runs-on: ubuntu-22.04
steps: steps:
- name: Checkout publishing branch - name: "Checkout publishing branch"
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Update bdk-ffi git submodule - name: "Set up JDK"
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- 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
- name: "Build bdk-jvm library"
run: | run: |
git submodule set-url bdk-ffi https://github.com/bitcoindevkit/bdk-ffi.git cd bdk-jvm
git submodule update --init bdk-ffi ./gradlew buildJvmLib
- name: Cache - name: "Upload Windows native libraries for reuse in publishing job"
uses: actions/upload-artifact@v3
with:
name: artifact-windows
path: D:\a\bdk-ffi\bdk-ffi\bdk-jvm\lib\src\main\resources\
build-full-library:
name: Create full bdk-jvm library
needs: [build-macOS-native-libs, build-windows-native-lib]
runs-on: ubuntu-20.04
steps:
- name: "Checkout publishing branch"
uses: actions/checkout@v3
- name: "Cache"
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: | path: |
@@ -62,26 +88,39 @@ jobs:
./target ./target
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- name: Set up JDK - name: "Set up JDK"
uses: actions/setup-java@v2 uses: actions/setup-java@v3
with: with:
distribution: temurin distribution: temurin
java-version: 11 java-version: 11
- name: Build bdk-jvm library - name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0
- name: "Build bdk-jvm library"
run: | run: |
cd bdk-jvm cd bdk-jvm
./gradlew buildJvmLib ./gradlew buildJvmLib
- name: Download macOS native libraries from previous job - name: "Download macOS native binaries from previous job"
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
id: download
with: with:
# download the artifact created in the prior job (named "artifact") name: artifact-macos
name: artifact
path: ./bdk-jvm/lib/src/main/resources/ path: ./bdk-jvm/lib/src/main/resources/
- name: Publish to Maven Central - name: "Download Windows native libraries from previous job"
uses: actions/download-artifact@v3
with:
name: artifact-windows
path: ./bdk-jvm/lib/src/main/resources/
- name: "Upload library code and binaries"
uses: actions/upload-artifact@v3
with:
name: artifact-full
path: ./bdk-jvm/lib/
- name: "Publish to Maven Central"
env: env:
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.PGP_KEY_ID }} ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.PGP_KEY_ID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET_KEY }} ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET_KEY }}

View File

@@ -1,4 +1,4 @@
name: Build and publish Python wheels name: Publish bdkpython to PyPI
on: [workflow_dispatch] on: [workflow_dispatch]
# We use manylinux2014 because older CentOS versions used by 2010 and 1 have a very old glibc version, which # We use manylinux2014 because older CentOS versions used by 2010 and 1 have a very old glibc version, which
@@ -7,9 +7,9 @@ on: [workflow_dispatch]
# tries to load glibc and fails because it requires a more recent version. # tries to load glibc and fails because it requires a more recent version.
jobs: jobs:
build-manylinux2014-x86_64-wheel: build-manylinux2014-x86_64-wheels:
name: "Build Manylinux 2014 x86_64 wheel" name: "Build Manylinux 2014 x86_64 wheel"
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
defaults: defaults:
run: run:
working-directory: bdk-python working-directory: bdk-python
@@ -21,77 +21,106 @@ jobs:
strategy: strategy:
matrix: matrix:
python: # Update this list whenever the docker image is updated (check /opt/python/) python: # Update this list whenever the docker image is updated (check /opt/python/)
- cp36-cp36m
- cp37-cp37m
- cp38-cp38 - cp38-cp38
- cp39-cp39 - cp39-cp39
- cp310-cp310 - cp310-cp310
- pp37-pypy37_pp73
- pp38-pypy38_pp73
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
submodules: true submodules: true
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: stable
- name: "Install requirements" - name: "Generate bdk.py and binaries"
run: ${PYBIN}/pip install -r requirements.txt run: bash ./scripts/generate-linux.sh
- name: "Generate bdk.py"
run: bash generate.sh
- name: "Build wheel" - name: "Build wheel"
run: ${PYBIN}/python setup.py bdist_wheel --verbose # Specifying the plat-name argument is necessary to build a wheel with the correct name,
# see issue #350 for more information
run: ${PYBIN}/python setup.py bdist_wheel --plat-name manylinux_2_17_x86_64 --verbose
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v3
with: with:
name: bdkpython-manylinux2014-x86_64-${{ matrix.python }} name: bdkpython-manylinux2014-x86_64-${{ matrix.python }}
path: /home/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl path: /home/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl
build-macos-universal-wheel: build-macos-arm64-wheels:
name: "Build macOS universal wheel" name: "Build macOS arm64 wheel"
runs-on: macos-12 runs-on: macos-13
defaults: defaults:
run: run:
working-directory: bdk-python working-directory: bdk-python
strategy: strategy:
matrix: matrix:
python: python:
- '3.7' - "3.8"
- '3.8' - "3.9"
- '3.9' - "3.10"
- '3.10'
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
submodules: true submodules: true
- uses: actions/setup-python@v2
- name: "Install Python"
uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python }} python-version: ${{ matrix.python }}
- name: "Generate bdk.py" - name: "Generate bdk.py and binaries"
run: | run: bash ./scripts/generate-macos-arm64.sh
python3 --version
rustup target add aarch64-apple-darwin
pip3 install --user -r requirements.txt
bash generate.sh
- name: "Build wheel" - name: "Build wheel"
env: # Specifying the plat-name argument is necessary to build a wheel with the correct name,
ARCHFLAGS: "-arch x86_64 -arch arm64" # see issue #350 for more information
run: python3 setup.py bdist_wheel --verbose run: python3 setup.py bdist_wheel --plat-name macosx_11_0_arm64 --verbose
- uses: actions/upload-artifact@v2 - name: "Upload artifacts"
uses: actions/upload-artifact@v3
with: with:
name: bdkpython-macos-${{ matrix.python }} name: bdkpython-macos-arm64-${{ matrix.python }}
path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl
build-windows-wheel: build-macos-x86_64-wheels:
name: "Build windows wheel" name: "Build macOS x86_64 wheel"
runs-on: macos-13
defaults:
run:
working-directory: bdk-python
strategy:
matrix:
python:
- "3.8"
- "3.9"
- "3.10"
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
submodules: true
- name: "Install Python"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: "Generate bdk.py and binaries"
run: bash ./scripts/generate-macos-x86_64.sh
- name: "Build wheel"
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
# see issue #350 for more information
run: python3 setup.py bdist_wheel --plat-name macosx_11_0_x86_64 --verbose
- uses: actions/upload-artifact@v3
with:
name: bdkpython-macos-x86_64-${{ matrix.python }}
path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl
build-windows-wheels:
name: "Build Windows wheel"
runs-on: windows-2022 runs-on: windows-2022
defaults: defaults:
run: run:
@@ -99,46 +128,43 @@ jobs:
strategy: strategy:
matrix: matrix:
python: python:
- '3.7' - "3.8"
- '3.8' - "3.9"
- '3.9' - "3.10"
- '3.10'
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
submodules: true submodules: true
- uses: actions/setup-python@v2 - uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python }} python-version: ${{ matrix.python }}
- name: "Generate bdk.py" - name: "Generate bdk.py and binaries"
run: | run: bash ./scripts/generate-windows.sh
python --version
pip install --user -r requirements.txt
bash generate.sh
- name: "Build wheel" - name: "Build wheel"
run: python setup.py bdist_wheel --verbose run: python setup.py bdist_wheel --verbose
- uses: actions/upload-artifact@v2 - name: "Upload artifacts"
uses: actions/upload-artifact@v3
with: with:
name: bdkpython-win-${{ matrix.python }} name: bdkpython-win-${{ matrix.python }}
path: D:\a\bdk-ffi\bdk-ffi\bdk-python\dist\*.whl path: D:\a\bdk-ffi\bdk-ffi\bdk-python\dist\*.whl
publish-pypi: publish-pypi:
name: "Publish on PyPI" name: "Publish on PyPI"
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
defaults: defaults:
run: run:
working-directory: bdk-python working-directory: bdk-python
needs: [build-manylinux2014-x86_64-wheel, build-macos-universal-wheel, build-windows-wheel] needs: [build-manylinux2014-x86_64-wheels, build-macos-arm64-wheels, build-macos-x86_64-wheels, build-windows-wheels]
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: "Download artifacts in dist/ directory" - name: "Download artifacts in dist/ directory"
uses: actions/download-artifact@v2 uses: actions/download-artifact@v3
with: with:
path: dist/ path: dist/

View File

@@ -1,5 +1,6 @@
name: Test Android name: Test Android
on: on:
workflow_dispatch:
push: push:
paths: paths:
- "bdk-ffi/**" - "bdk-ffi/**"
@@ -18,7 +19,7 @@ env:
jobs: jobs:
build: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
steps: steps:
- name: "Install Android NDK 21.4.7075529" - name: "Install Android NDK 21.4.7075529"
run: | run: |
@@ -28,10 +29,10 @@ jobs:
echo "y" | $SDKMANAGER "ndk;21.4.7075529" echo "y" | $SDKMANAGER "ndk;21.4.7075529"
- name: "Check out PR branch" - name: "Check out PR branch"
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: "Cache" - name: "Cache"
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/.cargo/registry ~/.cargo/registry
@@ -40,14 +41,22 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- name: "Set up JDK" - name: "Set up JDK"
uses: actions/setup-java@v2 uses: actions/setup-java@v3
with: with:
distribution: temurin distribution: temurin
java-version: 11 java-version: 11
- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0
- name: "Install Rust Android targets" - name: "Install Rust Android targets"
run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi
- name: "Build Android library"
run: |
cd bdk-android
./gradlew buildAndroidLib
# There are currently no unit tests for bdk-android and the integration tests require the macOS image # There are currently no unit tests for bdk-android and the integration tests require the macOS image
# which is not working with the older NDK version we are using, so for now we just make sure that the library builds. # which is not working with the older NDK version we are using, so for now we just make sure that the library builds.
# - name: "Run Android unit tests" # - name: "Run Android unit tests"

View File

@@ -1,5 +1,6 @@
name: Test Kotlin/JVM name: Test Kotlin/JVM
on: on:
workflow_dispatch:
push: push:
paths: paths:
- "bdk-ffi/**" - "bdk-ffi/**"
@@ -13,11 +14,11 @@ jobs:
build: build:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Check out PR branch - name: "Check out PR branch"
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Cache - name: "Cache"
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/.cargo/registry ~/.cargo/registry
@@ -25,13 +26,16 @@ jobs:
./target ./target
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }} key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
- name: Set up JDK - name: "Set up JDK"
uses: actions/setup-java@v2 uses: actions/setup-java@v3
with: with:
distribution: temurin distribution: temurin
java-version: 11 java-version: 11
- name: Run JVM tests - name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0
- name: "Run JVM tests"
run: | run: |
cd bdk-jvm cd bdk-jvm
./gradlew test --console=rich ./gradlew test

View File

@@ -1,5 +1,6 @@
name: Test Python name: Test Python
on: on:
workflow_dispatch:
push: push:
paths: paths:
- "bdk-ffi/**" - "bdk-ffi/**"
@@ -15,9 +16,9 @@ on:
# tries to load glibc and fails because it requires a more recent version. # tries to load glibc and fails because it requires a more recent version.
jobs: jobs:
build-manylinux2014-x86_64-wheel: build-manylinux2014-x86_64-wheels:
name: "Build and test Manylinux 2014 x86_64 wheels" name: "Build and test Manylinux 2014 x86_64 wheels"
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
defaults: defaults:
run: run:
working-directory: bdk-python working-directory: bdk-python
@@ -29,28 +30,25 @@ jobs:
strategy: strategy:
matrix: matrix:
python: python:
# - cp36-cp36m - cp38-cp38
# - cp37-cp37m - cp39-cp39
# - cp38-cp38
# - cp39-cp39
- cp310-cp310 - cp310-cp310
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
submodules: true submodules: true
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: stable
- name: "Install requirements" - name: "Generate bdk.py and binaries"
run: ${PYBIN}/pip install -r requirements.txt run: bash ./scripts/generate-linux.sh
- name: "Generate bdk.py"
run: bash generate.sh
- name: "Build wheel" - name: "Build wheel"
run: ${PYBIN}/python setup.py bdist_wheel --verbose # Specifying the plat-name argument is necessary to build a wheel with the correct name,
# see issue #350 for more information
run: ${PYBIN}/python setup.py bdist_wheel --plat-name manylinux_2_17_x86_64 --verbose
- name: "Install wheel" - name: "Install wheel"
run: ${PYBIN}/pip install ./dist/*.whl run: ${PYBIN}/pip install ./dist/*.whl
@@ -59,44 +57,82 @@ jobs:
run: ${PYBIN}/python -m unittest tests/test_bdk.py --verbose run: ${PYBIN}/python -m unittest tests/test_bdk.py --verbose
- name: "Upload artifact test" - name: "Upload artifact test"
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
with: with:
name: bdkpython-manylinux2014-x86_64-${{ matrix.python }} name: bdkpython-manylinux2014-x86_64-${{ matrix.python }}
path: /home/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl path: /home/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl
build-macos-universal-wheel: build-macos-arm64-wheels:
name: "Build and test macOS wheels" name: "Build and test macOS arm64 wheels"
runs-on: macos-12 runs-on: macos-13
defaults: defaults:
run: run:
working-directory: bdk-python working-directory: bdk-python
strategy: strategy:
matrix: matrix:
python: python:
# - '3.7' - "3.8"
# - '3.8' - "3.9"
# - '3.9' - "3.10"
- '3.10'
steps: steps:
- name: Checkout - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
submodules: true submodules: true
- uses: actions/setup-python@v2
- name: "Install Python"
uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python }} python-version: ${{ matrix.python }}
- name: "Generate bdk.py" - name: "Generate bdk.py and binaries"
run: | run: bash ./scripts/generate-macos-arm64.sh
python3 --version
rustup target add aarch64-apple-darwin
pip3 install --user -r requirements.txt
bash generate.sh
- name: "Build wheel" - name: "Build wheel"
env: # Specifying the plat-name argument is necessary to build a wheel with the correct name,
ARCHFLAGS: "-arch x86_64 -arch arm64" # see issue #350 for more information
run: python3 setup.py bdist_wheel --verbose run: python3 setup.py bdist_wheel --plat-name macosx_11_0_arm64 --verbose
# You can't install the arm64 wheel on the CI, so we skip these steps and simply test that the wheel builds
# - name: "Install wheel and run tests"
# run: |
# pip3 install ./dist/*.whl
# python3 -m unittest tests/test_bdk.py --verbose
- name: "Upload artifact test"
uses: actions/upload-artifact@v3
with:
name: bdkpython-macos-arm64-${{ matrix.python }}
path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl
build-macos-x86_64-wheels:
name: "Build and test macOS x86_64 wheels"
runs-on: macos-13
defaults:
run:
working-directory: bdk-python
strategy:
matrix:
python:
- "3.8"
- "3.9"
- "3.10"
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: "Generate bdk.py and binaries"
run: bash ./scripts/generate-macos-x86_64.sh
- name: "Build wheel"
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
# see issue #350 for more information
run: python3 setup.py bdist_wheel --plat-name macosx_11_0_x86_64 --verbose
- name: "Install wheel" - name: "Install wheel"
run: pip3 install ./dist/*.whl run: pip3 install ./dist/*.whl
@@ -104,7 +140,13 @@ jobs:
- name: "Run tests" - name: "Run tests"
run: python3 -m unittest tests/test_bdk.py --verbose run: python3 -m unittest tests/test_bdk.py --verbose
build-windows-wheel: - name: "Upload artifact test"
uses: actions/upload-artifact@v3
with:
name: bdkpython-macos-x86_64-${{ matrix.python }}
path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl
build-windows-wheels:
name: "Build and test Windows wheels" name: "Build and test Windows wheels"
runs-on: windows-2022 runs-on: windows-2022
defaults: defaults:
@@ -113,35 +155,35 @@ jobs:
strategy: strategy:
matrix: matrix:
python: python:
# - '3.7' - "3.8"
# - '3.8' - "3.9"
# - '3.9' - "3.10"
- '3.10'
steps: steps:
- name: "Checkout" - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
submodules: true submodules: true
- uses: actions/setup-python@v2
- name: "Install Python"
uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python }} python-version: ${{ matrix.python }}
- name: "Generate bdk.py" - name: "Generate bdk.py and binaries"
run: | run: bash ./scripts/generate-windows.sh
python --version
pip install --user -r requirements.txt
bash generate.sh
- name: "Build wheel" - name: "Build wheel"
run: python setup.py bdist_wheel --verbose run: python setup.py bdist_wheel --verbose
# TODO: On Windows the pip install ./dist/*.whl step fails with the following error: - name: "Upload artifact test"
# Run pip install ./dist/*.whl uses: actions/upload-artifact@v3
# WARNING: Requirement './dist/*.whl' looks like a filename, but the file does not exist with:
# ERROR: *.whl is not a valid wheel filename.*.whl is not a valid wheel name name: bdkpython-windows-${{ matrix.python }}
# So we skip the installing and the tests and simply test that the wheel builds path: D:\a\bdk-ffi\bdk-ffi\bdk-python\dist\*.whl
# - name: Install wheel - name: "Install dependencies"
# run: pip install ./dist/*.whl run: Get-ChildItem 'D:\a\bdk-ffi\bdk-ffi\bdk-python\dist\*.whl' | ForEach-Object {pip install $_.FullName}
# - name: Run tests shell: powershell
# run: python -m unittest tests/test_bdk.py --verbose
- name: "Run tests"
run: python -m unittest tests/test_bdk.py --verbose

View File

@@ -1,5 +1,6 @@
name: Test Swift name: Test Swift
on: on:
workflow_dispatch:
push: push:
paths: paths:
- "bdk-ffi/**" - "bdk-ffi/**"
@@ -14,7 +15,10 @@ jobs:
runs-on: macos-12 runs-on: macos-12
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: "Set default Rust version to 1.67.0"
run: rustup default 1.67.0
- name: Install Rust targets - name: Install Rust targets
run: | run: |
@@ -32,7 +36,7 @@ jobs:
- 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 run: cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-darwin
- name: Create lipo-ios-sim and lipo-macos - name: Create lipo-macos
run: | run: |
mkdir -p target/lipo-macos/release-smaller 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 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

View File

@@ -1,14 +1,46 @@
# Changelog # Changelog
All notable changes to this project prior to release **0.9.0** are documented in this file. Future Changelog information can also be found in each release's git tag (which can be viewed with `git tag -ln100 "v*"`), as well as on the [GitHub releases](https://github.com/bitcoindevkit/bdk-ffi/releases) page. See [DEVELOPMENT_CYCLE.md](DEVELOPMENT_CYCLE.md) for more details.
changelog information can be found in each release's git tag and can be viewed with `git tag -ln100 "v*"`.
Changelog info is also documented on the [GitHub releases](https://github.com/bitcoindevkit/bdk-ffi/releases)
page. See [DEVELOPMENT_CYCLE.md](DEVELOPMENT_CYCLE.md) for more details.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.29.0]
This release has a number of new APIs, and adds support for Windows in bdk-jvm.
Changelog
- Add support for Windows in bdk-jvm [#336]
- Add support for older version of Linux distros in bdk-jvm [#345]
- APIs added
- Expose `is_mine()` method on the `Wallet` type [#355]
- Expose `to_bytes()` method on the `Script` type [#369]
[#336]: https://github.com/bitcoindevkit/bdk-ffi/pull/336
[#345]: https://github.com/bitcoindevkit/bdk-ffi/pull/345
[#355]: https://github.com/bitcoindevkit/bdk-ffi/pull/355
[#369]: https://github.com/bitcoindevkit/bdk-ffi/pull/369
## [v0.28.0]
- Update BDK to version 0.28.0 [#341]
- Drop support of pypy releases of Python libraries [#351]
- Drop support for Python 3.6 and 3.7 [#351]
- Drop support for very old Linux versions that do not support the manylinux_2_17_x86_64 platform tag [#351]
- APIs changed:
- Expose Address payload and network properties. [#325]
- Add SignOptions to Wallet.sign() params. [#326]
- address field on `AddressInfo` type is now of type `Address` [#333]
- new PartiallySignedTransaction.json_serialize() function to get JSON serialized value of all PSBT fields. [#334]
- Add from_script constructor to `Address` type [#337]
[#325]: https://github.com/bitcoindevkit/bdk-ffi/pull/325
[#326]: https://github.com/bitcoindevkit/bdk-ffi/pull/326
[#333]: https://github.com/bitcoindevkit/bdk-ffi/pull/333
[#334]: https://github.com/bitcoindevkit/bdk-ffi/pull/334
[#337]: https://github.com/bitcoindevkit/bdk-ffi/pull/337
[#341]: https://github.com/bitcoindevkit/bdk-ffi/pull/341
[#351]: https://github.com/bitcoindevkit/bdk-ffi/pull/351
## [v0.27.1] ## [v0.27.1]
- Update BDK to latest version 0.27.1 [#312] - Update BDK to version 0.27.1 [#312]
- APIs changed - APIs changed
- `PartiallySignedTransaction.extract_tx()` returns a `Transaction` instead of the transaction bytes. [#296] - `PartiallySignedTransaction.extract_tx()` returns a `Transaction` instead of the transaction bytes. [#296]
- `Blockchain.broadcast()` takes a `Transaction` instead of a `PartiallySignedTransaction`. [#296] - `Blockchain.broadcast()` takes a `Transaction` instead of a `PartiallySignedTransaction`. [#296]
@@ -23,7 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#312]: https://github.com/bitcoindevkit/bdk-ffi/pull/312 [#312]: https://github.com/bitcoindevkit/bdk-ffi/pull/312
## [v0.26.0] ## [v0.26.0]
- Update BDK to latest version 0.26.0 [#288] - Update BDK to version 0.26.0 [#288]
- APIs changed - APIs changed
- The descriptor and change_descriptor arguments on the wallet constructor now take a `Descriptor` instead of a `String`. [#260] - The descriptor and change_descriptor arguments on the wallet constructor now take a `Descriptor` instead of a `String`. [#260]
- TxBuilder.drain_to() argument is now `Script` instead of address `String`. [#279] - TxBuilder.drain_to() argument is now `Script` instead of address `String`. [#279]
@@ -46,7 +78,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#288]: https://github.com/bitcoindevkit/bdk-ffi/pull/288 [#288]: https://github.com/bitcoindevkit/bdk-ffi/pull/288
## [v0.25.0] ## [v0.25.0]
- Update BDK to latest version 0.25.0 [#272] - Update BDK to version 0.25.0 [#272]
- APIs Added: - APIs Added:
- from_string() constructors now available on DescriptorSecretKey and DescriptorPublicKey [#247] - from_string() constructors now available on DescriptorSecretKey and DescriptorPublicKey [#247]
@@ -54,7 +86,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#272]: https://github.com/bitcoindevkit/bdk-ffi/pull/272 [#272]: https://github.com/bitcoindevkit/bdk-ffi/pull/272
## [v0.11.0] ## [v0.11.0]
- Update BDK to latest version 0.24.0 [#221] - Update BDK to version 0.24.0 [#221]
- APIs changed - APIs changed
- The constructor on the DescriptorSecretKey type now takes a Mnemonic instead of a String. - The constructor on the DescriptorSecretKey type now takes a Mnemonic instead of a String.
- APIs added - APIs added
@@ -70,7 +102,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#221]: https://github.com/bitcoindevkit/bdk-ffi/pull/221 [#221]: https://github.com/bitcoindevkit/bdk-ffi/pull/221
## [v0.10.0] ## [v0.10.0]
- Update BDK to latest version 0.23.0 [#204] - Update BDK to version 0.23.0 [#204]
- Update uniffi-rs to latest version 0.21.0 [#216] - Update uniffi-rs to latest version 0.21.0 [#216]
- Breaking Changes - Breaking Changes
- Changed `TxBuilder.finish()` to return new `TxBuilderResult` [#209] - Changed `TxBuilder.finish()` to return new `TxBuilderResult` [#209]
@@ -103,7 +135,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- APIs Added [#154] - APIs Added [#154]
- `generate_mnemonic()`, returns string mnemonic - `generate_mnemonic()`, returns string mnemonic
- `interface DescriptorSecretKey` - `interface DescriptorSecretKey`
- `new(Network, string_mnenoinc, password)`, contructs DescriptorSecretKey - `new(Network, string_mnenoinc, password)`, constructs DescriptorSecretKey
- `derive(DerivationPath)`, derives and returns child DescriptorSecretKey - `derive(DerivationPath)`, derives and returns child DescriptorSecretKey
- `extend(DerivationPath)`, extends and returns DescriptorSecretKey - `extend(DerivationPath)`, extends and returns DescriptorSecretKey
- `as_public()`, returns DescriptorSecretKey as DescriptorPublicKey - `as_public()`, returns DescriptorSecretKey as DescriptorPublicKey
@@ -183,8 +215,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[BIP 0174]:https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#encoding [BIP 0174]:https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#encoding
## [v0.2.0] [v0.29.0]: https://github.com/bitcoindevkit/bdk-ffi/compare/v0.28.0...v0.29.0
[v0.28.0]: https://github.com/bitcoindevkit/bdk-ffi/compare/v0.27.1...v0.28.0
[v0.27.1]: https://github.com/bitcoindevkit/bdk-ffi/compare/v0.26.0...v0.27.1 [v0.27.1]: https://github.com/bitcoindevkit/bdk-ffi/compare/v0.26.0...v0.27.1
[v0.26.0]: https://github.com/bitcoindevkit/bdk-ffi/compare/v0.25.0...v0.26.0 [v0.26.0]: https://github.com/bitcoindevkit/bdk-ffi/compare/v0.25.0...v0.26.0
[v0.25.0]: https://github.com/bitcoindevkit/bdk-ffi/compare/v0.11.0...v0.25.0 [v0.25.0]: https://github.com/bitcoindevkit/bdk-ffi/compare/v0.11.0...v0.25.0

473
Cargo.lock generated
View File

@@ -2,6 +2,15 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "addr2line"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
dependencies = [
"gimli",
]
[[package]] [[package]]
name = "adler" name = "adler"
version = "1.0.2" version = "1.0.2"
@@ -20,10 +29,27 @@ dependencies = [
] ]
[[package]] [[package]]
name = "anyhow" name = "ahash"
version = "1.0.70" version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
dependencies = [
"cfg-if",
"once_cell",
"version_check",
]
[[package]]
name = "allocator-api2"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
[[package]]
name = "anyhow"
version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]] [[package]]
name = "askama" name = "askama"
@@ -78,13 +104,13 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9"
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.68" version = "0.1.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.14", "syn 2.0.31",
] ]
[[package]] [[package]]
@@ -104,12 +130,33 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
version = "0.3.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
dependencies = [
"addr2line",
"cc",
"cfg-if",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
]
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.13.1" version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "base64"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53"
[[package]] [[package]]
name = "base64-compat" name = "base64-compat"
version = "1.0.0" version = "1.0.0"
@@ -121,11 +168,11 @@ dependencies = [
[[package]] [[package]]
name = "bdk" name = "bdk"
version = "0.28.0" version = "0.28.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9b650f45ae7dc8558544448253f3e1ae443433637ccd9f9d14d2089ff913480" checksum = "b15adb2017ab6437b6704a779ab8bbefe857612f5af9d84b677a1767f965e099"
dependencies = [ dependencies = [
"ahash", "ahash 0.7.6",
"async-trait", "async-trait",
"bdk-macros", "bdk-macros",
"bip39", "bip39",
@@ -147,7 +194,7 @@ dependencies = [
[[package]] [[package]]
name = "bdk-ffi" name = "bdk-ffi"
version = "0.28.0" version = "0.30.0"
dependencies = [ dependencies = [
"assert_matches", "assert_matches",
"bdk", "bdk",
@@ -197,7 +244,7 @@ version = "0.29.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0694ea59225b0c5f3cb405ff3f670e4828358ed26aec49dc352f730f0cb1a8a3" checksum = "0694ea59225b0c5f3cb405ff3f670e4828358ed26aec49dc352f730f0cb1a8a3"
dependencies = [ dependencies = [
"base64", "base64 0.13.1",
"bech32", "bech32",
"bitcoin_hashes", "bitcoin_hashes",
"secp256k1", "secp256k1",
@@ -245,9 +292,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "bumpalo" name = "bumpalo"
version = "3.12.0" version = "3.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
@@ -263,18 +310,18 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
[[package]] [[package]]
name = "camino" name = "camino"
version = "1.1.4" version = "1.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c530edf18f37068ac2d977409ed5cd50d53d73bc653c7647b48eb78976ac9ae2" checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c"
dependencies = [ dependencies = [
"serde", "serde",
] ]
[[package]] [[package]]
name = "cargo-platform" name = "cargo-platform"
version = "0.1.2" version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479"
dependencies = [ dependencies = [
"serde", "serde",
] ]
@@ -295,9 +342,12 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.79" version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@@ -307,9 +357,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.2.23" version = "3.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
@@ -324,9 +374,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "3.2.18" version = "3.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error", "proc-macro-error",
@@ -355,9 +405,9 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-epoch" name = "crossbeam-epoch"
version = "0.9.14" version = "0.9.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cfg-if", "cfg-if",
@@ -368,9 +418,9 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.15" version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
] ]
@@ -385,11 +435,11 @@ dependencies = [
"byteorder", "byteorder",
"libc", "libc",
"log", "log",
"rustls", "rustls 0.20.9",
"serde", "serde",
"serde_json", "serde_json",
"webpki", "webpki",
"webpki-roots", "webpki-roots 0.22.6",
"winapi", "winapi",
] ]
@@ -419,9 +469,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.25" version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"miniz_oxide", "miniz_oxide",
@@ -429,9 +479,9 @@ dependencies = [
[[package]] [[package]]
name = "form_urlencoded" name = "form_urlencoded"
version = "1.1.0" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
dependencies = [ dependencies = [
"percent-encoding", "percent-encoding",
] ]
@@ -463,15 +513,21 @@ dependencies = [
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.9" version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"wasi", "wasi",
] ]
[[package]]
name = "gimli"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
[[package]] [[package]]
name = "glob" name = "glob"
version = "0.3.1" version = "0.3.1"
@@ -494,17 +550,24 @@ name = "hashbrown"
version = "0.12.3" version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
dependencies = [ dependencies = [
"ahash", "ahash 0.8.3",
"allocator-api2",
] ]
[[package]] [[package]]
name = "hashlink" name = "hashlink"
version = "0.8.1" version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
dependencies = [ dependencies = [
"hashbrown", "hashbrown 0.14.0",
] ]
[[package]] [[package]]
@@ -524,9 +587,9 @@ dependencies = [
[[package]] [[package]]
name = "idna" name = "idna"
version = "0.3.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
dependencies = [ dependencies = [
"unicode-bidi", "unicode-bidi",
"unicode-normalization", "unicode-normalization",
@@ -539,7 +602,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown", "hashbrown 0.12.3",
] ]
[[package]] [[package]]
@@ -553,15 +616,15 @@ dependencies = [
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.6" version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.61" version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
dependencies = [ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
@@ -580,9 +643,9 @@ dependencies = [
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.141" version = "0.2.147"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
[[package]] [[package]]
name = "libsqlite3-sys" name = "libsqlite3-sys"
@@ -597,9 +660,9 @@ dependencies = [
[[package]] [[package]]
name = "lock_api" name = "lock_api"
version = "0.4.9" version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"scopeguard", "scopeguard",
@@ -607,24 +670,21 @@ dependencies = [
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.17" version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
dependencies = [
"cfg-if",
]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.5.0" version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
[[package]] [[package]]
name = "memoffset" name = "memoffset"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
dependencies = [ dependencies = [
"autocfg", "autocfg",
] ]
@@ -653,9 +713,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]] [[package]]
name = "miniscript" name = "miniscript"
version = "9.0.1" version = "9.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9601439f168c13bdc5bf84349c2e61c815be4a4dcebe8c4ff4af58f4e8a6d20" checksum = "e5b106477a0709e2da253e5559ba4ab20a272f8577f1eefff72f3a905b5d35f5"
dependencies = [ dependencies = [
"bitcoin", "bitcoin",
"serde", "serde",
@@ -663,9 +723,9 @@ dependencies = [
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.6.2" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
dependencies = [ dependencies = [
"adler", "adler",
] ]
@@ -681,16 +741,25 @@ dependencies = [
] ]
[[package]] [[package]]
name = "once_cell" name = "object"
version = "1.17.1" version = "0.32.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]] [[package]]
name = "os_str_bytes" name = "os_str_bytes"
version = "6.5.0" version = "6.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac"
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
@@ -719,27 +788,27 @@ dependencies = [
[[package]] [[package]]
name = "paste" name = "paste"
version = "1.0.12" version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.2.0" version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.9" version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.26" version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
[[package]] [[package]]
name = "plain" name = "plain"
@@ -779,18 +848,18 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.56" version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.26" version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@@ -864,10 +933,16 @@ dependencies = [
] ]
[[package]] [[package]]
name = "rustls" name = "rustc-demangle"
version = "0.20.8" version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
[[package]]
name = "rustls"
version = "0.20.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99"
dependencies = [ dependencies = [
"log", "log",
"ring", "ring",
@@ -876,16 +951,48 @@ dependencies = [
] ]
[[package]] [[package]]
name = "ryu" name = "rustls"
version = "1.0.13" version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8"
dependencies = [
"log",
"ring",
"rustls-webpki 0.101.4",
"sct",
]
[[package]]
name = "rustls-webpki"
version = "0.100.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e98ff011474fa39949b7e5c0428f9b4937eda7da7848bbb947786b7be0b27dab"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "rustls-webpki"
version = "0.101.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "ryu"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.1.0" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]] [[package]]
name = "scroll" name = "scroll"
@@ -898,13 +1005,13 @@ dependencies = [
[[package]] [[package]]
name = "scroll_derive" name = "scroll_derive"
version = "0.11.0" version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdbda6ac5cd1321e724fa9cee216f3a61885889b896f073b8f82322789c5250e" checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 1.0.109", "syn 2.0.31",
] ]
[[package]] [[package]]
@@ -940,38 +1047,38 @@ dependencies = [
[[package]] [[package]]
name = "semver" name = "semver"
version = "1.0.17" version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
dependencies = [ dependencies = [
"serde", "serde",
] ]
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.160" version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.160" version = "1.0.188"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.14", "syn 2.0.31",
] ]
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.96" version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@@ -980,9 +1087,9 @@ dependencies = [
[[package]] [[package]]
name = "siphasher" name = "siphasher"
version = "0.3.10" version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]] [[package]]
name = "sled" name = "sled"
@@ -1002,9 +1109,9 @@ dependencies = [
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.10.0" version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
[[package]] [[package]]
name = "socks" name = "socks"
@@ -1048,9 +1155,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.14" version = "2.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcf316d5356ed6847742d036f8a39c3b8435cac10bd528a4bd461928a6ab34d5" checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1074,22 +1181,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.40" version = "1.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.40" version = "1.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.14", "syn 2.0.31",
] ]
[[package]] [[package]]
@@ -1109,25 +1216,24 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.27.0" version = "1.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9"
dependencies = [ dependencies = [
"autocfg", "backtrace",
"pin-project-lite", "pin-project-lite",
"tokio-macros", "tokio-macros",
"windows-sys",
] ]
[[package]] [[package]]
name = "tokio-macros" name = "tokio-macros"
version = "2.0.0" version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.14", "syn 2.0.31",
] ]
[[package]] [[package]]
@@ -1141,9 +1247,9 @@ dependencies = [
[[package]] [[package]]
name = "unicase" name = "unicase"
version = "2.6.0" version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89"
dependencies = [ dependencies = [
"version_check", "version_check",
] ]
@@ -1156,9 +1262,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.8" version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
[[package]] [[package]]
name = "unicode-normalization" name = "unicode-normalization"
@@ -1298,28 +1404,28 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]] [[package]]
name = "ureq" name = "ureq"
version = "2.6.2" version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "338b31dd1314f68f3aabf3ed57ab922df95ffcd902476ca7ba3c4ce7b908c46d" checksum = "0b11c96ac7ee530603dcdf68ed1557050f374ce55a5a07193ebf8cbc9f8927e9"
dependencies = [ dependencies = [
"base64", "base64 0.21.3",
"flate2", "flate2",
"log", "log",
"once_cell", "once_cell",
"rustls", "rustls 0.21.7",
"rustls-webpki 0.100.2",
"serde", "serde",
"serde_json", "serde_json",
"socks", "socks",
"url", "url",
"webpki", "webpki-roots 0.23.1",
"webpki-roots",
] ]
[[package]] [[package]]
name = "url" name = "url"
version = "2.3.1" version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"idna", "idna",
@@ -1346,9 +1452,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]] [[package]]
name = "wasm-bindgen" name = "wasm-bindgen"
version = "0.2.84" version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"wasm-bindgen-macro", "wasm-bindgen-macro",
@@ -1356,24 +1462,24 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-backend" name = "wasm-bindgen-backend"
version = "0.2.84" version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
dependencies = [ dependencies = [
"bumpalo", "bumpalo",
"log", "log",
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 1.0.109", "syn 2.0.31",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]] [[package]]
name = "wasm-bindgen-macro" name = "wasm-bindgen-macro"
version = "0.2.84" version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
dependencies = [ dependencies = [
"quote", "quote",
"wasm-bindgen-macro-support", "wasm-bindgen-macro-support",
@@ -1381,28 +1487,28 @@ dependencies = [
[[package]] [[package]]
name = "wasm-bindgen-macro-support" name = "wasm-bindgen-macro-support"
version = "0.2.84" version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 1.0.109", "syn 2.0.31",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
[[package]] [[package]]
name = "wasm-bindgen-shared" name = "wasm-bindgen-shared"
version = "0.2.84" version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.61" version = "0.3.64"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@@ -1410,9 +1516,9 @@ dependencies = [
[[package]] [[package]]
name = "webpki" name = "webpki"
version = "0.22.0" version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" checksum = "f0e74f82d49d545ad128049b7e88f6576df2da6b02e9ce565c6f533be576957e"
dependencies = [ dependencies = [
"ring", "ring",
"untrusted", "untrusted",
@@ -1427,6 +1533,15 @@ dependencies = [
"webpki", "webpki",
] ]
[[package]]
name = "webpki-roots"
version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338"
dependencies = [
"rustls-webpki 0.100.2",
]
[[package]] [[package]]
name = "weedle2" name = "weedle2"
version = "4.0.0" version = "4.0.0"
@@ -1466,69 +1581,3 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
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.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"

View File

@@ -9,4 +9,4 @@ opt-level = 'z' # Optimize for size.
lto = true # Enable Link Time Optimization lto = true # Enable Link Time Optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations. codegen-units = 1 # Reduce number of codegen units to increase optimizations.
panic = 'abort' # Abort on panic panic = 'abort' # Abort on panic
strip = true # Strip symbols from binary* strip = true # Strip symbols from binary

View File

@@ -22,6 +22,21 @@ The below directories (a separate repository in the case of bdk-swift) include i
| Swift | iOS, macOS | [bdk-swift (GitHub)] | [Readme bdk-swift] | | | Swift | iOS, macOS | [bdk-swift (GitHub)] | [Readme bdk-swift] | |
| Python | linux, macOS, Windows | [bdk-python (PyPI)] | [Readme bdk-python] | | | Python | linux, macOS, Windows | [bdk-python (PyPI)] | [Readme bdk-python] | |
## Minimum Supported Rust Version (MSRV)
This library should compile with any combination of features with Rust 1.61.0.
To build with the MSRV you will need to pin dependencies as follows:
```shell
# required for sqlite feature, hashlink 0.8.2 has MSRV 1.61.0
cargo update -p hashlink --precise "0.8.1"
# tokio 1.30.0 has MSRV 1.63.0
cargo update -p tokio --precise "1.29.1"
# flate2 1.0.27 and up do not work with Rust 1.61.0, but 1.0.26 does
cargo update -p flate2 --precise "1.0.26"
```
## Contributing ## Contributing
### Adding new structs and functions ### Adding new structs and functions
@@ -49,8 +64,8 @@ See the [UniFFI User Guide](https://mozilla.github.io/uniffi-rs/)
repositories { repositories {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
implementation("org.bitcoindevkit:bdk-android:<version>") implementation("org.bitcoindevkit:bdk-android:<version>")
} }
``` ```
@@ -60,8 +75,8 @@ dependencies {
repositories { repositories {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
implementation("org.bitcoindevkit:bdk-jvm:<version>") implementation("org.bitcoindevkit:bdk-jvm:<version>")
} }
``` ```

View File

@@ -489,6 +489,9 @@ class Wallet(
*/ */
fun getInternalAddress(addressIndex: AddressIndex): AddressInfo {} fun getInternalAddress(addressIndex: AddressIndex): AddressInfo {}
/** Return whether or not a script is part of this wallet (either internal or external). */
fun isMine(script: Script): Boolean {}
/** Return the wallet's balance, across different categories. See [Balance] for the categories. Note that this method only operates on the internal database, which first needs to be [Wallet.sync] manually. */ /** Return the wallet's balance, across different categories. See [Balance] for the categories. Note that this method only operates on the internal database, which first needs to be [Wallet.sync] manually. */
fun getBalance(): Balance {} fun getBalance(): Balance {}
@@ -782,6 +785,19 @@ class Descriptor(descriptor: String, network: Network) {
*/ */
fun newBip84Public(publicKey: DescriptorPublicKey, fingerprint: String, keychain: KeychainKind, network: Network) {} fun newBip84Public(publicKey: DescriptorPublicKey, fingerprint: String, keychain: KeychainKind, network: Network) {}
/**
* BIP86 template. Expands to wpkh(key/86'/{0,1}'/0'/{0,1}/\*)
* Since there are hardened derivation steps, this template requires a private derivable key (generally a xprv/tprv).
*/
fun newBip86(secretKey: DescriptorSecretKey, keychain: KeychainKind, network: Network) {}
/**
* BIP86 public template. Expands to wpkh(key/{0,1}/\*)
* This assumes that the key used has already been derived with m/86'/0'/0' for Mainnet or m/86'/1'/0' for Testnet.
* This template requires the parent fingerprint to populate correctly the metadata of PSBTs.
*/
fun newBip86Public(publicKey: DescriptorPublicKey, fingerprint: String, keychain: KeychainKind, network: Network) {}
/** Return the public version of the output descriptor. */ /** Return the public version of the output descriptor. */
fun asString(): String {} fun asString(): String {}
@@ -826,7 +842,10 @@ data class TxBuilderResult (
/** /**
* A bitcoin script. * A bitcoin script.
*/ */
class Script(rawOutputScript: List<UByte>) class Script(rawOutputScript: List<UByte>) {
/** Return the script as bytes. */
fun toBytes(): List<UByte> {}
}
/** /**
* A bitcoin address. * A bitcoin address.

View File

@@ -8,8 +8,8 @@ repositories {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
implementation("org.bitcoindevkit:bdk-android:<version>") implementation("org.bitcoindevkit:bdk-android:<version>")
} }
``` ```
@@ -38,8 +38,8 @@ repositories {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
} }
dependencies { dependencies {
implementation("org.bitcoindevkit:bdk-android:<version-SNAPSHOT>") implementation("org.bitcoindevkit:bdk-android:<version-SNAPSHOT>")
} }
``` ```
@@ -54,19 +54,23 @@ _Note that Kotlin version `1.6.10` or later is required to build the library._
```shell ```shell
git clone https://github.com/bitcoindevkit/bdk-ffi git clone https://github.com/bitcoindevkit/bdk-ffi
``` ```
2. Follow the "General" bdk-ffi ["Getting Started (Developer)"] instructions. 2. Follow the "General" bdk-ffi ["Getting Started (Developer)"] instructions.
3. If building on macOS install required intel and m1 jvm targets 3. Install Rust (note that we are currently building using Rust 1.67.0):
```shell
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default 1.67.0
```
4. Install required targets 4. Install required targets
```sh ```sh
rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi
``` ```
5. Install Android SDK and Build-Tools for API level 30+ 5. Install Android SDK and Build-Tools for API level 30+
6. Setup `$ANDROID_SDK_ROOT` and `$ANDROID_NDK_ROOT` path variables (which are required by the 6. Setup `$ANDROID_SDK_ROOT` and `$ANDROID_NDK_ROOT` path variables (which are required by the
build tool), for example (NDK major version 21 is required): build tool), for example (note that currently, NDK version 21.4.7075529 is required):
```shell ```shell
export ANDROID_SDK_ROOT=~/Android/Sdk export ANDROID_SDK_ROOT=~/Android/Sdk
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/21.<NDK_VERSION> export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/21.4.7075529
``` ```
7. Build kotlin bindings 7. Build kotlin bindings
```sh ```sh
# build Android library # build Android library

View File

@@ -2,4 +2,4 @@ org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
kotlin.code.style=official kotlin.code.style=official
libraryVersion=0.28.0-SNAPSHOT libraryVersion=0.30.0

View File

@@ -1,14 +1,12 @@
[package] [package]
name = "bdk-ffi" name = "bdk-ffi"
version = "0.28.0" version = "0.30.0"
authors = ["Steve Myers <steve@notmandatory.org>", "Sudarsan Balaji <sudarsan.balaji@artfuldev.com>"] authors = ["Steve Myers <steve@notmandatory.org>", "Sudarsan Balaji <sudarsan.balaji@artfuldev.com>"]
edition = "2018" edition = "2018"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
[lib] [lib]
crate-type = ["lib", "staticlib", "cdylib"] crate-type = ["lib", "staticlib", "cdylib"]
#crate-type = ["staticlib", "cdylib"]
#crate-type = ["cdylib"]
name = "bdkffi" name = "bdkffi"
[[bin]] [[bin]]
@@ -19,7 +17,7 @@ path = "uniffi-bindgen.rs"
default = ["uniffi/cli"] default = ["uniffi/cli"]
[dependencies] [dependencies]
bdk = { version = "0.28", features = ["all-keys", "use-esplora-ureq", "sqlite-bundled", "rpc"] } bdk = { version = "0.28.2", features = ["all-keys", "use-esplora-ureq", "sqlite-bundled", "rpc"] }
uniffi = { version = "0.23.0" } uniffi = { version = "0.23.0" }
[build-dependencies] [build-dependencies]

View File

@@ -221,28 +221,31 @@ interface Wallet {
[Throws=BdkError] [Throws=BdkError]
constructor(Descriptor descriptor, Descriptor? change_descriptor, Network network, DatabaseConfig database_config); constructor(Descriptor descriptor, Descriptor? change_descriptor, Network network, DatabaseConfig database_config);
Network network();
[Throws=BdkError] [Throws=BdkError]
AddressInfo get_address(AddressIndex address_index); AddressInfo get_address(AddressIndex address_index);
[Throws=BdkError] [Throws=BdkError]
AddressInfo get_internal_address(AddressIndex address_index); AddressInfo get_internal_address(AddressIndex address_index);
[Throws=BdkError]
boolean is_mine(Script script);
[Throws=BdkError]
sequence<LocalUtxo> list_unspent();
[Throws=BdkError]
sequence<TransactionDetails> list_transactions(boolean include_raw);
[Throws=BdkError] [Throws=BdkError]
Balance get_balance(); Balance get_balance();
[Throws=BdkError] [Throws=BdkError]
boolean sign([ByRef] PartiallySignedTransaction psbt, SignOptions? sign_options); boolean sign([ByRef] PartiallySignedTransaction psbt, SignOptions? sign_options);
[Throws=BdkError]
sequence<TransactionDetails> list_transactions(boolean include_raw);
Network network();
[Throws=BdkError] [Throws=BdkError]
void sync([ByRef] Blockchain blockchain, Progress? progress); void sync([ByRef] Blockchain blockchain, Progress? progress);
[Throws=BdkError]
sequence<LocalUtxo> list_unspent();
}; };
interface FeeRate { interface FeeRate {
@@ -439,6 +442,12 @@ interface Descriptor {
[Name=new_bip84_public] [Name=new_bip84_public]
constructor(DescriptorPublicKey public_key, string fingerprint, KeychainKind keychain, Network network); constructor(DescriptorPublicKey public_key, string fingerprint, KeychainKind keychain, Network network);
[Name=new_bip86]
constructor(DescriptorSecretKey secret_key, KeychainKind keychain, Network network);
[Name=new_bip86_public]
constructor(DescriptorPublicKey public_key, string fingerprint, KeychainKind keychain, Network network);
string as_string(); string as_string();
string as_string_private(); string as_string_private();
@@ -493,4 +502,6 @@ enum WitnessVersion {
interface Script { interface Script {
constructor(sequence<u8> raw_output_script); constructor(sequence<u8> raw_output_script);
sequence<u8> to_bytes();
}; };

View File

@@ -17,7 +17,7 @@ use std::path::PathBuf;
use std::sync::{Arc, Mutex, MutexGuard}; use std::sync::{Arc, Mutex, MutexGuard};
pub(crate) struct Blockchain { pub(crate) struct Blockchain {
blockchain_mutex: Mutex<AnyBlockchain>, inner_mutex: Mutex<AnyBlockchain>,
} }
impl Blockchain { impl Blockchain {
@@ -52,16 +52,16 @@ impl Blockchain {
}; };
let blockchain = AnyBlockchain::from_config(&any_blockchain_config)?; let blockchain = AnyBlockchain::from_config(&any_blockchain_config)?;
Ok(Self { Ok(Self {
blockchain_mutex: Mutex::new(blockchain), inner_mutex: Mutex::new(blockchain),
}) })
} }
pub(crate) fn get_blockchain(&self) -> MutexGuard<AnyBlockchain> { pub(crate) fn get_blockchain(&self) -> MutexGuard<AnyBlockchain> {
self.blockchain_mutex.lock().expect("blockchain") self.inner_mutex.lock().expect("blockchain")
} }
pub(crate) fn broadcast(&self, transaction: &Transaction) -> Result<(), BdkError> { pub(crate) fn broadcast(&self, transaction: &Transaction) -> Result<(), BdkError> {
let tx = &transaction.internal; let tx = &transaction.inner;
self.get_blockchain().broadcast(tx) self.get_blockchain().broadcast(tx)
} }

View File

@@ -7,10 +7,10 @@ use bdk::keys::{
DescriptorPublicKey as BdkDescriptorPublicKey, DescriptorSecretKey as BdkDescriptorSecretKey, DescriptorPublicKey as BdkDescriptorPublicKey, DescriptorSecretKey as BdkDescriptorSecretKey,
}; };
use bdk::template::{ use bdk::template::{
Bip44, Bip44Public, Bip49, Bip49Public, Bip84, Bip84Public, DescriptorTemplate, Bip44, Bip44Public, Bip49, Bip49Public, Bip84, Bip84Public, Bip86, Bip86Public,
DescriptorTemplate,
}; };
use bdk::KeychainKind; use bdk::KeychainKind;
use std::ops::Deref;
use std::str::FromStr; use std::str::FromStr;
use std::sync::Arc; use std::sync::Arc;
@@ -35,9 +35,9 @@ impl Descriptor {
keychain_kind: KeychainKind, keychain_kind: KeychainKind,
network: Network, network: Network,
) -> Self { ) -> Self {
let derivable_key = secret_key.descriptor_secret_key_mutex.lock().unwrap(); let derivable_key = &secret_key.inner;
match derivable_key.deref() { match derivable_key {
BdkDescriptorSecretKey::XPrv(descriptor_x_key) => { BdkDescriptorSecretKey::XPrv(descriptor_x_key) => {
let derivable_key = descriptor_x_key.xkey; let derivable_key = descriptor_x_key.xkey;
let (extended_descriptor, key_map, _) = let (extended_descriptor, key_map, _) =
@@ -60,9 +60,9 @@ impl Descriptor {
network: Network, network: Network,
) -> Self { ) -> Self {
let fingerprint = Fingerprint::from_str(fingerprint.as_str()).unwrap(); let fingerprint = Fingerprint::from_str(fingerprint.as_str()).unwrap();
let derivable_key = public_key.descriptor_public_key_mutex.lock().unwrap(); let derivable_key = &public_key.inner;
match derivable_key.deref() { match derivable_key {
BdkDescriptorPublicKey::XPub(descriptor_x_key) => { BdkDescriptorPublicKey::XPub(descriptor_x_key) => {
let derivable_key = descriptor_x_key.xkey; let derivable_key = descriptor_x_key.xkey;
let (extended_descriptor, key_map, _) = let (extended_descriptor, key_map, _) =
@@ -86,9 +86,9 @@ impl Descriptor {
keychain_kind: KeychainKind, keychain_kind: KeychainKind,
network: Network, network: Network,
) -> Self { ) -> Self {
let derivable_key = secret_key.descriptor_secret_key_mutex.lock().unwrap(); let derivable_key = &secret_key.inner;
match derivable_key.deref() { match derivable_key {
BdkDescriptorSecretKey::XPrv(descriptor_x_key) => { BdkDescriptorSecretKey::XPrv(descriptor_x_key) => {
let derivable_key = descriptor_x_key.xkey; let derivable_key = descriptor_x_key.xkey;
let (extended_descriptor, key_map, _) = let (extended_descriptor, key_map, _) =
@@ -111,9 +111,9 @@ impl Descriptor {
network: Network, network: Network,
) -> Self { ) -> Self {
let fingerprint = Fingerprint::from_str(fingerprint.as_str()).unwrap(); let fingerprint = Fingerprint::from_str(fingerprint.as_str()).unwrap();
let derivable_key = public_key.descriptor_public_key_mutex.lock().unwrap(); let derivable_key = &public_key.inner;
match derivable_key.deref() { match derivable_key {
BdkDescriptorPublicKey::XPub(descriptor_x_key) => { BdkDescriptorPublicKey::XPub(descriptor_x_key) => {
let derivable_key = descriptor_x_key.xkey; let derivable_key = descriptor_x_key.xkey;
let (extended_descriptor, key_map, _) = let (extended_descriptor, key_map, _) =
@@ -137,9 +137,9 @@ impl Descriptor {
keychain_kind: KeychainKind, keychain_kind: KeychainKind,
network: Network, network: Network,
) -> Self { ) -> Self {
let derivable_key = secret_key.descriptor_secret_key_mutex.lock().unwrap(); let derivable_key = &secret_key.inner;
match derivable_key.deref() { match derivable_key {
BdkDescriptorSecretKey::XPrv(descriptor_x_key) => { BdkDescriptorSecretKey::XPrv(descriptor_x_key) => {
let derivable_key = descriptor_x_key.xkey; let derivable_key = descriptor_x_key.xkey;
let (extended_descriptor, key_map, _) = let (extended_descriptor, key_map, _) =
@@ -162,9 +162,9 @@ impl Descriptor {
network: Network, network: Network,
) -> Self { ) -> Self {
let fingerprint = Fingerprint::from_str(fingerprint.as_str()).unwrap(); let fingerprint = Fingerprint::from_str(fingerprint.as_str()).unwrap();
let derivable_key = public_key.descriptor_public_key_mutex.lock().unwrap(); let derivable_key = &public_key.inner;
match derivable_key.deref() { match derivable_key {
BdkDescriptorPublicKey::XPub(descriptor_x_key) => { BdkDescriptorPublicKey::XPub(descriptor_x_key) => {
let derivable_key = descriptor_x_key.xkey; let derivable_key = descriptor_x_key.xkey;
let (extended_descriptor, key_map, _) = let (extended_descriptor, key_map, _) =
@@ -183,6 +183,57 @@ impl Descriptor {
} }
} }
pub(crate) fn new_bip86(
secret_key: Arc<DescriptorSecretKey>,
keychain_kind: KeychainKind,
network: Network,
) -> Self {
let derivable_key = &secret_key.inner;
match derivable_key {
BdkDescriptorSecretKey::XPrv(descriptor_x_key) => {
let derivable_key = descriptor_x_key.xkey;
let (extended_descriptor, key_map, _) =
Bip86(derivable_key, keychain_kind).build(network).unwrap();
Self {
extended_descriptor,
key_map,
}
}
BdkDescriptorSecretKey::Single(_) => {
unreachable!()
}
}
}
pub(crate) fn new_bip86_public(
public_key: Arc<DescriptorPublicKey>,
fingerprint: String,
keychain_kind: KeychainKind,
network: Network,
) -> Self {
let fingerprint = Fingerprint::from_str(fingerprint.as_str()).unwrap();
let derivable_key = &public_key.inner;
match derivable_key {
BdkDescriptorPublicKey::XPub(descriptor_x_key) => {
let derivable_key = descriptor_x_key.xkey;
let (extended_descriptor, key_map, _) =
Bip86Public(derivable_key, fingerprint, keychain_kind)
.build(network)
.unwrap();
Self {
extended_descriptor,
key_map,
}
}
BdkDescriptorPublicKey::Single(_) => {
unreachable!()
}
}
}
pub(crate) fn as_string_private(&self) -> String { pub(crate) fn as_string_private(&self) -> String {
let descriptor = &self.extended_descriptor; let descriptor = &self.extended_descriptor;
let key_map = &self.key_map; let key_map = &self.key_map;
@@ -239,17 +290,27 @@ mod test {
.as_public(); .as_public();
println!("Public 84: {}", handmade_public_84.as_string()); println!("Public 84: {}", handmade_public_84.as_string());
// Public 84: [d1d04177/84'/1'/0']tpubDDNxbq17egjFk2edjv8oLnzxk52zny9aAYNv9CMqTzA4mQDiQq818sEkNe9Gzmd4QU8558zftqbfoVBDQorG3E4Wq26tB2JeE4KUoahLkx6/* // Public 84: [d1d04177/84'/1'/0']tpubDDNxbq17egjFk2edjv8oLnzxk52zny9aAYNv9CMqTzA4mQDiQq818sEkNe9Gzmd4QU8558zftqbfoVBDQorG3E4Wq26tB2JeE4KUoahLkx6/*
let handmade_public_86 = master
.derive(Arc::new(
DerivationPath::new("m/86h/1h/0h".to_string()).unwrap(),
))
.unwrap()
.as_public();
println!("Public 86: {}", handmade_public_86.as_string());
// Public 86: [d1d04177/86'/1'/0']tpubDCJzjbcGbdEfXMWaL6QmgVmuSfXkrue7m2YNoacWwyc7a2XjXaKojRqNEbo41CFL3PyYmKdhwg2fkGpLX4SQCbQjCGxAkWHJTw9WEeenrJb/*
let template_private_44 = let template_private_44 =
Descriptor::new_bip44(master.clone(), KeychainKind::External, Network::Testnet); Descriptor::new_bip44(master.clone(), KeychainKind::External, Network::Testnet);
let template_private_49 = let template_private_49 =
Descriptor::new_bip49(master.clone(), KeychainKind::External, Network::Testnet); Descriptor::new_bip49(master.clone(), KeychainKind::External, Network::Testnet);
let template_private_84 = let template_private_84 =
Descriptor::new_bip84(master, KeychainKind::External, Network::Testnet); Descriptor::new_bip84(master.clone(), KeychainKind::External, Network::Testnet);
let template_private_86 =
Descriptor::new_bip86(master, KeychainKind::External, Network::Testnet);
// the extended public keys are the same when creating them manually as they are with the templates // the extended public keys are the same when creating them manually as they are with the templates
println!("Template 49: {}", template_private_49.as_string()); println!("Template 49: {}", template_private_49.as_string());
println!("Template 44: {}", template_private_44.as_string()); println!("Template 44: {}", template_private_44.as_string());
println!("Template 84: {}", template_private_84.as_string()); println!("Template 84: {}", template_private_84.as_string());
// for the public versions of the templates these are incorrect, bug report and fix in bitcoindevkit/bdk#817 and bitcoindevkit/bdk#818 println!("Template 86: {}", template_private_86.as_string());
let template_public_44 = Descriptor::new_bip44_public( let template_public_44 = Descriptor::new_bip44_public(
handmade_public_44, handmade_public_44,
"d1d04177".to_string(), "d1d04177".to_string(),
@@ -268,9 +329,16 @@ mod test {
KeychainKind::External, KeychainKind::External,
Network::Testnet, Network::Testnet,
); );
let template_public_86 = Descriptor::new_bip86_public(
handmade_public_86,
"d1d04177".to_string(),
KeychainKind::External,
Network::Testnet,
);
println!("Template public 49: {}", template_public_49.as_string()); println!("Template public 49: {}", template_public_49.as_string());
println!("Template public 44: {}", template_public_44.as_string()); println!("Template public 44: {}", template_public_44.as_string());
println!("Template public 84: {}", template_public_84.as_string()); println!("Template public 84: {}", template_public_84.as_string());
println!("Template public 86: {}", template_public_86.as_string());
// when using a public key, both as_string and as_string_private return the same string // when using a public key, both as_string and as_string_private return the same string
assert_eq!( assert_eq!(
template_public_44.as_string_private(), template_public_44.as_string_private(),
@@ -284,6 +352,10 @@ mod test {
template_public_84.as_string_private(), template_public_84.as_string_private(),
template_public_84.as_string() template_public_84.as_string()
); );
assert_eq!(
template_public_86.as_string_private(),
template_public_86.as_string()
);
// when using as_string on a private key, we get the same result as when using it on a public key // when using as_string on a private key, we get the same result as when using it on a public key
assert_eq!( assert_eq!(
template_private_44.as_string(), template_private_44.as_string(),
@@ -297,6 +369,10 @@ mod test {
template_private_84.as_string(), template_private_84.as_string(),
template_public_84.as_string() template_public_84.as_string()
); );
assert_eq!(
template_private_86.as_string(),
template_public_86.as_string()
);
} }
#[test] #[test]
fn test_descriptor_from_string() { fn test_descriptor_from_string() {

View File

@@ -17,7 +17,7 @@ use std::sync::{Arc, Mutex};
/// Mnemonic phrases are a human-readable version of the private keys. /// Mnemonic phrases are a human-readable version of the private keys.
/// Supported number of words are 12, 15, 18, 21 and 24. /// Supported number of words are 12, 15, 18, 21 and 24.
pub(crate) struct Mnemonic { pub(crate) struct Mnemonic {
internal: BdkMnemonic, inner: BdkMnemonic,
} }
impl Mnemonic { impl Mnemonic {
@@ -26,13 +26,13 @@ impl Mnemonic {
let generated_key: GeneratedKey<_, BareCtx> = let generated_key: GeneratedKey<_, BareCtx> =
BdkMnemonic::generate((word_count, Language::English)).unwrap(); BdkMnemonic::generate((word_count, Language::English)).unwrap();
let mnemonic = BdkMnemonic::parse_in(Language::English, generated_key.to_string()).unwrap(); let mnemonic = BdkMnemonic::parse_in(Language::English, generated_key.to_string()).unwrap();
Mnemonic { internal: mnemonic } Mnemonic { inner: mnemonic }
} }
/// Parse a Mnemonic with given string /// Parse a Mnemonic with given string
pub(crate) fn from_string(mnemonic: String) -> Result<Self, BdkError> { pub(crate) fn from_string(mnemonic: String) -> Result<Self, BdkError> {
BdkMnemonic::from_str(&mnemonic) BdkMnemonic::from_str(&mnemonic)
.map(|m| Mnemonic { internal: m }) .map(|m| Mnemonic { inner: m })
.map_err(|e| BdkError::Generic(e.to_string())) .map_err(|e| BdkError::Generic(e.to_string()))
} }
@@ -40,25 +40,25 @@ impl Mnemonic {
/// Entropy must be a multiple of 32 bits (4 bytes) and 128-256 bits in length. /// Entropy must be a multiple of 32 bits (4 bytes) and 128-256 bits in length.
pub(crate) fn from_entropy(entropy: Vec<u8>) -> Result<Self, BdkError> { pub(crate) fn from_entropy(entropy: Vec<u8>) -> Result<Self, BdkError> {
BdkMnemonic::from_entropy(entropy.as_slice()) BdkMnemonic::from_entropy(entropy.as_slice())
.map(|m| Mnemonic { internal: m }) .map(|m| Mnemonic { inner: m })
.map_err(|e| BdkError::Generic(e.to_string())) .map_err(|e| BdkError::Generic(e.to_string()))
} }
/// Returns Mnemonic as string /// Returns Mnemonic as string
pub(crate) fn as_string(&self) -> String { pub(crate) fn as_string(&self) -> String {
self.internal.to_string() self.inner.to_string()
} }
} }
pub(crate) struct DerivationPath { pub(crate) struct DerivationPath {
derivation_path_mutex: Mutex<BdkDerivationPath>, inner_mutex: Mutex<BdkDerivationPath>,
} }
impl DerivationPath { impl DerivationPath {
pub(crate) fn new(path: String) -> Result<Self, BdkError> { pub(crate) fn new(path: String) -> Result<Self, BdkError> {
BdkDerivationPath::from_str(&path) BdkDerivationPath::from_str(&path)
.map(|x| DerivationPath { .map(|x| DerivationPath {
derivation_path_mutex: Mutex::new(x), inner_mutex: Mutex::new(x),
}) })
.map_err(|e| BdkError::Generic(e.to_string())) .map_err(|e| BdkError::Generic(e.to_string()))
} }
@@ -66,12 +66,12 @@ impl DerivationPath {
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct DescriptorSecretKey { pub(crate) struct DescriptorSecretKey {
pub(crate) descriptor_secret_key_mutex: Mutex<BdkDescriptorSecretKey>, pub(crate) inner: BdkDescriptorSecretKey,
} }
impl DescriptorSecretKey { impl DescriptorSecretKey {
pub(crate) fn new(network: Network, mnemonic: Arc<Mnemonic>, password: Option<String>) -> Self { pub(crate) fn new(network: Network, mnemonic: Arc<Mnemonic>, password: Option<String>) -> Self {
let mnemonic = mnemonic.internal.clone(); let mnemonic = mnemonic.inner.clone();
let xkey: ExtendedKey = (mnemonic, password).into_extended_key().unwrap(); let xkey: ExtendedKey = (mnemonic, password).into_extended_key().unwrap();
let descriptor_secret_key = BdkDescriptorSecretKey::XPrv(DescriptorXKey { let descriptor_secret_key = BdkDescriptorSecretKey::XPrv(DescriptorXKey {
origin: None, origin: None,
@@ -80,7 +80,7 @@ impl DescriptorSecretKey {
wildcard: bdk::descriptor::Wildcard::Unhardened, wildcard: bdk::descriptor::Wildcard::Unhardened,
}); });
Self { Self {
descriptor_secret_key_mutex: Mutex::new(descriptor_secret_key), inner: descriptor_secret_key,
} }
} }
@@ -88,15 +88,15 @@ impl DescriptorSecretKey {
let descriptor_secret_key = BdkDescriptorSecretKey::from_str(private_key.as_str()) let descriptor_secret_key = BdkDescriptorSecretKey::from_str(private_key.as_str())
.map_err(|e| BdkError::Generic(e.to_string()))?; .map_err(|e| BdkError::Generic(e.to_string()))?;
Ok(Self { Ok(Self {
descriptor_secret_key_mutex: Mutex::new(descriptor_secret_key), inner: descriptor_secret_key,
}) })
} }
pub(crate) fn derive(&self, path: Arc<DerivationPath>) -> Result<Arc<Self>, BdkError> { pub(crate) fn derive(&self, path: Arc<DerivationPath>) -> Result<Arc<Self>, BdkError> {
let secp = Secp256k1::new(); let secp = Secp256k1::new();
let descriptor_secret_key = self.descriptor_secret_key_mutex.lock().unwrap(); let descriptor_secret_key = &self.inner;
let path = path.derivation_path_mutex.lock().unwrap().deref().clone(); let path = path.inner_mutex.lock().unwrap().deref().clone();
match descriptor_secret_key.deref() { match descriptor_secret_key {
BdkDescriptorSecretKey::XPrv(descriptor_x_key) => { BdkDescriptorSecretKey::XPrv(descriptor_x_key) => {
let derived_xprv = descriptor_x_key.xkey.derive_priv(&secp, &path)?; let derived_xprv = descriptor_x_key.xkey.derive_priv(&secp, &path)?;
let key_source = match descriptor_x_key.origin.clone() { let key_source = match descriptor_x_key.origin.clone() {
@@ -110,7 +110,7 @@ impl DescriptorSecretKey {
wildcard: descriptor_x_key.wildcard, wildcard: descriptor_x_key.wildcard,
}); });
Ok(Arc::new(Self { Ok(Arc::new(Self {
descriptor_secret_key_mutex: Mutex::new(derived_descriptor_secret_key), inner: derived_descriptor_secret_key,
})) }))
} }
BdkDescriptorSecretKey::Single(_) => Err(BdkError::Generic( BdkDescriptorSecretKey::Single(_) => Err(BdkError::Generic(
@@ -120,9 +120,9 @@ impl DescriptorSecretKey {
} }
pub(crate) fn extend(&self, path: Arc<DerivationPath>) -> Result<Arc<Self>, BdkError> { pub(crate) fn extend(&self, path: Arc<DerivationPath>) -> Result<Arc<Self>, BdkError> {
let descriptor_secret_key = self.descriptor_secret_key_mutex.lock().unwrap(); let descriptor_secret_key = &self.inner;
let path = path.derivation_path_mutex.lock().unwrap().deref().clone(); let path = path.inner_mutex.lock().unwrap().deref().clone();
match descriptor_secret_key.deref() { match descriptor_secret_key {
BdkDescriptorSecretKey::XPrv(descriptor_x_key) => { BdkDescriptorSecretKey::XPrv(descriptor_x_key) => {
let extended_path = descriptor_x_key.derivation_path.extend(path); let extended_path = descriptor_x_key.derivation_path.extend(path);
let extended_descriptor_secret_key = BdkDescriptorSecretKey::XPrv(DescriptorXKey { let extended_descriptor_secret_key = BdkDescriptorSecretKey::XPrv(DescriptorXKey {
@@ -132,7 +132,7 @@ impl DescriptorSecretKey {
wildcard: descriptor_x_key.wildcard, wildcard: descriptor_x_key.wildcard,
}); });
Ok(Arc::new(Self { Ok(Arc::new(Self {
descriptor_secret_key_mutex: Mutex::new(extended_descriptor_secret_key), inner: extended_descriptor_secret_key,
})) }))
} }
BdkDescriptorSecretKey::Single(_) => Err(BdkError::Generic( BdkDescriptorSecretKey::Single(_) => Err(BdkError::Generic(
@@ -143,21 +143,16 @@ impl DescriptorSecretKey {
pub(crate) fn as_public(&self) -> Arc<DescriptorPublicKey> { pub(crate) fn as_public(&self) -> Arc<DescriptorPublicKey> {
let secp = Secp256k1::new(); let secp = Secp256k1::new();
let descriptor_public_key = self let descriptor_public_key = self.inner.to_public(&secp).unwrap();
.descriptor_secret_key_mutex
.lock()
.unwrap()
.to_public(&secp)
.unwrap();
Arc::new(DescriptorPublicKey { Arc::new(DescriptorPublicKey {
descriptor_public_key_mutex: Mutex::new(descriptor_public_key), inner: descriptor_public_key,
}) })
} }
/// Get the private key as bytes. /// Get the private key as bytes.
pub(crate) fn secret_bytes(&self) -> Vec<u8> { pub(crate) fn secret_bytes(&self) -> Vec<u8> {
let descriptor_secret_key = self.descriptor_secret_key_mutex.lock().unwrap(); let inner = &self.inner;
let secret_bytes: Vec<u8> = match descriptor_secret_key.deref() { let secret_bytes: Vec<u8> = match inner.deref() {
BdkDescriptorSecretKey::XPrv(descriptor_x_key) => { BdkDescriptorSecretKey::XPrv(descriptor_x_key) => {
descriptor_x_key.xkey.private_key.secret_bytes().to_vec() descriptor_x_key.xkey.private_key.secret_bytes().to_vec()
} }
@@ -170,13 +165,13 @@ impl DescriptorSecretKey {
} }
pub(crate) fn as_string(&self) -> String { pub(crate) fn as_string(&self) -> String {
self.descriptor_secret_key_mutex.lock().unwrap().to_string() self.inner.to_string()
} }
} }
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct DescriptorPublicKey { pub(crate) struct DescriptorPublicKey {
pub(crate) descriptor_public_key_mutex: Mutex<BdkDescriptorPublicKey>, pub(crate) inner: BdkDescriptorPublicKey,
} }
impl DescriptorPublicKey { impl DescriptorPublicKey {
@@ -184,14 +179,14 @@ impl DescriptorPublicKey {
let descriptor_public_key = BdkDescriptorPublicKey::from_str(public_key.as_str()) let descriptor_public_key = BdkDescriptorPublicKey::from_str(public_key.as_str())
.map_err(|e| BdkError::Generic(e.to_string()))?; .map_err(|e| BdkError::Generic(e.to_string()))?;
Ok(Self { Ok(Self {
descriptor_public_key_mutex: Mutex::new(descriptor_public_key), inner: descriptor_public_key,
}) })
} }
pub(crate) fn derive(&self, path: Arc<DerivationPath>) -> Result<Arc<Self>, BdkError> { pub(crate) fn derive(&self, path: Arc<DerivationPath>) -> Result<Arc<Self>, BdkError> {
let secp = Secp256k1::new(); let secp = Secp256k1::new();
let descriptor_public_key = self.descriptor_public_key_mutex.lock().unwrap(); let descriptor_public_key = &self.inner;
let path = path.derivation_path_mutex.lock().unwrap().deref().clone(); let path = path.inner_mutex.lock().unwrap().deref().clone();
match descriptor_public_key.deref() { match descriptor_public_key.deref() {
BdkDescriptorPublicKey::XPub(descriptor_x_key) => { BdkDescriptorPublicKey::XPub(descriptor_x_key) => {
@@ -207,7 +202,7 @@ impl DescriptorPublicKey {
wildcard: descriptor_x_key.wildcard, wildcard: descriptor_x_key.wildcard,
}); });
Ok(Arc::new(Self { Ok(Arc::new(Self {
descriptor_public_key_mutex: Mutex::new(derived_descriptor_public_key), inner: derived_descriptor_public_key,
})) }))
} }
BdkDescriptorPublicKey::Single(_) => Err(BdkError::Generic( BdkDescriptorPublicKey::Single(_) => Err(BdkError::Generic(
@@ -217,8 +212,8 @@ impl DescriptorPublicKey {
} }
pub(crate) fn extend(&self, path: Arc<DerivationPath>) -> Result<Arc<Self>, BdkError> { pub(crate) fn extend(&self, path: Arc<DerivationPath>) -> Result<Arc<Self>, BdkError> {
let descriptor_public_key = self.descriptor_public_key_mutex.lock().unwrap(); let descriptor_public_key = &self.inner;
let path = path.derivation_path_mutex.lock().unwrap().deref().clone(); let path = path.inner_mutex.lock().unwrap().deref().clone();
match descriptor_public_key.deref() { match descriptor_public_key.deref() {
BdkDescriptorPublicKey::XPub(descriptor_x_key) => { BdkDescriptorPublicKey::XPub(descriptor_x_key) => {
let extended_path = descriptor_x_key.derivation_path.extend(path); let extended_path = descriptor_x_key.derivation_path.extend(path);
@@ -229,7 +224,7 @@ impl DescriptorPublicKey {
wildcard: descriptor_x_key.wildcard, wildcard: descriptor_x_key.wildcard,
}); });
Ok(Arc::new(Self { Ok(Arc::new(Self {
descriptor_public_key_mutex: Mutex::new(extended_descriptor_public_key), inner: extended_descriptor_public_key,
})) }))
} }
BdkDescriptorPublicKey::Single(_) => Err(BdkError::Generic( BdkDescriptorPublicKey::Single(_) => Err(BdkError::Generic(
@@ -239,7 +234,7 @@ impl DescriptorPublicKey {
} }
pub(crate) fn as_string(&self) -> String { pub(crate) fn as_string(&self) -> String {
self.descriptor_public_key_mutex.lock().unwrap().to_string() self.inner.to_string()
} }
} }
@@ -254,7 +249,7 @@ mod test {
use bdk::bitcoin::Network; use bdk::bitcoin::Network;
use std::sync::Arc; use std::sync::Arc;
fn get_descriptor_secret_key() -> DescriptorSecretKey { fn get_inner() -> DescriptorSecretKey {
let mnemonic = Mnemonic::from_string("chaos fabric time speed sponsor all flat solution wisdom trophy crack object robot pave observe combine where aware bench orient secret primary cable detect".to_string()).unwrap(); let mnemonic = Mnemonic::from_string("chaos fabric time speed sponsor all flat solution wisdom trophy crack object robot pave observe combine where aware bench orient secret primary cable detect".to_string()).unwrap();
DescriptorSecretKey::new(Network::Testnet, Arc::new(mnemonic), None) DescriptorSecretKey::new(Network::Testnet, Arc::new(mnemonic), None)
} }
@@ -293,14 +288,14 @@ mod test {
#[test] #[test]
fn test_generate_descriptor_secret_key() { fn test_generate_descriptor_secret_key() {
let master_dsk = get_descriptor_secret_key(); let master_dsk = get_inner();
assert_eq!(master_dsk.as_string(), "tprv8ZgxMBicQKsPdWuqM1t1CDRvQtQuBPyfL6GbhQwtxDKgUAVPbxmj71pRA8raTqLrec5LyTs5TqCxdABcZr77bt2KyWA5bizJHnC4g4ysm4h/*"); assert_eq!(master_dsk.as_string(), "tprv8ZgxMBicQKsPdWuqM1t1CDRvQtQuBPyfL6GbhQwtxDKgUAVPbxmj71pRA8raTqLrec5LyTs5TqCxdABcZr77bt2KyWA5bizJHnC4g4ysm4h/*");
assert_eq!(master_dsk.as_public().as_string(), "tpubD6NzVbkrYhZ4WywdEfYbbd62yuvqLjAZuPsNyvzCNV85JekAEMbKHWSHLF9h3j45SxewXDcLv328B1SEZrxg4iwGfmdt1pDFjZiTkGiFqGa/*"); assert_eq!(master_dsk.as_public().as_string(), "tpubD6NzVbkrYhZ4WywdEfYbbd62yuvqLjAZuPsNyvzCNV85JekAEMbKHWSHLF9h3j45SxewXDcLv328B1SEZrxg4iwGfmdt1pDFjZiTkGiFqGa/*");
} }
#[test] #[test]
fn test_derive_self() { fn test_derive_self() {
let master_dsk = get_descriptor_secret_key(); let master_dsk = get_inner();
let derived_dsk: &DescriptorSecretKey = &derive_dsk(&master_dsk, "m").unwrap(); let derived_dsk: &DescriptorSecretKey = &derive_dsk(&master_dsk, "m").unwrap();
assert_eq!(derived_dsk.as_string(), "[d1d04177]tprv8ZgxMBicQKsPdWuqM1t1CDRvQtQuBPyfL6GbhQwtxDKgUAVPbxmj71pRA8raTqLrec5LyTs5TqCxdABcZr77bt2KyWA5bizJHnC4g4ysm4h/*"); assert_eq!(derived_dsk.as_string(), "[d1d04177]tprv8ZgxMBicQKsPdWuqM1t1CDRvQtQuBPyfL6GbhQwtxDKgUAVPbxmj71pRA8raTqLrec5LyTs5TqCxdABcZr77bt2KyWA5bizJHnC4g4ysm4h/*");
let master_dpk: &DescriptorPublicKey = &master_dsk.as_public(); let master_dpk: &DescriptorPublicKey = &master_dsk.as_public();
@@ -310,7 +305,7 @@ mod test {
#[test] #[test]
fn test_derive_descriptors_keys() { fn test_derive_descriptors_keys() {
let master_dsk = get_descriptor_secret_key(); let master_dsk = get_inner();
let derived_dsk: &DescriptorSecretKey = &derive_dsk(&master_dsk, "m/0").unwrap(); let derived_dsk: &DescriptorSecretKey = &derive_dsk(&master_dsk, "m/0").unwrap();
assert_eq!(derived_dsk.as_string(), "[d1d04177/0]tprv8d7Y4JLmD25jkKbyDZXcdoPHu1YtMHuH21qeN7mFpjfumtSU7eZimFYUCSa3MYzkEYfSNRBV34GEr2QXwZCMYRZ7M1g6PUtiLhbJhBZEGYJ/*"); assert_eq!(derived_dsk.as_string(), "[d1d04177/0]tprv8d7Y4JLmD25jkKbyDZXcdoPHu1YtMHuH21qeN7mFpjfumtSU7eZimFYUCSa3MYzkEYfSNRBV34GEr2QXwZCMYRZ7M1g6PUtiLhbJhBZEGYJ/*");
let master_dpk: &DescriptorPublicKey = &master_dsk.as_public(); let master_dpk: &DescriptorPublicKey = &master_dsk.as_public();
@@ -320,7 +315,7 @@ mod test {
#[test] #[test]
fn test_extend_descriptor_keys() { fn test_extend_descriptor_keys() {
let master_dsk = get_descriptor_secret_key(); let master_dsk = get_inner();
let extended_dsk: &DescriptorSecretKey = &extend_dsk(&master_dsk, "m/0").unwrap(); let extended_dsk: &DescriptorSecretKey = &extend_dsk(&master_dsk, "m/0").unwrap();
assert_eq!(extended_dsk.as_string(), "tprv8ZgxMBicQKsPdWuqM1t1CDRvQtQuBPyfL6GbhQwtxDKgUAVPbxmj71pRA8raTqLrec5LyTs5TqCxdABcZr77bt2KyWA5bizJHnC4g4ysm4h/0/*"); assert_eq!(extended_dsk.as_string(), "tprv8ZgxMBicQKsPdWuqM1t1CDRvQtQuBPyfL6GbhQwtxDKgUAVPbxmj71pRA8raTqLrec5LyTs5TqCxdABcZr77bt2KyWA5bizJHnC4g4ysm4h/0/*");
let master_dpk: &DescriptorPublicKey = &master_dsk.as_public(); let master_dpk: &DescriptorPublicKey = &master_dsk.as_public();
@@ -334,7 +329,7 @@ mod test {
} }
#[test] #[test]
fn test_from_str_descriptor_secret_key() { fn test_from_str_inner() {
let key1 = "L2wTu6hQrnDMiFNWA5na6jB12ErGQqtXwqpSL7aWquJaZG8Ai3ch"; let key1 = "L2wTu6hQrnDMiFNWA5na6jB12ErGQqtXwqpSL7aWquJaZG8Ai3ch";
let key2 = "tprv8ZgxMBicQKsPcwcD4gSnMti126ZiETsuX7qwrtMypr6FBwAP65puFn4v6c3jrN9VwtMRMph6nyT63NrfUL4C3nBzPcduzVSuHD7zbX2JKVc/1/1/1/*"; let key2 = "tprv8ZgxMBicQKsPcwcD4gSnMti126ZiETsuX7qwrtMypr6FBwAP65puFn4v6c3jrN9VwtMRMph6nyT63NrfUL4C3nBzPcduzVSuHD7zbX2JKVc/1/1/1/*";
let private_descriptor_key1 = DescriptorSecretKey::from_string(key1.to_string()).unwrap(); let private_descriptor_key1 = DescriptorSecretKey::from_string(key1.to_string()).unwrap();
@@ -347,8 +342,8 @@ mod test {
} }
#[test] #[test]
fn test_derive_and_extend_descriptor_secret_key() { fn test_derive_and_extend_inner() {
let master_dsk = get_descriptor_secret_key(); let master_dsk = get_inner();
// derive DescriptorSecretKey with path "m/0" from master // derive DescriptorSecretKey with path "m/0" from master
let derived_dsk: &DescriptorSecretKey = &derive_dsk(&master_dsk, "m/0").unwrap(); let derived_dsk: &DescriptorSecretKey = &derive_dsk(&master_dsk, "m/0").unwrap();
assert_eq!(derived_dsk.as_string(), "[d1d04177/0]tprv8d7Y4JLmD25jkKbyDZXcdoPHu1YtMHuH21qeN7mFpjfumtSU7eZimFYUCSa3MYzkEYfSNRBV34GEr2QXwZCMYRZ7M1g6PUtiLhbJhBZEGYJ/*"); assert_eq!(derived_dsk.as_string(), "[d1d04177/0]tprv8d7Y4JLmD25jkKbyDZXcdoPHu1YtMHuH21qeN7mFpjfumtSU7eZimFYUCSa3MYzkEYfSNRBV34GEr2QXwZCMYRZ7M1g6PUtiLhbJhBZEGYJ/*");
@@ -359,14 +354,14 @@ mod test {
#[test] #[test]
fn test_derive_hardened_path_using_public() { fn test_derive_hardened_path_using_public() {
let master_dpk = get_descriptor_secret_key().as_public(); let master_dpk = get_inner().as_public();
let derived_dpk = &derive_dpk(&master_dpk, "m/84h/1h/0h"); let derived_dpk = &derive_dpk(&master_dpk, "m/84h/1h/0h");
assert!(derived_dpk.is_err()); assert!(derived_dpk.is_err());
} }
#[test] #[test]
fn test_retrieve_master_secret_key() { fn test_retrieve_master_secret_key() {
let master_dpk = get_descriptor_secret_key(); let master_dpk = get_inner();
let master_private_key = master_dpk.secret_bytes().to_hex(); let master_private_key = master_dpk.secret_bytes().to_hex();
assert_eq!( assert_eq!(
master_private_key, master_private_key,

View File

@@ -203,7 +203,7 @@ impl From<&BdkTxOut> for TxOut {
TxOut { TxOut {
value: tx_out.value, value: tx_out.value,
script_pubkey: Arc::new(Script { script_pubkey: Arc::new(Script {
script: tx_out.script_pubkey.clone(), inner: tx_out.script_pubkey.clone(),
}), }),
} }
} }
@@ -226,7 +226,7 @@ impl From<BdkLocalUtxo> for LocalUtxo {
txout: TxOut { txout: TxOut {
value: local_utxo.txout.value, value: local_utxo.txout.value,
script_pubkey: Arc::new(Script { script_pubkey: Arc::new(Script {
script: local_utxo.txout.script_pubkey, inner: local_utxo.txout.script_pubkey,
}), }),
}, },
keychain: local_utxo.keychain, keychain: local_utxo.keychain,
@@ -275,7 +275,7 @@ impl From<&BdkTxIn> for TxIn {
vout: tx_in.previous_output.vout, vout: tx_in.previous_output.vout,
}, },
script_sig: Arc::new(Script { script_sig: Arc::new(Script {
script: tx_in.script_sig.clone(), inner: tx_in.script_sig.clone(),
}), }),
sequence: tx_in.sequence.0, sequence: tx_in.sequence.0,
witness: tx_in.witness.to_vec(), witness: tx_in.witness.to_vec(),
@@ -286,93 +286,93 @@ impl From<&BdkTxIn> for TxIn {
/// A Bitcoin transaction. /// A Bitcoin transaction.
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub struct Transaction { pub struct Transaction {
internal: BdkTransaction, inner: BdkTransaction,
} }
impl Transaction { impl Transaction {
fn new(transaction_bytes: Vec<u8>) -> Result<Self, BdkError> { fn new(transaction_bytes: Vec<u8>) -> Result<Self, BdkError> {
let mut decoder = Cursor::new(transaction_bytes); let mut decoder = Cursor::new(transaction_bytes);
let tx: BdkTransaction = BdkTransaction::consensus_decode(&mut decoder)?; let tx: BdkTransaction = BdkTransaction::consensus_decode(&mut decoder)?;
Ok(Transaction { internal: tx }) Ok(Transaction { inner: tx })
} }
fn txid(&self) -> String { fn txid(&self) -> String {
self.internal.txid().to_string() self.inner.txid().to_string()
} }
fn weight(&self) -> u64 { fn weight(&self) -> u64 {
self.internal.weight() as u64 self.inner.weight() as u64
} }
fn size(&self) -> u64 { fn size(&self) -> u64 {
self.internal.size() as u64 self.inner.size() as u64
} }
fn vsize(&self) -> u64 { fn vsize(&self) -> u64 {
self.internal.vsize() as u64 self.inner.vsize() as u64
} }
fn serialize(&self) -> Vec<u8> { fn serialize(&self) -> Vec<u8> {
self.internal.serialize() self.inner.serialize()
} }
fn is_coin_base(&self) -> bool { fn is_coin_base(&self) -> bool {
self.internal.is_coin_base() self.inner.is_coin_base()
} }
fn is_explicitly_rbf(&self) -> bool { fn is_explicitly_rbf(&self) -> bool {
self.internal.is_explicitly_rbf() self.inner.is_explicitly_rbf()
} }
fn is_lock_time_enabled(&self) -> bool { fn is_lock_time_enabled(&self) -> bool {
self.internal.is_lock_time_enabled() self.inner.is_lock_time_enabled()
} }
fn version(&self) -> i32 { fn version(&self) -> i32 {
self.internal.version self.inner.version
} }
fn lock_time(&self) -> u32 { fn lock_time(&self) -> u32 {
self.internal.lock_time.0 self.inner.lock_time.0
} }
fn input(&self) -> Vec<TxIn> { fn input(&self) -> Vec<TxIn> {
self.internal.input.iter().map(|x| x.into()).collect() self.inner.input.iter().map(|x| x.into()).collect()
} }
fn output(&self) -> Vec<TxOut> { fn output(&self) -> Vec<TxOut> {
self.internal.output.iter().map(|x| x.into()).collect() self.inner.output.iter().map(|x| x.into()).collect()
} }
} }
impl From<BdkTransaction> for Transaction { impl From<BdkTransaction> for Transaction {
fn from(tx: BdkTransaction) -> Self { fn from(tx: BdkTransaction) -> Self {
Transaction { internal: tx } Transaction { inner: tx }
} }
} }
/// A Bitcoin address. /// A Bitcoin address.
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
pub struct Address { pub struct Address {
address: BdkAddress, inner: BdkAddress,
} }
impl Address { impl Address {
fn new(address: String) -> Result<Self, BdkError> { fn new(address: String) -> Result<Self, BdkError> {
BdkAddress::from_str(address.as_str()) BdkAddress::from_str(address.as_str())
.map(|a| Address { address: a }) .map(|a| Address { inner: a })
.map_err(|e| BdkError::Generic(e.to_string())) .map_err(|e| BdkError::Generic(e.to_string()))
} }
/// alternative constructor /// alternative constructor
fn from_script(script: Arc<Script>, network: Network) -> Result<Self, BdkError> { fn from_script(script: Arc<Script>, network: Network) -> Result<Self, BdkError> {
BdkAddress::from_script(&script.script, network) BdkAddress::from_script(&script.inner, network)
.map(|a| Address { address: a }) .map(|a| Address { inner: a })
.map_err(|e| BdkError::Generic(e.to_string())) .map_err(|e| BdkError::Generic(e.to_string()))
} }
fn payload(&self) -> Payload { fn payload(&self) -> Payload {
match &self.address.payload.clone() { match &self.inner.payload.clone() {
BdkPayload::PubkeyHash(pubkey_hash) => Payload::PubkeyHash { BdkPayload::PubkeyHash(pubkey_hash) => Payload::PubkeyHash {
pubkey_hash: pubkey_hash.to_vec(), pubkey_hash: pubkey_hash.to_vec(),
}, },
@@ -387,27 +387,27 @@ impl Address {
} }
fn network(&self) -> Network { fn network(&self) -> Network {
self.address.network self.inner.network
} }
fn script_pubkey(&self) -> Arc<Script> { fn script_pubkey(&self) -> Arc<Script> {
Arc::new(Script { Arc::new(Script {
script: self.address.script_pubkey(), inner: self.inner.script_pubkey(),
}) })
} }
fn to_qr_uri(&self) -> String { fn to_qr_uri(&self) -> String {
self.address.to_qr_uri() self.inner.to_qr_uri()
} }
fn as_string(&self) -> String { fn as_string(&self) -> String {
self.address.to_string() self.inner.to_string()
} }
} }
impl From<BdkAddress> for Address { impl From<BdkAddress> for Address {
fn from(address: BdkAddress) -> Self { fn from(address: BdkAddress) -> Self {
Address { address } Address { inner: address }
} }
} }
@@ -430,19 +430,23 @@ pub enum Payload {
/// A Bitcoin script. /// A Bitcoin script.
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
pub struct Script { pub struct Script {
script: BdkScript, inner: BdkScript,
} }
impl Script { impl Script {
fn new(raw_output_script: Vec<u8>) -> Self { fn new(raw_output_script: Vec<u8>) -> Self {
let script: BdkScript = BdkScript::from(raw_output_script); let script: BdkScript = BdkScript::from(raw_output_script);
Script { script } Script { inner: script }
}
fn to_bytes(&self) -> Vec<u8> {
self.inner.to_bytes()
} }
} }
impl From<BdkScript> for Script { impl From<BdkScript> for Script {
fn from(bdk_script: BdkScript) -> Self { fn from(bdk_script: BdkScript) -> Self {
Script { script: bdk_script } Script { inner: bdk_script }
} }
} }

View File

@@ -10,7 +10,7 @@ use crate::{BdkError, FeeRate, Transaction};
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct PartiallySignedTransaction { pub(crate) struct PartiallySignedTransaction {
pub(crate) internal: Mutex<BdkPartiallySignedTransaction>, pub(crate) inner: Mutex<BdkPartiallySignedTransaction>,
} }
impl PartiallySignedTransaction { impl PartiallySignedTransaction {
@@ -18,24 +18,24 @@ impl PartiallySignedTransaction {
let psbt: BdkPartiallySignedTransaction = let psbt: BdkPartiallySignedTransaction =
BdkPartiallySignedTransaction::from_str(&psbt_base64)?; BdkPartiallySignedTransaction::from_str(&psbt_base64)?;
Ok(PartiallySignedTransaction { Ok(PartiallySignedTransaction {
internal: Mutex::new(psbt), inner: Mutex::new(psbt),
}) })
} }
pub(crate) fn serialize(&self) -> String { pub(crate) fn serialize(&self) -> String {
let psbt = self.internal.lock().unwrap().clone(); let psbt = self.inner.lock().unwrap().clone();
psbt.to_string() psbt.to_string()
} }
pub(crate) fn txid(&self) -> String { pub(crate) fn txid(&self) -> String {
let tx = self.internal.lock().unwrap().clone().extract_tx(); let tx = self.inner.lock().unwrap().clone().extract_tx();
let txid = tx.txid(); let txid = tx.txid();
txid.to_hex() txid.to_hex()
} }
/// Return the transaction. /// Return the transaction.
pub(crate) fn extract_tx(&self) -> Arc<Transaction> { pub(crate) fn extract_tx(&self) -> Arc<Transaction> {
let tx = self.internal.lock().unwrap().clone().extract_tx(); let tx = self.inner.lock().unwrap().clone().extract_tx();
Arc::new(tx.into()) Arc::new(tx.into())
} }
@@ -46,19 +46,19 @@ impl PartiallySignedTransaction {
&self, &self,
other: Arc<PartiallySignedTransaction>, other: Arc<PartiallySignedTransaction>,
) -> Result<Arc<PartiallySignedTransaction>, BdkError> { ) -> Result<Arc<PartiallySignedTransaction>, BdkError> {
let other_psbt = other.internal.lock().unwrap().clone(); let other_psbt = other.inner.lock().unwrap().clone();
let mut original_psbt = self.internal.lock().unwrap().clone(); let mut original_psbt = self.inner.lock().unwrap().clone();
original_psbt.combine(other_psbt)?; original_psbt.combine(other_psbt)?;
Ok(Arc::new(PartiallySignedTransaction { Ok(Arc::new(PartiallySignedTransaction {
internal: Mutex::new(original_psbt), inner: Mutex::new(original_psbt),
})) }))
} }
/// The total transaction fee amount, sum of input amounts minus sum of output amounts, in Sats. /// The total transaction fee amount, sum of input amounts minus sum of output amounts, in Sats.
/// If the PSBT is missing a TxOut for an input returns None. /// If the PSBT is missing a TxOut for an input returns None.
pub(crate) fn fee_amount(&self) -> Option<u64> { pub(crate) fn fee_amount(&self) -> Option<u64> {
self.internal.lock().unwrap().fee_amount() self.inner.lock().unwrap().fee_amount()
} }
/// The transaction's fee rate. This value will only be accurate if calculated AFTER the /// The transaction's fee rate. This value will only be accurate if calculated AFTER the
@@ -66,12 +66,12 @@ impl PartiallySignedTransaction {
/// transaction. /// transaction.
/// If the PSBT is missing a TxOut for an input returns None. /// If the PSBT is missing a TxOut for an input returns None.
pub(crate) fn fee_rate(&self) -> Option<Arc<FeeRate>> { pub(crate) fn fee_rate(&self) -> Option<Arc<FeeRate>> {
self.internal.lock().unwrap().fee_rate().map(Arc::new) self.inner.lock().unwrap().fee_rate().map(Arc::new)
} }
/// Serialize the PSBT data structure as a String of JSON. /// Serialize the PSBT data structure as a String of JSON.
pub(crate) fn json_serialize(&self) -> String { pub(crate) fn json_serialize(&self) -> String {
let psbt = self.internal.lock().unwrap(); let psbt = self.inner.lock().unwrap();
serde_json::to_string(psbt.deref()).unwrap() serde_json::to_string(psbt.deref()).unwrap()
} }
} }
@@ -90,7 +90,7 @@ mod test {
let test_wpkh = "wpkh(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW)"; let test_wpkh = "wpkh(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW)";
let (funded_wallet, _, _) = get_funded_wallet(test_wpkh); let (funded_wallet, _, _) = get_funded_wallet(test_wpkh);
let test_wallet = Wallet { let test_wallet = Wallet {
wallet_mutex: Mutex::new(funded_wallet), inner_mutex: Mutex::new(funded_wallet),
}; };
let drain_to_address = "tb1ql7w62elx9ucw4pj5lgw4l028hmuw80sndtntxt".to_string(); let drain_to_address = "tb1ql7w62elx9ucw4pj5lgw4l028hmuw80sndtntxt".to_string();
let drain_to_script = crate::Address::new(drain_to_address) let drain_to_script = crate::Address::new(drain_to_address)
@@ -103,7 +103,7 @@ mod test {
.drain_to(drain_to_script.clone()); .drain_to(drain_to_script.clone());
//dbg!(&tx_builder); //dbg!(&tx_builder);
assert!(tx_builder.drain_wallet); assert!(tx_builder.drain_wallet);
assert_eq!(tx_builder.drain_to, Some(drain_to_script.script.clone())); assert_eq!(tx_builder.drain_to, Some(drain_to_script.inner.clone()));
let tx_builder_result = tx_builder.finish(&test_wallet).unwrap(); let tx_builder_result = tx_builder.finish(&test_wallet).unwrap();

View File

@@ -23,7 +23,7 @@ use crate::{
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct Wallet { pub(crate) struct Wallet {
pub(crate) wallet_mutex: Mutex<BdkWallet<AnyDatabase>>, pub(crate) inner_mutex: Mutex<BdkWallet<AnyDatabase>>,
} }
/// A Bitcoin wallet. /// A Bitcoin wallet.
@@ -53,11 +53,13 @@ impl Wallet {
network, network,
database, database,
)?); )?);
Ok(Wallet { wallet_mutex }) Ok(Wallet {
inner_mutex: wallet_mutex,
})
} }
pub(crate) fn get_wallet(&self) -> MutexGuard<BdkWallet<AnyDatabase>> { pub(crate) fn get_wallet(&self) -> MutexGuard<BdkWallet<AnyDatabase>> {
self.wallet_mutex.lock().expect("wallet") self.inner_mutex.lock().expect("wallet")
} }
/// Get the Bitcoin network the wallet is using. /// Get the Bitcoin network the wallet is using.
@@ -65,6 +67,11 @@ impl Wallet {
self.get_wallet().network() self.get_wallet().network()
} }
/// Return whether or not a script is part of this wallet (either internal or external).
pub(crate) fn is_mine(&self, script: Arc<Script>) -> Result<bool, BdkError> {
self.get_wallet().is_mine(&script.inner)
}
/// Sync the internal database with the blockchain. /// Sync the internal database with the blockchain.
pub(crate) fn sync( pub(crate) fn sync(
&self, &self,
@@ -126,7 +133,7 @@ impl Wallet {
psbt: &PartiallySignedTransaction, psbt: &PartiallySignedTransaction,
sign_options: Option<SignOptions>, sign_options: Option<SignOptions>,
) -> Result<bool, BdkError> { ) -> Result<bool, BdkError> {
let mut psbt = psbt.internal.lock().unwrap(); let mut psbt = psbt.inner.lock().unwrap();
self.get_wallet().sign( self.get_wallet().sign(
&mut psbt, &mut psbt,
sign_options.map(SignOptions::into).unwrap_or_default(), sign_options.map(SignOptions::into).unwrap_or_default(),
@@ -266,7 +273,7 @@ impl TxBuilder {
/// Add a recipient to the internal list. /// Add a recipient to the internal list.
pub(crate) fn add_recipient(&self, script: Arc<Script>, amount: u64) -> Arc<Self> { pub(crate) fn add_recipient(&self, script: Arc<Script>, amount: u64) -> Arc<Self> {
let mut recipients: Vec<(BdkScript, u64)> = self.recipients.clone(); let mut recipients: Vec<(BdkScript, u64)> = self.recipients.clone();
recipients.append(&mut vec![(script.script.clone(), amount)]); recipients.append(&mut vec![(script.inner.clone(), amount)]);
Arc::new(TxBuilder { Arc::new(TxBuilder {
recipients, recipients,
..self.clone() ..self.clone()
@@ -276,7 +283,7 @@ impl TxBuilder {
pub(crate) fn set_recipients(&self, recipients: Vec<ScriptAmount>) -> Arc<Self> { pub(crate) fn set_recipients(&self, recipients: Vec<ScriptAmount>) -> Arc<Self> {
let recipients = recipients let recipients = recipients
.iter() .iter()
.map(|script_amount| (script_amount.script.script.clone(), script_amount.amount)) .map(|script_amount| (script_amount.script.inner.clone(), script_amount.amount))
.collect(); .collect();
Arc::new(TxBuilder { Arc::new(TxBuilder {
recipients, recipients,
@@ -381,7 +388,7 @@ impl TxBuilder {
/// to allow this output to be reduced to pay for the extra fees. /// to allow this output to be reduced to pay for the extra fees.
pub(crate) fn drain_to(&self, script: Arc<Script>) -> Arc<Self> { pub(crate) fn drain_to(&self, script: Arc<Script>) -> Arc<Self> {
Arc::new(TxBuilder { Arc::new(TxBuilder {
drain_to: Some(script.script.clone()), drain_to: Some(script.inner.clone()),
..self.clone() ..self.clone()
}) })
} }
@@ -463,7 +470,7 @@ impl TxBuilder {
.finish() .finish()
.map(|(psbt, tx_details)| TxBuilderResult { .map(|(psbt, tx_details)| TxBuilderResult {
psbt: Arc::new(PartiallySignedTransaction { psbt: Arc::new(PartiallySignedTransaction {
internal: Mutex::new(psbt), inner: Mutex::new(psbt),
}), }),
transaction_details: TransactionDetails::from(tx_details), transaction_details: TransactionDetails::from(tx_details),
}) })
@@ -547,7 +554,7 @@ impl BumpFeeTxBuilder {
tx_builder tx_builder
.finish() .finish()
.map(|(psbt, _)| PartiallySignedTransaction { .map(|(psbt, _)| PartiallySignedTransaction {
internal: Mutex::new(psbt), inner: Mutex::new(psbt),
}) })
.map(Arc::new) .map(Arc::new)
} }
@@ -560,9 +567,13 @@ impl BumpFeeTxBuilder {
mod test { mod test {
use crate::database::DatabaseConfig; use crate::database::DatabaseConfig;
use crate::descriptor::Descriptor; use crate::descriptor::Descriptor;
use crate::keys::{DescriptorSecretKey, Mnemonic};
use crate::wallet::{AddressIndex, TxBuilder, Wallet}; use crate::wallet::{AddressIndex, TxBuilder, Wallet};
use crate::Script;
use assert_matches::assert_matches;
use bdk::bitcoin::{Address, Network}; use bdk::bitcoin::{Address, Network};
use bdk::wallet::get_funded_wallet; use bdk::wallet::get_funded_wallet;
use bdk::KeychainKind;
use std::str::FromStr; use std::str::FromStr;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
@@ -571,7 +582,7 @@ mod test {
let test_wpkh = "wpkh(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW)"; let test_wpkh = "wpkh(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW)";
let (funded_wallet, _, _) = get_funded_wallet(test_wpkh); let (funded_wallet, _, _) = get_funded_wallet(test_wpkh);
let test_wallet = Wallet { let test_wallet = Wallet {
wallet_mutex: Mutex::new(funded_wallet), inner_mutex: Mutex::new(funded_wallet),
}; };
let drain_to_address = "tb1ql7w62elx9ucw4pj5lgw4l028hmuw80sndtntxt".to_string(); let drain_to_address = "tb1ql7w62elx9ucw4pj5lgw4l028hmuw80sndtntxt".to_string();
let drain_to_script = crate::Address::new(drain_to_address) let drain_to_script = crate::Address::new(drain_to_address)
@@ -581,10 +592,10 @@ mod test {
.drain_wallet() .drain_wallet()
.drain_to(drain_to_script.clone()); .drain_to(drain_to_script.clone());
assert!(tx_builder.drain_wallet); assert!(tx_builder.drain_wallet);
assert_eq!(tx_builder.drain_to, Some(drain_to_script.script.clone())); assert_eq!(tx_builder.drain_to, Some(drain_to_script.inner.clone()));
let tx_builder_result = tx_builder.finish(&test_wallet).unwrap(); let tx_builder_result = tx_builder.finish(&test_wallet).unwrap();
let psbt = tx_builder_result.psbt.internal.lock().unwrap().clone(); let psbt = tx_builder_result.psbt.inner.lock().unwrap().clone();
let tx_details = tx_builder_result.transaction_details; let tx_details = tx_builder_result.transaction_details;
// confirm one input with 50,000 sats // confirm one input with 50,000 sats
@@ -802,4 +813,47 @@ mod test {
"bcrt1qaux734vuhykww9632v8cmdnk7z2mw5lsf74v6k" "bcrt1qaux734vuhykww9632v8cmdnk7z2mw5lsf74v6k"
); );
} }
#[test]
fn test_is_mine() {
// is_mine should return true for addresses generated by the wallet
let mnemonic: Mnemonic = Mnemonic::from_string("chaos fabric time speed sponsor all flat solution wisdom trophy crack object robot pave observe combine where aware bench orient secret primary cable detect".to_string()).unwrap();
let secret_key: DescriptorSecretKey =
DescriptorSecretKey::new(Network::Testnet, Arc::new(mnemonic), None);
let descriptor: Descriptor = Descriptor::new_bip84(
Arc::new(secret_key),
KeychainKind::External,
Network::Testnet,
);
let wallet: Wallet = Wallet::new(
Arc::new(descriptor),
None,
Network::Testnet,
DatabaseConfig::Memory,
)
.unwrap();
let address = wallet.get_address(AddressIndex::New).unwrap();
let script: Arc<Script> = address.address.script_pubkey();
let is_mine_1: bool = wallet.is_mine(script).unwrap();
assert!(is_mine_1);
// is_mine returns false when provided a script that is not in the wallet
let other_wpkh = "wpkh(tprv8hwWMmPE4BVNxGdVt3HhEERZhondQvodUY7Ajyseyhudr4WabJqWKWLr4Wi2r26CDaNCQhhxEftEaNzz7dPGhWuKFU4VULesmhEfZYyBXdE/0/*)";
let other_descriptor = Descriptor::new(other_wpkh.to_string(), Network::Testnet).unwrap();
let other_wallet = Wallet::new(
Arc::new(other_descriptor),
None,
Network::Testnet,
DatabaseConfig::Memory,
)
.unwrap();
let other_address = other_wallet.get_address(AddressIndex::New).unwrap();
let other_script: Arc<Script> = other_address.address.script_pubkey();
let is_mine_2: bool = wallet.is_mine(other_script).unwrap();
assert_matches!(is_mine_2, false);
}
} }

View File

@@ -1,4 +1,4 @@
# bdk-android # bdk-jvm
This project builds a .jar package for the JVM platform that provide Kotlin language bindings for the [`bdk`] library. The Kotlin language bindings are created by the `bdk-ffi` project which is included in the root of this repository. This project builds a .jar package for the JVM platform that provide Kotlin language bindings for the [`bdk`] library. The Kotlin language bindings are created by the `bdk-ffi` project which is included in the root of this repository.
## How to Use ## How to Use
@@ -25,8 +25,8 @@ val internalDescriptor = Descriptor("wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8
val databaseConfig = DatabaseConfig.Memory val databaseConfig = DatabaseConfig.Memory
val blockchainConfig = BlockchainConfig.Electrum( val blockchainConfig = BlockchainConfig.Electrum(
ElectrumConfig("ssl://electrum.blockstream.info:60002", null, 5u, null, 10u, true) ElectrumConfig("ssl://electrum.blockstream.info:60002", null, 5u, null, 10u, true)
) )
val wallet = Wallet(externalDescriptor, internalDescriptor, Network.TESTNET, databaseConfig, blockchainConfig) val wallet = Wallet(externalDescriptor, internalDescriptor, Network.TESTNET, databaseConfig, blockchainConfig)
val newAddress = wallet.getAddress(AddressIndex.LastUnused) val newAddress = wallet.getAddress(AddressIndex.LastUnused)
``` ```
@@ -38,32 +38,39 @@ repositories {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
} }
dependencies { dependencies {
implementation("org.bitcoindevkit:bdk-jvm:<version-SNAPSHOT>") implementation("org.bitcoindevkit:bdk-jvm:<version-SNAPSHOT>")
} }
``` ```
## Example Projects ## Example Projects
* [Tatooine Faucet](https://github.com/thunderbiscuit/tatooine) * [Tatooine Faucet](https://github.com/thunderbiscuit/tatooine)
## How to build ## How to build
_Note that Kotlin version `1.6.10` or later is required to build the library._ _Note that Kotlin version `1.6.10` or later is required to build the library._
1. Install JDK 11. It must be version 11 (not 17), otherwise it won't build. For example, with SDKMAN!:
1. Clone this repository. ```shell
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install java 11.0.19-tem
```
2. Install Rust (note that we are currently building using Rust 1.67.0):
```shell
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default 1.67.0
```
3. Clone this repository.
```shell ```shell
git clone https://github.com/bitcoindevkit/bdk-ffi git clone https://github.com/bitcoindevkit/bdk-ffi
``` ```
2. Follow the "General" bdk-ffi ["Getting Started (Developer)"] instructions. 4. If building on macOS install required intel and m1 jvm targets
3. If building on macOS install required intel and m1 jvm targets
```sh ```sh
rustup target add x86_64-apple-darwin aarch64-apple-darwin rustup target add x86_64-apple-darwin aarch64-apple-darwin
``` ```
4. Build kotlin bindings 5. Build kotlin bindings
```sh ```sh
# build JVM library ./gradlew buildJvmLib
./gradlew buildJvmLib ```
```
## How to publish to your local Maven repo ## How to publish to your local Maven repo
```shell ```shell

View File

@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx1536m org.gradle.jvmargs=-Xmx1536m
android.enableJetifier=true android.enableJetifier=true
kotlin.code.style=official kotlin.code.style=official
libraryVersion=0.28.0-SNAPSHOT libraryVersion=0.30.0

View File

@@ -20,8 +20,8 @@ repositories {
} }
java { java {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_11
withSourcesJar() withSourcesJar()
withJavadocJar() withJavadocJar()
} }
@@ -107,4 +107,8 @@ signing {
// binaries before running the tests // binaries before running the tests
tasks.withType<KotlinCompile> { tasks.withType<KotlinCompile> {
dependsOn("buildJvmLib") dependsOn("buildJvmLib")
kotlinOptions {
jvmTarget = "11"
}
} }

View File

@@ -4,11 +4,13 @@ package org.bitcoindevkit.plugins
val operatingSystem: OS = when { val operatingSystem: OS = when {
System.getProperty("os.name").contains("mac", ignoreCase = true) -> OS.MAC System.getProperty("os.name").contains("mac", ignoreCase = true) -> OS.MAC
System.getProperty("os.name").contains("linux", ignoreCase = true) -> OS.LINUX System.getProperty("os.name").contains("linux", ignoreCase = true) -> OS.LINUX
System.getProperty("os.name").contains("windows", ignoreCase = true) -> OS.WINDOWS
else -> OS.OTHER else -> OS.OTHER
} }
enum class OS { enum class OS {
MAC, MAC,
LINUX, LINUX,
WINDOWS,
OTHER, OTHER,
} }

View File

@@ -27,13 +27,20 @@ internal class UniFfiJvmPlugin : Plugin<Project> {
val cargoArgs: List<String> = listOf("build", "--profile", "release-smaller", "--target", "aarch64-apple-darwin") val cargoArgs: List<String> = listOf("build", "--profile", "release-smaller", "--target", "aarch64-apple-darwin")
args(cargoArgs) args(cargoArgs)
} }
} else if(operatingSystem == OS.LINUX) { } else if (operatingSystem == OS.LINUX) {
exec { exec {
workingDir("${project.projectDir}/../../bdk-ffi") workingDir("${project.projectDir}/../../bdk-ffi")
executable("cargo") executable("cargo")
val cargoArgs: List<String> = listOf("build", "--profile", "release-smaller", "--target", "x86_64-unknown-linux-gnu") val cargoArgs: List<String> = listOf("build", "--profile", "release-smaller", "--target", "x86_64-unknown-linux-gnu")
args(cargoArgs) args(cargoArgs)
} }
} else if (operatingSystem == OS.WINDOWS) {
exec {
workingDir("${project.projectDir}/../../bdk-ffi")
executable("cargo")
val cargoArgs: List<String> = listOf("build", "--profile", "release-smaller", "--target", "x86_64-pc-windows-msvc")
args(cargoArgs)
}
} }
} }
@@ -70,13 +77,25 @@ internal class UniFfiJvmPlugin : Plugin<Project> {
ext = "so" ext = "so"
) )
) )
} else if (operatingSystem == OS.WINDOWS) {
libsToCopy.add(
CopyMetadata(
targetDir = "x86_64-pc-windows-msvc",
resDir = "win32-x86-64",
ext = "dll"
)
)
}
val libName = when (operatingSystem) {
OS.WINDOWS -> "bdkffi"
else -> "libbdkffi"
} }
libsToCopy.forEach { libsToCopy.forEach {
doFirst { doFirst {
copy { copy {
with(it) { with(it) {
from("${project.projectDir}/../../target/${this.targetDir}/release-smaller/libbdkffi.${this.ext}") from("${project.projectDir}/../../target/${this.targetDir}/release-smaller/${libName}.${this.ext}")
into("${project.projectDir}/../../bdk-jvm/lib/src/main/resources/${this.resDir}/") into("${project.projectDir}/../../bdk-jvm/lib/src/main/resources/${this.resDir}/")
} }
} }

View File

@@ -1,2 +1,3 @@
include ./src/bdkpython/libbdkffi.dylib include ./src/bdkpython/libbdkffi.dylib
include ./src/bdkpython/libbdkffi.so include ./src/bdkpython/libbdkffi.so
include ./src/bdkpython/bdkffi.dll

View File

@@ -12,9 +12,9 @@ pip install bdkpython
## Run the tests ## Run the tests
```shell ```shell
pip install --requirement requirements.txt pip install --requirement requirements.txt
bash ./generate.sh bash ./scripts/generate-linux.sh # here you should run the script appropriate for your platform
python setup.py bdist_wheel --verbose python setup.py bdist_wheel --verbose
pip install ./dist/bdkpython-<yourversion>-py3-none-any.whl --force-reinstall pip install ./dist/bdkpython-<yourversion>.whl --force-reinstall
python -m unittest --verbose tests/test_bdk.py python -m unittest --verbose tests/test_bdk.py
``` ```
@@ -23,26 +23,14 @@ python -m unittest --verbose tests/test_bdk.py
# Install dependencies # Install dependencies
pip install --requirement requirements.txt pip install --requirement requirements.txt
# Generate the bindings # Generate the bindings (use the script appropriate for your platform)
bash generate.sh bash ./scripts/generate-linux.sh
# Build the wheel # Build the wheel
python setup.py --verbose bdist_wheel python setup.py --verbose bdist_wheel
``` ```
## Run tox to build and test locally
```shell
# install dev requirements
pip install --requirement requirements-dev.txt
# build bindings glue code (located at ./src/bdkpython/bdk.py)
source ./generate.sh
# build and test
tox -vv
```
## Install locally ## Install locally
```shell ```shell
pip install ./dist/bdkpython-<yourversion>-py3-none-any.whl pip install ./dist/bdkpython-<yourversion>.whl
``` ```

View File

@@ -1,24 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
OS=$(uname -s)
echo "Generating bdk.py..."
cd ../bdk-ffi/
cargo run --bin uniffi-bindgen generate src/bdk.udl --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
echo "Generating native binaries..."
cargo build --profile release-smaller
case $OS in
"Darwin")
echo "Copying macOS libbdkffi.dylib..."
cp ../target/release-smaller/libbdkffi.dylib ../bdk-python/src/bdkpython/libbdkffi.dylib
;;
"Linux")
echo "Copying linux libbdkffi.so..."
cp ../target/release-smaller/libbdkffi.so ../bdk-python/src/bdkpython/libbdkffi.so
;;
esac
cd ../bdk-python/
echo "All done!"

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
${PYBIN}/python --version
${PYBIN}/pip install -r requirements.txt
echo "Generating bdk.py..."
cd ../bdk-ffi/
cargo run --bin uniffi-bindgen generate src/bdk.udl --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
echo "Generating native binaries..."
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
echo "All done!"

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
python3 --version
pip install --user -r requirements.txt
echo "Generating bdk.py..."
cd ../bdk-ffi/
cargo run --bin uniffi-bindgen generate src/bdk.udl --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
echo "Generating native binaries..."
rustup default 1.67.0
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
echo "All done!"

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
python3 --version
pip install --user -r requirements.txt
echo "Generating bdk.py..."
cd ../bdk-ffi/
cargo run --bin uniffi-bindgen generate src/bdk.udl --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
echo "Generating native binaries..."
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
echo "All done!"

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
python3 --version
pip install --user -r requirements.txt
echo "Generating bdk.py..."
cd ../bdk-ffi/
cargo run --bin uniffi-bindgen generate src/bdk.udl --language python --out-dir ../bdk-python/src/bdkpython/ --no-format
echo "Generating native binaries..."
rustup default 1.67.0
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
echo "All done!"

View File

@@ -51,7 +51,7 @@ print(f"Wallet balance is: {balance.total}")
setup( setup(
name="bdkpython", name="bdkpython",
version="0.28.0.dev0", version="0.30.0",
description="The Python language bindings for the Bitcoin Development Kit", description="The Python language bindings for the Bitcoin Development Kit",
long_description=LONG_DESCRIPTION, long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
@@ -62,4 +62,7 @@ setup(
url="https://github.com/bitcoindevkit/bdk-ffi", url="https://github.com/bitcoindevkit/bdk-ffi",
author="Alekos Filini <alekos.filini@gmail.com>, Steve Myers <steve@notmandatory.org>", author="Alekos Filini <alekos.filini@gmail.com>, Steve Myers <steve@notmandatory.org>",
license="MIT or Apache 2.0", license="MIT or Apache 2.0",
# This is required to ensure the library name includes the python version, abi, and platform tags
# See issue #350 for more information
has_ext_modules=lambda: True,
) )

View File

@@ -29,7 +29,9 @@ let package = Package(
.binaryTarget(name: "bdkFFI", path: "./bdkFFI.xcframework"), .binaryTarget(name: "bdkFFI", path: "./bdkFFI.xcframework"),
.target( .target(
name: "BitcoinDevKit", name: "BitcoinDevKit",
dependencies: ["bdkFFI"]), dependencies: ["bdkFFI"],
swiftSettings: [.unsafeFlags(["-suppress-warnings"])]
),
.testTarget( .testTarget(
name: "BitcoinDevKitTests", name: "BitcoinDevKitTests",
dependencies: ["BitcoinDevKit"]), dependencies: ["BitcoinDevKit"]),

View File

@@ -5,10 +5,10 @@
# #
# Run the script from the repo root directory, ie: ./bdk-swift/build-local-swift.sh # Run the script from the repo root directory, ie: ./bdk-swift/build-local-swift.sh
rustup install nightly-x86_64-apple-darwin rustup install nightly-2023-04-10
rustup component add rust-src --toolchain nightly-x86_64-apple-darwin rustup component add rust-src --toolchain nightly-2023-04-10
rustup target add aarch64-apple-ios x86_64-apple-ios rustup target add aarch64-apple-ios x86_64-apple-ios
rustup target add aarch64-apple-ios-sim --toolchain nightly rustup target add aarch64-apple-ios-sim --toolchain nightly-2023-04-10
rustup target add aarch64-apple-darwin x86_64-apple-darwin rustup target add aarch64-apple-darwin x86_64-apple-darwin
pushd bdk-ffi pushd bdk-ffi
@@ -20,10 +20,10 @@ cargo build --package bdk-ffi --profile release-smaller --target x86_64-apple-da
cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-darwin cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-darwin
cargo build --package bdk-ffi --profile release-smaller --target x86_64-apple-ios cargo build --package bdk-ffi --profile release-smaller --target x86_64-apple-ios
cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-ios cargo build --package bdk-ffi --profile release-smaller --target aarch64-apple-ios
cargo +nightly build --package bdk-ffi --release -Z build-std --target aarch64-apple-ios-sim cargo +nightly-2023-04-10 build --package bdk-ffi --profile release-smaller --target aarch64-apple-ios-sim
mkdir -p target/lipo-ios-sim/release-smaller mkdir -p target/lipo-ios-sim/release-smaller
lipo target/aarch64-apple-ios-sim/release/libbdkffi.a target/x86_64-apple-ios/release-smaller/libbdkffi.a -create -output target/lipo-ios-sim/release-smaller/libbdkffi.a lipo target/aarch64-apple-ios-sim/release-smaller/libbdkffi.a target/x86_64-apple-ios/release-smaller/libbdkffi.a -create -output target/lipo-ios-sim/release-smaller/libbdkffi.a
mkdir -p target/lipo-macos/release-smaller 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 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