@bitgo/wasm-utxo 4.31.0 → 4.33.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.
@@ -2,39 +2,31 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
5
+ export const __wbg_bip322namespace_free: (a: number, b: number) => void;
6
+ export const __wbg_messagenamespace_free: (a: number, b: number) => void;
5
7
  export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
6
- export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
7
- export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
8
- export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
9
- export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
10
- export const isInspectEnabled: () => number;
11
- export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
12
- export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
13
- export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
14
- export const wasmdimensions_empty: () => number;
15
- export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
16
- export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
17
- export const wasmdimensions_from_output_script_length: (a: number) => number;
18
- export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
19
- export const wasmdimensions_from_psbt: (a: number, b: number) => void;
20
- export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
21
- export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
22
- export const wasmdimensions_get_output_vsize: (a: number) => number;
23
- export const wasmdimensions_get_output_weight: (a: number) => number;
24
- export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
25
- export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
26
- export const wasmdimensions_has_segwit: (a: number) => number;
27
- export const wasmdimensions_plus: (a: number, b: number) => number;
28
- export const wasmdimensions_times: (a: number, b: number) => number;
29
- export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
30
- export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
31
- export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
32
8
  export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
9
+ export const __wbg_wasmecpair_free: (a: number, b: number) => void;
10
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
33
11
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
34
12
  export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
35
13
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
36
14
  export const __wbg_zcashunifiedaddress_free: (a: number, b: number) => void;
37
15
  export const __wbg_zcashv6transaction_free: (a: number, b: number) => void;
16
+ export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
17
+ export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
18
+ export const bip322namespace_add_bip322_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
19
+ export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
20
+ export const bip322namespace_verify_bip322_psbt_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
21
+ export const bip322namespace_verify_bip322_psbt_input_with_pubkeys: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
22
+ export const bip322namespace_verify_bip322_tx_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
23
+ export const bip322namespace_verify_bip322_tx_input_with_pubkeys: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
24
+ export const isInspectEnabled: () => number;
25
+ export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
26
+ export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
27
+ export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
28
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
29
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
38
30
  export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
39
31
  export const wasmdashtransaction_get_inputs: (a: number, b: number) => void;
40
32
  export const wasmdashtransaction_get_outputs: (a: number, b: number) => void;
@@ -45,6 +37,19 @@ export const wasmdashtransaction_lock_time: (a: number) => number;
45
37
  export const wasmdashtransaction_output_count: (a: number) => number;
46
38
  export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
47
39
  export const wasmdashtransaction_version: (a: number) => number;
40
+ export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
41
+ export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
42
+ export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
43
+ export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
44
+ export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
45
+ export const wasmecpair_private_key: (a: number) => number;
46
+ export const wasmecpair_public_key: (a: number) => number;
47
+ export const wasmecpair_to_wif: (a: number, b: number) => void;
48
+ export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
49
+ export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
50
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
51
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
52
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
48
53
  export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
49
54
  export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
50
55
  export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
@@ -107,6 +112,7 @@ export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: n
107
112
  export const wrappsbt_validate_signature_at_input: (a: number, b: number, c: number, d: number, e: number) => void;
108
113
  export const wrappsbt_verify_signature_with_key: (a: number, b: number, c: number, d: number) => void;
109
114
  export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
115
+ export const zcash_ironwood_version_group_id: () => number;
110
116
  export const zcashunifiedaddress_contains: (a: number, b: number, c: number, d: number) => void;
111
117
  export const zcashunifiedaddress_orchardReceiver: (a: number, b: number) => void;
112
118
  export const zcashunifiedaddress_parse: (a: number, b: number, c: number, d: number, e: number) => void;
@@ -126,14 +132,18 @@ export const wasmtransaction_input_count: (a: number) => number;
126
132
  export const wasmtransaction_output_count: (a: number) => number;
127
133
  export const wasmzcashtransaction_input_count: (a: number) => number;
128
134
  export const wasmzcashtransaction_output_count: (a: number) => number;
135
+ export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
136
+ export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
129
137
  export const wasmtransaction_lock_time: (a: number) => number;
130
138
  export const wasmtransaction_version: (a: number) => number;
131
139
  export const wasmzcashtransaction_lock_time: (a: number) => number;
132
140
  export const wasmzcashtransaction_version: (a: number) => number;
133
141
  export const wrappsbt_lock_time: (a: number) => number;
134
142
  export const wrappsbt_version: (a: number) => number;
