Skip to content

refactor(ledger)!: remove the wasm transport and browser/node features - #158

Merged
prestwich merged 2 commits into
mainfrom
prestwich/remove-ledger-wasm
Oct 19, 2026
Merged

prestwich merged 2 commits into
mainfrom
prestwich/remove-ledger-wasm

Conversation

@prestwich

@prestwich prestwich commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Summary

coins-ledger becomes a native-only crate. The JS/WASM transport, the mutually exclusive browser and node features, the wasm-only dependencies, the cdylib crate type, and the 2020 wasm-pack node test harness are removed. The wasm32 cfg splits in the transport, error, and protocol modules collapse to their native branches, and logging unifies on tracing.

coins-core, coins-bip32, and coins-bip39 keep their wasm32 support. The CI wasm job now checks them with coins-ledger excluded, as a two-entry matrix (default and --no-default-features).

Why

The wasm transport had no users:

  • No crates.io reverse dependency enables browser or node. Three of them (ethers-signers, both starknet account crates) gate coins-ledger behind cfg(not(target_arch = "wasm32")).
  • Every GitHub hit for coins-ledger/browser or coins-ledger/node is alloy's feature passthrough, a fork of alloy, or this repo's archive. The only crate forwarding alloy's passthrough is native-only.
  • No npm package was ever published under the @summa-tx scope; the wasm-pack output never shipped.
  • The JS glue has not executed in CI since 2020 (Test Ledger WASM #33, wasm-pack tests broken for ledger  #45 have been open since then). No outside user ever filed a wasm issue.
  • The two projects that originally needed Rust-side APDU in the browser (this repo's bitcoins-ledger, Zondax's ledger-rs) both dropped it; Zondax's crate is native HID only today.
  • Side effect: 44 of the 52 open dependabot alerts on main (all 4 critical, 22 of 26 high) are in crates/ledger/node_tests/package-lock.json, which this PR deletes. The remaining 8 are in archive/.

Downstream

  • alloy-signer-ledger forwards browser = ["coins-ledger/browser"] and node = ["coins-ledger/node"]. Those must be deleted when alloy bumps to coins-ledger 0.16; cargo rejects features that reference a nonexistent dependency feature. alloy already excludes alloy-signer-ledger from its own wasm CI, so nothing else changes for them.
  • The public API alloy uses (Ledger, LedgerAsync, DefaultTransport, LedgerError, APDUCommand, APDUAnswer) is unchanged.
  • On wasm32-unknown-unknown the crate now fails at hidapi's C build, like every other native HID crate. No compile_error! shim.

Testing

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets with RUSTFLAGS="-D warnings"
  • cargo test --workspace and cargo test --workspace --no-default-features
  • cargo +nightly doc --workspace --no-deps --document-private-items with RUSTDOCFLAGS="--cfg docsrs -D warnings"
  • cargo check --workspace --exclude coins-ledger --target wasm32-unknown-unknown, with and without --no-default-features (mirrors the new CI job)
  • cargo check -p coins-ledger --target wasm32-unknown-unknown fails at hidapi-rusb's build script, as expected

Closes #33. Closes #45.

🤖 Generated with Claude Code

prestwich and others added 2 commits October 19, 2026 11:26
coins-ledger is now native-only. The JS/WASM transport, the mutually
exclusive `browser` and `node` features, the wasm-only dependencies, the
cdylib crate type, and the 2020 wasm-pack node test harness are gone.
The wasm32 cfg splits in the transport, error, and protocol modules
collapse to their native branches, and logging unifies on `tracing`.

The other crates keep their wasm32 support. The CI wasm job now checks
them with the ledger crate excluded, for both default and no-default
features.

BREAKING: downstream crates forwarding `coins-ledger/browser` or
`coins-ledger/node` must drop those features. `coins-ledger` no longer
builds for `wasm32-unknown-unknown`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@prestwich
prestwich merged commit c83a8a5 into main Oct 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wasm-pack tests broken for ledger Test Ledger WASM

1 participant