feat(tx_builder): expand TxBuilder with hardware wallet PSBT options, OP_RETURN data, and sequence control#45
Draft
darioAnongba wants to merge 1 commit intomainfrom
Draft
feat(tx_builder): expand TxBuilder with hardware wallet PSBT options, OP_RETURN data, and sequence control#45darioAnongba wants to merge 1 commit intomainfrom
darioAnongba wants to merge 1 commit intomainfrom
Conversation
bfe03c0 to
7a96f81
Compare
…nd sequence control Expand the TxBuilder API with options important for hardware wallet workflows and advanced transaction construction: - add_data: embed OP_RETURN data (up to 80 bytes) for timestamping, protocol anchoring, and metadata - only_witness_utxo: reduce PSBT size for segwit-only wallets - include_output_redeem_witness_script: ColdCard/BitBox compatibility - add_global_xpubs: multisig hardware wallet support (PSBT_GLOBAL_XPUB) - current_height: coinbase maturity checks and anti-fee-sniping - set_exact_sequence: fine-grained nSequence control for RBF/CSV - only_spend_change: shorthand for OnlyChange spend policy Also adds TxIn::sequence getter for reading input nSequence values, enabling callers to verify sequence values on built transactions. All new options are applied in both regular and fee-bump builder paths where applicable. The PSBT-related options (only_witness_utxo, include_output_redeem_witness_script, add_global_xpubs) are forwarded to the fee-bump builder as well. Includes unit tests (wallet.test.ts) for all new options including chaining verification and add_data validation, plus integration tests (esplora.test.ts) that exercise the options with real funded wallets in regtest. Closes #21 (partial — TxBuilder area)
7a96f81 to
9908d0b
Compare
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
Expand the
TxBuilderAPI surface with options important for hardware wallet workflows and advanced transaction construction. This continues the work on #21 (expand API surface coverage), focusing on the TxBuilder area.Changes
New TxBuilder options
add_data(data)only_witness_utxo()include_output_redeem_witness_script()add_global_xpubs()current_height(height)set_exact_sequence(n_sequence)only_spend_change()ChangeSpendPolicy::OnlyChangeNew type accessors
TxInsequence(getter)Fee bump support
The PSBT-related options (
only_witness_utxo,include_output_redeem_witness_script,add_global_xpubs) are also forwarded to the fee-bump builder path.Tests
wallet.test.ts): All new options tested for correct chaining,add_datavalidation (rejects >80 bytes, accepts empty/valid data), combined options chain testesplora.test.ts): Real funded wallet tests in regtest coveringadd_dataOP_RETURN verification,only_witness_utxosigning,include_output_redeem_witness_script,add_global_xpubs,current_height,set_exact_sequenceverification, and a combined multi-option testCHANGELOG
Entry added under
[Unreleased].Partially closes #21