143
+ export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
135
144
  export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
136
145
  export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
146
+ export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
137
147
  export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
138
148
  export const wrapdescriptor_descType: (a: number, b: number) => void;
139
149
  export const wrapdescriptor_encode: (a: number, b: number) => void;
@@ -154,23 +164,16 @@ export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d:
154
164
  export const wrapminiscript_node: (a: number, b: number) => void;
155
165
  export const wrapminiscript_toAsmString: (a: number, b: number) => void;
156
166
  export const wrapminiscript_toString: (a: number, b: number) => void;
157
- export const __wbg_bip322namespace_free: (a: number, b: number) => void;
158
167
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
159
168
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
160
169
  export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
161
- export const __wbg_messagenamespace_free: (a: number, b: number) => void;
162
170
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
163
- export const __wbg_wasmecpair_free: (a: number, b: number) => void;
164
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
171
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
165
172
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
166
- export const bip322namespace_add_bip322_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
167
- export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
168
- export const bip322namespace_verify_bip322_psbt_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
169
- export const bip322namespace_verify_bip322_psbt_input_with_pubkeys: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
170
- export const bip322namespace_verify_bip322_tx_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
171
- export const bip322namespace_verify_bip322_tx_input_with_pubkeys: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
172
173
  export const bitgopsbt_add_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number) => void;
173
174
  export const bitgopsbt_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number, k: number, l: number) => void;
175
+ export const bitgopsbt_add_ironwood_output: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: number, h: number, i: number, j: number, k: number) => void;
176
+ export const bitgopsbt_add_ironwood_v6_signature: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
174
177
  export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
175
178
  export const bitgopsbt_add_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
176
179
  export const bitgopsbt_add_output_with_address: (a: number, b: number, c: number, d: number, e: bigint) => void;
@@ -183,11 +186,14 @@ export const bitgopsbt_add_wallet_input_at_index: (a: number, b: number, c: numb
183
186
  export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
184
187
  export const bitgopsbt_add_wallet_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number) => void;
185
188
  export const bitgopsbt_combine_inputs: (a: number, b: number, c: number, d: number) => void;
189
+ export const bitgopsbt_combine_ironwood_proof: (a: number, b: number, c: number, d: number) => void;
186
190
  export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
187
191
  export const bitgopsbt_consensus_branch_id: (a: number) => number;
188
192
  export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
189
193
  export const bitgopsbt_create_empty_zcash: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
190
194
  export const bitgopsbt_create_empty_zcash_at_height: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
195
+ export const bitgopsbt_create_empty_zcash_v6: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
196
+ export const bitgopsbt_create_empty_zcash_v6_at_height: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
191
197
  export const bitgopsbt_delete_input_kv: (a: number, b: number, c: number, d: number) => void;
192
198
  export const bitgopsbt_delete_kv: (a: number, b: number, c: number) => void;
193
199
  export const bitgopsbt_delete_output_kv: (a: number, b: number, c: number, d: number) => void;
@@ -216,6 +222,8 @@ export const bitgopsbt_get_outputs: (a: number, b: number) => void;
216
222
  export const bitgopsbt_get_outputs_with_address: (a: number, b: number) => void;
217
223
  export const bitgopsbt_get_unsigned_tx: (a: number, b: number) => void;
218
224
  export const bitgopsbt_input_count: (a: number) => number;
225
+ export const bitgopsbt_ironwood_v6_transparent_sighash: (a: number, b: number, c: number) => void;
226
+ export const bitgopsbt_ironwood_v6_txid: (a: number, b: number) => void;
219
227
  export const bitgopsbt_is_musig2_input: (a: number, b: number) => number;
220
228
  export const bitgopsbt_lock_time: (a: number) => number;
221
229
  export const bitgopsbt_network: (a: number, b: number) => void;
@@ -226,11 +234,13 @@ export const bitgopsbt_remove_input: (a: number, b: number, c: number) => void;
226
234
  export const bitgopsbt_remove_output: (a: number, b: number, c: number) => void;
227
235
  export const bitgopsbt_serialize: (a: number, b: number) => void;
228
236
  export const bitgopsbt_set_input_kv: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
237
+ export const bitgopsbt_set_ironwood_out_ciphertext: (a: number, b: number, c: number, d: number, e: number) => void;
229
238
  export const bitgopsbt_set_kv: (a: number, b: number, c: number, d: number, e: number) => void;
