@bitgo/wasm-utxo 4.41.0 → 5.1.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.
Files changed (42) hide show
  1. package/dist/cjs/js/address.d.ts +3 -7
  2. package/dist/cjs/js/address.js +4 -8
  3. package/dist/cjs/js/descriptorWallet/psbt/findDescriptors.js +16 -12
  4. package/dist/cjs/js/fixedScriptWallet/Dimensions.d.ts +5 -16
  5. package/dist/cjs/js/fixedScriptWallet/Dimensions.js +2 -2
  6. package/dist/cjs/js/fixedScriptWallet/ZcashDimensions.d.ts +45 -0
  7. package/dist/cjs/js/fixedScriptWallet/ZcashDimensions.js +30 -0
  8. package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.d.ts +16 -0
  9. package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.js +20 -0
  10. package/dist/cjs/js/index.d.ts +18 -0
  11. package/dist/cjs/js/index.js +4 -1
  12. package/dist/cjs/js/psbt.d.ts +2 -1
  13. package/dist/cjs/js/psbtBase.d.ts +3 -1
  14. package/dist/cjs/js/psbtBase.js +3 -0
  15. package/dist/cjs/js/wasm/wasm_utxo.d.ts +55 -5
  16. package/dist/cjs/js/wasm/wasm_utxo.js +174 -7
  17. package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
  18. package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +93 -85
  19. package/dist/cjs/js/zcashAddress.d.ts +44 -0
  20. package/dist/cjs/js/zcashAddress.js +58 -0
  21. package/dist/esm/js/address.d.ts +3 -7
  22. package/dist/esm/js/address.js +4 -8
  23. package/dist/esm/js/descriptorWallet/psbt/findDescriptors.js +16 -12
  24. package/dist/esm/js/fixedScriptWallet/Dimensions.d.ts +5 -16
  25. package/dist/esm/js/fixedScriptWallet/Dimensions.js +2 -2
  26. package/dist/esm/js/fixedScriptWallet/ZcashDimensions.d.ts +45 -0
  27. package/dist/esm/js/fixedScriptWallet/ZcashDimensions.js +26 -0
  28. package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.d.ts +16 -0
  29. package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.js +20 -0
  30. package/dist/esm/js/index.d.ts +18 -0
  31. package/dist/esm/js/index.js +2 -0
  32. package/dist/esm/js/psbt.d.ts +2 -1
  33. package/dist/esm/js/psbtBase.d.ts +3 -1
  34. package/dist/esm/js/psbtBase.js +3 -0
  35. package/dist/esm/js/wasm/wasm_utxo.d.ts +55 -5
  36. package/dist/esm/js/wasm/wasm_utxo.js +1 -1
  37. package/dist/esm/js/wasm/wasm_utxo_bg.js +170 -7
  38. package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
  39. package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +93 -85
  40. package/dist/esm/js/zcashAddress.d.ts +44 -0
  41. package/dist/esm/js/zcashAddress.js +52 -0
  42. package/package.json +1 -1
@@ -46,23 +46,19 @@ export class AddressNamespace {
46
46
  }
47
47
  }
48
48
  /**
49
- * `can_be_shielded_output`: when set and `address` is a ZIP-316 unified address carrying an
50
- * Orchard/Ironwood receiver, returns that raw 43-byte receiver instead of a transparent
51
- * scriptPubKey. See [`to_output_script_or_shielded_receiver_with_coin`] for the exact
52
- * fallback/error rules.
49
+ * Convert `address` to its scriptPubKey bytes for `coin`.
53
50
  * @param {string} address
54
51
  * @param {string} coin
55
- * @param {boolean | null} [can_be_shielded_output]
56
52
  * @returns {Uint8Array}
57
53
  */
