@bitgo/wasm-utxo 4.16.0 → 4.17.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.
@@ -155,6 +155,16 @@ export declare class ZcashBitGoPsbt extends BitGoPsbt {
155
155
  * @returns The expiry height (0 if not set)
156
156
  */
157
157
  get expiryHeight(): number;
158
+ /**
159
+ * Get the Zcash consensus branch ID stored in the PSBT proprietary map.
160
+ * Returns undefined for v5 PSBTs or PSBTs without the key.
161
+ */
162
+ get consensusBranchId(): number | undefined;
163
+ /**
164
+ * Return the Zcash consensus branch ID active at `height` on `network`.
165
+ * Returns undefined if `height` is before Overwinter activation.
166
+ */
167
+ static branchIdForHeight(network: ZcashNetworkName, height: number): number | undefined;
158
168
  /**
159
169
  * Extract the final Zcash transaction from a finalized PSBT
160
170
  *
@@ -173,6 +173,20 @@ class ZcashBitGoPsbt extends BitGoPsbt_js_1.BitGoPsbt {
173
173
  get expiryHeight() {
174
174
  return this.wasm.expiry_height();
175
175
  }
176
+ /**
177
+ * Get the Zcash consensus branch ID stored in the PSBT proprietary map.
178
+ * Returns undefined for v5 PSBTs or PSBTs without the key.
179
+ */
180
+ get consensusBranchId() {
181
+ return this.wasm.consensus_branch_id();
182
+ }
183
+ /**
184
+ * Return the Zcash consensus branch ID active at `height` on `network`.
185
+ * Returns undefined if `height` is before Overwinter activation.
186
+ */
187
+ static branchIdForHeight(network, height) {
188
+ return (0, wasm_utxo_js_1.zcash_branch_id_for_height)(network, height);
189
+ }
176
190
  /**
177
191
  * Extract the final Zcash transaction from a finalized PSBT
178
192
  *
@@ -176,6 +176,10 @@ export class BitGoPsbt {
176
176
  * Returns error if networks don't match
177
177
  */
178
178
  combine_musig2_nonces(source_psbt: BitGoPsbt): void;
179
+ /**
180
+ * Get the Zcash consensus branch ID from the PSBT proprietary map (returns None for non-Zcash PSBTs)
181
+ */
182
+ consensus_branch_id(): number | undefined;
179
183
  /**
180
184
  * Create an empty PSBT for the given network with wallet keys
181
185
  *
@@ -1597,3 +1601,12 @@ export function parsePsbtToJson(psbt_bytes: Uint8Array, coin_name: string): stri
1597
1601
  * - The network name is unknown
1598
1602
  */
1599
1603
  export function parseTxToJson(tx_bytes: Uint8Array, coin_name: string): string;
1604
+
1605
+ /**
1606
+ * Return the Zcash consensus branch ID active at `height` on `network`.
1607
+ *
1608
+ * `network`: "zcash" / "zec" for mainnet, "zcashTest" / "tzec" for testnet.
1609
+ * Returns `None` if `height` is before Overwinter activation.
1610
+ * Throws if `network` is not a recognised Zcash network name.
1611
+ */
1612
+ export function zcash_branch_id_for_height(network: string, height: number): number | undefined;
@@ -803,6 +803,14 @@ class BitGoPsbt {
803
803
  wasm.__wbindgen_add_to_stack_pointer(16);
804
804
  }
805
805
  }
