refactor(bitcoin_client_js): migrate descriptors to v3 and upgrade bitcoinjs-lib to v7#430
refactor(bitcoin_client_js): migrate descriptors to v3 and upgrade bitcoinjs-lib to v7#430landabaso wants to merge 3 commits intoLedgerHQ:developfrom
Conversation
…s v3 and extend wallet address vectors for LedgerHQ#428
…/number API via internal adapters
|
BTW, I added a |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #430 +/- ##
===========================================
- Coverage 85.96% 85.81% -0.16%
===========================================
Files 30 18 -12
Lines 3476 2812 -664
Branches 520 425 -95
===========================================
- Hits 2988 2413 -575
+ Misses 477 388 -89
Partials 11 11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR migrates the bitcoin_client_js library from bitcoinjs-lib v6 to v7 and @bitcoinerlab/descriptors v1 to v3, enabling tapscript address validation while maintaining API backward compatibility through internal type conversions.
Changes:
- Upgraded bitcoinjs-lib from 6.x to 7.x and
@bitcoinerlab/descriptorsfrom 1.x to 3.x, with TypeScript/Jest toolchain updates - Added type conversion helpers (asBuffer, asSatoshiNumber) to convert bitcoinjs-lib v7's Uint8Array/bigint to Buffer/number throughout psbtv2.ts
- Migrated address validation from Descriptor to Output API, enabling tapscript support and extending test coverage with taproot descriptor cases
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| bitcoin_client_js/package.json | Updated dependencies: bitcoinjs-lib ^7.0.1, @bitcoinerlab/descriptors ^3.0.6, Jest/TypeScript toolchain upgrades, node >=18.14 requirement |
| bitcoin_client_js/src/lib/psbtv2.ts | Added asBuffer/asSatoshiNumber conversion helpers; wrapped all bitcoinjs-lib v7 Uint8Array/bigint values in Transaction and Psbt operations |
| bitcoin_client_js/src/lib/policy.ts | Wrapped crypto.sha256 return values with Buffer.from to handle Uint8Array |
| bitcoin_client_js/src/lib/merkle.ts | Added sha256AsBuffer helper function to convert crypto.sha256 Uint8Array output to Buffer |
| bitcoin_client_js/src/lib/clientCommands.ts | Wrapped crypto.sha256 return value with Buffer.from for preimage handling |
| bitcoin_client_js/src/lib/appClient.ts | Migrated from Descriptor({expression, network}) to Output({descriptor, network}) API; updated error handling comments for v3 tapscript support |
| bitcoin_client_js/src/tests/appClient.test.ts | Added 6 new test cases covering sh(sortedmulti), sh(wsh(sortedmulti)), tr() taproot descriptors, and musig policies from Python test suite |
| bitcoin_client_js/jest.config.js | Added testPathIgnorePatterns to exclude build directory from test runs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR is a follow up to #428. It enables descriptors v3 support and aligns dependencies with the current
bitcoinjs-libmajor.@bitcoinerlab/descriptorsv3 (DescriptorsFactory+Output), enabling tapscript address validation.appClientwallet-address integration vectors with additional testnet descriptor/address cases from Python coverage.bitcoinjs-libfrom6.xto7.xTypeScript 5.9,Jest 30,ts-jest,babel-jest,typedoc 0.28) and setnode >= 18.14(required by bitcoinjs-lib / @bitcoinerlab/descriptors).Uint8Array/bigintvalues internally to existingBuffer/numberinterfaces.