Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
599bd8ff06 | ||
|
|
fbec953149 | ||
|
|
0b07b8ed05 | ||
|
|
b59327e5ea | ||
|
|
e6500baae7 | ||
|
|
85f220b953 | ||
|
|
106d31c9c3 | ||
|
|
4ae169f860 | ||
|
|
7717ebb097 | ||
|
|
c3e8469686 | ||
|
|
faf23b7d25 | ||
|
|
1da01b4a0b | ||
|
|
f1ba03bf50 | ||
|
|
bc182c7164 | ||
|
|
5fc189717d | ||
|
|
849bfe79c1 | ||
|
|
dc79b78b2d | ||
|
|
7cc08f1d6f | ||
|
|
031fcb02da | ||
|
|
5f9b5682e5 | ||
|
|
d0a7315c9d | ||
|
|
0bfc56b0e8 | ||
|
|
3dd6c203e8 | ||
|
|
76acbf575b | ||
|
|
039b64de5c | ||
|
|
fe7e4e21c0 | ||
|
|
77f89afc68 | ||
|
|
25033f6bd6 | ||
|
|
3cb2c2c394 | ||
|
|
5092987b26 | ||
|
|
aea25dbf21 | ||
|
|
ed67eba910 | ||
|
|
90606b2455 | ||
|
|
49e8fe461e | ||
|
|
de88184b8c | ||
|
|
3be2c0495f | ||
|
|
2c4c64515f | ||
|
|
17323d3184 | ||
|
|
b382511a9e | ||
|
|
d3895441d3 | ||
|
|
269512a673 | ||
|
|
d27206787a | ||
|
|
c1b1fd6f5d | ||
|
|
7062fbd047 | ||
|
|
0e34a6bacf | ||
|
|
89e85a20cf | ||
|
|
d8718c3f05 | ||
|
|
871a06d1ce | ||
|
|
b820d6a2ba | ||
|
|
79d9fa2909 | ||
|
|
a0e0467d39 | ||
|
|
f2296704e6 |
17
.github/ISSUE_TEMPLATE/enhancement_request.md
vendored
Normal file
17
.github/ISSUE_TEMPLATE/enhancement_request.md
vendored
Normal 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. -->
|
||||
102
.github/ISSUE_TEMPLATE/minor_release.md
vendored
102
.github/ISSUE_TEMPLATE/minor_release.md
vendored
@@ -7,77 +7,81 @@ assignees: ''
|
||||
---
|
||||
|
||||
## 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.
|
||||
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_
|
||||
4. - [ ] 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
|
||||
6. - [ ] Build the library and run the tests, and adjust if necessary.
|
||||
```sh
|
||||
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.
|
||||
```shell
|
||||
# start an emulator prior to running the tests
|
||||
cd bdk-android
|
||||
cd ./bdk-android/
|
||||
./gradlew buildAndroidLib
|
||||
./gradlew connectedAndroidTest
|
||||
```
|
||||
7. - [ ] Update the readme if necessary
|
||||
|
||||
6. - [ ] Update the readme if necessary
|
||||
#### _JVM_
|
||||
8. - [ ] 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
|
||||
10. - [ ] Build the library and run the tests, and adjust if necessary
|
||||
```sh
|
||||
cd bdk-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
|
||||
```shell
|
||||
cd ./bdk-jvm/
|
||||
./gradlew buildJvmLib
|
||||
./gradlew test
|
||||
```
|
||||
11. - [ ] Update the readme if necessary
|
||||
|
||||
10. - [ ] Update the readme if necessary
|
||||
#### _Swift_
|
||||
12. - [ ] Run the tests and adjust if necessary
|
||||
```sh
|
||||
11. - [ ] Run the tests and adjust if necessary
|
||||
```shell
|
||||
./bdk-swift/build-local-swift.sh
|
||||
cd bdk-swift
|
||||
cd ./bdk-swift/
|
||||
swift test
|
||||
```
|
||||
13. - [ ] Update the readme if necessary
|
||||
|
||||
12. - [ ] Update the readme if necessary
|
||||
#### _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
|
||||
15. - [ ] Build the library
|
||||
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
|
||||
```
|
||||
16. - [ ] Run the tests and adjust if necessary
|
||||
15. - [ ] Run the tests and adjust if necessary
|
||||
```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
|
||||
```
|
||||
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
|
||||
|
||||
84
.github/ISSUE_TEMPLATE/patch_release.md
vendored
84
.github/ISSUE_TEMPLATE/patch_release.md
vendored
@@ -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
|
||||
2
.github/workflows/audit.yml
vendored
2
.github/workflows/audit.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
name: Security audit
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions-rs/audit-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
14
.github/workflows/cont_integration.yml
vendored
14
.github/workflows/cont_integration.yml
vendored
@@ -14,18 +14,18 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
rust:
|
||||
- version: 1.63.0 # STABLE
|
||||
- version: 1.71.0 # STABLE
|
||||
clippy: true
|
||||
- version: 1.61.0 # MSRV
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Generate cache key
|
||||
run: echo "${{ matrix.rust.version }} ${{ matrix.features }}" | tee .cache_key
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
@@ -46,6 +46,12 @@ jobs:
|
||||
- name: Update toolchain
|
||||
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
|
||||
run: cargo build
|
||||
|
||||
@@ -61,7 +67,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set default toolchain
|
||||
run: rustup default nightly
|
||||
|
||||
11
.github/workflows/publish-android.yaml
vendored
11
.github/workflows/publish-android.yaml
vendored
@@ -10,7 +10,7 @@ env:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: "Install Android NDK 21.4.7075529"
|
||||
run: |
|
||||
@@ -20,10 +20,10 @@ jobs:
|
||||
echo "y" | $SDKMANAGER "ndk;21.4.7075529"
|
||||
|
||||
- name: "Check out PR branch"
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: "Cache"
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
@@ -32,11 +32,14 @@ jobs:
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
|
||||
|
||||
- name: "Set up JDK"
|
||||
uses: actions/setup-java@v2
|
||||
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 Rust Android targets"
|
||||
run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi
|
||||
|
||||
|
||||
99
.github/workflows/publish-jvm.yaml
vendored
99
.github/workflows/publish-jvm.yaml
vendored
@@ -2,14 +2,14 @@ name: Publish bdk-jvm to Maven Central
|
||||
on: [workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
build-jvm-macOS-M1-native-lib:
|
||||
name: "Create M1 and x86_64 JVM native binaries"
|
||||
build-macOS-native-libs:
|
||||
name: "Create M1 and x86_64 native binaries"
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- name: "Checkout publishing branch"
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache
|
||||
- name: "Cache"
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
@@ -18,42 +18,68 @@ jobs:
|
||||
./target
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v2
|
||||
- name: "Set up JDK"
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: temurin
|
||||
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
|
||||
|
||||
- name: Build bdk-jvm library
|
||||
- name: "Build bdk-jvm library"
|
||||
run: |
|
||||
cd bdk-jvm
|
||||
./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
|
||||
with:
|
||||
# name: no name is required because we upload the entire directory
|
||||
# the default name "artifact" will be used
|
||||
name: artifact-macos
|
||||
path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-jvm/lib/src/main/resources/
|
||||
|
||||
build-jvm-full-library:
|
||||
name: Create full bdk-jvm library
|
||||
needs: [build-jvm-macOS-M1-native-lib]
|
||||
runs-on: ubuntu-22.04
|
||||
build-windows-native-lib:
|
||||
name: "Create Windows native binaries"
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Checkout publishing branch
|
||||
uses: actions/checkout@v2
|
||||
- name: "Checkout publishing branch"
|
||||
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: |
|
||||
git submodule set-url bdk-ffi https://github.com/bitcoindevkit/bdk-ffi.git
|
||||
git submodule update --init bdk-ffi
|
||||
cd bdk-jvm
|
||||
./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
|
||||
with:
|
||||
path: |
|
||||
@@ -62,26 +88,39 @@ jobs:
|
||||
./target
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v2
|
||||
- name: "Set up JDK"
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: temurin
|
||||
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: |
|
||||
cd bdk-jvm
|
||||
./gradlew buildJvmLib
|
||||
|
||||
- name: Download macOS native libraries from previous job
|
||||
- name: "Download macOS native binaries from previous job"
|
||||
uses: actions/download-artifact@v3
|
||||
id: download
|
||||
with:
|
||||
# download the artifact created in the prior job (named "artifact")
|
||||
name: artifact
|
||||
name: artifact-macos
|
||||
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:
|
||||
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.PGP_KEY_ID }}
|
||||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SECRET_KEY }}
|
||||
|
||||
132
.github/workflows/publish-python.yaml
vendored
132
.github/workflows/publish-python.yaml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Build and publish Python wheels
|
||||
name: Publish bdkpython to PyPI
|
||||
on: [workflow_dispatch]
|
||||
|
||||
# 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.
|
||||
|
||||
jobs:
|
||||
build-manylinux2014-x86_64-wheel:
|
||||
build-manylinux2014-x86_64-wheels:
|
||||
name: "Build Manylinux 2014 x86_64 wheel"
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: bdk-python
|
||||
@@ -21,77 +21,106 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
python: # Update this list whenever the docker image is updated (check /opt/python/)
|
||||
- cp36-cp36m
|
||||
- cp37-cp37m
|
||||
- cp38-cp38
|
||||
- cp39-cp39
|
||||
- cp310-cp310
|
||||
- pp37-pypy37_pp73
|
||||
- pp38-pypy38_pp73
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: "Install requirements"
|
||||
run: ${PYBIN}/pip install -r requirements.txt
|
||||
|
||||
- name: "Generate bdk.py"
|
||||
run: bash generate.sh
|
||||
- name: "Generate bdk.py and binaries"
|
||||
run: bash ./scripts/generate-linux.sh
|
||||
|
||||
- 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:
|
||||
name: bdkpython-manylinux2014-x86_64-${{ matrix.python }}
|
||||
path: /home/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl
|
||||
|
||||
build-macos-universal-wheel:
|
||||
name: "Build macOS universal wheel"
|
||||
runs-on: macos-12
|
||||
build-macos-arm64-wheels:
|
||||
name: "Build macOS arm64 wheel"
|
||||
runs-on: macos-13
|
||||
defaults:
|
||||
run:
|
||||
working-directory: bdk-python
|
||||
strategy:
|
||||
matrix:
|
||||
python:
|
||||
- '3.7'
|
||||
- '3.8'
|
||||
- '3.9'
|
||||
- '3.10'
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
|
||||
- name: "Install Python"
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
|
||||
- name: "Generate bdk.py"
|
||||
run: |
|
||||
python3 --version
|
||||
rustup target add aarch64-apple-darwin
|
||||
pip3 install --user -r requirements.txt
|
||||
bash generate.sh
|
||||
- name: "Generate bdk.py and binaries"
|
||||
run: bash ./scripts/generate-macos-arm64.sh
|
||||
|
||||
- name: "Build wheel"
|
||||
env:
|
||||
ARCHFLAGS: "-arch x86_64 -arch arm64"
|
||||
run: python3 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: 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:
|
||||
name: bdkpython-macos-${{ matrix.python }}
|
||||
name: bdkpython-macos-arm64-${{ matrix.python }}
|
||||
path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl
|
||||
|
||||
build-windows-wheel:
|
||||
name: "Build windows wheel"
|
||||
build-macos-x86_64-wheels:
|
||||
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
|
||||
defaults:
|
||||
run:
|
||||
@@ -99,46 +128,43 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
python:
|
||||
- '3.7'
|
||||
- '3.8'
|
||||
- '3.9'
|
||||
- '3.10'
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
|
||||
- name: "Generate bdk.py"
|
||||
run: |
|
||||
python --version
|
||||
pip install --user -r requirements.txt
|
||||
bash generate.sh
|
||||
- name: "Generate bdk.py and binaries"
|
||||
run: bash ./scripts/generate-windows.sh
|
||||
|
||||
- name: "Build wheel"
|
||||
run: python setup.py bdist_wheel --verbose
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
- name: "Upload artifacts"
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: bdkpython-win-${{ matrix.python }}
|
||||
path: D:\a\bdk-ffi\bdk-ffi\bdk-python\dist\*.whl
|
||||
|
||||
publish-pypi:
|
||||
name: "Publish on PyPI"
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
defaults:
|
||||
run:
|
||||
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:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: "Download artifacts in dist/ directory"
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: dist/
|
||||
|
||||
|
||||
17
.github/workflows/test-android.yaml
vendored
17
.github/workflows/test-android.yaml
vendored
@@ -1,5 +1,6 @@
|
||||
name: Test Android
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- "bdk-ffi/**"
|
||||
@@ -18,7 +19,7 @@ env:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: "Install Android NDK 21.4.7075529"
|
||||
run: |
|
||||
@@ -28,10 +29,10 @@ jobs:
|
||||
echo "y" | $SDKMANAGER "ndk;21.4.7075529"
|
||||
|
||||
- name: "Check out PR branch"
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: "Cache"
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
@@ -40,14 +41,22 @@ jobs:
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
|
||||
|
||||
- name: "Set up JDK"
|
||||
uses: actions/setup-java@v2
|
||||
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 Rust Android targets"
|
||||
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
|
||||
# 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"
|
||||
|
||||
20
.github/workflows/test-jvm.yaml
vendored
20
.github/workflows/test-jvm.yaml
vendored
@@ -1,5 +1,6 @@
|
||||
name: Test Kotlin/JVM
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- "bdk-ffi/**"
|
||||
@@ -13,11 +14,11 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Check out PR branch
|
||||
uses: actions/checkout@v2
|
||||
- name: "Check out PR branch"
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v2
|
||||
- name: "Cache"
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
@@ -25,13 +26,16 @@ jobs:
|
||||
./target
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v2
|
||||
- name: "Set up JDK"
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: temurin
|
||||
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: |
|
||||
cd bdk-jvm
|
||||
./gradlew test --console=rich
|
||||
./gradlew test
|
||||
|
||||
150
.github/workflows/test-python.yaml
vendored
150
.github/workflows/test-python.yaml
vendored
@@ -1,5 +1,6 @@
|
||||
name: Test Python
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- "bdk-ffi/**"
|
||||
@@ -15,9 +16,9 @@ on:
|
||||
# tries to load glibc and fails because it requires a more recent version.
|
||||
|
||||
jobs:
|
||||
build-manylinux2014-x86_64-wheel:
|
||||
build-manylinux2014-x86_64-wheels:
|
||||
name: "Build and test Manylinux 2014 x86_64 wheels"
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
defaults:
|
||||
run:
|
||||
working-directory: bdk-python
|
||||
@@ -29,28 +30,25 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
python:
|
||||
# - cp36-cp36m
|
||||
# - cp37-cp37m
|
||||
# - cp38-cp38
|
||||
# - cp39-cp39
|
||||
- cp38-cp38
|
||||
- cp39-cp39
|
||||
- cp310-cp310
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: "Install requirements"
|
||||
run: ${PYBIN}/pip install -r requirements.txt
|
||||
|
||||
- name: "Generate bdk.py"
|
||||
run: bash generate.sh
|
||||
- name: "Generate bdk.py and binaries"
|
||||
run: bash ./scripts/generate-linux.sh
|
||||
|
||||
- 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"
|
||||
run: ${PYBIN}/pip install ./dist/*.whl
|
||||
@@ -59,44 +57,82 @@ jobs:
|
||||
run: ${PYBIN}/python -m unittest tests/test_bdk.py --verbose
|
||||
|
||||
- name: "Upload artifact test"
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: bdkpython-manylinux2014-x86_64-${{ matrix.python }}
|
||||
path: /home/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl
|
||||
|
||||
build-macos-universal-wheel:
|
||||
name: "Build and test macOS wheels"
|
||||
runs-on: macos-12
|
||||
build-macos-arm64-wheels:
|
||||
name: "Build and test macOS arm64 wheels"
|
||||
runs-on: macos-13
|
||||
defaults:
|
||||
run:
|
||||
working-directory: bdk-python
|
||||
strategy:
|
||||
matrix:
|
||||
python:
|
||||
# - '3.7'
|
||||
# - '3.8'
|
||||
# - '3.9'
|
||||
- '3.10'
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
|
||||
- name: "Install Python"
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
|
||||
- name: "Generate bdk.py"
|
||||
run: |
|
||||
python3 --version
|
||||
rustup target add aarch64-apple-darwin
|
||||
pip3 install --user -r requirements.txt
|
||||
bash generate.sh
|
||||
- name: "Generate bdk.py and binaries"
|
||||
run: bash ./scripts/generate-macos-arm64.sh
|
||||
|
||||
- name: "Build wheel"
|
||||
env:
|
||||
ARCHFLAGS: "-arch x86_64 -arch arm64"
|
||||
run: python3 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: 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"
|
||||
run: pip3 install ./dist/*.whl
|
||||
@@ -104,7 +140,13 @@ jobs:
|
||||
- name: "Run tests"
|
||||
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"
|
||||
runs-on: windows-2022
|
||||
defaults:
|
||||
@@ -113,35 +155,35 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
python:
|
||||
# - '3.7'
|
||||
# - '3.8'
|
||||
# - '3.9'
|
||||
- '3.10'
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- uses: actions/setup-python@v2
|
||||
|
||||
- name: "Install Python"
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
|
||||
- name: "Generate bdk.py"
|
||||
run: |
|
||||
python --version
|
||||
pip install --user -r requirements.txt
|
||||
bash generate.sh
|
||||
- name: "Generate bdk.py and binaries"
|
||||
run: bash ./scripts/generate-windows.sh
|
||||
|
||||
- name: "Build wheel"
|
||||
run: python setup.py bdist_wheel --verbose
|
||||
|
||||
# TODO: On Windows the pip install ./dist/*.whl step fails with the following error:
|
||||
# Run pip install ./dist/*.whl
|
||||
# WARNING: Requirement './dist/*.whl' looks like a filename, but the file does not exist
|
||||
# ERROR: *.whl is not a valid wheel filename.*.whl is not a valid wheel name
|
||||
# So we skip the installing and the tests and simply test that the wheel builds
|
||||
- name: "Upload artifact test"
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: bdkpython-windows-${{ matrix.python }}
|
||||
path: D:\a\bdk-ffi\bdk-ffi\bdk-python\dist\*.whl
|
||||
|
||||
# - name: Install wheel
|
||||
# run: pip install ./dist/*.whl
|
||||
# - name: Run tests
|
||||
# run: python -m unittest tests/test_bdk.py --verbose
|
||||
- name: "Install dependencies"
|
||||
run: Get-ChildItem 'D:\a\bdk-ffi\bdk-ffi\bdk-python\dist\*.whl' | ForEach-Object {pip install $_.FullName}
|
||||
shell: powershell
|
||||
|
||||
- name: "Run tests"
|
||||
run: python -m unittest tests/test_bdk.py --verbose
|
||||
|
||||
8
.github/workflows/test-swift.yaml
vendored
8
.github/workflows/test-swift.yaml
vendored
@@ -1,5 +1,6 @@
|
||||
name: Test Swift
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- "bdk-ffi/**"
|
||||
@@ -14,7 +15,10 @@ jobs:
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- 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
|
||||
run: |
|
||||
@@ -32,7 +36,7 @@ jobs:
|
||||
- name: Build bdk-ffi for 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: |
|
||||
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
|
||||
|
||||
56
CHANGELOG.md
56
CHANGELOG.md
@@ -1,14 +1,46 @@
|
||||
# Changelog
|
||||
All notable changes to this project prior to release **0.9.0** are documented in this file. Future
|
||||
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.
|
||||
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.
|
||||
|
||||
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).
|
||||
|
||||
## [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]
|
||||
- Update BDK to latest version 0.27.1 [#312]
|
||||
- Update BDK to version 0.27.1 [#312]
|
||||
- APIs changed
|
||||
- `PartiallySignedTransaction.extract_tx()` returns a `Transaction` instead of the transaction bytes. [#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
|
||||
|
||||
## [v0.26.0]
|
||||
- Update BDK to latest version 0.26.0 [#288]
|
||||
- Update BDK to version 0.26.0 [#288]
|
||||
- APIs changed
|
||||
- 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]
|
||||
@@ -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
|
||||
|
||||
## [v0.25.0]
|
||||
- Update BDK to latest version 0.25.0 [#272]
|
||||
- Update BDK to version 0.25.0 [#272]
|
||||
- APIs Added:
|
||||
- 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
|
||||
|
||||
## [v0.11.0]
|
||||
- Update BDK to latest version 0.24.0 [#221]
|
||||
- Update BDK to version 0.24.0 [#221]
|
||||
- APIs changed
|
||||
- The constructor on the DescriptorSecretKey type now takes a Mnemonic instead of a String.
|
||||
- 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
|
||||
|
||||
## [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]
|
||||
- Breaking Changes
|
||||
- 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]
|
||||
- `generate_mnemonic()`, returns string mnemonic
|
||||
- `interface DescriptorSecretKey`
|
||||
- `new(Network, string_mnenoinc, password)`, contructs DescriptorSecretKey
|
||||
- `new(Network, string_mnenoinc, password)`, constructs DescriptorSecretKey
|
||||
- `derive(DerivationPath)`, derives and returns child DescriptorSecretKey
|
||||
- `extend(DerivationPath)`, extends and returns DescriptorSecretKey
|
||||
- `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
|
||||
|
||||
## [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.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
|
||||
|
||||
473
Cargo.lock
generated
473
Cargo.lock
generated
@@ -2,6 +2,15 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler"
|
||||
version = "1.0.2"
|
||||
@@ -20,10 +29,27 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.70"
|
||||
name = "ahash"
|
||||
version = "0.8.3"
|
||||
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]]
|
||||
name = "askama"
|
||||
@@ -78,13 +104,13 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.68"
|
||||
version = "0.1.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842"
|
||||
checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.14",
|
||||
"syn 2.0.31",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -104,12 +130,33 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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]]
|
||||
name = "base64"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53"
|
||||
|
||||
[[package]]
|
||||
name = "base64-compat"
|
||||
version = "1.0.0"
|
||||
@@ -121,11 +168,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bdk"
|
||||
version = "0.28.0"
|
||||
version = "0.28.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e9b650f45ae7dc8558544448253f3e1ae443433637ccd9f9d14d2089ff913480"
|
||||
checksum = "b15adb2017ab6437b6704a779ab8bbefe857612f5af9d84b677a1767f965e099"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"ahash 0.7.6",
|
||||
"async-trait",
|
||||
"bdk-macros",
|
||||
"bip39",
|
||||
@@ -147,7 +194,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bdk-ffi"
|
||||
version = "0.28.0"
|
||||
version = "0.30.0"
|
||||
dependencies = [
|
||||
"assert_matches",
|
||||
"bdk",
|
||||
@@ -197,7 +244,7 @@ version = "0.29.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0694ea59225b0c5f3cb405ff3f670e4828358ed26aec49dc352f730f0cb1a8a3"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"base64 0.13.1",
|
||||
"bech32",
|
||||
"bitcoin_hashes",
|
||||
"secp256k1",
|
||||
@@ -245,9 +292,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.12.0"
|
||||
version = "3.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
|
||||
checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
@@ -263,18 +310,18 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
|
||||
|
||||
[[package]]
|
||||
name = "camino"
|
||||
version = "1.1.4"
|
||||
version = "1.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c530edf18f37068ac2d977409ed5cd50d53d73bc653c7647b48eb78976ac9ae2"
|
||||
checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo-platform"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27"
|
||||
checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -295,9 +342,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.79"
|
||||
version = "1.0.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
|
||||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
@@ -307,9 +357,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "3.2.23"
|
||||
version = "3.2.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5"
|
||||
checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags",
|
||||
@@ -324,9 +374,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "3.2.18"
|
||||
version = "3.2.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65"
|
||||
checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
@@ -355,9 +405,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.14"
|
||||
version = "0.9.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
|
||||
checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
@@ -368,9 +418,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.15"
|
||||
version = "0.8.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b"
|
||||
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
@@ -385,11 +435,11 @@ dependencies = [
|
||||
"byteorder",
|
||||
"libc",
|
||||
"log",
|
||||
"rustls",
|
||||
"rustls 0.20.9",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"webpki",
|
||||
"webpki-roots",
|
||||
"webpki-roots 0.22.6",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
@@ -419,9 +469,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.25"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841"
|
||||
checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
@@ -429,9 +479,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
|
||||
checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
|
||||
dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
@@ -463,15 +513,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.9"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
|
||||
checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.1"
|
||||
@@ -494,17 +550,24 @@ name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"ahash 0.8.3",
|
||||
"allocator-api2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashlink"
|
||||
version = "0.8.1"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa"
|
||||
checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
"hashbrown 0.14.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -524,9 +587,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"
|
||||
checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
|
||||
dependencies = [
|
||||
"unicode-bidi",
|
||||
"unicode-normalization",
|
||||
@@ -539,7 +602,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
"hashbrown 0.12.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -553,15 +616,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.6"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.61"
|
||||
version = "0.3.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730"
|
||||
checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
@@ -580,9 +643,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.141"
|
||||
version = "0.2.147"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5"
|
||||
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
@@ -597,9 +660,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.9"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
|
||||
checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"scopeguard",
|
||||
@@ -607,24 +670,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.17"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.5.0"
|
||||
version = "2.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||
checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.8.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
|
||||
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
@@ -653,9 +713,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "miniscript"
|
||||
version = "9.0.1"
|
||||
version = "9.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9601439f168c13bdc5bf84349c2e61c815be4a4dcebe8c4ff4af58f4e8a6d20"
|
||||
checksum = "e5b106477a0709e2da253e5559ba4ab20a272f8577f1eefff72f3a905b5d35f5"
|
||||
dependencies = [
|
||||
"bitcoin",
|
||||
"serde",
|
||||
@@ -663,9 +723,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.6.2"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
|
||||
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
@@ -681,16 +741,25 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.17.1"
|
||||
name = "object"
|
||||
version = "0.32.1"
|
||||
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]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.5.0"
|
||||
version = "6.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267"
|
||||
checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac"
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
@@ -719,27 +788,27 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.12"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79"
|
||||
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "2.2.0"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
|
||||
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.9"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
|
||||
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.26"
|
||||
version = "0.3.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
|
||||
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
|
||||
|
||||
[[package]]
|
||||
name = "plain"
|
||||
@@ -779,18 +848,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.56"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
|
||||
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.26"
|
||||
version = "1.0.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
|
||||
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -864,10 +933,16 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.20.8"
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.23"
|
||||
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 = [
|
||||
"log",
|
||||
"ring",
|
||||
@@ -876,16 +951,48 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.13"
|
||||
name = "rustls"
|
||||
version = "0.21.7"
|
||||
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]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "scroll"
|
||||
@@ -898,13 +1005,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "scroll_derive"
|
||||
version = "0.11.0"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bdbda6ac5cd1321e724fa9cee216f3a61885889b896f073b8f82322789c5250e"
|
||||
checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
"syn 2.0.31",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -940,38 +1047,38 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
|
||||
checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.160"
|
||||
version = "1.0.188"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c"
|
||||
checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.160"
|
||||
version = "1.0.188"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df"
|
||||
checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.14",
|
||||
"syn 2.0.31",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.96"
|
||||
version = "1.0.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1"
|
||||
checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@@ -980,9 +1087,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "0.3.10"
|
||||
version = "0.3.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
|
||||
checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
|
||||
|
||||
[[package]]
|
||||
name = "sled"
|
||||
@@ -1002,9 +1109,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.10.0"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
|
||||
checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
|
||||
|
||||
[[package]]
|
||||
name = "socks"
|
||||
@@ -1048,9 +1155,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.14"
|
||||
version = "2.0.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcf316d5356ed6847742d036f8a39c3b8435cac10bd528a4bd461928a6ab34d5"
|
||||
checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1074,22 +1181,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.40"
|
||||
version = "1.0.48"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
|
||||
checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.40"
|
||||
version = "1.0.48"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
|
||||
checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.14",
|
||||
"syn 2.0.31",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1109,25 +1216,24 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.27.0"
|
||||
version = "1.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001"
|
||||
checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"backtrace",
|
||||
"pin-project-lite",
|
||||
"tokio-macros",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.0.0"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce"
|
||||
checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.14",
|
||||
"syn 2.0.31",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1141,9 +1247,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.6.0"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
|
||||
checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89"
|
||||
dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
@@ -1156,9 +1262,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.8"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
|
||||
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
@@ -1298,28 +1404,28 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
|
||||
|
||||
[[package]]
|
||||
name = "ureq"
|
||||
version = "2.6.2"
|
||||
version = "2.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "338b31dd1314f68f3aabf3ed57ab922df95ffcd902476ca7ba3c4ce7b908c46d"
|
||||
checksum = "0b11c96ac7ee530603dcdf68ed1557050f374ce55a5a07193ebf8cbc9f8927e9"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"base64 0.21.3",
|
||||
"flate2",
|
||||
"log",
|
||||
"once_cell",
|
||||
"rustls",
|
||||
"rustls 0.21.7",
|
||||
"rustls-webpki 0.100.2",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"socks",
|
||||
"url",
|
||||
"webpki",
|
||||
"webpki-roots",
|
||||
"webpki-roots 0.23.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.3.1"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
|
||||
checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna",
|
||||
@@ -1346,9 +1452,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.84"
|
||||
version = "0.2.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b"
|
||||
checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
@@ -1356,24 +1462,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.84"
|
||||
version = "0.2.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9"
|
||||
checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
"syn 2.0.31",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.84"
|
||||
version = "0.2.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5"
|
||||
checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -1381,28 +1487,28 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.84"
|
||||
version = "0.2.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
|
||||
checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
"syn 2.0.31",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.84"
|
||||
version = "0.2.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
|
||||
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.61"
|
||||
version = "0.3.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97"
|
||||
checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@@ -1410,9 +1516,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "webpki"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd"
|
||||
checksum = "f0e74f82d49d545ad128049b7e88f6576df2da6b02e9ce565c6f533be576957e"
|
||||
dependencies = [
|
||||
"ring",
|
||||
"untrusted",
|
||||
@@ -1427,6 +1533,15 @@ dependencies = [
|
||||
"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]]
|
||||
name = "weedle2"
|
||||
version = "4.0.0"
|
||||
@@ -1466,69 +1581,3 @@ name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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"
|
||||
|
||||
@@ -9,4 +9,4 @@ opt-level = 'z' # Optimize for size.
|
||||
lto = true # Enable Link Time Optimization
|
||||
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
|
||||
panic = 'abort' # Abort on panic
|
||||
strip = true # Strip symbols from binary*
|
||||
strip = true # Strip symbols from binary
|
||||
|
||||
23
README.md
23
README.md
@@ -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] | |
|
||||
| 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
|
||||
|
||||
### Adding new structs and functions
|
||||
@@ -49,8 +64,8 @@ See the [UniFFI User Guide](https://mozilla.github.io/uniffi-rs/)
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
implementation("org.bitcoindevkit:bdk-android:<version>")
|
||||
dependencies {
|
||||
implementation("org.bitcoindevkit:bdk-android:<version>")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -60,8 +75,8 @@ dependencies {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
implementation("org.bitcoindevkit:bdk-jvm:<version>")
|
||||
dependencies {
|
||||
implementation("org.bitcoindevkit:bdk-jvm:<version>")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -489,6 +489,9 @@ class Wallet(
|
||||
*/
|
||||
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. */
|
||||
fun getBalance(): Balance {}
|
||||
|
||||
@@ -782,6 +785,19 @@ class Descriptor(descriptor: String, 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. */
|
||||
fun asString(): String {}
|
||||
|
||||
@@ -826,7 +842,10 @@ data class TxBuilderResult (
|
||||
/**
|
||||
* 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.
|
||||
|
||||
@@ -8,8 +8,8 @@ repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.bitcoindevkit:bdk-android:<version>")
|
||||
dependencies {
|
||||
implementation("org.bitcoindevkit:bdk-android:<version>")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -38,8 +38,8 @@ repositories {
|
||||
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.bitcoindevkit:bdk-android:<version-SNAPSHOT>")
|
||||
dependencies {
|
||||
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
|
||||
git clone https://github.com/bitcoindevkit/bdk-ffi
|
||||
```
|
||||
2. Follow the "General" bdk-ffi ["Getting Started (Developer)"] instructions.
|
||||
3. If building on macOS install required intel and m1 jvm targets
|
||||
2. Follow the "General" bdk-ffi ["Getting Started (Developer)"] instructions.
|
||||
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
|
||||
```sh
|
||||
rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi
|
||||
```
|
||||
```sh
|
||||
rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi
|
||||
```
|
||||
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
|
||||
build tool), for example (NDK major version 21 is required):
|
||||
```shell
|
||||
export ANDROID_SDK_ROOT=~/Android/Sdk
|
||||
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/21.<NDK_VERSION>
|
||||
```
|
||||
build tool), for example (note that currently, NDK version 21.4.7075529 is required):
|
||||
```shell
|
||||
export ANDROID_SDK_ROOT=~/Android/Sdk
|
||||
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/21.4.7075529
|
||||
```
|
||||
7. Build kotlin bindings
|
||||
```sh
|
||||
# build Android library
|
||||
|
||||
@@ -2,4 +2,4 @@ org.gradle.jvmargs=-Xmx1536m
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
kotlin.code.style=official
|
||||
libraryVersion=0.28.0-SNAPSHOT
|
||||
libraryVersion=0.30.0
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
[package]
|
||||
name = "bdk-ffi"
|
||||
version = "0.28.0"
|
||||
version = "0.30.0"
|
||||
authors = ["Steve Myers <steve@notmandatory.org>", "Sudarsan Balaji <sudarsan.balaji@artfuldev.com>"]
|
||||
edition = "2018"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[lib]
|
||||
crate-type = ["lib", "staticlib", "cdylib"]
|
||||
#crate-type = ["staticlib", "cdylib"]
|
||||
#crate-type = ["cdylib"]
|
||||
name = "bdkffi"
|
||||
|
||||
[[bin]]
|
||||
@@ -19,7 +17,7 @@ path = "uniffi-bindgen.rs"
|
||||
default = ["uniffi/cli"]
|
||||
|
||||
[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" }
|
||||
|
||||
[build-dependencies]
|
||||
|
||||
@@ -221,28 +221,31 @@ interface Wallet {
|
||||
[Throws=BdkError]
|
||||
constructor(Descriptor descriptor, Descriptor? change_descriptor, Network network, DatabaseConfig database_config);
|
||||
|
||||
Network network();
|
||||
|
||||
[Throws=BdkError]
|
||||
AddressInfo get_address(AddressIndex address_index);
|
||||
|
||||
[Throws=BdkError]
|
||||
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]
|
||||
Balance get_balance();
|
||||
|
||||
[Throws=BdkError]
|
||||
boolean sign([ByRef] PartiallySignedTransaction psbt, SignOptions? sign_options);
|
||||
|
||||
[Throws=BdkError]
|
||||
sequence<TransactionDetails> list_transactions(boolean include_raw);
|
||||
|
||||
Network network();
|
||||
|
||||
[Throws=BdkError]
|
||||
void sync([ByRef] Blockchain blockchain, Progress? progress);
|
||||
|
||||
[Throws=BdkError]
|
||||
sequence<LocalUtxo> list_unspent();
|
||||
};
|
||||
|
||||
interface FeeRate {
|
||||
@@ -439,6 +442,12 @@ interface Descriptor {
|
||||
[Name=new_bip84_public]
|
||||
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_private();
|
||||
@@ -493,4 +502,6 @@ enum WitnessVersion {
|
||||
|
||||
interface Script {
|
||||
constructor(sequence<u8> raw_output_script);
|
||||
|
||||
sequence<u8> to_bytes();
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ use std::path::PathBuf;
|
||||
use std::sync::{Arc, Mutex, MutexGuard};
|
||||
|
||||
pub(crate) struct Blockchain {
|
||||
blockchain_mutex: Mutex<AnyBlockchain>,
|
||||
inner_mutex: Mutex<AnyBlockchain>,
|
||||
}
|
||||
|
||||
impl Blockchain {
|
||||
@@ -52,16 +52,16 @@ impl Blockchain {
|
||||
};
|
||||
let blockchain = AnyBlockchain::from_config(&any_blockchain_config)?;
|
||||
Ok(Self {
|
||||
blockchain_mutex: Mutex::new(blockchain),
|
||||
inner_mutex: Mutex::new(blockchain),
|
||||
})
|
||||
}
|
||||
|
||||
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> {
|
||||
let tx = &transaction.internal;
|
||||
let tx = &transaction.inner;
|
||||
self.get_blockchain().broadcast(tx)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ use bdk::keys::{
|
||||
DescriptorPublicKey as BdkDescriptorPublicKey, DescriptorSecretKey as BdkDescriptorSecretKey,
|
||||
};
|
||||
use bdk::template::{
|
||||
Bip44, Bip44Public, Bip49, Bip49Public, Bip84, Bip84Public, DescriptorTemplate,
|
||||
Bip44, Bip44Public, Bip49, Bip49Public, Bip84, Bip84Public, Bip86, Bip86Public,
|
||||
DescriptorTemplate,
|
||||
};
|
||||
use bdk::KeychainKind;
|
||||
use std::ops::Deref;
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -35,9 +35,9 @@ impl Descriptor {
|
||||
keychain_kind: KeychainKind,
|
||||
network: Network,
|
||||
) -> 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) => {
|
||||
let derivable_key = descriptor_x_key.xkey;
|
||||
let (extended_descriptor, key_map, _) =
|
||||
@@ -60,9 +60,9 @@ impl Descriptor {
|
||||
network: Network,
|
||||
) -> Self {
|
||||
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) => {
|
||||
let derivable_key = descriptor_x_key.xkey;
|
||||
let (extended_descriptor, key_map, _) =
|
||||
@@ -86,9 +86,9 @@ impl Descriptor {
|
||||
keychain_kind: KeychainKind,
|
||||
network: Network,
|
||||
) -> 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) => {
|
||||
let derivable_key = descriptor_x_key.xkey;
|
||||
let (extended_descriptor, key_map, _) =
|
||||
@@ -111,9 +111,9 @@ impl Descriptor {
|
||||
network: Network,
|
||||
) -> Self {
|
||||
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) => {
|
||||
let derivable_key = descriptor_x_key.xkey;
|
||||
let (extended_descriptor, key_map, _) =
|
||||
@@ -137,9 +137,9 @@ impl Descriptor {
|
||||
keychain_kind: KeychainKind,
|
||||
network: Network,
|
||||
) -> 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) => {
|
||||
let derivable_key = descriptor_x_key.xkey;
|
||||
let (extended_descriptor, key_map, _) =
|
||||
@@ -162,9 +162,9 @@ impl Descriptor {
|
||||
network: Network,
|
||||
) -> Self {
|
||||
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) => {
|
||||
let derivable_key = descriptor_x_key.xkey;
|
||||
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 {
|
||||
let descriptor = &self.extended_descriptor;
|
||||
let key_map = &self.key_map;
|
||||
@@ -239,17 +290,27 @@ mod test {
|
||||
.as_public();
|
||||
println!("Public 84: {}", handmade_public_84.as_string());
|
||||
// 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 =
|
||||
Descriptor::new_bip44(master.clone(), KeychainKind::External, Network::Testnet);
|
||||
let template_private_49 =
|
||||
Descriptor::new_bip49(master.clone(), KeychainKind::External, Network::Testnet);
|
||||
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
|
||||
println!("Template 49: {}", template_private_49.as_string());
|
||||
println!("Template 44: {}", template_private_44.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(
|
||||
handmade_public_44,
|
||||
"d1d04177".to_string(),
|
||||
@@ -268,9 +329,16 @@ mod test {
|
||||
KeychainKind::External,
|
||||
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 44: {}", template_public_44.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
|
||||
assert_eq!(
|
||||
template_public_44.as_string_private(),
|
||||
@@ -284,6 +352,10 @@ mod test {
|
||||
template_public_84.as_string_private(),
|
||||
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
|
||||
assert_eq!(
|
||||
template_private_44.as_string(),
|
||||
@@ -297,6 +369,10 @@ mod test {
|
||||
template_private_84.as_string(),
|
||||
template_public_84.as_string()
|
||||
);
|
||||
assert_eq!(
|
||||
template_private_86.as_string(),
|
||||
template_public_86.as_string()
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
fn test_descriptor_from_string() {
|
||||
|
||||
@@ -17,7 +17,7 @@ use std::sync::{Arc, Mutex};
|
||||
/// Mnemonic phrases are a human-readable version of the private keys.
|
||||
/// Supported number of words are 12, 15, 18, 21 and 24.
|
||||
pub(crate) struct Mnemonic {
|
||||
internal: BdkMnemonic,
|
||||
inner: BdkMnemonic,
|
||||
}
|
||||
|
||||
impl Mnemonic {
|
||||
@@ -26,13 +26,13 @@ impl Mnemonic {
|
||||
let generated_key: GeneratedKey<_, BareCtx> =
|
||||
BdkMnemonic::generate((word_count, Language::English)).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
|
||||
pub(crate) fn from_string(mnemonic: String) -> Result<Self, BdkError> {
|
||||
BdkMnemonic::from_str(&mnemonic)
|
||||
.map(|m| Mnemonic { internal: m })
|
||||
.map(|m| Mnemonic { inner: m })
|
||||
.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.
|
||||
pub(crate) fn from_entropy(entropy: Vec<u8>) -> Result<Self, BdkError> {
|
||||
BdkMnemonic::from_entropy(entropy.as_slice())
|
||||
.map(|m| Mnemonic { internal: m })
|
||||
.map(|m| Mnemonic { inner: m })
|
||||
.map_err(|e| BdkError::Generic(e.to_string()))
|
||||
}
|
||||
|
||||
/// Returns Mnemonic as string
|
||||
pub(crate) fn as_string(&self) -> String {
|
||||
self.internal.to_string()
|
||||
self.inner.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct DerivationPath {
|
||||
derivation_path_mutex: Mutex<BdkDerivationPath>,
|
||||
inner_mutex: Mutex<BdkDerivationPath>,
|
||||
}
|
||||
|
||||
impl DerivationPath {
|
||||
pub(crate) fn new(path: String) -> Result<Self, BdkError> {
|
||||
BdkDerivationPath::from_str(&path)
|
||||
.map(|x| DerivationPath {
|
||||
derivation_path_mutex: Mutex::new(x),
|
||||
inner_mutex: Mutex::new(x),
|
||||
})
|
||||
.map_err(|e| BdkError::Generic(e.to_string()))
|
||||
}
|
||||
@@ -66,12 +66,12 @@ impl DerivationPath {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct DescriptorSecretKey {
|
||||
pub(crate) descriptor_secret_key_mutex: Mutex<BdkDescriptorSecretKey>,
|
||||
pub(crate) inner: BdkDescriptorSecretKey,
|
||||
}
|
||||
|
||||
impl DescriptorSecretKey {
|
||||
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 descriptor_secret_key = BdkDescriptorSecretKey::XPrv(DescriptorXKey {
|
||||
origin: None,
|
||||
@@ -80,7 +80,7 @@ impl DescriptorSecretKey {
|
||||
wildcard: bdk::descriptor::Wildcard::Unhardened,
|
||||
});
|
||||
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())
|
||||
.map_err(|e| BdkError::Generic(e.to_string()))?;
|
||||
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> {
|
||||
let secp = Secp256k1::new();
|
||||
let descriptor_secret_key = self.descriptor_secret_key_mutex.lock().unwrap();
|
||||
let path = path.derivation_path_mutex.lock().unwrap().deref().clone();
|
||||
match descriptor_secret_key.deref() {
|
||||
let descriptor_secret_key = &self.inner;
|
||||
let path = path.inner_mutex.lock().unwrap().deref().clone();
|
||||
match descriptor_secret_key {
|
||||
BdkDescriptorSecretKey::XPrv(descriptor_x_key) => {
|
||||
let derived_xprv = descriptor_x_key.xkey.derive_priv(&secp, &path)?;
|
||||
let key_source = match descriptor_x_key.origin.clone() {
|
||||
@@ -110,7 +110,7 @@ impl DescriptorSecretKey {
|
||||
wildcard: descriptor_x_key.wildcard,
|
||||
});
|
||||
Ok(Arc::new(Self {
|
||||
descriptor_secret_key_mutex: Mutex::new(derived_descriptor_secret_key),
|
||||
inner: derived_descriptor_secret_key,
|
||||
}))
|
||||
}
|
||||
BdkDescriptorSecretKey::Single(_) => Err(BdkError::Generic(
|
||||
@@ -120,9 +120,9 @@ impl DescriptorSecretKey {
|
||||
}
|
||||
|
||||
pub(crate) fn extend(&self, path: Arc<DerivationPath>) -> Result<Arc<Self>, BdkError> {
|
||||
let descriptor_secret_key = self.descriptor_secret_key_mutex.lock().unwrap();
|
||||
let path = path.derivation_path_mutex.lock().unwrap().deref().clone();
|
||||
match descriptor_secret_key.deref() {
|
||||
let descriptor_secret_key = &self.inner;
|
||||
let path = path.inner_mutex.lock().unwrap().deref().clone();
|
||||
match descriptor_secret_key {
|
||||
BdkDescriptorSecretKey::XPrv(descriptor_x_key) => {
|
||||
let extended_path = descriptor_x_key.derivation_path.extend(path);
|
||||
let extended_descriptor_secret_key = BdkDescriptorSecretKey::XPrv(DescriptorXKey {
|
||||
@@ -132,7 +132,7 @@ impl DescriptorSecretKey {
|
||||
wildcard: descriptor_x_key.wildcard,
|
||||
});
|
||||
Ok(Arc::new(Self {
|
||||
descriptor_secret_key_mutex: Mutex::new(extended_descriptor_secret_key),
|
||||
inner: extended_descriptor_secret_key,
|
||||
}))
|
||||
}
|
||||
BdkDescriptorSecretKey::Single(_) => Err(BdkError::Generic(
|
||||
@@ -143,21 +143,16 @@ impl DescriptorSecretKey {
|
||||
|
||||
pub(crate) fn as_public(&self) -> Arc<DescriptorPublicKey> {
|
||||
let secp = Secp256k1::new();
|
||||
let descriptor_public_key = self
|
||||
.descriptor_secret_key_mutex
|
||||
.lock()
|
||||
.unwrap()
|
||||
.to_public(&secp)
|
||||
.unwrap();
|
||||
let descriptor_public_key = self.inner.to_public(&secp).unwrap();
|
||||
Arc::new(DescriptorPublicKey {
|
||||
descriptor_public_key_mutex: Mutex::new(descriptor_public_key),
|
||||
inner: descriptor_public_key,
|
||||
})
|
||||
}
|
||||
|
||||
/// Get the private key as bytes.
|
||||
pub(crate) fn secret_bytes(&self) -> Vec<u8> {
|
||||
let descriptor_secret_key = self.descriptor_secret_key_mutex.lock().unwrap();
|
||||
let secret_bytes: Vec<u8> = match descriptor_secret_key.deref() {
|
||||
let inner = &self.inner;
|
||||
let secret_bytes: Vec<u8> = match inner.deref() {
|
||||
BdkDescriptorSecretKey::XPrv(descriptor_x_key) => {
|
||||
descriptor_x_key.xkey.private_key.secret_bytes().to_vec()
|
||||
}
|
||||
@@ -170,13 +165,13 @@ impl DescriptorSecretKey {
|
||||
}
|
||||
|
||||
pub(crate) fn as_string(&self) -> String {
|
||||
self.descriptor_secret_key_mutex.lock().unwrap().to_string()
|
||||
self.inner.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct DescriptorPublicKey {
|
||||
pub(crate) descriptor_public_key_mutex: Mutex<BdkDescriptorPublicKey>,
|
||||
pub(crate) inner: BdkDescriptorPublicKey,
|
||||
}
|
||||
|
||||
impl DescriptorPublicKey {
|
||||
@@ -184,14 +179,14 @@ impl DescriptorPublicKey {
|
||||
let descriptor_public_key = BdkDescriptorPublicKey::from_str(public_key.as_str())
|
||||
.map_err(|e| BdkError::Generic(e.to_string()))?;
|
||||
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> {
|
||||
let secp = Secp256k1::new();
|
||||
let descriptor_public_key = self.descriptor_public_key_mutex.lock().unwrap();
|
||||
let path = path.derivation_path_mutex.lock().unwrap().deref().clone();
|
||||
let descriptor_public_key = &self.inner;
|
||||
let path = path.inner_mutex.lock().unwrap().deref().clone();
|
||||
|
||||
match descriptor_public_key.deref() {
|
||||
BdkDescriptorPublicKey::XPub(descriptor_x_key) => {
|
||||
@@ -207,7 +202,7 @@ impl DescriptorPublicKey {
|
||||
wildcard: descriptor_x_key.wildcard,
|
||||
});
|
||||
Ok(Arc::new(Self {
|
||||
descriptor_public_key_mutex: Mutex::new(derived_descriptor_public_key),
|
||||
inner: derived_descriptor_public_key,
|
||||
}))
|
||||
}
|
||||
BdkDescriptorPublicKey::Single(_) => Err(BdkError::Generic(
|
||||
@@ -217,8 +212,8 @@ impl DescriptorPublicKey {
|
||||
}
|
||||
|
||||
pub(crate) fn extend(&self, path: Arc<DerivationPath>) -> Result<Arc<Self>, BdkError> {
|
||||
let descriptor_public_key = self.descriptor_public_key_mutex.lock().unwrap();
|
||||
let path = path.derivation_path_mutex.lock().unwrap().deref().clone();
|
||||
let descriptor_public_key = &self.inner;
|
||||
let path = path.inner_mutex.lock().unwrap().deref().clone();
|
||||
match descriptor_public_key.deref() {
|
||||
BdkDescriptorPublicKey::XPub(descriptor_x_key) => {
|
||||
let extended_path = descriptor_x_key.derivation_path.extend(path);
|
||||
@@ -229,7 +224,7 @@ impl DescriptorPublicKey {
|
||||
wildcard: descriptor_x_key.wildcard,
|
||||
});
|
||||
Ok(Arc::new(Self {
|
||||
descriptor_public_key_mutex: Mutex::new(extended_descriptor_public_key),
|
||||
inner: extended_descriptor_public_key,
|
||||
}))
|
||||
}
|
||||
BdkDescriptorPublicKey::Single(_) => Err(BdkError::Generic(
|
||||
@@ -239,7 +234,7 @@ impl DescriptorPublicKey {
|
||||
}
|
||||
|
||||
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 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();
|
||||
DescriptorSecretKey::new(Network::Testnet, Arc::new(mnemonic), None)
|
||||
}
|
||||
@@ -293,14 +288,14 @@ mod test {
|
||||
|
||||
#[test]
|
||||
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_public().as_string(), "tpubD6NzVbkrYhZ4WywdEfYbbd62yuvqLjAZuPsNyvzCNV85JekAEMbKHWSHLF9h3j45SxewXDcLv328B1SEZrxg4iwGfmdt1pDFjZiTkGiFqGa/*");
|
||||
}
|
||||
|
||||
#[test]
|
||||
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();
|
||||
assert_eq!(derived_dsk.as_string(), "[d1d04177]tprv8ZgxMBicQKsPdWuqM1t1CDRvQtQuBPyfL6GbhQwtxDKgUAVPbxmj71pRA8raTqLrec5LyTs5TqCxdABcZr77bt2KyWA5bizJHnC4g4ysm4h/*");
|
||||
let master_dpk: &DescriptorPublicKey = &master_dsk.as_public();
|
||||
@@ -310,7 +305,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
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();
|
||||
assert_eq!(derived_dsk.as_string(), "[d1d04177/0]tprv8d7Y4JLmD25jkKbyDZXcdoPHu1YtMHuH21qeN7mFpjfumtSU7eZimFYUCSa3MYzkEYfSNRBV34GEr2QXwZCMYRZ7M1g6PUtiLhbJhBZEGYJ/*");
|
||||
let master_dpk: &DescriptorPublicKey = &master_dsk.as_public();
|
||||
@@ -320,7 +315,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
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();
|
||||
assert_eq!(extended_dsk.as_string(), "tprv8ZgxMBicQKsPdWuqM1t1CDRvQtQuBPyfL6GbhQwtxDKgUAVPbxmj71pRA8raTqLrec5LyTs5TqCxdABcZr77bt2KyWA5bizJHnC4g4ysm4h/0/*");
|
||||
let master_dpk: &DescriptorPublicKey = &master_dsk.as_public();
|
||||
@@ -334,7 +329,7 @@ mod test {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_str_descriptor_secret_key() {
|
||||
fn test_from_str_inner() {
|
||||
let key1 = "L2wTu6hQrnDMiFNWA5na6jB12ErGQqtXwqpSL7aWquJaZG8Ai3ch";
|
||||
let key2 = "tprv8ZgxMBicQKsPcwcD4gSnMti126ZiETsuX7qwrtMypr6FBwAP65puFn4v6c3jrN9VwtMRMph6nyT63NrfUL4C3nBzPcduzVSuHD7zbX2JKVc/1/1/1/*";
|
||||
let private_descriptor_key1 = DescriptorSecretKey::from_string(key1.to_string()).unwrap();
|
||||
@@ -347,8 +342,8 @@ mod test {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_derive_and_extend_descriptor_secret_key() {
|
||||
let master_dsk = get_descriptor_secret_key();
|
||||
fn test_derive_and_extend_inner() {
|
||||
let master_dsk = get_inner();
|
||||
// derive DescriptorSecretKey with path "m/0" from master
|
||||
let derived_dsk: &DescriptorSecretKey = &derive_dsk(&master_dsk, "m/0").unwrap();
|
||||
assert_eq!(derived_dsk.as_string(), "[d1d04177/0]tprv8d7Y4JLmD25jkKbyDZXcdoPHu1YtMHuH21qeN7mFpjfumtSU7eZimFYUCSa3MYzkEYfSNRBV34GEr2QXwZCMYRZ7M1g6PUtiLhbJhBZEGYJ/*");
|
||||
@@ -359,14 +354,14 @@ mod test {
|
||||
|
||||
#[test]
|
||||
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");
|
||||
assert!(derived_dpk.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
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();
|
||||
assert_eq!(
|
||||
master_private_key,
|
||||
|
||||
@@ -203,7 +203,7 @@ impl From<&BdkTxOut> for TxOut {
|
||||
TxOut {
|
||||
value: tx_out.value,
|
||||
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 {
|
||||
value: local_utxo.txout.value,
|
||||
script_pubkey: Arc::new(Script {
|
||||
script: local_utxo.txout.script_pubkey,
|
||||
inner: local_utxo.txout.script_pubkey,
|
||||
}),
|
||||
},
|
||||
keychain: local_utxo.keychain,
|
||||
@@ -275,7 +275,7 @@ impl From<&BdkTxIn> for TxIn {
|
||||
vout: tx_in.previous_output.vout,
|
||||
},
|
||||
script_sig: Arc::new(Script {
|
||||
script: tx_in.script_sig.clone(),
|
||||
inner: tx_in.script_sig.clone(),
|
||||
}),
|
||||
sequence: tx_in.sequence.0,
|
||||
witness: tx_in.witness.to_vec(),
|
||||
@@ -286,93 +286,93 @@ impl From<&BdkTxIn> for TxIn {
|
||||
/// A Bitcoin transaction.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Transaction {
|
||||
internal: BdkTransaction,
|
||||
inner: BdkTransaction,
|
||||
}
|
||||
|
||||
impl Transaction {
|
||||
fn new(transaction_bytes: Vec<u8>) -> Result<Self, BdkError> {
|
||||
let mut decoder = Cursor::new(transaction_bytes);
|
||||
let tx: BdkTransaction = BdkTransaction::consensus_decode(&mut decoder)?;
|
||||
Ok(Transaction { internal: tx })
|
||||
Ok(Transaction { inner: tx })
|
||||
}
|
||||
|
||||
fn txid(&self) -> String {
|
||||
self.internal.txid().to_string()
|
||||
self.inner.txid().to_string()
|
||||
}
|
||||
|
||||
fn weight(&self) -> u64 {
|
||||
self.internal.weight() as u64
|
||||
self.inner.weight() as u64
|
||||
}
|
||||
|
||||
fn size(&self) -> u64 {
|
||||
self.internal.size() as u64
|
||||
self.inner.size() as u64
|
||||
}
|
||||
|
||||
fn vsize(&self) -> u64 {
|
||||
self.internal.vsize() as u64
|
||||
self.inner.vsize() as u64
|
||||
}
|
||||
|
||||
fn serialize(&self) -> Vec<u8> {
|
||||
self.internal.serialize()
|
||||
self.inner.serialize()
|
||||
}
|
||||
|
||||
fn is_coin_base(&self) -> bool {
|
||||
self.internal.is_coin_base()
|
||||
self.inner.is_coin_base()
|
||||
}
|
||||
|
||||
fn is_explicitly_rbf(&self) -> bool {
|
||||
self.internal.is_explicitly_rbf()
|
||||
self.inner.is_explicitly_rbf()
|
||||
}
|
||||
|
||||
fn is_lock_time_enabled(&self) -> bool {
|
||||
self.internal.is_lock_time_enabled()
|
||||
self.inner.is_lock_time_enabled()
|
||||
}
|
||||
|
||||
fn version(&self) -> i32 {
|
||||
self.internal.version
|
||||
self.inner.version
|
||||
}
|
||||
|
||||
fn lock_time(&self) -> u32 {
|
||||
self.internal.lock_time.0
|
||||
self.inner.lock_time.0
|
||||
}
|
||||
|
||||
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> {
|
||||
self.internal.output.iter().map(|x| x.into()).collect()
|
||||
self.inner.output.iter().map(|x| x.into()).collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BdkTransaction> for Transaction {
|
||||
fn from(tx: BdkTransaction) -> Self {
|
||||
Transaction { internal: tx }
|
||||
Transaction { inner: tx }
|
||||
}
|
||||
}
|
||||
|
||||
/// A Bitcoin address.
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct Address {
|
||||
address: BdkAddress,
|
||||
inner: BdkAddress,
|
||||
}
|
||||
|
||||
impl Address {
|
||||
fn new(address: String) -> Result<Self, BdkError> {
|
||||
BdkAddress::from_str(address.as_str())
|
||||
.map(|a| Address { address: a })
|
||||
.map(|a| Address { inner: a })
|
||||
.map_err(|e| BdkError::Generic(e.to_string()))
|
||||
}
|
||||
|
||||
/// alternative constructor
|
||||
fn from_script(script: Arc<Script>, network: Network) -> Result<Self, BdkError> {
|
||||
BdkAddress::from_script(&script.script, network)
|
||||
.map(|a| Address { address: a })
|
||||
BdkAddress::from_script(&script.inner, network)
|
||||
.map(|a| Address { inner: a })
|
||||
.map_err(|e| BdkError::Generic(e.to_string()))
|
||||
}
|
||||
|
||||
fn payload(&self) -> Payload {
|
||||
match &self.address.payload.clone() {
|
||||
match &self.inner.payload.clone() {
|
||||
BdkPayload::PubkeyHash(pubkey_hash) => Payload::PubkeyHash {
|
||||
pubkey_hash: pubkey_hash.to_vec(),
|
||||
},
|
||||
@@ -387,27 +387,27 @@ impl Address {
|
||||
}
|
||||
|
||||
fn network(&self) -> Network {
|
||||
self.address.network
|
||||
self.inner.network
|
||||
}
|
||||
|
||||
fn script_pubkey(&self) -> Arc<Script> {
|
||||
Arc::new(Script {
|
||||
script: self.address.script_pubkey(),
|
||||
inner: self.inner.script_pubkey(),
|
||||
})
|
||||
}
|
||||
|
||||
fn to_qr_uri(&self) -> String {
|
||||
self.address.to_qr_uri()
|
||||
self.inner.to_qr_uri()
|
||||
}
|
||||
|
||||
fn as_string(&self) -> String {
|
||||
self.address.to_string()
|
||||
self.inner.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BdkAddress> for Address {
|
||||
fn from(address: BdkAddress) -> Self {
|
||||
Address { address }
|
||||
Address { inner: address }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,19 +430,23 @@ pub enum Payload {
|
||||
/// A Bitcoin script.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Script {
|
||||
script: BdkScript,
|
||||
inner: BdkScript,
|
||||
}
|
||||
|
||||
impl Script {
|
||||
fn new(raw_output_script: Vec<u8>) -> Self {
|
||||
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 {
|
||||
fn from(bdk_script: BdkScript) -> Self {
|
||||
Script { script: bdk_script }
|
||||
Script { inner: bdk_script }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use crate::{BdkError, FeeRate, Transaction};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct PartiallySignedTransaction {
|
||||
pub(crate) internal: Mutex<BdkPartiallySignedTransaction>,
|
||||
pub(crate) inner: Mutex<BdkPartiallySignedTransaction>,
|
||||
}
|
||||
|
||||
impl PartiallySignedTransaction {
|
||||
@@ -18,24 +18,24 @@ impl PartiallySignedTransaction {
|
||||
let psbt: BdkPartiallySignedTransaction =
|
||||
BdkPartiallySignedTransaction::from_str(&psbt_base64)?;
|
||||
Ok(PartiallySignedTransaction {
|
||||
internal: Mutex::new(psbt),
|
||||
inner: Mutex::new(psbt),
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn serialize(&self) -> String {
|
||||
let psbt = self.internal.lock().unwrap().clone();
|
||||
let psbt = self.inner.lock().unwrap().clone();
|
||||
psbt.to_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();
|
||||
txid.to_hex()
|
||||
}
|
||||
|
||||
/// Return the 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())
|
||||
}
|
||||
|
||||
@@ -46,19 +46,19 @@ impl PartiallySignedTransaction {
|
||||
&self,
|
||||
other: Arc<PartiallySignedTransaction>,
|
||||
) -> Result<Arc<PartiallySignedTransaction>, BdkError> {
|
||||
let other_psbt = other.internal.lock().unwrap().clone();
|
||||
let mut original_psbt = self.internal.lock().unwrap().clone();
|
||||
let other_psbt = other.inner.lock().unwrap().clone();
|
||||
let mut original_psbt = self.inner.lock().unwrap().clone();
|
||||
|
||||
original_psbt.combine(other_psbt)?;
|
||||
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.
|
||||
/// If the PSBT is missing a TxOut for an input returns None.
|
||||
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
|
||||
@@ -66,12 +66,12 @@ impl PartiallySignedTransaction {
|
||||
/// transaction.
|
||||
/// If the PSBT is missing a TxOut for an input returns None.
|
||||
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.
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ mod test {
|
||||
let test_wpkh = "wpkh(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW)";
|
||||
let (funded_wallet, _, _) = get_funded_wallet(test_wpkh);
|
||||
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_script = crate::Address::new(drain_to_address)
|
||||
@@ -103,7 +103,7 @@ mod test {
|
||||
.drain_to(drain_to_script.clone());
|
||||
//dbg!(&tx_builder);
|
||||
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();
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ use crate::{
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Wallet {
|
||||
pub(crate) wallet_mutex: Mutex<BdkWallet<AnyDatabase>>,
|
||||
pub(crate) inner_mutex: Mutex<BdkWallet<AnyDatabase>>,
|
||||
}
|
||||
|
||||
/// A Bitcoin wallet.
|
||||
@@ -53,11 +53,13 @@ impl Wallet {
|
||||
network,
|
||||
database,
|
||||
)?);
|
||||
Ok(Wallet { wallet_mutex })
|
||||
Ok(Wallet {
|
||||
inner_mutex: wallet_mutex,
|
||||
})
|
||||
}
|
||||
|
||||
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.
|
||||
@@ -65,6 +67,11 @@ impl Wallet {
|
||||
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.
|
||||
pub(crate) fn sync(
|
||||
&self,
|
||||
@@ -126,7 +133,7 @@ impl Wallet {
|
||||
psbt: &PartiallySignedTransaction,
|
||||
sign_options: Option<SignOptions>,
|
||||
) -> Result<bool, BdkError> {
|
||||
let mut psbt = psbt.internal.lock().unwrap();
|
||||
let mut psbt = psbt.inner.lock().unwrap();
|
||||
self.get_wallet().sign(
|
||||
&mut psbt,
|
||||
sign_options.map(SignOptions::into).unwrap_or_default(),
|
||||
@@ -266,7 +273,7 @@ impl TxBuilder {
|
||||
/// Add a recipient to the internal list.
|
||||
pub(crate) fn add_recipient(&self, script: Arc<Script>, amount: u64) -> Arc<Self> {
|
||||
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 {
|
||||
recipients,
|
||||
..self.clone()
|
||||
@@ -276,7 +283,7 @@ impl TxBuilder {
|
||||
pub(crate) fn set_recipients(&self, recipients: Vec<ScriptAmount>) -> Arc<Self> {
|
||||
let recipients = recipients
|
||||
.iter()
|
||||
.map(|script_amount| (script_amount.script.script.clone(), script_amount.amount))
|
||||
.map(|script_amount| (script_amount.script.inner.clone(), script_amount.amount))
|
||||
.collect();
|
||||
Arc::new(TxBuilder {
|
||||
recipients,
|
||||
@@ -381,7 +388,7 @@ impl TxBuilder {
|
||||
/// to allow this output to be reduced to pay for the extra fees.
|
||||
pub(crate) fn drain_to(&self, script: Arc<Script>) -> Arc<Self> {
|
||||
Arc::new(TxBuilder {
|
||||
drain_to: Some(script.script.clone()),
|
||||
drain_to: Some(script.inner.clone()),
|
||||
..self.clone()
|
||||
})
|
||||
}
|
||||
@@ -463,7 +470,7 @@ impl TxBuilder {
|
||||
.finish()
|
||||
.map(|(psbt, tx_details)| TxBuilderResult {
|
||||
psbt: Arc::new(PartiallySignedTransaction {
|
||||
internal: Mutex::new(psbt),
|
||||
inner: Mutex::new(psbt),
|
||||
}),
|
||||
transaction_details: TransactionDetails::from(tx_details),
|
||||
})
|
||||
@@ -547,7 +554,7 @@ impl BumpFeeTxBuilder {
|
||||
tx_builder
|
||||
.finish()
|
||||
.map(|(psbt, _)| PartiallySignedTransaction {
|
||||
internal: Mutex::new(psbt),
|
||||
inner: Mutex::new(psbt),
|
||||
})
|
||||
.map(Arc::new)
|
||||
}
|
||||
@@ -560,9 +567,13 @@ impl BumpFeeTxBuilder {
|
||||
mod test {
|
||||
use crate::database::DatabaseConfig;
|
||||
use crate::descriptor::Descriptor;
|
||||
use crate::keys::{DescriptorSecretKey, Mnemonic};
|
||||
use crate::wallet::{AddressIndex, TxBuilder, Wallet};
|
||||
use crate::Script;
|
||||
use assert_matches::assert_matches;
|
||||
use bdk::bitcoin::{Address, Network};
|
||||
use bdk::wallet::get_funded_wallet;
|
||||
use bdk::KeychainKind;
|
||||
use std::str::FromStr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
@@ -571,7 +582,7 @@ mod test {
|
||||
let test_wpkh = "wpkh(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW)";
|
||||
let (funded_wallet, _, _) = get_funded_wallet(test_wpkh);
|
||||
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_script = crate::Address::new(drain_to_address)
|
||||
@@ -581,10 +592,10 @@ mod test {
|
||||
.drain_wallet()
|
||||
.drain_to(drain_to_script.clone());
|
||||
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 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;
|
||||
|
||||
// confirm one input with 50,000 sats
|
||||
@@ -802,4 +813,47 @@ mod test {
|
||||
"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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
## How to Use
|
||||
@@ -25,8 +25,8 @@ val internalDescriptor = Descriptor("wpkh([c258d2e4/84h/1h/0h]tpubDDYkZojQFQjht8
|
||||
val databaseConfig = DatabaseConfig.Memory
|
||||
|
||||
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 newAddress = wallet.getAddress(AddressIndex.LastUnused)
|
||||
```
|
||||
@@ -38,32 +38,39 @@ repositories {
|
||||
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.bitcoindevkit:bdk-jvm:<version-SNAPSHOT>")
|
||||
dependencies {
|
||||
implementation("org.bitcoindevkit:bdk-jvm:<version-SNAPSHOT>")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Example Projects
|
||||
* [Tatooine Faucet](https://github.com/thunderbiscuit/tatooine)
|
||||
|
||||
## How to build
|
||||
_Note that Kotlin version `1.6.10` or later is required to build the library._
|
||||
|
||||
1. Clone this repository.
|
||||
1. Install JDK 11. It must be version 11 (not 17), otherwise it won't build. For example, with SDKMAN!:
|
||||
```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
|
||||
git clone https://github.com/bitcoindevkit/bdk-ffi
|
||||
```
|
||||
2. Follow the "General" bdk-ffi ["Getting Started (Developer)"] instructions.
|
||||
3. If building on macOS install required intel and m1 jvm targets
|
||||
4. If building on macOS install required intel and m1 jvm targets
|
||||
```sh
|
||||
rustup target add x86_64-apple-darwin aarch64-apple-darwin
|
||||
```
|
||||
4. Build kotlin bindings
|
||||
```sh
|
||||
# build JVM library
|
||||
./gradlew buildJvmLib
|
||||
```
|
||||
5. Build kotlin bindings
|
||||
```sh
|
||||
./gradlew buildJvmLib
|
||||
```
|
||||
|
||||
## How to publish to your local Maven repo
|
||||
```shell
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
android.enableJetifier=true
|
||||
kotlin.code.style=official
|
||||
libraryVersion=0.28.0-SNAPSHOT
|
||||
libraryVersion=0.30.0
|
||||
|
||||
@@ -20,8 +20,8 @@ repositories {
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
@@ -107,4 +107,8 @@ signing {
|
||||
// binaries before running the tests
|
||||
tasks.withType<KotlinCompile> {
|
||||
dependsOn("buildJvmLib")
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@ package org.bitcoindevkit.plugins
|
||||
val operatingSystem: OS = when {
|
||||
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("windows", ignoreCase = true) -> OS.WINDOWS
|
||||
else -> OS.OTHER
|
||||
}
|
||||
|
||||
enum class OS {
|
||||
MAC,
|
||||
LINUX,
|
||||
WINDOWS,
|
||||
OTHER,
|
||||
}
|
||||
|
||||
@@ -27,13 +27,20 @@ internal class UniFfiJvmPlugin : Plugin<Project> {
|
||||
val cargoArgs: List<String> = listOf("build", "--profile", "release-smaller", "--target", "aarch64-apple-darwin")
|
||||
args(cargoArgs)
|
||||
}
|
||||
} else if(operatingSystem == OS.LINUX) {
|
||||
} else if (operatingSystem == OS.LINUX) {
|
||||
exec {
|
||||
workingDir("${project.projectDir}/../../bdk-ffi")
|
||||
executable("cargo")
|
||||
val cargoArgs: List<String> = listOf("build", "--profile", "release-smaller", "--target", "x86_64-unknown-linux-gnu")
|
||||
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"
|
||||
)
|
||||
)
|
||||
} 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 {
|
||||
doFirst {
|
||||
copy {
|
||||
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}/")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
include ./src/bdkpython/libbdkffi.dylib
|
||||
include ./src/bdkpython/libbdkffi.so
|
||||
include ./src/bdkpython/bdkffi.dll
|
||||
|
||||
@@ -12,9 +12,9 @@ pip install bdkpython
|
||||
## Run the tests
|
||||
```shell
|
||||
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
|
||||
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
|
||||
```
|
||||
|
||||
@@ -23,26 +23,14 @@ python -m unittest --verbose tests/test_bdk.py
|
||||
# Install dependencies
|
||||
pip install --requirement requirements.txt
|
||||
|
||||
# Generate the bindings
|
||||
bash generate.sh
|
||||
# Generate the bindings (use the script appropriate for your platform)
|
||||
bash ./scripts/generate-linux.sh
|
||||
|
||||
# Build the 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
|
||||
```shell
|
||||
pip install ./dist/bdkpython-<yourversion>-py3-none-any.whl
|
||||
pip install ./dist/bdkpython-<yourversion>.whl
|
||||
```
|
||||
|
||||
@@ -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!"
|
||||
18
bdk-python/scripts/generate-linux.sh
Normal file
18
bdk-python/scripts/generate-linux.sh
Normal 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!"
|
||||
19
bdk-python/scripts/generate-macos-arm64.sh
Normal file
19
bdk-python/scripts/generate-macos-arm64.sh
Normal 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!"
|
||||
18
bdk-python/scripts/generate-macos-x86_64.sh
Normal file
18
bdk-python/scripts/generate-macos-x86_64.sh
Normal 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!"
|
||||
19
bdk-python/scripts/generate-windows.sh
Normal file
19
bdk-python/scripts/generate-windows.sh
Normal 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!"
|
||||
@@ -51,7 +51,7 @@ print(f"Wallet balance is: {balance.total}")
|
||||
|
||||
setup(
|
||||
name="bdkpython",
|
||||
version="0.28.0.dev0",
|
||||
version="0.30.0",
|
||||
description="The Python language bindings for the Bitcoin Development Kit",
|
||||
long_description=LONG_DESCRIPTION,
|
||||
long_description_content_type="text/markdown",
|
||||
@@ -62,4 +62,7 @@ setup(
|
||||
url="https://github.com/bitcoindevkit/bdk-ffi",
|
||||
author="Alekos Filini <alekos.filini@gmail.com>, Steve Myers <steve@notmandatory.org>",
|
||||
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,
|
||||
)
|
||||
|
||||
@@ -29,7 +29,9 @@ let package = Package(
|
||||
.binaryTarget(name: "bdkFFI", path: "./bdkFFI.xcframework"),
|
||||
.target(
|
||||
name: "BitcoinDevKit",
|
||||
dependencies: ["bdkFFI"]),
|
||||
dependencies: ["bdkFFI"],
|
||||
swiftSettings: [.unsafeFlags(["-suppress-warnings"])]
|
||||
),
|
||||
.testTarget(
|
||||
name: "BitcoinDevKitTests",
|
||||
dependencies: ["BitcoinDevKit"]),
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
#
|
||||
# Run the script from the repo root directory, ie: ./bdk-swift/build-local-swift.sh
|
||||
|
||||
rustup install nightly-x86_64-apple-darwin
|
||||
rustup component add rust-src --toolchain nightly-x86_64-apple-darwin
|
||||
rustup install nightly-2023-04-10
|
||||
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-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
|
||||
|
||||
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 x86_64-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
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user