Skip to content

Commit 9cb6f70

Browse files
committed
Merge branch 'master' into fix_wallet_checksum
2 parents 648282e + 5720e38 commit 9cb6f70

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+938
-1794
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Enhancement request
3+
about: Request a new feature or change to an existing feature
4+
title: ''
5+
labels: 'enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the enhancement**
11+
<!-- A clear and concise description of what you would like added or changed. -->
12+
13+
**Use case**
14+
<!-- Tell us how you or others will use this new feature or change to an existing feature. -->
15+
16+
**Additional context**
17+
<!-- Add any other context about the enhancement here. -->

.github/workflows/cont_integration.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ jobs:
1717
- default
1818
- minimal
1919
- all-keys
20-
- minimal,use-esplora-ureq
20+
- minimal,use-esplora-blocking
2121
- key-value-db
2222
- electrum
2323
- compact_filters
24-
- esplora,ureq,key-value-db,electrum
24+
- use-esplora-blocking,key-value-db,electrum
2525
- compiler
2626
- rpc
2727
- verify
2828
- async-interface
29-
- use-esplora-reqwest
29+
- use-esplora-async
3030
- sqlite
3131
- sqlite-bundled
3232
steps:
@@ -100,10 +100,10 @@ jobs:
100100
features: test-rpc-legacy
101101
- name: esplora
102102
testprefix: esplora
103-
features: test-esplora,use-esplora-reqwest,verify
103+
features: test-esplora,use-esplora-async,verify
104104
- name: esplora
105105
testprefix: esplora
106-
features: test-esplora,use-esplora-ureq,verify
106+
features: test-esplora,use-esplora-blocking,verify
107107
steps:
108108
- name: Checkout
109109
uses: actions/checkout@v2
@@ -154,7 +154,7 @@ jobs:
154154
- name: Update toolchain
155155
run: rustup update
156156
- name: Check
157-
run: cargo check --target wasm32-unknown-unknown --features use-esplora-reqwest --no-default-features
157+
run: cargo check --target wasm32-unknown-unknown --features use-esplora-async,dev-getrandom-wasm --no-default-features
158158

159159
fmt:
160160
name: Rust fmt

.github/workflows/nightly_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Update toolchain
2525
run: rustup update
2626
- name: Build docs
27-
run: cargo rustdoc --verbose --features=compiler,electrum,esplora,ureq,compact_filters,key-value-db,all-keys,sqlite -- --cfg docsrs -Dwarnings
27+
run: cargo rustdoc --verbose --features=compiler,electrum,esplora,use-esplora-blocking,compact_filters,rpc,key-value-db,sqlite,all-keys,verify,hardware-signer -- --cfg docsrs -Dwarnings
2828
- name: Upload artifact
2929
uses: actions/upload-artifact@v2
3030
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/target
22
Cargo.lock
3+
/.vscode
34

45
*.swp
56
.idea

Cargo.toml

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bdk"
3-
version = "0.22.0"
3+
version = "0.23.0"
44
edition = "2018"
55
authors = ["Alekos Filini <alekos.filini@gmail.com>", "Riccardo Casatta <riccardo@casatta.it>"]
66
homepage = "https://bitcoindevkit.org"
@@ -14,40 +14,39 @@ license = "MIT OR Apache-2.0"
1414
[dependencies]
1515
bdk-macros = "^0.6"
1616
log = "^0.4"
17-
miniscript = { version = "7.0", features = ["use-serde"] }
18-
bitcoin = { version = "0.28.1", features = ["use-serde", "base64", "rand"] }
17+
miniscript = { version = "8.0", features = ["serde"] }
18+
bitcoin = { version = "0.29.1", features = ["serde", "base64", "rand"] }
1919
serde = { version = "^1.0", features = ["derive"] }
2020
serde_json = { version = "^1.0" }
21-
rand = "^0.7"
21+
rand = "^0.8"
2222

2323
# Optional dependencies
2424
sled = { version = "0.34", optional = true }
25-
electrum-client = { version = "0.11", optional = true }
25+
electrum-client = { version = "0.12", optional = true }
26+
esplora-client = { version = "0.2", default-features = false, optional = true }
2627
rusqlite = { version = "0.27.0", optional = true }
2728
ahash = { version = "0.7.6", optional = true }
28-
reqwest = { version = "0.11", optional = true, default-features = false, features = ["json"] }
29-
ureq = { version = "~2.2.0", features = ["json"], optional = true }
3029
futures = { version = "0.3", optional = true }
3130
async-trait = { version = "0.1", optional = true }
3231
rocksdb = { version = "0.14", default-features = false, features = ["snappy"], optional = true }
3332
cc = { version = ">=1.0.64", optional = true }
3433
socks = { version = "0.3", optional = true }
35-
hwi = { version = "0.2.2", optional = true }
34+
hwi = { version = "0.3.0", optional = true }
3635

3736
bip39 = { version = "1.0.1", optional = true }
3837
bitcoinconsensus = { version = "0.19.0-3", optional = true }
3938

4039
# Needed by bdk_blockchain_tests macro and the `rpc` feature
41-
bitcoincore-rpc = { version = "0.15", optional = true }
40+
bitcoincore-rpc = { version = "0.16", optional = true }
4241

4342
# Platform-specific dependencies
4443
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
4544
tokio = { version = "1", features = ["rt"] }
4645

4746
[target.'cfg(target_arch = "wasm32")'.dependencies]
47+
getrandom = "0.2"
4848
async-trait = "0.1"
4949
js-sys = "0.3"
50-
rand = { version = "^0.7", features = ["wasm-bindgen"] }
5150