230
239
  export const bitgopsbt_set_output_kv: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
231
240
  export const bitgopsbt_sign_all_musig2_inputs: (a: number, b: number, c: number) => void;
232
241
  export const bitgopsbt_sign_all_replay_protection_inputs: (a: number, b: number, c: number) => void;
233
242
  export const bitgopsbt_sign_all_wallet_inputs: (a: number, b: number, c: number) => void;
243
+ export const bitgopsbt_sign_ironwood_v6: (a: number, b: number, c: number, d: number) => void;
234
244
  export const bitgopsbt_sign_musig2_input: (a: number, b: number, c: number, d: number) => void;
235
245
  export const bitgopsbt_sign_single_input_with_privkey: (a: number, b: number, c: number, d: number) => void;
236
246
  export const bitgopsbt_sign_single_input_with_xpriv: (a: number, b: number, c: number, d: number) => void;
@@ -254,8 +264,6 @@ export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: num
254
264
  export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
255
265
  export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
256
266
  export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
257
- export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
258
- export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
259
267
  export const wasmbip32_chain_code: (a: number) => number;
260
268
  export const wasmbip32_depth: (a: number) => number;
261
269
  export const wasmbip32_derive: (a: number, b: number, c: number) => void;
@@ -278,28 +286,30 @@ export const wasmbip32_private_key: (a: number) => number;
278
286
  export const wasmbip32_public_key: (a: number) => number;
279
287
  export const wasmbip32_to_base58: (a: number, b: number) => void;
280
288
  export const wasmbip32_to_wif: (a: number, b: number) => void;
281
- export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
282
- export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
283
- export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
284
- export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
285
- export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
286
- export const wasmecpair_private_key: (a: number) => number;
287
- export const wasmecpair_public_key: (a: number) => number;
288
- export const wasmecpair_to_wif: (a: number, b: number) => void;
289
- export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
290
- export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
291
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
292
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
293
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
289
+ export const wasmdimensions_empty: () => number;
290
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
291
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
292
+ export const wasmdimensions_from_output_script_length: (a: number) => number;
293
+ export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
294
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
295
+ export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
296
+ export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
297
+ export const wasmdimensions_get_output_vsize: (a: number) => number;
298
+ export const wasmdimensions_get_output_weight: (a: number) => number;
299
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
300
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
301
+ export const wasmdimensions_has_segwit: (a: number) => number;
302
+ export const wasmdimensions_plus: (a: number, b: number) => number;
303
+ export const wasmdimensions_times: (a: number, b: number) => number;
294
304
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
295
305
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
296
306
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
297
307
  export const wasmrootwalletkeys_user_key: (a: number) => number;
298
308
  export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
299
309
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
310
+ export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
300
311
  export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
301
312
  export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
302
- export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
303
313
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
304
314
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
305
315
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -3,6 +3,15 @@ import { BitGoPsbt, type CreateEmptyOptions, type HydrationUnspent } from "./Bit
3
3
  import { ZcashTransaction, type ITransaction } from "../transaction.js";
4
4
  /** Zcash network names */
5
5
  export type ZcashNetworkName = "zcash" | "zcashTest" | "zec" | "tzec";
6
+ /**
7
+ * Zcash v6 (Ironwood) version group id (0xd884b698). Its presence marks a PSBT as v6 — see
8
+ * `ZcashIronwoodBitGoPsbt`.
9
+ *
10
+ * Read from the wasm layer rather than hard-coded, so it cannot drift from
11
+ * `ZCASH_IRONWOOD_VERSION_GROUP_ID` in `src/zcash/transaction.rs`: a divergence would make the
12
+ * v4/v6 discrimination in {@link ZcashBitGoPsbt.fromBytes} silently classify v6 bytes as v4.
13
+ */
14
+ export declare const IRONWOOD_VERSION_GROUP_ID: number;
6
15
  /** Options for creating an empty Zcash PSBT (preferred method using block height) */
