refactor(wasm-utxo): add dynamic dispatch and Zcash hydration support#252
Merged
OttoAllmendinger merged 2 commits intomasterfrom Apr 17, 2026
Merged
refactor(wasm-utxo): add dynamic dispatch and Zcash hydration support#252OttoAllmendinger merged 2 commits intomasterfrom
OttoAllmendinger merged 2 commits intomasterfrom
Conversation
9ae1b10 to
781c8c6
Compare
781c8c6 to
816b3fd
Compare
eb2bca4 to
f3575b7
Compare
55d5154 to
48bbeed
Compare
Changes fromHalfSignedLegacyTransaction to accept Transaction | DashTransaction instead of Uint8Array, avoiding re-serialization round-trips. Bitcoin-like transactions: - Add dynamic dispatch via Transaction.supportsCoin() - Validate transaction type and reject Zcash with helpful error message - Pass WASM transaction directly without re-parsing bytes - Support pre-decoded transaction instances to avoid re-parsing Zcash support: - Add ZcashBitGoPsbt.fromHalfSignedLegacyTransaction() - Support block height mode (recommended) or explicit consensus_branch_id - Implement full Sapling field restoration - Add comprehensive round-trip tests Rust layer: - Refactor hydration logic into shared hydrate_psbt() helper - Add from_half_signed_legacy_transaction_zcash_with_block_height() - Add from_half_signed_legacy_transaction_zcash_with_branch_id() - Extract HydrationUnspentInput parsing into TryFromJsValue trait WASM bindings expose both variants with unified unspent parsing. All fromHalfSignedLegacy tests pass including new Zcash round-trip tests. Co-authored-by: llm-git <llm-git@ttll.de>
Replace utxolib network objects with coin-based utilities throughout tests for `fromHalfSignedLegacyTransaction`. Update helper functions to accept `CoinName` instead of `Network`, and use new coin utilities for mainnet checks and script type validation. - Replace `isSupportedNetwork` with `isSupportedCoin` using `CoinName` - Update `createHalfSignedP2msPsbt` to use coin-based utilities - Use `supportsScriptType` instead of network-based validation - Replace network list iteration with `coinNames` filtering - Remove `getCoinNameForNetwork` dependency - Clarify test descriptions for transaction instance handling Co-authored-by: llm-git <llm-git@ttll.de>
48bbeed to
6a46f4b
Compare
lcovar
approved these changes
Apr 17, 2026
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.
Extends BitGoPsbt.fromHalfSignedLegacyTransaction() with dynamic
dispatch to detect transaction type (Bitcoin/Dash/Zcash) and early
rejection of Zcash with helpful error message. Accepts Transaction
objects directly instead of Uint8Array to avoid round-tripping
through bytes.
Adds ZcashBitGoPsbt.fromHalfSignedLegacyTransaction() supporting:
Rust layer implements:
Transaction classes add supportsCoin() for dispatch routing.
WASM bindings expose both Zcash variants with unified unspent parsing.
Test improvements:
Ref: BTC-0