@bitgo/wasm-utxo 4.30.0 → 4.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,175 @@
1
+ import { BitGoPsbt as WasmBitGoPsbt } from "../wasm/wasm_utxo.js";
2
+ import { RootWalletKeys } from "./RootWalletKeys.js";
3
+ import { IRONWOOD_VERSION_GROUP_ID, ZcashBitGoPsbt, } from "./ZcashBitGoPsbt.js";
4
+ /**
5
+ * A fresh ZIP-302 "no memo" memo field: the `0xf6` marker byte followed by 511 zero bytes. The
6
+ * default for {@link ZcashIronwoodBitGoPsbt.addShieldedOutput}'s `memo` option.
7
+ *
8
+ * Not the same as an all-zeros memo, which decodes as a *text* memo holding the empty string and is
9
+ * rendered as such by wallets. Exported so callers can pass it explicitly, and so the distinction is
10
+ * visible rather than buried in a default.
11
+ *
12
+ * A function rather than a shared constant: a module-level `Uint8Array` is mutable, so one caller
13
+ * writing into it would silently change the default memo for every later output.
14
+ */
15
+ export function zip302NoMemo() {
16
+ const memo = new Uint8Array(512);
17
+ memo[0] = 0xf6;
18
+ return memo;
19
+ }
20
+ /**
21
+ * A Zcash **v6 (Ironwood / NU6.3)** shielding PSBT.
22
+ *
23
+ * Distinct from the generic `ZcashBitGoPsbt` (v4/Sapling-shaped transactions): a v6 PSBT carries
24
+ * its shielded side as an orchard PCZT in the proprietary map rather than Sapling fields, and its
25
+ * lifecycle mirrors the microservice build → sign → combine flow rather than the v4 ZIP-243
26
+ * signing path.
27
+ *
28
+ * Method names carry no `ironwood` prefix — the class name already says it. They follow the base
29
+ * `BitGoPsbt` vocabulary (`createEmpty`, `fromBytes`, `addOutput`-style adders, `getId`) so the v6
30
+ * surface reads the same as the v4 one; the wasm bindings keep their `ironwood_v6_*` names because
31
+ * they live on the single flat `BitGoPsbt` struct, where the prefix is what disambiguates them.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const psbt = ZcashIronwoodBitGoPsbt.createEmpty("zcash", walletKeys, { blockHeight });
36
+ * psbt.addWalletInput(...);
37
+ * psbt.addWalletOutput(...);
38
+ * psbt.addShieldedOutput(recipient, amount, { anchor });
39
+ * const sighash = psbt.transparentSighash(0);
40
+ * // ... sign sighash externally, then:
41
+ * psbt.addTransparentSignature(0, pubkey, sig);
42
+ * const tx = psbt.combineProof(proof);
43
+ * ```
44
+ */
45
+ export class ZcashIronwoodBitGoPsbt extends ZcashBitGoPsbt {
46
+ /**
47
+ * Create an empty Zcash **v6 (Ironwood)** shielding PSBT, with the consensus branch ID
48
+ * determined from block height.
49
+ *
50
+ * Add transparent inputs/outputs with the usual `addWalletInput` / `addWalletOutput`, the
51
+ * shielded output with {@link addShieldedOutput}, then sign the transparent inputs over
52
+ * {@link transparentSighash} and finish with {@link combineProof}.
53
+ *
54
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
55
+ * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
56
+ * @param options - Options including blockHeight (at/after NU6.3 activation)
57
+ */
58
+ static createEmpty(network, walletKeys, options) {
59
+ const keys = RootWalletKeys.from(walletKeys);
60
+ const wasm = WasmBitGoPsbt.create_empty_zcash_v6_at_height(network, keys.wasm, options.blockHeight, options.lockTime, options.expiryHeight);
61
+ return new ZcashIronwoodBitGoPsbt(wasm);
62
+ }
63
+ /**
64
+ * Create an empty Zcash **v6 (Ironwood)** shielding PSBT with an explicit consensus branch ID.
65
+ *
66
+ * **Advanced use only.** Prefer {@link createEmpty}, which derives the branch ID from a block
67
+ * height and rejects heights before NU6.3 activation. Reach for this only when you already know
68
+ * the branch ID — regtest, a future upgrade, or replaying a known-good value.
69
+ *
70
+ * Only the *version group ID* is fixed by the v6 format; the consensus branch ID tracks the active
71
+ * network upgrade and remains caller-supplied, exactly as for v4.
72
+ *
73
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
74
+ * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
75
+ * @param options - Options including the required consensusBranchId
76
+ */
77
+ static createEmptyWithConsensusBranchId(network, walletKeys, options) {
78
+ const keys = RootWalletKeys.from(walletKeys);
79
+ const wasm = WasmBitGoPsbt.create_empty_zcash_v6(network, keys.wasm, options.consensusBranchId, options.lockTime, options.expiryHeight);
80
+ return new ZcashIronwoodBitGoPsbt(wasm);
81
+ }
82
+ /**
83
+ * Not applicable to v6, and not implementable: a broadcast v6 transaction carries the shielded
84
+ * side as a proof plus a binding signature, while every v6 operation here needs the PCZT — which
85
+ * holds witness data (`rseed`, `rcv`, `alpha`, the note plaintext) that is deliberately *not*
86
+ * recoverable from the transaction. Decoding the transparent skeleton alone would yield a PSBT
87
+ * that `getId`, `transparentSighash`, `combineProof`, and even `serialize`/{@link fromBytes} all
88
+ * reject. Inherited only because JS statics are inherited.
89
+ */
90
+ static fromNetworkFormat() {
91
+ throw new Error("not supported for v6 (Ironwood): the PCZT witness data cannot be recovered from a broadcast " +
92
+ "transaction; rebuild the PSBT with createEmpty");
93
+ }
94
+ /**
95
+ * Not applicable to v6: the legacy half-signed format is a v4-era p2ms encoding with no way to
96
+ * carry the PCZT, and no v6 transaction has ever been produced in it. Inherited only because JS
97
+ * statics are inherited.
98
+ */
99
+ static fromHalfSignedLegacyTransaction() {
100
+ throw new Error("not supported for v6 (Ironwood): the legacy half-signed format is v4-only; " +
101
+ "rebuild the PSBT with createEmpty");
102
+ }
103
+ /**
104
+ * Deserialize a v6 (Ironwood) Zcash PSBT from bytes.
105
+ *
106
+ * @param bytes - The PSBT bytes
107
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
108
+ * @throws Error if the deserialized PSBT is not a v6 (Ironwood) PSBT
109
+ * @returns A ZcashIronwoodBitGoPsbt instance
110
+ */
111
+ static fromBytes(bytes, network) {
112
+ const wasm = WasmBitGoPsbt.from_bytes(bytes, network);
113
+ const psbt = new ZcashIronwoodBitGoPsbt(wasm);
114
+ if (psbt.versionGroupId !== IRONWOOD_VERSION_GROUP_ID) {
115
+ throw new Error("not a v6 (Ironwood) PSBT: use ZcashBitGoPsbt.fromBytes for v4/Sapling-shaped PSBTs");
116
+ }
117
+ return psbt;
118
+ }
119
+ /**
120
+ * Add the shielded output (Constructor role). Stores the orchard PCZT in the PSBT.
121
+ *
122
+ * Named for the shielded/transparent split rather than the note type, leaving room for a
123
+ * transparent-output variant alongside the inherited `addOutput` / `addWalletOutput`.
124
+ *
125
+ * @param recipient - 43-byte raw Orchard/Ironwood address
126
+ * @param amount - note value in zatoshi
127
+ * @param options.anchor - 32-byte Ironwood note-commitment-tree root
128
+ * @param options.memo - optional 512-byte memo (defaults to the ZIP-302 "no memo" encoding)
129
+ * @param options.ovk - optional 32-byte outgoing viewing key (omit for a keyless build)
130
+ */
131
+ addShieldedOutput(recipient, amount, options) {
132
+ const memo = options.memo ?? zip302NoMemo();
133
+ this.wasm.add_ironwood_output(recipient, amount, options.ovk, options.anchor, memo);
134
+ }
135
+ /**
136
+ * The canonical (display-order) ZIP-244 v6 txid as a lowercase hex string, matching
137
+ * `ITransaction.getId()`. Defined once the transparent inputs/outputs and the shielded output are
138
+ * in place; unchanged by signing or proving.
139
+ */
140
+ getId() {
141
+ return this.wasm.ironwood_v6_txid();
142
+ }
143
+ /**
144
+ * The ZIP-244 per-input transparent sighash (32 bytes) the key controlling transparent input
145
+ * `index` must sign.
146
+ */
147
+ transparentSighash(index) {
148
+ return this.wasm.ironwood_v6_transparent_sighash(index);
149
+ }
150
+ /**
151
+ * Ingest a transparent-input signature returned by the client/HSM, after verifying it against
152
+ * {@link transparentSighash} for that input.
153
+ *
154
+ * @param index - transparent input index
155
+ * @param pubkey - the signing public key
156
+ * @param sig - DER ECDSA signature with the trailing SIGHASH_ALL byte (as in a scriptSig)
157
+ */
158
+ addTransparentSignature(index, pubkey, sig) {
159
+ this.wasm.add_ironwood_v6_signature(index, pubkey, sig);
160
+ }
161
+ /**
162
+ * Transaction Extractor role: given the external prover's `proof` bytes, finalize the
163
+ * transparent inputs, apply the shielded binding signature, and return the broadcast-ready v6
164
+ * transaction bytes. Requires every transparent input to be signed via
165
+ * {@link addTransparentSignature}.
166
+ *
167
+ * Terminal: the wasm binding drops the stored PCZT on success, so any later v6 call on this PSBT
168
+ * throws — including after a `serialize`/{@link fromBytes} round-trip, since the PCZT is gone
169
+ * from the bytes too. Build a fresh PSBT instead. On failure nothing is dropped, so a call that
170
+ * errors (bad proof, unsigned input) leaves the PSBT retryable.
171
+ */
172
+ combineProof(proof) {
173
+ return this.wasm.combine_ironwood_proof(proof);
174
+ }
175
+ }
@@ -8,7 +8,8 @@ export { ChainCode, chainCodes, assertChainCode, type Scope } from "./chains.js"
8
8
  export { requiresPrevTxForP2sh } from "./prevTx.js";