806
+ /**
807
+ * Get the Zcash consensus branch ID from the PSBT proprietary map (returns None for non-Zcash PSBTs)
808
+ * @returns {number | undefined}
809
+ */
810
+ consensus_branch_id() {
811
+ const ret = wasm.bitgopsbt_consensus_branch_id(this.__wbg_ptr);
812
+ return ret === 0x100000001 ? undefined : ret;
813
+ }
806
814
  /**
807
815
  * Create an empty PSBT for the given network with wallet keys
808
816
  *
@@ -6231,6 +6239,35 @@ function parseTxToJson(tx_bytes, coin_name) {
6231
6239
  }
6232
6240
  exports.parseTxToJson = parseTxToJson;
6233
6241
 
6242
+ /**
6243
+ * Return the Zcash consensus branch ID active at `height` on `network`.
6244
+ *
6245
+ * `network`: "zcash" / "zec" for mainnet, "zcashTest" / "tzec" for testnet.
6246
+ * Returns `None` if `height` is before Overwinter activation.
6247
+ * Throws if `network` is not a recognised Zcash network name.
6248
+ * @param {string} network
6249
+ * @param {number} height
6250
+ * @returns {number | undefined}
6251
+ */
6252
+ function zcash_branch_id_for_height(network, height) {
6253
+ try {
6254
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6255
+ const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
6256
+ const len0 = WASM_VECTOR_LEN;
6257
+ wasm.zcash_branch_id_for_height(retptr, ptr0, len0, height);
6258
+ var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
6259
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6260
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
6261
+ if (r3) {
6262
+ throw takeObject(r2);
6263
+ }
6264
+ return r0 === 0x100000001 ? undefined : r0;
6265
+ } finally {
6266
+ wasm.__wbindgen_add_to_stack_pointer(16);
6267
+ }
6268
+ }
6269
+ exports.zcash_branch_id_for_height = zcash_branch_id_for_height;
6270
+
6234
6271
  function __wbg_get_imports() {
6235
6272
  const import0 = {
6236
6273
  __proto__: null,
Binary file
@@ -2,18 +2,23 @@
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_inscriptionsnamespace_free: (a: number, b: number) => void;
5
+ export const __wbg_bip322namespace_free: (a: number, b: number) => void;
6
6
  export const __wbg_messagenamespace_free: (a: number, b: number) => void;
7
7
  export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
8
8
  export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
9
- export const __wbg_wasmdimensions_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;
10
11
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
11
12
  export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
12
13
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
13
14
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
14
15
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
15
- export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
16
- 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;
16
+ 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;
17
+ export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
18
+ 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;
19
+ 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;
20
+ 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;
21
+ 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;
17
22
  export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
18
23
  export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
19
24
  export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
@@ -28,21 +33,19 @@ export const wasmdashtransaction_lock_time: (a: number) => number;
28
33
  export const wasmdashtransaction_output_count: (a: number) => number;
29
34
  export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
30
35
  export const wasmdashtransaction_version: (a: number) => number;
31
- export const wasmdimensions_empty: () => number;
32
- export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
33
- export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
34
- export const wasmdimensions_from_output_script_length: (a: number) => number;
35
- export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
36
- export const wasmdimensions_from_psbt: (a: number, b: number) => void;
37
- export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
38
- export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
39
- export const wasmdimensions_get_output_vsize: (a: number) => number;
40
- export const wasmdimensions_get_output_weight: (a: number) => number;
41
- export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
42
- export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
43
- export const wasmdimensions_has_segwit: (a: number) => number;
44
- export const wasmdimensions_plus: (a: number, b: number) => number;
45
- export const wasmdimensions_times: (a: number, b: number) => number;
36
+ export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
37
+ export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
38
+ export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
39
+ export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
40
+ export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
41
+ export const wasmecpair_private_key: (a: number) => number;
42
+ export const wasmecpair_public_key: (a: number) => number;
43
+ export const wasmecpair_to_wif: (a: number, b: number) => void;
44
+ export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
45
+ export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
46
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
47
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
48
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
46
49
  export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
47
50
  export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
48
51
  export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
@@ -110,10 +113,8 @@ export const wasmzcashtransaction_lock_time: (a: number) => number;
110
113
  export const wasmzcashtransaction_version: (a: number) => number;
111
114
  export const wrappsbt_lock_time: (a: number) => number;
112
115
  export const wrappsbt_version: (a: number) => number;
113
- export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
114
116
  export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
115
117
  export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
116
- export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
117
118
  export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
118
119
  export const wrapdescriptor_descType: (a: number, b: number) => void;
119
120
  export const wrapdescriptor_encode: (a: number, b: number) => void;
@@ -134,19 +135,13 @@ export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d:
134
135
  export const wrapminiscript_node: (a: number, b: number) => void;
135
136
  export const wrapminiscript_toAsmString: (a: number, b: number) => void;
136
137
  export const wrapminiscript_toString: (a: number, b: number) => void;
137
- export const __wbg_bip322namespace_free: (a: number, b: number) => void;
138
138
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
139
139
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
140
+ export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
140
141
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
141
- export const __wbg_wasmecpair_free: (a: number, b: number) => void;
142
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
142
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
143
143
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
144
- 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;
145
- export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
146
- 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;
147
- 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;
148
- 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;
149
- 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;
144
+ export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
150
145
  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;
151
146
  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;
152
147
  export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
@@ -161,6 +156,7 @@ export const bitgopsbt_add_wallet_input_at_index: (a: number, b: number, c: numb
161
156
  export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
162
157
  export const bitgopsbt_add_wallet_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number) => void;
163
158
  export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
159
+ export const bitgopsbt_consensus_branch_id: (a: number) => number;
164
160
  export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
165
161
  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;
166
162
  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;
@@ -228,6 +224,8 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
228
224
  export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
229
225
  export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
230
226
  export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
227
+ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
228
+ 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;
231
229
  export const isInspectEnabled: () => number;
232
230
  export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
233
231
  export const wasmbip32_chain_code: (a: number) => number;
@@ -252,29 +250,33 @@ export const wasmbip32_private_key: (a: number) => number;
252
250
  export const wasmbip32_public_key: (a: number) => number;
253
251
  export const wasmbip32_to_base58: (a: number, b: number) => void;
254
252
  export const wasmbip32_to_wif: (a: number, b: number) => void;
255
- export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
256
- export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
257
- export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
258
- export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
259
- export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
260
- export const wasmecpair_private_key: (a: number) => number;
261
- export const wasmecpair_public_key: (a: number) => number;
262
- export const wasmecpair_to_wif: (a: number, b: number) => void;
263
- export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
264
- export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
265
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
266
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
267
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
253
+ export const wasmdimensions_empty: () => number;
254
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
255
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
256
+ export const wasmdimensions_from_output_script_length: (a: number) => number;
257
+ export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
258
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
259
+ export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
260
+ export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
261
+ export const wasmdimensions_get_output_vsize: (a: number) => number;
262
+ export const wasmdimensions_get_output_weight: (a: number) => number;
263
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
264
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
265
+ export const wasmdimensions_has_segwit: (a: number) => number;
266
+ export const wasmdimensions_plus: (a: number, b: number) => number;
267
+ export const wasmdimensions_times: (a: number, b: number) => number;
268
268
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
269
269
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
270
270
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
271
271
  export const wasmrootwalletkeys_user_key: (a: number) => number;
272
272
  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;
273
+ export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
274
+ export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
273
275
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
276
+ export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
274
277
  export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
275
278
  export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
276
279
  export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
277
- export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
278
280
  export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
279
281
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
280
282
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
@@ -155,6 +155,16 @@ export declare class ZcashBitGoPsbt extends BitGoPsbt {
155
155
  * @returns The expiry height (0 if not set)
156
156
  */
157
157
  get expiryHeight(): number;
158
+ /**
159
+ * Get the Zcash consensus branch ID stored in the PSBT proprietary map.
160
+ * Returns undefined for v5 PSBTs or PSBTs without the key.
161
+ */
162
+ get consensusBranchId(): number | undefined;
163
+ /**
164
+ * Return the Zcash consensus branch ID active at `height` on `network`.
165
+ * Returns undefined if `height` is before Overwinter activation.
166
+ */
167
+ static branchIdForHeight(network: ZcashNetworkName, height: number): number | undefined;
158
168
  /**
159
169
  * Extract the final Zcash transaction from a finalized PSBT
160
170
  *
@@ -1,4 +1,4 @@
1
- import { BitGoPsbt as WasmBitGoPsbt } from "../wasm/wasm_utxo.js";
1
+ import { BitGoPsbt as WasmBitGoPsbt, zcash_branch_id_for_height } 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";
@@ -170,6 +170,20 @@ export class ZcashBitGoPsbt extends BitGoPsbt {
170
170
  get expiryHeight() {
171
171
  return this.wasm.expiry_height();
172
172
  }
173
+ /**
174
+ * Get the Zcash consensus branch ID stored in the PSBT proprietary map.
175
+ * Returns undefined for v5 PSBTs or PSBTs without the key.
176
+ */
177
+ get consensusBranchId() {
178
+ return this.wasm.consensus_branch_id();
179
+ }
180
+ /**
181
+ * Return the Zcash consensus branch ID active at `height` on `network`.
182
+ * Returns undefined if `height` is before Overwinter activation.
183
+ */
184
+ static branchIdForHeight(network, height) {
185
+ return zcash_branch_id_for_height(network, height);
186
+ }
173
187
  /**
174
188
  * Extract the final Zcash transaction from a finalized PSBT
175
189
  *
@@ -176,6 +176,10 @@ export class BitGoPsbt {
176
176
  * Returns error if networks don't match
177
177
  */
178
178
  combine_musig2_nonces(source_psbt: BitGoPsbt): void;
179
+ /**
180
+ * Get the Zcash consensus branch ID from the PSBT proprietary map (returns None for non-Zcash PSBTs)
181
+ */
182
+ consensus_branch_id(): number | undefined;
179
183
  /**
180
184
  * Create an empty PSBT for the given network with wallet keys
181
185
  *
@@ -1597,3 +1601,12 @@ export function parsePsbtToJson(psbt_bytes: Uint8Array, coin_name: string): stri
1597
1601
  * - The network name is unknown
1598
1602
  */
1599
1603
  export function parseTxToJson(tx_bytes: Uint8Array, coin_name: string): string;
1604
+
1605
+ /**
1606
+ * Return the Zcash consensus branch ID active at `height` on `network`.
1607
+ *
1608
+ * `network`: "zcash" / "zec" for mainnet, "zcashTest" / "tzec" for testnet.
1609
+ * Returns `None` if `height` is before Overwinter activation.
1610
+ * Throws if `network` is not a recognised Zcash network name.
1611
+ */
1612
+ export function zcash_branch_id_for_height(network: string, height: number): number | undefined;
@@ -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, isInspectEnabled, parsePsbtRawToJson, parsePsbtToJson, parseTxToJson
8
+ AddressNamespace, Bip322Namespace, BitGoPsbt, FixedScriptWalletNamespace, InscriptionsNamespace, MessageNamespace, UtxolibCompatNamespace, WasmBIP32, WasmDashTransaction, WasmDimensions, WasmECPair, WasmReplayProtection, WasmRootWalletKeys, WasmTransaction, WasmUtxoNamespace, WasmZcashTransaction, WrapDescriptor, WrapMiniscript, WrapPsbt, isInspectEnabled, parsePsbtRawToJson, parsePsbtToJson, parseTxToJson, zcash_branch_id_for_height
9
9
  } from "./wasm_utxo_bg.js";
@@ -799,6 +799,14 @@ export class BitGoPsbt {
799
799
  wasm.__wbindgen_add_to_stack_pointer(16);
800
800
  }
801
801
  }
802
+ /**
803
+ * Get the Zcash consensus branch ID from the PSBT proprietary map (returns None for non-Zcash PSBTs)
804
+ * @returns {number | undefined}
805
+ */
806
+ consensus_branch_id() {
807
+ const ret = wasm.bitgopsbt_consensus_branch_id(this.__wbg_ptr);
808
+ return ret === 0x100000001 ? undefined : ret;
809
+ }
802
810
  /**
803
811
  * Create an empty PSBT for the given network with wallet keys
804
812
  *
@@ -6205,6 +6213,34 @@ export function parseTxToJson(tx_bytes, coin_name) {
6205
6213
  wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
6206
6214
  }
6207
6215
  }
6216
+
6217
+ /**
6218
+ * Return the Zcash consensus branch ID active at `height` on `network`.
6219
+ *
6220
+ * `network`: "zcash" / "zec" for mainnet, "zcashTest" / "tzec" for testnet.
6221
+ * Returns `None` if `height` is before Overwinter activation.
6222
+ * Throws if `network` is not a recognised Zcash network name.
6223
+ * @param {string} network
6224
+ * @param {number} height
6225
+ * @returns {number | undefined}
6226
+ */
6227
+ export function zcash_branch_id_for_height(network, height) {
6228
+ try {
6229
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6230
+ const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
6231
+ const len0 = WASM_VECTOR_LEN;
6232
+ wasm.zcash_branch_id_for_height(retptr, ptr0, len0, height);
6233
+ var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
6234
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6235
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
6236
+ if (r3) {
6237
+ throw takeObject(r2);
6238
+ }
6239
+ return r0 === 0x100000001 ? undefined : r0;
6240
+ } finally {
6241
+ wasm.__wbindgen_add_to_stack_pointer(16);
6242
+ }
6243
+ }
6208
6244
  export function __wbg_Error_8c4e43fe74559d73(arg0, arg1) {
6209
6245
  const ret = Error(getStringFromWasm0(arg0, arg1));
6210
6246
  return addHeapObject(ret);
Binary file
@@ -2,18 +2,23 @@
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_inscriptionsnamespace_free: (a: number, b: number) => void;
5
+ export const __wbg_bip322namespace_free: (a: number, b: number) => void;
6
6
  export const __wbg_messagenamespace_free: (a: number, b: number) => void;
7
7
  export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
8
8
  export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
9
- export const __wbg_wasmdimensions_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;
10
11
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
11
12
  export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
12
13
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
13
14
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
14
15
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
15
- export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
16
- 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;
16
+ 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;
17
+ export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
18
+ 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;
19
+ 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;
20
+ 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;
21
+ 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;
17
22
  export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
18
23
  export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
19
24
  export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
@@ -28,21 +33,19 @@ export const wasmdashtransaction_lock_time: (a: number) => number;
28
33
  export const wasmdashtransaction_output_count: (a: number) => number;
29
34
  export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
30
35
  export const wasmdashtransaction_version: (a: number) => number;
31
- export const wasmdimensions_empty: () => number;
32
- export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
33
- export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
34
- export const wasmdimensions_from_output_script_length: (a: number) => number;
35
- export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
36
- export const wasmdimensions_from_psbt: (a: number, b: number) => void;
37
- export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
38
- export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
39
- export const wasmdimensions_get_output_vsize: (a: number) => number;
40
- export const wasmdimensions_get_output_weight: (a: number) => number;
41
- export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
42
- export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
43
- export const wasmdimensions_has_segwit: (a: number) => number;
44
- export const wasmdimensions_plus: (a: number, b: number) => number;
45
- export const wasmdimensions_times: (a: number, b: number) => number;
36
+ export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
37
+ export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
38
+ export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
39
+ export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
40
+ export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
41
+ export const wasmecpair_private_key: (a: number) => number;
42
+ export const wasmecpair_public_key: (a: number) => number;
43
+ export const wasmecpair_to_wif: (a: number, b: number) => void;
44
+ export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
45
+ export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
46
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
47
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
48
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
46
49
  export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
47
50
  export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
48
51
  export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
@@ -110,10 +113,8 @@ export const wasmzcashtransaction_lock_time: (a: number) => number;
110
113
  export const wasmzcashtransaction_version: (a: number) => number;
111
114
  export const wrappsbt_lock_time: (a: number) => number;
112
115
  export const wrappsbt_version: (a: number) => number;
113
- export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
114
116
  export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
115
117
  export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
116
- export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
117
118
  export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
118
119
  export const wrapdescriptor_descType: (a: number, b: number) => void;
119
120
  export const wrapdescriptor_encode: (a: number, b: number) => void;
@@ -134,19 +135,13 @@ export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d:
134
135
  export const wrapminiscript_node: (a: number, b: number) => void;
135
136
  export const wrapminiscript_toAsmString: (a: number, b: number) => void;
136
137
  export const wrapminiscript_toString: (a: number, b: number) => void;
137
- export const __wbg_bip322namespace_free: (a: number, b: number) => void;
138
138
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
139
139
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
140
+ export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
140
141
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
141
- export const __wbg_wasmecpair_free: (a: number, b: number) => void;
142
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
142
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
143
143
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
144
- 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;
145
- export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
146
- 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;
147
- 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;
148
- 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;
149
- 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;
144
+ export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
150
145
  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;
151
146
  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;
152
147
  export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
@@ -161,6 +156,7 @@ export const bitgopsbt_add_wallet_input_at_index: (a: number, b: number, c: numb
161
156
  export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
162
157
  export const bitgopsbt_add_wallet_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number) => void;
163
158
  export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
159
+ export const bitgopsbt_consensus_branch_id: (a: number) => number;
164
160
  export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
165
161
  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;
166
162
  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;
@@ -228,6 +224,8 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
228
224
  export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
229
225
  export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
230
226
  export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
227
+ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
228
+ 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;
231
229
  export const isInspectEnabled: () => number;
232
230
  export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
233
231
  export const wasmbip32_chain_code: (a: number) => number;
@@ -252,29 +250,33 @@ export const wasmbip32_private_key: (a: number) => number;
252
250
  export const wasmbip32_public_key: (a: number) => number;
253
251
  export const wasmbip32_to_base58: (a: number, b: number) => void;
254
252
  export const wasmbip32_to_wif: (a: number, b: number) => void;
255
- export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
256
- export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
257
- export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
258
- export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
259
- export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
260
- export const wasmecpair_private_key: (a: number) => number;
261
- export const wasmecpair_public_key: (a: number) => number;
262
- export const wasmecpair_to_wif: (a: number, b: number) => void;
263
- export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
264
- export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
265
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
266
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
267
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
253
+ export const wasmdimensions_empty: () => number;
254
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
255
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
256
+ export const wasmdimensions_from_output_script_length: (a: number) => number;
257
+ export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
258
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
259
+ export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
260
+ export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
261
+ export const wasmdimensions_get_output_vsize: (a: number) => number;
262
+ export const wasmdimensions_get_output_weight: (a: number) => number;
263
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
264
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
265
+ export const wasmdimensions_has_segwit: (a: number) => number;
266
+ export const wasmdimensions_plus: (a: number, b: number) => number;
267
+ export const wasmdimensions_times: (a: number, b: number) => number;
268
268
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
269
269
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
270
270
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
271
271
  export const wasmrootwalletkeys_user_key: (a: number) => number;
272
272
  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;
273
+ export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
274
+ export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
273
275
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
276
+ export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
274
277
  export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
275
278
  export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
276
279
  export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
277
- export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
278
280
  export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
279
281
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
280
282
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitgo/wasm-utxo",
3
3
  "description": "WebAssembly wrapper for rust-bitcoin (beta)",
4
- "version": "4.16.0",
4
+ "version": "4.17.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",