feat(wasm-utxo)!: add index-based PSBT/transaction mutation ops#190
Merged
OttoAllmendinger merged 2 commits intomasterfrom Mar 4, 2026
Merged
feat(wasm-utxo)!: add index-based PSBT/transaction mutation ops#190OttoAllmendinger merged 2 commits intomasterfrom
OttoAllmendinger merged 2 commits intomasterfrom
Conversation
c21a4ee to
d60dbaa
Compare
Add index-based insertion and removal methods to PSBT and transaction types, enabling flexible construction and editing workflows. ## Breaking Changes - All `add_*` methods now return `Result<usize, String>` consistently - `addInput`, `addOutput`, and related wallet methods may now throw errors for out-of-bounds indices - `inputCount`, `outputCount`, `lockTime`, and `version` changed from property accessors to methods (use `()` to call) - `unsignedTxid` renamed to `unsignedTxId` for consistency - `IPsbtIntrospection` renamed to `IPsbt` to reflect mutation support - `IPsbtIntrospectionWithAddress` renamed to `IPsbtWithAddress` ## New Features - `addInputAtIndex`/`addOutputAtIndex` for PSBTs and transactions - `addWalletInputAtIndex`/`addWalletOutputAtIndex` for wallet ops - `addReplayProtectionInputAtIndex` for replay protection - `removeInput`/`removeOutput` methods for PSBTs - New `psbt_ops` module with bounds-checked operations ## Implementation - All append operations delegate to index variants at `len()` - Bounds checking ensures indices are `<= len` (allow append) - Consistent error handling across all mutation operations - Methods maintain PSBT/transaction invariants during mutation Co-authored-by: llm-git <llm-git@ttll.de> Issue: BTC-3049
Split monolithic lint commands into individual tasks for prettier, eslint, rustfmt, and clippy. This enables running specific linters independently and provides better control over the linting workflow. BREAKING CHANGE: `check-fmt` now runs prettier and rustfmt instead of both formatters. Use `lint` for comprehensive checks including clippy. Issue: BTC-XXXX Co-authored-by: llm-git <llm-git@ttll.de>
d60dbaa to
19d0182
Compare
davidkaplanbitgo
approved these changes
Mar 4, 2026
davidkaplanbitgo
requested changes
Mar 4, 2026
Comment on lines
+205
to
+212
| addInputAtIndex( | ||
| index: number, | ||
| txid: string, | ||
| vout: number, | ||
| value: bigint, | ||
| script: Uint8Array, | ||
| sequence?: number, | ||
| ): number; |
Contributor
There was a problem hiding this comment.
Please add a jsdoc here
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.
Add index-based insertion and removal methods to PSBT and transaction
types, enabling flexible construction and editing workflows. Also
restructure linting scripts for granular control over individual
linters.
Breaking Changes
add_*methods now returnResult<usize, String>consistentlyaddInput,addOutput, and related wallet methods may now throwerrors for out-of-bounds indices
inputCount,outputCount,lockTime, andversionchanged fromproperty accessors to methods (use
()to call)unsignedTxidrenamed tounsignedTxIdfor consistencyIPsbtIntrospectionrenamed toIPsbtto reflect mutation supportIPsbtIntrospectionWithAddressrenamed toIPsbtWithAddresscheck-fmtnow runs prettier and rustfmt instead of both formatters.Use
lintfor comprehensive checks including clippy.New Features
addInputAtIndex/addOutputAtIndexfor PSBTs and transactionsaddWalletInputAtIndex/addWalletOutputAtIndexfor wallet opsaddReplayProtectionInputAtIndexfor replay protectionremoveInput/removeOutputmethods for PSBTspsbt_opsmodule with bounds-checked operationsImplementation
len()<= len(allow append)Issue: BTC-3049