9
9
  export { BitGoPsbt, getWalletKeysFromPsbt, type NetworkName, type ScriptId, type ParsedInput, type ParsedOutput, type ParsedTransaction, type SignPath, type CreateEmptyOptions, type AddInputOptions, type AddOutputOptions, type AddWalletInputOptions, type AddWalletOutputOptions, type ParseTransactionOptions, type ParseOutputsOptions, type HydrationUnspent, } from "./BitGoPsbt.js";
10
10
  export { BitGoKeySubtype, type PsbtKvKey } from "./BitGoKeySubtype.js";
11
- export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, } from "./ZcashBitGoPsbt.js";
11
+ export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, IRONWOOD_VERSION_GROUP_ID, } from "./ZcashBitGoPsbt.js";
12
+ export { ZcashIronwoodBitGoPsbt, zip302NoMemo, type CreateEmptyIronwoodOptions, type CreateEmptyIronwoodWithConsensusBranchIdOptions, } from "./ZcashIronwoodBitGoPsbt.js";
12
13
  export { ZcashUnifiedAddress } from "./ZcashUnifiedAddress.js";
13
14
  export { ZcashV6Transaction } from "./ZcashV6Transaction.js";
14
15
  import type { ScriptType } from "./scriptType.js";
@@ -11,7 +11,9 @@ export { requiresPrevTxForP2sh } from "./prevTx.js";
11
11
  export { BitGoPsbt, getWalletKeysFromPsbt, } from "./BitGoPsbt.js";
