From ae7d0bc411061f0d43e3199bb1cde184f959e773 Mon Sep 17 00:00:00 2001 From: Dario Anongba Varela Date: Mon, 25 Aug 2025 13:08:36 +0200 Subject: [PATCH 1/3] release --- Cargo.lock | 78 +++++++----------------------------------------------- Cargo.toml | 11 ++------ 2 files changed, 12 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5dd1f09..4a7d721 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,8 +73,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f" dependencies = [ - "bitcoin-internals 0.3.0", - "bitcoin_hashes 0.14.0", + "bitcoin-internals", + "bitcoin_hashes", ] [[package]] @@ -131,7 +131,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f278518ee6f2a17711fd4662dc34ce6153792a7a21575f05a9c8e2cb9ba36245" dependencies = [ "bdk_chain", - "bip39", "bitcoin", "miniscript", "rand_core", @@ -145,17 +144,6 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" -[[package]] -name = "bip39" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d193de1f7487df1914d3a568b772458861d33f9c54249612cc2893d6915054" -dependencies = [ - "bitcoin_hashes 0.13.0", - "serde", - "unicode-normalization", -] - [[package]] name = "bitcoin" version = "0.32.6" @@ -165,22 +153,16 @@ dependencies = [ "base58ck", "base64 0.21.7", "bech32", - "bitcoin-internals 0.3.0", + "bitcoin-internals", "bitcoin-io", "bitcoin-units", - "bitcoin_hashes 0.14.0", - "hex-conservative 0.2.1", + "bitcoin_hashes", + "hex-conservative", "hex_lit", "secp256k1", "serde", ] -[[package]] -name = "bitcoin-internals" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" - [[package]] name = "bitcoin-internals" version = "0.3.0" @@ -202,20 +184,10 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2" dependencies = [ - "bitcoin-internals 0.3.0", + "bitcoin-internals", "serde", ] -[[package]] -name = "bitcoin_hashes" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" -dependencies = [ - "bitcoin-internals 0.2.0", - "hex-conservative 0.1.2", -] - [[package]] name = "bitcoin_hashes" version = "0.14.0" @@ -223,13 +195,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" dependencies = [ "bitcoin-io", - "hex-conservative 0.2.1", + "hex-conservative", "serde", ] [[package]] name = "bitcoindevkit" -version = "0.1.13" +version = "0.2.0" dependencies = [ "anyhow", "bdk_esplora", @@ -332,7 +304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "209cf00e44b979682b22be38672317d8bb48dd5ea2726e61b762d6b14b5842f2" dependencies = [ "bitcoin", - "hex-conservative 0.2.1", + "hex-conservative", "log", "reqwest", "serde", @@ -505,12 +477,6 @@ dependencies = [ "serde", ] -[[package]] -name = "hex-conservative" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" - [[package]] name = "hex-conservative" version = "0.2.1" @@ -1118,7 +1084,7 @@ version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" dependencies = [ - "bitcoin_hashes 0.14.0", + "bitcoin_hashes", "rand", "secp256k1-sys", "serde", @@ -1299,21 +1265,6 @@ dependencies = [ "zerovec", ] -[[package]] -name = "tinyvec" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" version = "1.46.1" @@ -1417,15 +1368,6 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" -[[package]] -name = "unicode-normalization" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" -dependencies = [ - "tinyvec", -] - [[package]] name = "url" version = "2.5.4" diff --git a/Cargo.toml b/Cargo.toml index a6f0e55..609e648 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,15 +1,9 @@ [package] name = "bitcoindevkit" -version = "0.1.13" +version = "0.2.0" repository = "https://github.com/bitcoindevkit/bdk-wasm" description = "A modern, lightweight, descriptor-based wallet library in WebAssembly for browsers and Node" -keywords = [ - "bitcoin", - "descriptor", - "wasm", - "browser", - "node", -] +keywords = ["bitcoin", "descriptor", "wasm", "browser", "node"] readme = "README.md" license = "MIT OR Apache-2.0" authors = ["Bitcoin Developers"] @@ -51,7 +45,6 @@ console_error_panic_hook = { version = "0.1.7", optional = true } [dev-dependencies] wasm-bindgen-test = "0.3.50" -bdk_wallet = { version = "2.0.0", features = ["keys-bip39"] } [profile.release] # Tell `rustc` to optimize for small code size. From 957a3b3097f94d11afc205f65156e1bafe2541da Mon Sep 17 00:00:00 2001 From: Dario Anongba Varela Date: Mon, 25 Aug 2025 13:18:51 +0200 Subject: [PATCH 2/3] publish node and web --- .github/workflows/publish-release.yml | 69 ++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 19ed612..339e2e1 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -21,17 +21,50 @@ jobs: toolchain: stable - name: Install wasm-pack run: curl https://raw.githubusercontent.com/rustwasm/wasm-pack/a3a48401795cd4b3afe1d74568c93675a04f3970/installer/init.sh -sSf | sh -s -- -f + - name: Install jq + run: apt-get update -y && apt-get install -y jq - name: Rust Cache uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 - name: Build - run: wasm-pack build --scope bitcoindevkit --features "esplora" + run: | + wasm-pack build --target bundler --out-dir pkg-web --features "esplora" + cd pkg-web + jq '.name = "bdk-wallet-web"' package.json > temp.json && mv temp.json package.json + cd .. + wasm-pack build --target nodejs --out-dir pkg-node --all-features + cd pkg-node + jq '.name = "bdk-wallet-node"' package.json > temp.json && mv temp.json package.json + cd .. + - uses: actions/cache@v4 + with: + path: ./pkg-web + key: ${{ github.sha }}-web + - uses: actions/cache@v4 + with: + path: ./pkg-node + key: ${{ github.sha }}-node + + publish-npm-dry-run-web: + runs-on: ubuntu-latest + needs: publish-release + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.sha }} + - uses: actions/setup-node@v4 + with: + node-version: "lts/*" - uses: actions/cache@v4 with: path: | - ./pkg - key: ${{ github.sha }} + ./pkg-web + key: ${{ github.sha }}-web + fail-on-cache-miss: true + - name: Dry Run Publish + working-directory: pkg-web + run: npm publish --dry-run - publish-npm-dry-run: + publish-npm-dry-run-node: runs-on: ubuntu-latest needs: publish-release steps: @@ -44,17 +77,17 @@ jobs: - uses: actions/cache@v4 with: path: | - ./pkg - key: ${{ github.sha }} + ./pkg-node + key: ${{ github.sha }}-node fail-on-cache-miss: true - name: Dry Run Publish - working-directory: pkg + working-directory: pkg-node run: npm publish --dry-run publish-npm: environment: npm-publish runs-on: ubuntu-latest - needs: publish-npm-dry-run + needs: [publish-npm-dry-run-web, publish-npm-dry-run-node] steps: - uses: actions/checkout@v4 with: @@ -66,11 +99,23 @@ jobs: - uses: actions/cache@v4 with: path: | - ./pkg - key: ${{ github.sha }} + ./pkg-web + key: ${{ github.sha }}-web + fail-on-cache-miss: true + - uses: actions/cache@v4 + with: + path: | + ./pkg-node + key: ${{ github.sha }}-node fail-on-cache-miss: true - - name: Publish - working-directory: pkg + - name: Publish web + working-directory: pkg-web + run: npm publish --access=public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + SKIP_PREPACK: true + - name: Publish node + working-directory: pkg-node run: npm publish --access=public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From ece0f867e8e864fb781be61799378e0288a608ee Mon Sep 17 00:00:00 2001 From: Dario Anongba Varela Date: Mon, 25 Aug 2025 13:21:22 +0200 Subject: [PATCH 3/3] publish multiple --- README.md | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2b3edf7..5e38dc2 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,8 @@

- NPM Package + NPM Package (Web) + NPM Package (Node) MIT or Apache-2.0 Licensed Rustc Version 1.73.0+ Chat on Discord @@ -21,7 +22,7 @@ The `bdk-wasm` library aims at providing access to the excellent [BitcoinDevKit](https://github.com/bitcoindevkit/bdk) to JS and Node environments (and eventually any device supporting WebAssembly). It specializes in compiling BDK on the `wasm32-unknown-unknown` target and use [`wasm-bindgen`](https://github.com/rustwasm/wasm-bindgen) to create TypeScript bindings. -This repo handles the packaging and publishing of the `bitcoindevkit` NPM package, using `wasm-pack`. +This repo handles the packaging and publishing of the `bdk-wallet-web` (for browsers) and `bdk-wallet-node` (for Node.js) NPM packages, using `wasm-pack`. This library offers all the desired functionality to build a Bitcoin wallet out of the box: @@ -36,10 +37,18 @@ This library offers all the desired functionality to build a Bitcoin wallet out For a lightweight library providing stateless utility functions, see [`bitcoinjs`](https://github.com/bitcoinjs/bitcoinjs-lib). -## Browser Usage +## Installation + +### Browser/Web + +```sh +yarn add bdk-wallet-web +``` + +### Node.js ```sh -yarn add bitcoindevkit +yarn add bdk-wallet-node ``` ## Notes on WASM Specific Considerations @@ -80,11 +89,17 @@ Refers to [this section](./DEVELOPMENT.md#build-on-macos). > rustup target add wasm32-unknown-unknown > ``` +To build for browser/web: + ```sh -wasm-pack build +wasm-pack build --target bundler --features "esplora" ``` -> Choose your desired features when building: `--features "esplora"` +To build for Node.js: + +```sh +wasm-pack build --target nodejs --all-features +``` ### Test in Headless Browsers with `wasm-pack test`