5251
[features]
5352
minimal = []
@@ -69,23 +68,26 @@ hardware-signer = ["hwi"]
6968
#
7069
# - Users wanting asynchronous HTTP calls should enable `async-interface` to get
7170
# access to the asynchronous method implementations. Then, if Esplora is wanted,
72-
# enable `esplora` AND `reqwest` (`--features=use-esplora-reqwest`).
71+
# enable the `use-esplora-async` feature.
7372
# - Users wanting blocking HTTP calls can use any of the other blockchain
7473
# implementations (`compact_filters`, `electrum`, or `esplora`). Users wanting to
75-
# use Esplora should enable `esplora` AND `ureq` (`--features=use-esplora-ureq`).
74+
# use Esplora should enable the `use-esplora-blocking` feature.
7675
#
7776
# WARNING: Please take care with the features below, various combinations will
7877
# fail to build. We cannot currently build `bdk` with `--all-features`.
7978
async-interface = ["async-trait"]
8079
electrum = ["electrum-client"]
8180
# MUST ALSO USE `--no-default-features`.
82-
use-esplora-reqwest = ["esplora", "reqwest", "reqwest/socks", "futures"]
83-
use-esplora-ureq = ["esplora", "ureq", "ureq/socks"]
81+
use-esplora-async = ["esplora", "esplora-client/async", "futures"]
82+
use-esplora-blocking = ["esplora", "esplora-client/blocking"]
83+
# Deprecated aliases
84+
use-esplora-reqwest = ["use-esplora-async"]
85+
use-esplora-ureq = ["use-esplora-blocking"]
8486
# Typical configurations will not need to use `esplora` feature directly.
8587
esplora = []
8688

87-
# Use below feature with `use-esplora-reqwest` to enable reqwest default TLS support
88-
reqwest-default-tls = ["reqwest/default-tls"]
89+
# Use below feature with `use-esplora-async` to enable reqwest default TLS support
90+
reqwest-default-tls = ["esplora-client/async-https"]
8991

9092
# Debug/Test features
9193
test-blockchains = ["bitcoincore-rpc", "electrum-client"]
@@ -96,13 +98,18 @@ test-esplora = ["electrsd/legacy", "electrsd/esplora_a33e97e1", "electrsd/bitcoi
9698
test-md-docs = ["electrum"]
9799
test-hardware-signer = ["hardware-signer"]
98100

101+
# This feature is used to run `cargo check` in our CI targeting wasm. It's not recommended
102+
# for libraries to explicitly include the "getrandom/js" feature, so we only do it when
103+
# necessary for running our CI. See: https://docs.rs/getrandom/0.2.8/getrandom/#webassembly-support
104+
dev-getrandom-wasm = ["getrandom/js"]
105+
99106
[dev-dependencies]
100107
lazy_static = "1.4"
101108
env_logger = "0.7"
102-
electrsd = "0.20"
109+
electrsd = "0.21"
110+
# Move back to importing from rust-bitcoin once https://github.com/rust-bitcoin/rust-bitcoin/pull/1342 is released
111+
base64 = "^0.13"
103112

104-
[[example]]
105-
name = "address_validator"
106113
[[example]]
107114
name = "compact_filters_balance"
108115
required-features = ["compact_filters"]
@@ -126,9 +133,14 @@ name = "psbt_signer"
126133
path = "examples/psbt_signer.rs"
127134
required-features = ["electrum"]
128135

136+
[[example]]
137+
name = "hardware_signer"
138+
path = "examples/hardware_signer.rs"
139+
required-features = ["electrum", "hardware-signer"]
140+
129141
[workspace]
130142
members = ["macros"]
131143
[package.metadata.docs.rs]
132-
features = ["compiler", "electrum", "esplora", "use-esplora-ureq", "compact_filters", "rpc", "key-value-db", "sqlite", "all-keys", "verify", "hardware-signer"]
144+
features = ["compiler", "electrum", "esplora", "use-esplora-blocking", "compact_filters", "rpc", "key-value-db", "sqlite", "all-keys", "verify", "hardware-signer"]
133145
# defines the configuration attribute `docsrs`
134146
rustdoc-args = ["--cfg", "docsrs"]

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ use bdk::blockchain::ElectrumBlockchain;
9595
use bdk::electrum_client::Client;
9696
use bdk::wallet::AddressIndex::New;
9797
98-
use bitcoin::base64;
98+
use base64;
9999
use bitcoin::consensus::serialize;
100100
101101
fn main() -> Result<(), bdk::Error> {
@@ -132,7 +132,7 @@ fn main() -> Result<(), bdk::Error> {
132132
```rust,no_run
133133
use bdk::{Wallet, SignOptions, database::MemoryDatabase};
134134
135-
use bitcoin::base64;
135+
use base64;
136136
use bitcoin::consensus::deserialize;
137137
138138
fn main() -> Result<(), bdk::Error> {
@@ -171,6 +171,17 @@ cargo test --features test-electrum
171171
The other options are `test-esplora`, `test-rpc` or `test-rpc-legacy` which runs against an older version of Bitcoin Core.
172172
Note that `electrs` and `bitcoind` binaries are automatically downloaded (on mac and linux), to specify you already have installed binaries you must use `--no-default-features` and provide `BITCOIND_EXE` and `ELECTRS_EXE` as environment variables.
173173

174+
## Running under WASM
175+
176+
If you want to run this library under WASM you will probably have to add the following lines to you `Cargo.toml`:
177+
178+
```toml
179+
[dependencies]
180+
getrandom = { version = "0.2", features = ["js"] }
181+
```
182+
183+
This enables the `rand` crate to work in environments where JavaScript is available. See [this link](https://docs.rs/getrandom/0.2.8/getrandom/#webassembly-support) to learn more.
184+
174185
## License
175186

176187
Licensed under either of

examples/address_validator.rs

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)