58
- static to_output_script_with_coin(address, coin, can_be_shielded_output) {
54
+ static to_output_script_with_coin(address, coin) {
59
55
  try {
60
56
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
61
57
  const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
62
58
  const len0 = WASM_VECTOR_LEN;
63
59
  const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
64
60
  const len1 = WASM_VECTOR_LEN;
65
- wasm.addressnamespace_to_output_script_with_coin(retptr, ptr0, len0, ptr1, len1, isLikeNone(can_be_shielded_output) ? 0xFFFFFF : can_be_shielded_output ? 1 : 0);
61
+ wasm.addressnamespace_to_output_script_with_coin(retptr, ptr0, len0, ptr1, len1);
66
62
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
67
63
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
68
64
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1691,6 +1687,25 @@ export class BitGoPsbt {
1691
1687
  const ret = wasm.bitgopsbt_get_global_xpubs(this.__wbg_ptr);
1692
1688
  return takeObject(ret);
1693
1689
  }
1690
+ /**
1691
+ * @param {number} index
1692
+ * @returns {any}
1693
+ */
1694
+ get_input_key_values(index) {
1695
+ try {
1696
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1697
+ wasm.bitgopsbt_get_input_key_values(retptr, this.__wbg_ptr, index);
1698
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1699
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1700
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1701
+ if (r2) {
1702
+ throw takeObject(r1);
1703
+ }
1704
+ return takeObject(r0);
1705
+ } finally {
1706
+ wasm.__wbindgen_add_to_stack_pointer(16);
1707
+ }
1708
+ }
1694
1709
  /**
1695
1710
  * @param {number} index
1696
1711
  * @param {any} key
@@ -6088,6 +6103,25 @@ export class WrapPsbt {
6088
6103
  const ret = wasm.wrappsbt_get_global_xpubs(this.__wbg_ptr);
6089
6104
  return takeObject(ret);
6090
6105
  }
6106
+ /**
6107
+ * @param {number} index
6108
+ * @returns {any}
6109
+ */
6110
+ get_input_key_values(index) {
6111
+ try {
6112
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6113
+ wasm.wrappsbt_get_input_key_values(retptr, this.__wbg_ptr, index);
6114
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6115
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6116
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6117
+ if (r2) {
6118
+ throw takeObject(r1);
6119
+ }
6120
+ return takeObject(r0);
6121
+ } finally {
6122
+ wasm.__wbindgen_add_to_stack_pointer(16);
6123
+ }
6124
+ }
6091
6125
  /**
6092
6126
  * @param {number} index
6093
6127
  * @param {any} key
@@ -6796,6 +6830,28 @@ export class ZcashUnifiedAddress {
6796
6830
  wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
6797
6831
  }
6798
6832
  }
6833
+ /**
6834
+ * Whether this Unified Address carries an Orchard/Ironwood receiver.
6835
+ *
6836
+ * Equivalent to `orchardReceiver !== undefined`, without cloning the receiver bytes
6837
+ * when the caller only needs presence.
6838
+ * @returns {boolean}
6839
+ */
6840
+ get hasOrchardReceiver() {
6841
+ const ret = wasm.zcashunifiedaddress_hasOrchardReceiver(this.__wbg_ptr);
6842
+ return ret !== 0;
6843
+ }
6844
+ /**
6845
+ * Whether this Unified Address carries a transparent (P2PKH/P2SH) receiver.
6846
+ *
6847
+ * Equivalent to `transparentScript !== undefined`, without cloning the script bytes
6848
+ * when the caller only needs presence.
6849
+ * @returns {boolean}
6850
+ */
6851
+ get hasTransparentReceiver() {
6852
+ const ret = wasm.zcashunifiedaddress_hasTransparentReceiver(this.__wbg_ptr);
6853
+ return ret !== 0;
6854
+ }
6799
6855
  /**
6800
6856
  * The Orchard/Ironwood receiver's raw 43 bytes (diversifier + pk_d), or `undefined`.
6801
6857
  * @returns {Uint8Array | undefined}
@@ -7301,6 +7357,113 @@ export function parseTxToJson(tx_bytes, coin_name) {
7301
7357
  }
7302
7358
  }
7303
7359
 
7360
+ /**
7361
+ * Whether `address` is a ZIP-316 unified address for `coin`'s network carrying an
7362
+ * Orchard/Ironwood receiver. `false` (never throws) for a malformed/wrong-network unified
7363
+ * address, an ordinary address, or a UA with no Orchard/Ironwood receiver.
7364
+ * @param {string} address
7365
+ * @param {string} coin
7366
+ * @returns {boolean}
7367
+ */
7368
+ export function zcashHasOrchardReceiver(address, coin) {
7369
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7370
+ const len0 = WASM_VECTOR_LEN;
7371
+ const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7372
+ const len1 = WASM_VECTOR_LEN;
7373
+ const ret = wasm.zcashHasOrchardReceiver(ptr0, len0, ptr1, len1);
7374
+ return ret !== 0;
7375
+ }
7376
+
7377
+ /**
7378
+ * Whether `address` has a usable transparent receiver for `coin`'s network: either it's a
7379
+ * unified address carrying a transparent receiver, or it's itself a valid transparent address
7380
+ * for `coin`. `false` (never throws) otherwise.
7381
+ * @param {string} address
7382
+ * @param {string} coin
7383
+ * @returns {boolean}
7384
+ */
7385
+ export function zcashHasTransparentReceiver(address, coin) {
7386
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7387
+ const len0 = WASM_VECTOR_LEN;
7388
+ const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7389
+ const len1 = WASM_VECTOR_LEN;
7390
+ const ret = wasm.zcashHasTransparentReceiver(ptr0, len0, ptr1, len1);
7391
+ return ret !== 0;
7392
+ }
7393
+
7394
+ /**
7395
+ * @param {string} address
7396
+ * @param {string} coin
7397
+ * @returns {Uint8Array}
7398
+ */
7399
+ export function zcashToShieldedReceiverWithCoin(address, coin) {
7400
+ try {
7401
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
7402
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7403
+ const len0 = WASM_VECTOR_LEN;
7404
+ const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7405
+ const len1 = WASM_VECTOR_LEN;
7406
+ wasm.zcashToShieldedReceiverWithCoin(retptr, ptr0, len0, ptr1, len1);
7407
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
7408
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
7409
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
7410
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
7411
+ if (r3) {
7412
+ throw takeObject(r2);
7413
+ }
7414
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
7415
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
7416
+ return v3;
7417
+ } finally {
7418
+ wasm.__wbindgen_add_to_stack_pointer(16);
7419
+ }
7420
+ }
7421
+
7422
+ /**
7423
+ * Resolve the Orchard/Ironwood receiver of a ZIP-316 unified address for `coin`'s network, as
7424
+ * its raw 43 bytes (diversifier + `pk_d`) — there is no scriptPubKey for a shielded output, so
7425
+ * this can't return script bytes uniformly and returns raw receiver bytes instead.
7426
+ *
7427
+ * A UA that has no Orchard/Ironwood receiver (e.g. Sapling-only) throws rather than falling back
7428
+ * to the transparent receiver. If `address` merely looks like a unified address for this coin's
7429
+ * network (right Bech32m HRP) but is malformed, this also throws. `address` must be a unified
7430
+ * address — an ordinary transparent address is rejected, since it can never carry a shielded
7431
+ * receiver; use {@link toOutputScriptWithCoin} in `js/address.ts` for the transparent case.
7432
+ * Resolve the transparent receiver of an `address` for `coin`'s network, as its scriptPubKey
7433
+ * bytes. When `address` is a ZIP-316 unified address, resolves its transparent receiver rather
7434
+ * than rejecting the UA string outright — a UA with no transparent receiver (e.g. Orchard-only)
7435
+ * throws rather than falling back to a shielded one. An ordinary (non-UA) address falls through
7436
+ * to the same transparent codec path as any other coin.
7437
+ *
7438
+ * This is the zcash-aware counterpart of `toOutputScriptWithCoin` in `js/address.ts`, which
7439
+ * dispatches here for zcash/tzec so that non-zcash coins never pay for a unified-address check.
7440
+ * @param {string} address
7441
+ * @param {string} coin
7442
+ * @returns {Uint8Array}
7443
+ */
7444
+ export function zcashToTransparentReceiverWithCoin(address, coin) {
7445
+ try {
7446
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
7447
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7448
+ const len0 = WASM_VECTOR_LEN;
7449
+ const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7450
+ const len1 = WASM_VECTOR_LEN;
7451
+ wasm.zcashToTransparentReceiverWithCoin(retptr, ptr0, len0, ptr1, len1);
7452
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
7453
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
7454
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
7455
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
7456
+ if (r3) {
7457
+ throw takeObject(r2);
7458
+ }
7459
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
7460
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
7461
+ return v3;
7462
+ } finally {
7463
+ wasm.__wbindgen_add_to_stack_pointer(16);
7464
+ }
7465
+ }
7466
+
7304
7467
  /**
7305
7468
  * Return the Zcash consensus branch ID active at `height` on `network`.
7306
7469
  *
Binary file
@@ -1,18 +1,57 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const __wbg_bip322namespace_free: (a: number, b: number) => void;
5
- 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;
6
- export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
7
- 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;
8
- 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;
9
- 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;
10
- 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;
11
- export const __wbg_ironwoodwitness_free: (a: number, b: number) => void;
4
+ export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
5
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
6
+ export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
7
+ export const wrapdescriptor_descType: (a: number, b: number) => void;
8
+ export const wrapdescriptor_encode: (a: number, b: number) => void;
9
+ export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
10
+ export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
11
+ export const wrapdescriptor_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
12
+ export const wrapdescriptor_hasWildcard: (a: number) => number;
13
+ export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
14
+ export const wrapdescriptor_node: (a: number, b: number) => void;
15
+ export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
16
+ export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
17
+ export const wrapdescriptor_toString: (a: number, b: number) => void;
18
+ export const wrapminiscript_encode: (a: number, b: number) => void;
19
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
20
+ export const wrapminiscript_fromBitcoinScriptExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
21
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
22
+ export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
23
+ export const wrapminiscript_node: (a: number, b: number) => void;
24
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
25
+ export const wrapminiscript_toString: (a: number, b: number) => void;
26
+ export const __wbg_addressnamespace_free: (a: number, b: number) => void;
12
27
  export const __wbg_messagenamespace_free: (a: number, b: number) => void;
13
- export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
28
+ export const __wbg_wasmecpair_free: (a: number, b: number) => void;
14
29
  export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
30
+ export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
31
+ export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
32
+ export const isInspectEnabled: () => number;
33
+ export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
34
+ export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
35
+ export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
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;
49
+ export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
50
+ export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
51
+ export const __wbg_ironwoodwitness_free: (a: number, b: number) => void;
52
+ export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
15
53
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
54
+ export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
16
55
  export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
17
56
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
18
57
  export const __wbg_zcashunifiedaddress_free: (a: number, b: number) => void;
@@ -20,8 +59,6 @@ export const __wbg_zcashv6transaction_free: (a: number, b: number) => void;
20
59
  export const ironwood_build_witness: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
21
60
  export const ironwoodwitness_auth_path: (a: number, b: number) => void;
22
61
  export const ironwoodwitness_position: (a: number) => number;
23
- export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
24
- export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
25
62
  export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
26
63
  export const wasmdashtransaction_get_inputs: (a: number, b: number) => void;
27
64
  export const wasmdashtransaction_get_outputs: (a: number, b: number) => void;
@@ -32,9 +69,6 @@ export const wasmdashtransaction_lock_time: (a: number) => number;
32
69
  export const wasmdashtransaction_output_count: (a: number) => number;
33
70
  export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
34
71
  export const wasmdashtransaction_version: (a: number) => number;
35
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
36
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
37
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
38
72
  export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
39
73
  export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
40
74
  export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
@@ -47,6 +81,7 @@ export const wasmtransaction_get_outputs_with_address: (a: number, b: number, c:
47
81
  export const wasmtransaction_get_txid: (a: number, b: number) => void;
48
82
  export const wasmtransaction_get_vsize: (a: number) => number;
49
83
  export const wasmtransaction_to_bytes: (a: number, b: number) => void;
84
+ export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
50
85
  export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
51
86
  export const wasmzcashtransaction_get_inputs: (a: number, b: number) => void;
52
87
  export const wasmzcashtransaction_get_outputs: (a: number, b: number) => void;
@@ -69,6 +104,7 @@ export const wrappsbt_finalize_input: (a: number, b: number, c: number) => void;
69
104
  export const wrappsbt_finalize_mut: (a: number, b: number) => void;
70
105
  export const wrappsbt_finalize_mut_zcash: (a: number, b: number, c: number, d: number, e: number) => void;
71
106
  export const wrappsbt_get_global_xpubs: (a: number) => number;
107
+ export const wrappsbt_get_input_key_values: (a: number, b: number, c: number) => void;
72
108
  export const wrappsbt_get_input_kv: (a: number, b: number, c: number, d: number) => void;
73
109
  export const wrappsbt_get_inputs: (a: number, b: number) => void;
74
110
  export const wrappsbt_get_kv: (a: number, b: number, c: number) => void;
@@ -98,10 +134,16 @@ export const wrappsbt_update_input_with_descriptor: (a: number, b: number, c: nu
98
134
  export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: number, d: number) => void;
99
135
  export const wrappsbt_validate_signature_at_input: (a: number, b: number, c: number, d: number, e: number) => void;
100
136
  export const wrappsbt_verify_signature_with_key: (a: number, b: number, c: number, d: number) => void;
137
+ export const zcashHasOrchardReceiver: (a: number, b: number, c: number, d: number) => number;
138
+ export const zcashHasTransparentReceiver: (a: number, b: number, c: number, d: number) => number;
139
+ export const zcashToShieldedReceiverWithCoin: (a: number, b: number, c: number, d: number, e: number) => void;
140
+ export const zcashToTransparentReceiverWithCoin: (a: number, b: number, c: number, d: number, e: number) => void;
101
141
  export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
102
142
  export const zcash_ironwood_version_group_id: () => number;
103
143
  export const zcashunifiedaddress_contains: (a: number, b: number, c: number, d: number) => void;
104
144
  export const zcashunifiedaddress_encodeOrchardReceiver: (a: number, b: number, c: number, d: number, e: number) => void;
145
+ export const zcashunifiedaddress_hasOrchardReceiver: (a: number) => number;
146
+ export const zcashunifiedaddress_hasTransparentReceiver: (a: number) => number;
105
147
  export const zcashunifiedaddress_orchardReceiver: (a: number, b: number) => void;
106
148
  export const zcashunifiedaddress_parse: (a: number, b: number, c: number, d: number, e: number) => void;
107
149
  export const zcashunifiedaddress_saplingReceiver: (a: number, b: number) => void;
@@ -127,36 +169,42 @@ export const wasmzcashtransaction_lock_time: (a: number) => number;
127
169
  export const wasmzcashtransaction_version: (a: number) => number;
128
170
  export const wrappsbt_lock_time: (a: number) => number;
129
171
  export const wrappsbt_version: (a: number) => number;
130
- export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
131
- export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
132
- export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
133
- export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
134
- 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;
135
- export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
136
- export const wrapdescriptor_descType: (a: number, b: number) => void;
137
- export const wrapdescriptor_encode: (a: number, b: number) => void;
138
- export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
139
- export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
140
- export const wrapdescriptor_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
141
- export const wrapdescriptor_hasWildcard: (a: number) => number;
142
- export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
143
- export const wrapdescriptor_node: (a: number, b: number) => void;
144
- export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
145
- export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
146
- export const wrapdescriptor_toString: (a: number, b: number) => void;
147
- export const wrapminiscript_encode: (a: number, b: number) => void;
148
- export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
149
- export const wrapminiscript_fromBitcoinScriptExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
150
- export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
151
- export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
152
- export const wrapminiscript_node: (a: number, b: number) => void;
153
- export const wrapminiscript_toAsmString: (a: number, b: number) => void;
154
- export const wrapminiscript_toString: (a: number, b: number) => void;
172
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
173
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
174
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
175
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
176
+ export const wasmdimensions_empty: () => number;
177
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
178
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
179
+ export const wasmdimensions_from_output_script_length: (a: number) => number;
180
+ export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
181
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
182
+ export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
183
+ export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
184
+ export const wasmdimensions_get_output_vsize: (a: number) => number;
185
+ export const wasmdimensions_get_output_weight: (a: number) => number;
186
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
187
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
188
+ export const wasmdimensions_has_segwit: (a: number) => number;
189
+ export const wasmdimensions_plus: (a: number, b: number) => number;
190
+ export const wasmdimensions_times: (a: number, b: number) => number;
191
+ export const __wbg_bip322namespace_free: (a: number, b: number) => void;
192
+ export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
193
+ 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;
194
+ export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
195
+ 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;
196
+ 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;
197
+ 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;
198
+ 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;
199
+ export const wasmrootwalletkeys_backup_key: (a: number) => number;
200
+ export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
201
+ export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
202
+ export const wasmrootwalletkeys_user_key: (a: number) => number;
203
+ 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;
155
204
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
156
205
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
206
+ export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
157
207
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
158
- export const __wbg_wasmecpair_free: (a: number, b: number) => void;
159
- export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
160
208
  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;
161
209
  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;
162
210
  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, l: number, m: number) => void;
@@ -202,6 +250,7 @@ export const bitgopsbt_from_network_format_zcash_with_block_height: (a: number,
202
250
  export const bitgopsbt_from_network_format_zcash_with_branch_id: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
203
251
  export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
204
252
  export const bitgopsbt_get_global_xpubs: (a: number) => number;
253
+ export const bitgopsbt_get_input_key_values: (a: number, b: number, c: number) => void;
205
254
  export const bitgopsbt_get_input_kv: (a: number, b: number, c: number, d: number) => void;
206
255
  export const bitgopsbt_get_inputs: (a: number, b: number) => void;
207
256
  export const bitgopsbt_get_kv: (a: number, b: number, c: number) => void;
@@ -253,6 +302,8 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
253
302
  export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
254
303
  export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
255
304
  export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
305
+ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
306
+ 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;
256
307
  export const wasmbip32_chain_code: (a: number) => number;
257
308
  export const wasmbip32_depth: (a: number) => number;
258
309
  export const wasmbip32_derive: (a: number, b: number, c: number) => void;
@@ -275,53 +326,10 @@ export const wasmbip32_private_key: (a: number) => number;
275
326
  export const wasmbip32_public_key: (a: number) => number;
276
327
  export const wasmbip32_to_base58: (a: number, b: number) => void;
277
328
  export const wasmbip32_to_wif: (a: number, b: number) => void;
278
- export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
279
- export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
280
- export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
281
- export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
282
- export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
283
- export const wasmecpair_private_key: (a: number) => number;
284
- export const wasmecpair_public_key: (a: number) => number;
285
- export const wasmecpair_to_wif: (a: number, b: number) => void;
286
- export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
287
- export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
288
- export const wasmrootwalletkeys_backup_key: (a: number) => number;
289
- export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
290
- export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
291
- export const wasmrootwalletkeys_user_key: (a: number) => number;
292
- 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;
293
329
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
330
+ export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
294
331
  export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
295
332
  export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
296
- export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
297
- export const __wbg_addressnamespace_free: (a: number, b: number) => void;
298
- export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
299
- export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
300
- export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
301
- export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
302
- export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
303
- export const isInspectEnabled: () => number;
304
- export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
305
- export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
306
- export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
307
- export const wasmdimensions_empty: () => number;
308
- export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
309
- export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
310
- export const wasmdimensions_from_output_script_length: (a: number) => number;
311
- export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
312
- export const wasmdimensions_from_psbt: (a: number, b: number) => void;
313
- export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
314
- export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
315
- export const wasmdimensions_get_output_vsize: (a: number) => number;
316
- export const wasmdimensions_get_output_weight: (a: number) => number;
317
- export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
318
- export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
319
- export const wasmdimensions_has_segwit: (a: number) => number;
320
- export const wasmdimensions_plus: (a: number, b: number) => number;
321
- export const wasmdimensions_times: (a: number, b: number) => number;
322
- export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
323
- export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
324
- export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
325
333
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
326
334
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
327
335
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -0,0 +1,44 @@
1
+ import type { CoinName } from "./coinName.js";
2
+ /**
3
+ * Convert `address` to its scriptPubKey bytes for `coin`'s network. When `address` is a ZIP-316
4
+ * unified address, resolves its transparent receiver -- same as any other transparent address --
5
+ * rather than rejecting the UA string outright. A UA with no transparent receiver (e.g.
6
+ * Orchard-only) throws rather than falling back to a shielded one.
7
+ *
8
+ * `js/address.ts`'s `toOutputScriptWithCoin` dispatches here for zcash/tzec; call this directly
9
+ * only if you already know `coin` is a Zcash coin.
10
+ */
11
+ export declare function toTransparentReceiverWithCoin(address: string, coin: CoinName): Uint8Array;
12
+ /**
13
+ * Resolve the Orchard/Ironwood receiver of a ZIP-316 unified address for `coin`'s network, as its
14
+ * raw 43 bytes (diversifier + `pk_d`) -- there is no scriptPubKey for a shielded output, so this
15
+ * returns raw receiver bytes rather than a scriptPubKey.
16
+ *
17
+ * `address` must be a unified address; an ordinary transparent address is rejected, since it can
18
+ * never carry a shielded receiver. A UA that has no Orchard/Ironwood receiver (e.g. Sapling-only)
19
+ * throws rather than falling back to the transparent receiver. If `address` merely looks like a
20
+ * unified address for this coin's network (right Bech32m HRP) but is malformed, this also throws.
21
+ * Use {@link toOutputScriptWithCoin} from `js/address.ts` for the transparent case.
22
+ */
23
+ export declare function toShieldedReceiverWithCoin(address: string, coin: CoinName): Uint8Array;
24
+ /**
25
+ * Whether `address` is a ZIP-316 unified address for `coin`'s network carrying an
26
+ * Orchard/Ironwood receiver.
27
+ *
28
+ * A plain membership check, not a decoder: never throws. Returns `false` for a malformed or
29
+ * wrong-network unified address, an ordinary (non-UA) address, or a UA with no Orchard/Ironwood
30
+ * receiver (e.g. Sapling-only). Use {@link toShieldedReceiverWithCoin} when the raw receiver bytes
31
+ * are needed.
32
+ */
33
+ export declare function hasOrchardReceiver(address: string, coin: CoinName): boolean;
34
+ /**
35
+ * Whether `address` has a usable transparent receiver for `coin`'s network: either `address` is
36
+ * a ZIP-316 unified address carrying a transparent receiver, or `address` is itself an ordinary
37
+ * transparent address that decodes for `coin`.
38
+ *
39
+ * A plain membership check, not a decoder: never throws. Returns `false` for a malformed or
40
+ * wrong-network unified address, a UA with no transparent receiver (e.g. Orchard-only), or an
41
+ * address that is neither a unified address nor a valid transparent address for `coin`. Use
42
+ * {@link toOutputScriptWithCoin} from `js/address.ts` when the scriptPubKey bytes are needed.
43
+ */
44
+ export declare function hasTransparentReceiver(address: string, coin: CoinName): boolean;
@@ -0,0 +1,52 @@
1
+ import { zcashHasOrchardReceiver, zcashHasTransparentReceiver, zcashToShieldedReceiverWithCoin, zcashToTransparentReceiverWithCoin, } from "./wasm/wasm_utxo.js";
2
+ /**
3
+ * Convert `address` to its scriptPubKey bytes for `coin`'s network. When `address` is a ZIP-316
4
+ * unified address, resolves its transparent receiver -- same as any other transparent address --
5
+ * rather than rejecting the UA string outright. A UA with no transparent receiver (e.g.
6
+ * Orchard-only) throws rather than falling back to a shielded one.
7
+ *
8
+ * `js/address.ts`'s `toOutputScriptWithCoin` dispatches here for zcash/tzec; call this directly
9
+ * only if you already know `coin` is a Zcash coin.
10
+ */
11
+ export function toTransparentReceiverWithCoin(address, coin) {
12
+ return zcashToTransparentReceiverWithCoin(address, coin);
13
+ }
14
+ /**
15
+ * Resolve the Orchard/Ironwood receiver of a ZIP-316 unified address for `coin`'s network, as its
16
+ * raw 43 bytes (diversifier + `pk_d`) -- there is no scriptPubKey for a shielded output, so this
17
+ * returns raw receiver bytes rather than a scriptPubKey.
18
+ *
19
+ * `address` must be a unified address; an ordinary transparent address is rejected, since it can
20
+ * never carry a shielded receiver. A UA that has no Orchard/Ironwood receiver (e.g. Sapling-only)
21
+ * throws rather than falling back to the transparent receiver. If `address` merely looks like a
22
+ * unified address for this coin's network (right Bech32m HRP) but is malformed, this also throws.
23
+ * Use {@link toOutputScriptWithCoin} from `js/address.ts` for the transparent case.
24
+ */
25
+ export function toShieldedReceiverWithCoin(address, coin) {
26
+ return zcashToShieldedReceiverWithCoin(address, coin);
27
+ }
28
+ /**
29
+ * Whether `address` is a ZIP-316 unified address for `coin`'s network carrying an
30
+ * Orchard/Ironwood receiver.
31
+ *
32
+ * A plain membership check, not a decoder: never throws. Returns `false` for a malformed or
33
+ * wrong-network unified address, an ordinary (non-UA) address, or a UA with no Orchard/Ironwood
34
+ * receiver (e.g. Sapling-only). Use {@link toShieldedReceiverWithCoin} when the raw receiver bytes
35
+ * are needed.
36
+ */
37
+ export function hasOrchardReceiver(address, coin) {
38
+ return zcashHasOrchardReceiver(address, coin);
39
+ }
40
+ /**
41
+ * Whether `address` has a usable transparent receiver for `coin`'s network: either `address` is
42
+ * a ZIP-316 unified address carrying a transparent receiver, or `address` is itself an ordinary
43
+ * transparent address that decodes for `coin`.
44
+ *
45
+ * A plain membership check, not a decoder: never throws. Returns `false` for a malformed or
46
+ * wrong-network unified address, a UA with no transparent receiver (e.g. Orchard-only), or an
47
+ * address that is neither a unified address nor a valid transparent address for `coin`. Use
48
+ * {@link toOutputScriptWithCoin} from `js/address.ts` when the scriptPubKey bytes are needed.
49
+ */
50
+ export function hasTransparentReceiver(address, coin) {
51
+ return zcashHasTransparentReceiver(address, coin);
52
+ }
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.41.0",
4
+ "version": "5.1.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",