feat(wallet): expose finalize_psbt, cancel_tx, tx_details, descriptor_checksum, next_derivation_index#43
Open
darioAnongba wants to merge 3 commits intomainfrom
Open
feat(wallet): expose finalize_psbt, cancel_tx, tx_details, descriptor_checksum, next_derivation_index#43darioAnongba wants to merge 3 commits intomainfrom
darioAnongba wants to merge 3 commits intomainfrom
Conversation
added 2 commits
March 17, 2026 10:07
…_checksum, next_derivation_index Add five new Wallet methods that were available in bdk_wallet but not yet exposed through the WASM bindings: - finalize_psbt: Finalize a PSBT by adding finalized scripts and witnesses to inputs. Essential for multi-sig and watch-only workflows. - cancel_tx: Inform the wallet that a transaction will not be broadcast, freeing reserved change addresses for future transactions. - tx_details: Get comprehensive transaction details including sent, received, fee, fee rate, balance delta, and chain position. - descriptor_checksum: Get the checksum portion of the descriptor string for a given keychain. - next_derivation_index: Get the next unused derivation index, always returning a value (0 if nothing derived yet), unlike derivation_index which returns None. Also adds the TxDetails WASM-compatible wrapper type with getters for all fields, exposing balance_delta as i64 satoshis since SignedAmount has no existing wrapper. Closes #21
darioAnongba
commented
Mar 17, 2026
| }); | ||
| }); | ||
|
|
||
| describe("tx_details", () => { |
Collaborator
Author
There was a problem hiding this comment.
need a more comprehensive test.
| describe("finalize_psbt", () => { | ||
| it("is callable with default SignOptions", () => { | ||
| expect(typeof wallet.finalize_psbt).toBe("function"); | ||
| // Full PSBT finalization is tested in esplora integration tests |
Collaborator
Author
There was a problem hiding this comment.
why add an empty test? where are these esplora tests using finalize_psbt?
| it("is callable on the wallet", () => { | ||
| // cancel_tx only unmarks change addresses; with an empty wallet it's a no-op. | ||
| // We verify the method exists and is callable. | ||
| expect(typeof wallet.cancel_tx).toBe("function"); |
Collaborator
Author
There was a problem hiding this comment.
why add an empty test? where are these esplora tests using cancel_tx?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes five
bdk_wallet::Walletmethods that were available upstream but not yet wrapped for WASM consumers. Continues the API surface expansion tracked in #21.New Wallet Methods
finalize_psbt(psbt, options)cancel_tx(tx)tx_details(txid)descriptor_checksum(keychain)next_derivation_index(keychain)derivation_indexwhich returnsNonefor fresh wallets).New Type
TxDetails— WASM-compatible wrapper forbdk_wallet::TxDetailswith getters fortxid,sent,received,fee,fee_rate,balance_delta_sat(i64),chain_position, andtx.balance_deltais exposed asi64satoshis sinceSignedAmounthas no existing WASM wrapper.Tests
descriptor_checksum: Validates non-empty 8-char string, different for external/internal keychains.next_derivation_index: Tests fresh wallet (returns 0), increment after reveal, consistency withderivation_index.cancel_tx: Method existence and callability.finalize_psbt: Method existence check (full PSBT finalization requires funded wallet, covered in esplora integration tests).tx_details: Returnsundefinedfor unknown txid.