12
12
  export { BitGoKeySubtype } from "./BitGoKeySubtype.js";
13
13
  // Zcash-specific PSBT subclass
14
- export { ZcashBitGoPsbt, } from "./ZcashBitGoPsbt.js";
14
+ export { ZcashBitGoPsbt, IRONWOOD_VERSION_GROUP_ID, } from "./ZcashBitGoPsbt.js";
15
+ // Zcash v6 (Ironwood / NU6.3) shielding PSBT
16
+ export { ZcashIronwoodBitGoPsbt, zip302NoMemo, } from "./ZcashIronwoodBitGoPsbt.js";
15
17
  // Zcash ZIP-316 Unified Address
16
18
  export { ZcashUnifiedAddress } from "./ZcashUnifiedAddress.js";
17
19
  // Zcash v6 (Ironwood / NU6.3) transaction
@@ -136,6 +136,26 @@ export class BitGoPsbt {
136
136
  * The index of the newly added input
137
137
  */
138
138
  add_input_at_index(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null, prev_tx?: Uint8Array | null): number;
139
+ /**
140
+ * Constructor: add the shielded Ironwood output as an orchard PCZT stored in the PSBT.
141
+ *
142
+ * * `recipient` - raw Orchard/Ironwood address ([`ORCHARD_ADDRESS_SIZE`] bytes)
143
+ * * `amount` - note value in zatoshi
144
+ * * `ovk` - optional outgoing viewing key ([`OVK_SIZE`] bytes; `None` for a keyless build)
145
+ * * `anchor` - Ironwood note-commitment-tree root ([`ANCHOR_SIZE`] bytes)
146
+ * * `memo` - ZIP-302 memo field ([`MEMO_SIZE`] bytes)
147
+ *
148
+ * [`ORCHARD_ADDRESS_SIZE`]: crate::zcash::ironwood_build::ORCHARD_ADDRESS_SIZE
149
+ * [`OVK_SIZE`]: crate::zcash::ironwood_build::OVK_SIZE
150
+ * [`ANCHOR_SIZE`]: crate::zcash::ironwood_build::ANCHOR_SIZE
151
+ * [`MEMO_SIZE`]: crate::zcash::ironwood_build::MEMO_SIZE
152
+ */
153
+ add_ironwood_output(recipient: Uint8Array, amount: bigint, ovk: Uint8Array | null | undefined, anchor: Uint8Array, memo: Uint8Array): void;
154
+ /**
155
+ * Ingest a transparent-input signature (`sig`: DER ECDSA with the trailing SIGHASH_ALL byte)
156
+ * after verifying it against `ironwood_v6_transparent_sighash(index)`.
157
+ */
158
+ add_ironwood_v6_signature(index: number, pubkey: Uint8Array, sig: Uint8Array): void;
139
159
  add_output(script: Uint8Array, value: bigint): number;
140
160
  add_output_at_index(index: number, script: Uint8Array, value: bigint): number;
141
161
  add_output_with_address(address: string, value: bigint): number;
@@ -170,6 +190,17 @@ export class BitGoPsbt {
170
190
  * Returns error if PSBT parsing fails or input counts don't match
171
191
  */
172
192
  combine_inputs(other_bytes: Uint8Array): void;
193
+ /**
194
+ * Transaction Extractor: given the external prover's `proof` bytes, finalize the transparent
195
+ * inputs, apply the shielded binding signature, and return the broadcast-ready v6 transaction
196
+ * bytes. Requires the transparent inputs to be signed (via `add_ironwood_v6_signature`).
197
+ *
198
+ * Terminal: on success the stored PCZT is dropped, so a second call — or any other Ironwood
199
+ * operation, including after a `serialize`/`from_bytes` round-trip — fails rather than silently
200
+ * re-running against already-extracted state. Build a fresh PSBT instead. On failure nothing is
201
+ * dropped, so a call that errors (bad proof, unsigned input) leaves the PSBT retryable.
202
+ */
203
+ combine_ironwood_proof(proof: Uint8Array): Uint8Array;
173
204
  /**
174
205
  * Combine/merge data from another PSBT into this one
175
206
  *
@@ -236,6 +267,23 @@ export class BitGoPsbt {
236
267
  * Returns error if block height is before Overwinter activation
237
268
  */
238
269
  static create_empty_zcash_at_height(network: string, wallet_keys: WasmRootWalletKeys, block_height: number, version?: number | null, lock_time?: number | null, version_group_id?: number | null, expiry_height?: number | null): BitGoPsbt;
270
+ /**
271
+ * Create an empty Zcash **v6 (Ironwood)** shielding PSBT with an explicit consensus branch id.
272
+ *
273
+ * The version group id is fixed by the v6 format, but the consensus branch id tracks the active
274
+ * network upgrade and stays caller-supplied — the v6 analogue of `create_empty_zcash`. Prefer
275
+ * `create_empty_zcash_v6_at_height`, which derives it from a block height and rejects heights
276
+ * before NU6.3 activation; this is the escape hatch for callers that already know the value.
277
+ */
278
+ static create_empty_zcash_v6(network: string, wallet_keys: WasmRootWalletKeys, consensus_branch_id: number, lock_time?: number | null, expiry_height?: number | null): BitGoPsbt;
279
+ /**
280
+ * Create an empty Zcash **v6 (Ironwood)** shielding PSBT, with the consensus branch id
281
+ * resolved from `block_height`. Transparent inputs/outputs are added with the usual
282
+ * `add_wallet_input` / `add_wallet_output`; the shielded output and the v6 sign/combine
283
+ * steps use the dedicated `add_ironwood_output` / `ironwood_v6_*` / `combine_ironwood_proof`
284
+ * methods.
285
+ */
286
+ static create_empty_zcash_v6_at_height(network: string, wallet_keys: WasmRootWalletKeys, block_height: number, lock_time?: number | null, expiry_height?: number | null): BitGoPsbt;
239
287
  delete_input_kv(index: number, key: any): void;
240
288
  delete_kv(key: any): void;
241
289
  delete_output_kv(index: number, key: any): void;
@@ -426,6 +474,16 @@ export class BitGoPsbt {
426
474
  */
427
475
  get_unsigned_tx(): Uint8Array;
428
476
  input_count(): number;
477
+ /**
478
+ * The ZIP-244 per-input transparent sighash (32 bytes) that the key controlling transparent
479
+ * input `index` must sign.
480
+ */
481
+ ironwood_v6_transparent_sighash(index: number): Uint8Array;
482
+ /**
483
+ * The canonical (display-order) ZIP-244 v6 txid as a lowercase hex string, matching the
484
+ * `getId()` convention used elsewhere (see [`crate::wasm::zcash::ZcashV6Transaction::get_id`]).
485
+ */
486
+ ironwood_v6_txid(): string;
429
487
  /**
430
488
  * Check if an input is a MuSig2 keypath input.
431
489
  *
@@ -1761,3 +1819,12 @@ export function parseTxToJson(tx_bytes: Uint8Array, coin_name: string): string;
1761
1819
  * with `.message` and `.code`), not a bare string.
1762
1820
  */
1763
1821
  export function zcash_branch_id_for_height(network: string, height: number): number | undefined;
1822
+
1823
+ /**
1824
+ * The Zcash v6 (Ironwood / NU6.3) version group id.
1825
+ *
1826
+ * Exported so the TypeScript layer can derive its `IRONWOOD_VERSION_GROUP_ID` from the Rust
1827
+ * constant instead of hard-coding a second copy: the two are used together to tell v6 PSBTs from
1828
+ * v4/Sapling ones, and a silent divergence would route v6 bytes down the v4 path.
1829
+ */
1830
+ export function zcash_ironwood_version_group_id(): number;
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./wasm_utxo_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
 
7
7
  export {
8
- AddressNamespace, Bip322Namespace, BitGoPsbt, FixedScriptWalletNamespace, InscriptionsNamespace, MessageNamespace, UtxolibCompatNamespace, WasmBIP32, WasmDashTransaction, WasmDimensions, WasmECPair, WasmReplayProtection, WasmRootWalletKeys, WasmTransaction, WasmUtxoNamespace, WasmZcashTransaction, WrapDescriptor, WrapMiniscript, WrapPsbt, ZcashUnifiedAddress, ZcashV6Transaction, isInspectEnabled, parsePsbtRawToJson, parsePsbtToJson, parseTxToJson, zcash_branch_id_for_height
8
+ AddressNamespace, Bip322Namespace, BitGoPsbt, FixedScriptWalletNamespace, InscriptionsNamespace, MessageNamespace, UtxolibCompatNamespace, WasmBIP32, WasmDashTransaction, WasmDimensions, WasmECPair, WasmReplayProtection, WasmRootWalletKeys, WasmTransaction, WasmUtxoNamespace, WasmZcashTransaction, WrapDescriptor, WrapMiniscript, WrapPsbt, ZcashUnifiedAddress, ZcashV6Transaction, isInspectEnabled, parsePsbtRawToJson, parsePsbtToJson, parseTxToJson, zcash_branch_id_for_height, zcash_ironwood_version_group_id
9
9
  } from "./wasm_utxo_bg.js";
@@ -465,6 +465,70 @@ export class BitGoPsbt {
465
465
  wasm.__wbindgen_add_to_stack_pointer(16);
466
466
  }
467
467
  }
468
+ /**
469
+ * Constructor: add the shielded Ironwood output as an orchard PCZT stored in the PSBT.
470
+ *
471
+ * * `recipient` - raw Orchard/Ironwood address ([`ORCHARD_ADDRESS_SIZE`] bytes)
472
+ * * `amount` - note value in zatoshi
473
+ * * `ovk` - optional outgoing viewing key ([`OVK_SIZE`] bytes; `None` for a keyless build)
474
+ * * `anchor` - Ironwood note-commitment-tree root ([`ANCHOR_SIZE`] bytes)
475
+ * * `memo` - ZIP-302 memo field ([`MEMO_SIZE`] bytes)
476
+ *
477
+ * [`ORCHARD_ADDRESS_SIZE`]: crate::zcash::ironwood_build::ORCHARD_ADDRESS_SIZE
478
+ * [`OVK_SIZE`]: crate::zcash::ironwood_build::OVK_SIZE
479
+ * [`ANCHOR_SIZE`]: crate::zcash::ironwood_build::ANCHOR_SIZE
480
+ * [`MEMO_SIZE`]: crate::zcash::ironwood_build::MEMO_SIZE
481
+ * @param {Uint8Array} recipient
482
+ * @param {bigint} amount
483
+ * @param {Uint8Array | null | undefined} ovk
484
+ * @param {Uint8Array} anchor
485
+ * @param {Uint8Array} memo
486
+ */
487
+ add_ironwood_output(recipient, amount, ovk, anchor, memo) {
488
+ try {
489
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
490
+ const ptr0 = passArray8ToWasm0(recipient, wasm.__wbindgen_export);
491
+ const len0 = WASM_VECTOR_LEN;
492
+ var ptr1 = isLikeNone(ovk) ? 0 : passArray8ToWasm0(ovk, wasm.__wbindgen_export);
493
+ var len1 = WASM_VECTOR_LEN;
494
+ const ptr2 = passArray8ToWasm0(anchor, wasm.__wbindgen_export);
495
+ const len2 = WASM_VECTOR_LEN;
496
+ const ptr3 = passArray8ToWasm0(memo, wasm.__wbindgen_export);
497
+ const len3 = WASM_VECTOR_LEN;
498
+ wasm.bitgopsbt_add_ironwood_output(retptr, this.__wbg_ptr, ptr0, len0, amount, ptr1, len1, ptr2, len2, ptr3, len3);
499
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
500
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
501
+ if (r1) {
502
+ throw takeObject(r0);
503
+ }
504
+ } finally {
505
+ wasm.__wbindgen_add_to_stack_pointer(16);
506
+ }
507
+ }
508
+ /**
509
+ * Ingest a transparent-input signature (`sig`: DER ECDSA with the trailing SIGHASH_ALL byte)
510
+ * after verifying it against `ironwood_v6_transparent_sighash(index)`.
511
+ * @param {number} index
512
+ * @param {Uint8Array} pubkey
513
+ * @param {Uint8Array} sig
514
+ */
515
+ add_ironwood_v6_signature(index, pubkey, sig) {
516
+ try {
517
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
518
+ const ptr0 = passArray8ToWasm0(pubkey, wasm.__wbindgen_export);
519
+ const len0 = WASM_VECTOR_LEN;
520
+ const ptr1 = passArray8ToWasm0(sig, wasm.__wbindgen_export);
521
+ const len1 = WASM_VECTOR_LEN;
522
+ wasm.bitgopsbt_add_ironwood_v6_signature(retptr, this.__wbg_ptr, index, ptr0, len0, ptr1, len1);
523
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
524
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
525
+ if (r1) {
526
+ throw takeObject(r0);
527
+ }
528
+ } finally {
529
+ wasm.__wbindgen_add_to_stack_pointer(16);
530
+ }
531
+ }
468
532
  /**
469
533
  * @param {Uint8Array} script
470
534
  * @param {bigint} value
@@ -794,6 +858,38 @@ export class BitGoPsbt {
794
858
  wasm.__wbindgen_add_to_stack_pointer(16);
795
859
  }
796
860
  }
861
+ /**
862
+ * Transaction Extractor: given the external prover's `proof` bytes, finalize the transparent
863
+ * inputs, apply the shielded binding signature, and return the broadcast-ready v6 transaction
864
+ * bytes. Requires the transparent inputs to be signed (via `add_ironwood_v6_signature`).
865
+ *
866
+ * Terminal: on success the stored PCZT is dropped, so a second call — or any other Ironwood
867
+ * operation, including after a `serialize`/`from_bytes` round-trip — fails rather than silently
868
+ * re-running against already-extracted state. Build a fresh PSBT instead. On failure nothing is
869
+ * dropped, so a call that errors (bad proof, unsigned input) leaves the PSBT retryable.
870
+ * @param {Uint8Array} proof
871
+ * @returns {Uint8Array}
872
+ */
873
+ combine_ironwood_proof(proof) {
874
+ try {
875
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
876
+ const ptr0 = passArray8ToWasm0(proof, wasm.__wbindgen_export);
877
+ const len0 = WASM_VECTOR_LEN;
878
+ wasm.bitgopsbt_combine_ironwood_proof(retptr, this.__wbg_ptr, ptr0, len0);
879
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
880
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
881
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
882
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
883
+ if (r3) {
884
+ throw takeObject(r2);
885
+ }
886
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
887
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
888
+ return v2;
889
+ } finally {
890
+ wasm.__wbindgen_add_to_stack_pointer(16);
891
+ }
892
+ }
797
893
  /**
798
894
  * Combine/merge data from another PSBT into this one
799
895
  *
@@ -950,6 +1046,69 @@ export class BitGoPsbt {
950
1046
  wasm.__wbindgen_add_to_stack_pointer(16);
951
1047
  }
952
1048
  }
1049
+ /**
1050
+ * Create an empty Zcash **v6 (Ironwood)** shielding PSBT with an explicit consensus branch id.
1051
+ *
1052
+ * The version group id is fixed by the v6 format, but the consensus branch id tracks the active
1053
+ * network upgrade and stays caller-supplied — the v6 analogue of `create_empty_zcash`. Prefer
1054
+ * `create_empty_zcash_v6_at_height`, which derives it from a block height and rejects heights
1055
+ * before NU6.3 activation; this is the escape hatch for callers that already know the value.
1056
+ * @param {string} network
1057
+ * @param {WasmRootWalletKeys} wallet_keys
1058
+ * @param {number} consensus_branch_id
1059
+ * @param {number | null} [lock_time]
1060
+ * @param {number | null} [expiry_height]
1061
+ * @returns {BitGoPsbt}
1062
+ */
1063
+ static create_empty_zcash_v6(network, wallet_keys, consensus_branch_id, lock_time, expiry_height) {
1064
+ try {
1065
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1066
+ const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1067
+ const len0 = WASM_VECTOR_LEN;
1068
+ _assertClass(wallet_keys, WasmRootWalletKeys);
1069
+ wasm.bitgopsbt_create_empty_zcash_v6(retptr, ptr0, len0, wallet_keys.__wbg_ptr, consensus_branch_id, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
1070
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1071
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1072
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1073
+ if (r2) {
1074
+ throw takeObject(r1);
1075
+ }
1076
+ return BitGoPsbt.__wrap(r0);
1077
+ } finally {
1078
+ wasm.__wbindgen_add_to_stack_pointer(16);
1079
+ }
1080
+ }
1081
+ /**
1082
+ * Create an empty Zcash **v6 (Ironwood)** shielding PSBT, with the consensus branch id
1083
+ * resolved from `block_height`. Transparent inputs/outputs are added with the usual
1084
+ * `add_wallet_input` / `add_wallet_output`; the shielded output and the v6 sign/combine
1085
+ * steps use the dedicated `add_ironwood_output` / `ironwood_v6_*` / `combine_ironwood_proof`
1086
+ * methods.
1087
+ * @param {string} network
1088
+ * @param {WasmRootWalletKeys} wallet_keys
1089
+ * @param {number} block_height
1090
+ * @param {number | null} [lock_time]
1091
+ * @param {number | null} [expiry_height]
1092
+ * @returns {BitGoPsbt}
1093
+ */
1094
+ static create_empty_zcash_v6_at_height(network, wallet_keys, block_height, lock_time, expiry_height) {
1095
+ try {
1096
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1097
+ const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1098
+ const len0 = WASM_VECTOR_LEN;
1099
+ _assertClass(wallet_keys, WasmRootWalletKeys);
1100
+ wasm.bitgopsbt_create_empty_zcash_v6_at_height(retptr, ptr0, len0, wallet_keys.__wbg_ptr, block_height, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
1101
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1102
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1103
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1104
+ if (r2) {
1105
+ throw takeObject(r1);
1106
+ }
1107
+ return BitGoPsbt.__wrap(r0);
1108
+ } finally {
1109
+ wasm.__wbindgen_add_to_stack_pointer(16);
1110
+ }
1111
+ }
953
1112
  /**
954
1113
  * @param {number} index
955
1114
  * @param {any} key
@@ -1629,6 +1788,59 @@ export class BitGoPsbt {
1629
1788
  const ret = wasm.bitgopsbt_input_count(this.__wbg_ptr);
1630
1789
  return ret >>> 0;
1631
1790
  }
1791
+ /**
1792
+ * The ZIP-244 per-input transparent sighash (32 bytes) that the key controlling transparent
1793
+ * input `index` must sign.
1794
+ * @param {number} index
1795
+ * @returns {Uint8Array}
1796
+ */
1797
+ ironwood_v6_transparent_sighash(index) {
1798
+ try {
1799
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1800
+ wasm.bitgopsbt_ironwood_v6_transparent_sighash(retptr, this.__wbg_ptr, index);
1801
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1802
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1803
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1804
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1805
+ if (r3) {
1806
+ throw takeObject(r2);
1807
+ }
1808
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1809
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1810
+ return v1;
1811
+ } finally {
1812
+ wasm.__wbindgen_add_to_stack_pointer(16);
1813
+ }
1814
+ }
1815
+ /**
1816
+ * The canonical (display-order) ZIP-244 v6 txid as a lowercase hex string, matching the
1817
+ * `getId()` convention used elsewhere (see [`crate::wasm::zcash::ZcashV6Transaction::get_id`]).
1818
+ * @returns {string}
1819
+ */
1820
+ ironwood_v6_txid() {
1821
+ let deferred2_0;
1822
+ let deferred2_1;
1823
+ try {
1824
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1825
+ wasm.bitgopsbt_ironwood_v6_txid(retptr, this.__wbg_ptr);
1826
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1827
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1828
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1829
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1830
+ var ptr1 = r0;
1831
+ var len1 = r1;
1832
+ if (r3) {
1833
+ ptr1 = 0; len1 = 0;
1834
+ throw takeObject(r2);
1835
+ }
1836
+ deferred2_0 = ptr1;
1837
+ deferred2_1 = len1;
1838
+ return getStringFromWasm0(ptr1, len1);
1839
+ } finally {
1840
+ wasm.__wbindgen_add_to_stack_pointer(16);
1841
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
1842
+ }
1843
+ }
1632
1844
  /**
1633
1845
  * Check if an input is a MuSig2 keypath input.
1634
1846
  *
@@ -6702,6 +6914,19 @@ export function zcash_branch_id_for_height(network, height) {
6702
6914
  wasm.__wbindgen_add_to_stack_pointer(16);
6703
6915
  }
6704
6916
  }
6917
+
6918
+ /**
6919
+ * The Zcash v6 (Ironwood / NU6.3) version group id.
6920
+ *
6921
+ * Exported so the TypeScript layer can derive its `IRONWOOD_VERSION_GROUP_ID` from the Rust
6922
+ * constant instead of hard-coding a second copy: the two are used together to tell v6 PSBTs from
6923
+ * v4/Sapling ones, and a silent divergence would route v6 bytes down the v4 path.
6924
+ * @returns {number}
6925
+ */
6926
+ export function zcash_ironwood_version_group_id() {
6927
+ const ret = wasm.zcash_ironwood_version_group_id();
6928
+ return ret >>> 0;
6929
+ }
6705
6930
  export function __wbg_Error_8c4e43fe74559d73(arg0, arg1) {
6706
6931
  const ret = Error(getStringFromWasm0(arg0, arg1));
6707
6932
  return addHeapObject(ret);
Binary file