7
16
  export type CreateEmptyZcashOptions = CreateEmptyOptions & {
8
17
  /** Block height to determine consensus branch ID automatically */
@@ -98,6 +107,8 @@ export declare class ZcashBitGoPsbt extends BitGoPsbt {
98
107
  *
99
108
  * @param bytes - The PSBT bytes
100
109
  * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
110
+ * @throws Error if the deserialized PSBT is a v6 (Ironwood) PSBT — use
111
+ * {@link ZcashIronwoodBitGoPsbt.fromBytes} instead
101
112
  * @returns A ZcashBitGoPsbt instance
102
113
  */
103
114
  static fromBytes(bytes: Uint8Array, network: ZcashNetworkName): ZcashBitGoPsbt;
@@ -1,7 +1,16 @@
1
- import { BitGoPsbt as WasmBitGoPsbt, zcash_branch_id_for_height } from "../wasm/wasm_utxo.js";
1
+ import { BitGoPsbt as WasmBitGoPsbt, zcash_branch_id_for_height, zcash_ironwood_version_group_id, } from "../wasm/wasm_utxo.js";
2
2
  import { RootWalletKeys } from "./RootWalletKeys.js";
3
3
  import { BitGoPsbt } from "./BitGoPsbt.js";
4
4
  import { ZcashTransaction } from "../transaction.js";
5
+ /**
6
+ * Zcash v6 (Ironwood) version group id (0xd884b698). Its presence marks a PSBT as v6 — see
7
+ * `ZcashIronwoodBitGoPsbt`.
8
+ *
9
+ * Read from the wasm layer rather than hard-coded, so it cannot drift from
10
+ * `ZCASH_IRONWOOD_VERSION_GROUP_ID` in `src/zcash/transaction.rs`: a divergence would make the
11
+ * v4/v6 discrimination in {@link ZcashBitGoPsbt.fromBytes} silently classify v6 bytes as v4.
12
+ */
13
+ export const IRONWOOD_VERSION_GROUP_ID = zcash_ironwood_version_group_id();
5
14
  /**
6
15
  * Zcash-specific PSBT implementation
7
16
  *
@@ -87,11 +96,17 @@ export class ZcashBitGoPsbt extends BitGoPsbt {
87
96
  *
88
97
  * @param bytes - The PSBT bytes
89
98
  * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
99
+ * @throws Error if the deserialized PSBT is a v6 (Ironwood) PSBT — use
100
+ * {@link ZcashIronwoodBitGoPsbt.fromBytes} instead
90
101
  * @returns A ZcashBitGoPsbt instance
91
102
  */
92
103
  static fromBytes(bytes, network) {
93
104
  const wasm = WasmBitGoPsbt.from_bytes(bytes, network);
94
- return new ZcashBitGoPsbt(wasm);
105
+ const psbt = new ZcashBitGoPsbt(wasm);
106
+ if (psbt.versionGroupId === IRONWOOD_VERSION_GROUP_ID) {
107
+ throw new Error("this is a v6 (Ironwood) PSBT: use ZcashIronwoodBitGoPsbt.fromBytes instead");
108
+ }
109
+ return psbt;
95
110
  }
96
111
  /**
97
112
  * Reconstruct a Zcash PSBT from a network-format transaction (unsigned, half-signed, or fully-signed).
@@ -0,0 +1,233 @@
1
+ import { type BIP32Arg } from "../bip32.js";
2
+ import { type ECPairArg } from "../ecpair.js";
3
+ import { type WalletKeysArg } from "./RootWalletKeys.js";
4
+ import { ZcashBitGoPsbt, type ZcashNetworkName } from "./ZcashBitGoPsbt.js";
5
+ /**
6
+ * Options for creating an empty Zcash v6 (Ironwood) shielding PSBT.
7
+ *
8
+ * Deliberately narrower than `CreateEmptyZcashOptions`: `version` and `versionGroupId` are fixed by
9
+ * the v6 format, so accepting them would only let a caller ask for something that is then ignored.
10
+ */
11
+ export type CreateEmptyIronwoodOptions = {
12
+ /** Block height to determine the consensus branch ID automatically (at/after NU6.3 activation) */
13
+ blockHeight: number;
14
+ /** Lock time (default: 0) */
15
+ lockTime?: number;
16
+ /** Zcash transaction expiry height */
17
+ expiryHeight?: number;
18
+ };
19
+ /**
20
+ * Options for creating an empty Zcash v6 (Ironwood) shielding PSBT with an explicit consensus
21
+ * branch ID.
22
+ *
23
+ * Like {@link CreateEmptyIronwoodOptions}, this omits `version` and `versionGroupId` — both are
24
+ * fixed by the v6 format. The consensus branch ID is *not* fixed: it tracks the active network
25
+ * upgrade, so it stays a caller-supplied parameter exactly as it is for v4.
26
+ */
27
+ export type CreateEmptyIronwoodWithConsensusBranchIdOptions = {
28
+ /** Zcash consensus branch ID (e.g. the NU6.3 branch ID) */
29
+ consensusBranchId: number;
30
+ /** Lock time (default: 0) */
31
+ lockTime?: number;
32
+ /** Zcash transaction expiry height */
33
+ expiryHeight?: number;
34
+ };
35
+ /**
36
+ * A fresh ZIP-302 "no memo" memo field: the `0xf6` marker byte followed by 511 zero bytes. The
37
+ * default for {@link ZcashIronwoodBitGoPsbt.addShieldedOutput}'s `memo` option.
38
+ *
39
+ * Not the same as an all-zeros memo, which decodes as a *text* memo holding the empty string and is
40
+ * rendered as such by wallets. Exported so callers can pass it explicitly, and so the distinction is
41
+ * visible rather than buried in a default.
42
+ *
43
+ * A function rather than a shared constant: a module-level `Uint8Array` is mutable, so one caller
44
+ * writing into it would silently change the default memo for every later output.
45
+ */
46
+ export declare function zip302NoMemo(): Uint8Array;
47
+ /**
48
+ * A Zcash **v6 (Ironwood / NU6.3)** shielding PSBT.
49
+ *
50
+ * Distinct from the generic `ZcashBitGoPsbt` (v4/Sapling-shaped transactions): a v6 PSBT carries
51
+ * its shielded side as an orchard PCZT in the proprietary map rather than Sapling fields, and its
52
+ * lifecycle mirrors the microservice build → sign → combine flow rather than the v4 ZIP-243
53
+ * signing path.
54
+ *
55
+ * Method names carry no `ironwood` prefix — the class name already says it. They follow the base
56
+ * `BitGoPsbt` vocabulary (`createEmpty`, `fromBytes`, `addOutput`-style adders, `getId`) so the v6
57
+ * surface reads the same as the v4 one; the wasm bindings keep their `ironwood_v6_*` names because
58
+ * they live on the single flat `BitGoPsbt` struct, where the prefix is what disambiguates them.
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const psbt = ZcashIronwoodBitGoPsbt.createEmpty("zcash", walletKeys, { blockHeight });
63
+ * psbt.addWalletInput(...);
64
+ * psbt.addWalletOutput(...);
65
+ * psbt.addShieldedOutput(recipient, amount, { anchor });
66
+ * const sighash = psbt.transparentSighash(0);
67
+ * // ... sign sighash externally, then:
68
+ * psbt.addTransparentSignature(0, pubkey, sig);
69
+ * const tx = psbt.combineProof(proof);
70
+ * ```
71
+ */
72
+ export declare class ZcashIronwoodBitGoPsbt extends ZcashBitGoPsbt {
73
+ /**
74
+ * Create an empty Zcash **v6 (Ironwood)** shielding PSBT, with the consensus branch ID
75
+ * determined from block height.
76
+ *
77
+ * Add transparent inputs/outputs with the usual `addWalletInput` / `addWalletOutput`, the
78
+ * shielded output with {@link addShieldedOutput}, then sign the transparent inputs over
79
+ * {@link transparentSighash} and finish with {@link combineProof}.
80
+ *
81
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
82
+ * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
83
+ * @param options - Options including blockHeight (at/after NU6.3 activation)
84
+ */
85
+ static createEmpty(network: ZcashNetworkName, walletKeys: WalletKeysArg, options: CreateEmptyIronwoodOptions): ZcashIronwoodBitGoPsbt;
86
+ /**
87
+ * Create an empty Zcash **v6 (Ironwood)** shielding PSBT with an explicit consensus branch ID.
88
+ *
89
+ * **Advanced use only.** Prefer {@link createEmpty}, which derives the branch ID from a block
90
+ * height and rejects heights before NU6.3 activation. Reach for this only when you already know
91
+ * the branch ID — regtest, a future upgrade, or replaying a known-good value.
92
+ *
93
+ * Only the *version group ID* is fixed by the v6 format; the consensus branch ID tracks the active
94
+ * network upgrade and remains caller-supplied, exactly as for v4.
95
+ *
96
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
97
+ * @param walletKeys - The wallet's root keys (sets global xpubs in the PSBT)
98
+ * @param options - Options including the required consensusBranchId
99
+ */
100
+ static createEmptyWithConsensusBranchId(network: ZcashNetworkName, walletKeys: WalletKeysArg, options: CreateEmptyIronwoodWithConsensusBranchIdOptions): ZcashIronwoodBitGoPsbt;
101
+ /**
102
+ * Not applicable to v6, and not implementable: a broadcast v6 transaction carries the shielded
103
+ * side as a proof plus a binding signature, while every v6 operation here needs the PCZT — which
104
+ * holds witness data (`rseed`, `rcv`, `alpha`, the note plaintext) that is deliberately *not*
105
+ * recoverable from the transaction. Decoding the transparent skeleton alone would yield a PSBT
106
+ * that `getId`, `transparentSighash`, `combineProof`, and even `serialize`/{@link fromBytes} all
107
+ * reject. Inherited only because JS statics are inherited.
108
+ */
109
+ static fromNetworkFormat(): never;
110
+ /**
111
+ * Not applicable to v6: the legacy half-signed format is a v4-era p2ms encoding with no way to
112
+ * carry the PCZT, and no v6 transaction has ever been produced in it. Inherited only because JS
113
+ * statics are inherited.
114
+ */
115
+ static fromHalfSignedLegacyTransaction(): never;
116
+ /**
117
+ * Deserialize a v6 (Ironwood) Zcash PSBT from bytes.
118
+ *
119
+ * @param bytes - The PSBT bytes
120
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
121
+ * @throws Error if the deserialized PSBT is not a v6 (Ironwood) PSBT
122
+ * @returns A ZcashIronwoodBitGoPsbt instance
123
+ */
124
+ static fromBytes(bytes: Uint8Array, network: ZcashNetworkName): ZcashIronwoodBitGoPsbt;
125
+ /**
126
+ * Add the shielded output (Constructor role). Stores the orchard PCZT in the PSBT.
127
+ *
128
+ * Named for the shielded/transparent split rather than the note type, leaving room for a
129
+ * transparent-output variant alongside the inherited `addOutput` / `addWalletOutput`.
130
+ *
131
+ * @param recipient - 43-byte raw Orchard/Ironwood address
132
+ * @param amount - note value in zatoshi
133
+ * @param options.anchor - 32-byte Ironwood note-commitment-tree root
134
+ * @param options.memo - optional 512-byte memo (defaults to the ZIP-302 "no memo" encoding)
135
+ * @param options.ovk - optional 32-byte outgoing viewing key (omit for a keyless build)
136
+ */
137
+ addShieldedOutput(recipient: Uint8Array, amount: bigint, options: {
138
+ anchor: Uint8Array;
139
+ memo?: Uint8Array;
140
+ ovk?: Uint8Array;
141
+ }): void;
142
+ /**
143
+ * Client-managed `ovk`: re-encrypt the shielded output's `out_ciphertext` under **this wallet's**
144
+ * `ovk`, derived as the ECDH agreement of `rootWalletKeys.bitgoKey()` and `userKey`. Both are root
145
+ * keys, so the `ovk` does not depend on which inputs the transaction spends, and the server can
146
+ * re-derive the identical value from its own private key plus the user's public key in order to
147
+ * validate `out_ciphertext` before countersigning. The server never sees `userKey` or the `ovk`.
148
+ *
149
+ * `userKey` must be the wallet's user root key — passing the backup or BitGo key throws, since an
150
+ * `ovk` derived from those is one neither the user nor the server can reproduce, and the resulting
151
+ * transaction would broadcast fine while leaving the shielded output permanently unrecoverable.
152
+ *
153
+ * Normally you do not call this directly: {@link sign} performs it on the first signing round.
154
+ *
155
+ * Must be called **before** signing: `out_ciphertext` is committed by the ZIP-244 sighash, so
156
+ * calling this after any transparent signature has been added (via
157
+ * {@link addTransparentSignature}) throws rather than silently invalidating that signature.
158
+ *
159
+ * @param actionIndex - index of the Ironwood action whose output to re-encrypt (always `0`: only
160
+ * one shielded output per transaction is supported, see {@link addShieldedOutput})
161
+ * @param userKey - the wallet's user root key (an xpriv)
162
+ * @param rootWalletKeys - the wallet's root keys, supplying the BitGo cosigner pubkey
163
+ */
164
+ setShieldedOutCiphertext(actionIndex: number, userKey: BIP32Arg, rootWalletKeys: WalletKeysArg): void;
165
+ /**
166
+ * The canonical (display-order) ZIP-244 v6 txid as a lowercase hex string, matching
167
+ * `ITransaction.getId()`. Defined once the transparent inputs/outputs and the shielded output are
168
+ * in place; unchanged by signing or proving.
169
+ */
170
+ getId(): string;
171
+ /**
172
+ * The ZIP-244 per-input transparent sighash (32 bytes) the key controlling transparent input
173
+ * `index` must sign.
174
+ */
175
+ transparentSighash(index: number): Uint8Array;
176
+ /**
177
+ * Ingest a transparent-input signature returned by the client/HSM, after verifying it against
178
+ * {@link transparentSighash} for that input.
179
+ *
180
+ * @param index - transparent input index
181
+ * @param pubkey - the signing public key
182
+ * @param sig - DER ECDSA signature with the trailing SIGHASH_ALL byte (as in a scriptSig)
183
+ */
184
+ addTransparentSignature(index: number, pubkey: Uint8Array, sig: Uint8Array): void;
185
+ /**
186
+ * Sign every transparent input `key` resolves a private key for, over the ZIP-244 transparent
187
+ * sighash. The v6 (Ironwood) counterpart to the inherited `sign(key)` — that base implementation
188
+ * rejects v6 PSBTs outright, since it only knows the ZIP-243 digest.
189
+ *
190
+ * If no transparent signature has been added to this PSBT yet, this is the first signing round and
191
+ * `key` must be the wallet's user root key: it is used with `rootWalletKeys.bitgoKey()` to derive
192
+ * this wallet's `ovk` and finalize `out_ciphertext` — the client-managed-`ovk` flow — before any
193
+ * sighash is computed. Once a signature exists, that step is a no-op, so a caller passes
194
+ * `rootWalletKeys` on every signing round unconditionally: `psbt.sign(userXpriv, rootWalletKeys)`
195
+ * and later `psbt.sign(bitgoXpriv, rootWalletKeys)` — only the first call actually uses it.
196
+ * `rootWalletKeys` is mandatory precisely so that step can never be silently skipped by omission.
197
+ *
198
+ * **The user must sign first**, and this is enforced: a first round opened by any other key throws
199
+ * rather than deriving an `ovk` that neither the user nor the server can reproduce. One consequence
200
+ * is that a backup-key recovery cannot open the first signing round of a shielding transaction.
201
+ *
202
+ * `rootWalletKeys` is typed optional only so this override type-checks against the inherited
203
+ * `sign(key)` signature — omitting it throws at runtime rather than silently signing without the
204
+ * `ovk` step.
205
+ *
206
+ * @param key - an xpriv (BIP32Arg); raw privkeys (ECPairArg) are not meaningful here, since
207
+ * `out_ciphertext` derivation needs the key's `bip32_derivation` path
208
+ * @param rootWalletKeys - the wallet's root keys (required). Any {@link WalletKeysArg} form, same
209
+ * as {@link setShieldedOutCiphertext} and {@link createEmpty} — an xpub triple, a utxo-lib
210
+ * `RootWalletKeys`, or this package's own — so it is never sensitive to which copy of the class
211
+ * a caller's `RootWalletKeys` came from.
212
+ * @returns the transparent input indices that were signed
213
+ */
214
+ sign(key: BIP32Arg | ECPairArg, rootWalletKeys?: WalletKeysArg): number[];
215
+ /**
216
+ * @deprecated Not supported for v6 (Ironwood): always throws. Inherited only because the base
217
+ * class's single-input overload must be preserved for the override to type-check; use
218
+ * {@link sign} (all matching inputs) instead.
219
+ */
220
+ sign(inputIndex: number, key: BIP32Arg | ECPairArg): void;
221
+ /**
222
+ * Transaction Extractor role: given the external prover's `proof` bytes, finalize the
223
+ * transparent inputs, apply the shielded binding signature, and return the broadcast-ready v6
224
+ * transaction bytes. Requires every transparent input to be signed via
225
+ * {@link addTransparentSignature}.
226
+ *
227
+ * Terminal: the wasm binding drops the stored PCZT on success, so any later v6 call on this PSBT
228
+ * throws — including after a `serialize`/{@link fromBytes} round-trip, since the PCZT is gone
229
+ * from the bytes too. Build a fresh PSBT instead. On failure nothing is dropped, so a call that
230
+ * errors (bad proof, unsigned input) leaves the PSBT retryable.
231
+ */
232
+ combineProof(proof: Uint8Array): Uint8Array;
233
+ }