Skip to content

feat(wasm-utxo): expose ZEC branch ID APIs on ZcashBitGoPsbt#296

Draft
OttoAllmendinger wants to merge 1 commit into
masterfrom
otto/T1-3519-zec-branch-id-apis
Draft

feat(wasm-utxo): expose ZEC branch ID APIs on ZcashBitGoPsbt#296
OttoAllmendinger wants to merge 1 commit into
masterfrom
otto/T1-3519-zec-branch-id-apis

Conversation

@OttoAllmendinger

Copy link
Copy Markdown
Contributor

Adds consensus_branch_id() to the #[wasm_bindgen] impl BitGoPsbt (Zcash variant only; returns None for non-ZEC PSBTs). Adds a zcash_branch_id_for_height() free function that wraps the existing Rust branch_id_for_height, returning a Result so it throws on unrecognised network strings — only "zcash"/"zec" (mainnet) and "zcashTest"/"tzec" (testnet) are accepted.

TypeScript ZcashBitGoPsbt gains:

  • consensusBranchId: number | undefined — reads the branch ID from the PSBT proprietary map (absent for v5 or non-ZEC PSBTs)
  • static branchIdForHeight(network, height): number | undefined — returns the consensus branch ID active at a given chain height

These APIs let callers (e.g. ims-utxo parse path) validate a PSBT's consensus branch ID against the current chain height without importing @bitgo-beta/utxo-lib.

Refs: T1-3519

Adds consensus_branch_id() to the wasm_bindgen BitGoPsbt impl (Zcash
variant only; returns None for non-ZEC PSBTs). Adds a
zcash_branch_id_for_height() free function wrapping the existing Rust
branch_id_for_height, returning a Result so it throws on unrecognised
network strings ("zcash"/"zec" for mainnet, "zcashTest"/"tzec" for
testnet — anything else is an error).

TypeScript ZcashBitGoPsbt gains:
  consensusBranchId: number | undefined — reads the branch ID stored in
    the PSBT proprietary map (absent for v5 or non-ZEC PSBTs).
  static branchIdForHeight(network, height): number | undefined — returns
    the consensus branch ID active at a given chain height.

These APIs allow callers (e.g. ims-utxo parse path) to validate a PSBT's
consensus branch ID against the current chain height without importing
@bitgo-beta/utxo-lib.

Refs: T1-3519
@linear-code

linear-code Bot commented Jun 17, 2026

Copy link
Copy Markdown

T1-3519

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant