@bitgo/wasm-utxo 4.41.0 → 5.0.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 (34) 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/fixedScriptWallet/Dimensions.d.ts +5 -16
  4. package/dist/cjs/js/fixedScriptWallet/Dimensions.js +2 -2
  5. package/dist/cjs/js/fixedScriptWallet/ZcashDimensions.d.ts +45 -0
  6. package/dist/cjs/js/fixedScriptWallet/ZcashDimensions.js +30 -0
  7. package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.d.ts +16 -0
  8. package/dist/cjs/js/fixedScriptWallet/ZcashUnifiedAddress.js +20 -0
  9. package/dist/cjs/js/index.d.ts +2 -0
  10. package/dist/cjs/js/index.js +4 -1
  11. package/dist/cjs/js/wasm/wasm_utxo.d.ts +53 -5
  12. package/dist/cjs/js/wasm/wasm_utxo.js +136 -7
  13. package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
  14. package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +80 -74
  15. package/dist/cjs/js/zcashAddress.d.ts +44 -0
  16. package/dist/cjs/js/zcashAddress.js +58 -0
  17. package/dist/esm/js/address.d.ts +3 -7
  18. package/dist/esm/js/address.js +4 -8
  19. package/dist/esm/js/fixedScriptWallet/Dimensions.d.ts +5 -16
  20. package/dist/esm/js/fixedScriptWallet/Dimensions.js +2 -2
  21. package/dist/esm/js/fixedScriptWallet/ZcashDimensions.d.ts +45 -0
  22. package/dist/esm/js/fixedScriptWallet/ZcashDimensions.js +26 -0
  23. package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.d.ts +16 -0
  24. package/dist/esm/js/fixedScriptWallet/ZcashUnifiedAddress.js +20 -0
  25. package/dist/esm/js/index.d.ts +2 -0
  26. package/dist/esm/js/index.js +2 -0
  27. package/dist/esm/js/wasm/wasm_utxo.d.ts +53 -5
  28. package/dist/esm/js/wasm/wasm_utxo.js +1 -1
  29. package/dist/esm/js/wasm/wasm_utxo_bg.js +132 -7
  30. package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
  31. package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +80 -74
  32. package/dist/esm/js/zcashAddress.d.ts +44 -0
  33. package/dist/esm/js/zcashAddress.js +52 -0
  34. package/package.json +1 -1
@@ -7,12 +7,9 @@ export class AddressNamespace {
7
7
  [Symbol.dispose](): void;
8
8
  static from_output_script_with_coin(script: Uint8Array, coin: string, format?: string | null): string;
9
9
  /**
10
- * `can_be_shielded_output`: when set and `address` is a ZIP-316 unified address carrying an
11
- * Orchard/Ironwood receiver, returns that raw 43-byte receiver instead of a transparent
12
- * scriptPubKey. See [`to_output_script_or_shielded_receiver_with_coin`] for the exact
13
- * fallback/error rules.
10
+ * Convert `address` to its scriptPubKey bytes for `coin`.
14
11
  */
15
- static to_output_script_with_coin(address: string, coin: string, can_be_shielded_output?: boolean | null): Uint8Array;
12
+ static to_output_script_with_coin(address: string, coin: string): Uint8Array;
16
13
  }
17
14
 
18
15
  /**
@@ -1798,6 +1795,20 @@ export class ZcashUnifiedAddress {
1798
1795
  * below are infallible. Throws if the address is malformed or on the wrong network.
1799
1796
  */
1800
1797
  static parse(address: string, network: string): ZcashUnifiedAddress;
1798
+ /**
1799
+ * Whether this Unified Address carries an Orchard/Ironwood receiver.
1800
+ *
1801
+ * Equivalent to `orchardReceiver !== undefined`, without cloning the receiver bytes
1802
+ * when the caller only needs presence.
1803
+ */
1804
+ readonly hasOrchardReceiver: boolean;
1805
+ /**
1806
+ * Whether this Unified Address carries a transparent (P2PKH/P2SH) receiver.
1807
+ *
1808
+ * Equivalent to `transparentScript !== undefined`, without cloning the script bytes
1809
+ * when the caller only needs presence.
1810
+ */
1811
+ readonly hasTransparentReceiver: boolean;
1801
1812
  /**
1802
1813
  * The Orchard/Ironwood receiver's raw 43 bytes (diversifier + pk_d), or `undefined`.
1803
1814
  */
@@ -1966,6 +1977,43 @@ export function parsePsbtToJson(psbt_bytes: Uint8Array, coin_name: string): stri
1966
1977
  */
1967
1978
  export function parseTxToJson(tx_bytes: Uint8Array, coin_name: string): string;
1968
1979
 
1980
+ /**
1981
+ * Whether `address` is a ZIP-316 unified address for `coin`'s network carrying an
1982
+ * Orchard/Ironwood receiver. `false` (never throws) for a malformed/wrong-network unified
1983
+ * address, an ordinary address, or a UA with no Orchard/Ironwood receiver.
1984
+ */
1985
+ export function zcashHasOrchardReceiver(address: string, coin: string): boolean;
1986
+
1987
+ /**
1988
+ * Whether `address` has a usable transparent receiver for `coin`'s network: either it's a
1989
+ * unified address carrying a transparent receiver, or it's itself a valid transparent address
1990
+ * for `coin`. `false` (never throws) otherwise.
1991
+ */
1992
+ export function zcashHasTransparentReceiver(address: string, coin: string): boolean;
1993
+
1994
+ export function zcashToShieldedReceiverWithCoin(address: string, coin: string): Uint8Array;
1995
+
1996
+ /**
1997
+ * Resolve the Orchard/Ironwood receiver of a ZIP-316 unified address for `coin`'s network, as
1998
+ * its raw 43 bytes (diversifier + `pk_d`) — there is no scriptPubKey for a shielded output, so
1999
+ * this can't return script bytes uniformly and returns raw receiver bytes instead.
2000
+ *
2001
+ * A UA that has no Orchard/Ironwood receiver (e.g. Sapling-only) throws rather than falling back
2002
+ * to the transparent receiver. If `address` merely looks like a unified address for this coin's
2003
+ * network (right Bech32m HRP) but is malformed, this also throws. `address` must be a unified
2004
+ * address — an ordinary transparent address is rejected, since it can never carry a shielded
2005
+ * receiver; use {@link toOutputScriptWithCoin} in `js/address.ts` for the transparent case.
2006
+ * Resolve the transparent receiver of an `address` for `coin`'s network, as its scriptPubKey
2007
+ * bytes. When `address` is a ZIP-316 unified address, resolves its transparent receiver rather
2008
+ * than rejecting the UA string outright — a UA with no transparent receiver (e.g. Orchard-only)
2009
+ * throws rather than falling back to a shielded one. An ordinary (non-UA) address falls through
2010
+ * to the same transparent codec path as any other coin.
2011
+ *
2012
+ * This is the zcash-aware counterpart of `toOutputScriptWithCoin` in `js/address.ts`, which
2013
+ * dispatches here for zcash/tzec so that non-zcash coins never pay for a unified-address check.
2014
+ */
2015
+ export function zcashToTransparentReceiverWithCoin(address: string, coin: string): Uint8Array;
2016
+
1969
2017
  /**
1970
2018
  * Return the Zcash consensus branch ID active at `height` on `network`.
1971
2019
  *
@@ -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, IronwoodWitness, MessageNamespace, UtxolibCompatNamespace, WasmBIP32, WasmDashTransaction, WasmDimensions, WasmECPair, WasmReplayProtection, WasmRootWalletKeys, WasmTransaction, WasmUtxoNamespace, WasmZcashTransaction, WrapDescriptor, WrapMiniscript, WrapPsbt, ZcashUnifiedAddress, ZcashV6Transaction, ironwood_build_witness, isInspectEnabled, parsePsbtRawToJson, parsePsbtToJson, parseTxToJson, zcash_branch_id_for_height, zcash_ironwood_version_group_id
8
+ AddressNamespace, Bip322Namespace, BitGoPsbt, FixedScriptWalletNamespace, InscriptionsNamespace, IronwoodWitness, MessageNamespace, UtxolibCompatNamespace, WasmBIP32, WasmDashTransaction, WasmDimensions, WasmECPair, WasmReplayProtection, WasmRootWalletKeys, WasmTransaction, WasmUtxoNamespace, WasmZcashTransaction, WrapDescriptor, WrapMiniscript, WrapPsbt, ZcashUnifiedAddress, ZcashV6Transaction, ironwood_build_witness, isInspectEnabled, parsePsbtRawToJson, parsePsbtToJson, parseTxToJson, zcashHasOrchardReceiver, zcashHasTransparentReceiver, zcashToShieldedReceiverWithCoin, zcashToTransparentReceiverWithCoin, zcash_branch_id_for_height, zcash_ironwood_version_group_id
9
9
  } from "./wasm_utxo_bg.js";
@@ -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);
@@ -6796,6 +6792,28 @@ export class ZcashUnifiedAddress {
6796
6792
  wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
6797
6793
  }
6798
6794
  }
6795
+ /**
6796
+ * Whether this Unified Address carries an Orchard/Ironwood receiver.
6797
+ *
6798
+ * Equivalent to `orchardReceiver !== undefined`, without cloning the receiver bytes
6799
+ * when the caller only needs presence.
6800
+ * @returns {boolean}
6801
+ */
6802
+ get hasOrchardReceiver() {
6803
+ const ret = wasm.zcashunifiedaddress_hasOrchardReceiver(this.__wbg_ptr);
6804
+ return ret !== 0;
6805
+ }
6806
+ /**
6807
+ * Whether this Unified Address carries a transparent (P2PKH/P2SH) receiver.
6808
+ *
6809
+ * Equivalent to `transparentScript !== undefined`, without cloning the script bytes
6810
+ * when the caller only needs presence.
6811
+ * @returns {boolean}
6812
+ */
6813
+ get hasTransparentReceiver() {
6814
+ const ret = wasm.zcashunifiedaddress_hasTransparentReceiver(this.__wbg_ptr);
6815
+ return ret !== 0;
6816
+ }
6799
6817
  /**
6800
6818
  * The Orchard/Ironwood receiver's raw 43 bytes (diversifier + pk_d), or `undefined`.
6801
6819
  * @returns {Uint8Array | undefined}
@@ -7301,6 +7319,113 @@ export function parseTxToJson(tx_bytes, coin_name) {
7301
7319
  }
7302
7320
  }
7303
7321
 
7322
+ /**
7323
+ * Whether `address` is a ZIP-316 unified address for `coin`'s network carrying an
7324
+ * Orchard/Ironwood receiver. `false` (never throws) for a malformed/wrong-network unified
7325
+ * address, an ordinary address, or a UA with no Orchard/Ironwood receiver.
7326
+ * @param {string} address
7327
+ * @param {string} coin
7328
+ * @returns {boolean}
7329
+ */
7330
+ export function zcashHasOrchardReceiver(address, coin) {
7331
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7332
+ const len0 = WASM_VECTOR_LEN;
7333
+ const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7334
+ const len1 = WASM_VECTOR_LEN;
7335
+ const ret = wasm.zcashHasOrchardReceiver(ptr0, len0, ptr1, len1);
7336
+ return ret !== 0;
7337
+ }
7338
+
7339
+ /**
7340
+ * Whether `address` has a usable transparent receiver for `coin`'s network: either it's a
7341
+ * unified address carrying a transparent receiver, or it's itself a valid transparent address
7342
+ * for `coin`. `false` (never throws) otherwise.
7343
+ * @param {string} address
7344
+ * @param {string} coin
7345
+ * @returns {boolean}
7346
+ */
7347
+ export function zcashHasTransparentReceiver(address, coin) {
7348
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7349
+ const len0 = WASM_VECTOR_LEN;
7350
+ const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7351
+ const len1 = WASM_VECTOR_LEN;
7352
+ const ret = wasm.zcashHasTransparentReceiver(ptr0, len0, ptr1, len1);
7353
+ return ret !== 0;
7354
+ }
7355
+
7356
+ /**
7357
+ * @param {string} address
7358
+ * @param {string} coin
7359
+ * @returns {Uint8Array}
7360
+ */
7361
+ export function zcashToShieldedReceiverWithCoin(address, coin) {
7362
+ try {
7363
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
7364
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7365
+ const len0 = WASM_VECTOR_LEN;
7366
+ const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7367
+ const len1 = WASM_VECTOR_LEN;
7368
+ wasm.zcashToShieldedReceiverWithCoin(retptr, ptr0, len0, ptr1, len1);
7369
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
7370
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
7371
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
7372
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
7373
+ if (r3) {
7374
+ throw takeObject(r2);
7375
+ }
7376
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
7377
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
7378
+ return v3;
7379
+ } finally {
7380
+ wasm.__wbindgen_add_to_stack_pointer(16);
7381
+ }
7382
+ }
7383
+
7384
+ /**
7385
+ * Resolve the Orchard/Ironwood receiver of a ZIP-316 unified address for `coin`'s network, as
7386
+ * its raw 43 bytes (diversifier + `pk_d`) — there is no scriptPubKey for a shielded output, so
7387
+ * this can't return script bytes uniformly and returns raw receiver bytes instead.
7388
+ *
7389
+ * A UA that has no Orchard/Ironwood receiver (e.g. Sapling-only) throws rather than falling back
7390
+ * to the transparent receiver. If `address` merely looks like a unified address for this coin's
7391
+ * network (right Bech32m HRP) but is malformed, this also throws. `address` must be a unified
7392
+ * address — an ordinary transparent address is rejected, since it can never carry a shielded
7393
+ * receiver; use {@link toOutputScriptWithCoin} in `js/address.ts` for the transparent case.
7394
+ * Resolve the transparent receiver of an `address` for `coin`'s network, as its scriptPubKey
7395
+ * bytes. When `address` is a ZIP-316 unified address, resolves its transparent receiver rather
7396
+ * than rejecting the UA string outright — a UA with no transparent receiver (e.g. Orchard-only)
7397
+ * throws rather than falling back to a shielded one. An ordinary (non-UA) address falls through
7398
+ * to the same transparent codec path as any other coin.
7399
+ *
7400
+ * This is the zcash-aware counterpart of `toOutputScriptWithCoin` in `js/address.ts`, which
7401
+ * dispatches here for zcash/tzec so that non-zcash coins never pay for a unified-address check.
7402
+ * @param {string} address
7403
+ * @param {string} coin
7404
+ * @returns {Uint8Array}
7405
+ */
7406
+ export function zcashToTransparentReceiverWithCoin(address, coin) {
7407
+ try {
7408
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
7409
+ const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7410
+ const len0 = WASM_VECTOR_LEN;
7411
+ const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
7412
+ const len1 = WASM_VECTOR_LEN;
7413
+ wasm.zcashToTransparentReceiverWithCoin(retptr, ptr0, len0, ptr1, len1);
7414
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
7415
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
7416
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
7417
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
7418
+ if (r3) {
7419
+ throw takeObject(r2);
7420
+ }
7421
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
7422
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
7423
+ return v3;
7424
+ } finally {
7425
+ wasm.__wbindgen_add_to_stack_pointer(16);
7426
+ }
7427
+ }
7428
+
7304
7429
  /**
7305
7430
  * Return the Zcash consensus branch ID active at `height` on `network`.
7306
7431
  *
Binary file
@@ -1,15 +1,39 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
5
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
6
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
7
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
8
+ export const wasmdimensions_empty: () => number;
9
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
10
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
11
+ export const wasmdimensions_from_output_script_length: (a: number) => number;
12
+ export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
13
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
14
+ export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
15
+ export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
16
+ export const wasmdimensions_get_output_vsize: (a: number) => number;
17
+ export const wasmdimensions_get_output_weight: (a: number) => number;
18
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
19
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
20
+ export const wasmdimensions_has_segwit: (a: number) => number;
21
+ export const wasmdimensions_plus: (a: number, b: number) => number;
22
+ export const wasmdimensions_times: (a: number, b: number) => number;
4
23
  export const __wbg_bip322namespace_free: (a: number, b: number) => void;
24
+ export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
5
25
  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
26
  export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
7
27
  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
28
  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
29
  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
30
  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;
31
+ export const wasmrootwalletkeys_backup_key: (a: number) => number;
32
+ export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
33
+ export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
34
+ export const wasmrootwalletkeys_user_key: (a: number) => number;
35
+ 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;
11
36
  export const __wbg_ironwoodwitness_free: (a: number, b: number) => void;
12
- export const __wbg_messagenamespace_free: (a: number, b: number) => void;
13
37
  export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
14
38
  export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
15
39
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
@@ -20,8 +44,6 @@ export const __wbg_zcashv6transaction_free: (a: number, b: number) => void;
20
44
  export const ironwood_build_witness: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
21
45
  export const ironwoodwitness_auth_path: (a: number, b: number) => void;
22
46
  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
47
  export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
26
48
  export const wasmdashtransaction_get_inputs: (a: number, b: number) => void;
27
49
  export const wasmdashtransaction_get_outputs: (a: number, b: number) => void;
@@ -98,10 +120,16 @@ export const wrappsbt_update_input_with_descriptor: (a: number, b: number, c: nu
98
120
  export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: number, d: number) => void;
99
121
  export const wrappsbt_validate_signature_at_input: (a: number, b: number, c: number, d: number, e: number) => void;
100
122
  export const wrappsbt_verify_signature_with_key: (a: number, b: number, c: number, d: number) => void;
123
+ export const zcashHasOrchardReceiver: (a: number, b: number, c: number, d: number) => number;
124
+ export const zcashHasTransparentReceiver: (a: number, b: number, c: number, d: number) => number;
125
+ export const zcashToShieldedReceiverWithCoin: (a: number, b: number, c: number, d: number, e: number) => void;
126
+ export const zcashToTransparentReceiverWithCoin: (a: number, b: number, c: number, d: number, e: number) => void;
101
127
  export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
102
128
  export const zcash_ironwood_version_group_id: () => number;
103
129
  export const zcashunifiedaddress_contains: (a: number, b: number, c: number, d: number) => void;
104
130
  export const zcashunifiedaddress_encodeOrchardReceiver: (a: number, b: number, c: number, d: number, e: number) => void;
131
+ export const zcashunifiedaddress_hasOrchardReceiver: (a: number) => number;
132
+ export const zcashunifiedaddress_hasTransparentReceiver: (a: number) => number;
105
133
  export const zcashunifiedaddress_orchardReceiver: (a: number, b: number) => void;
106
134
  export const zcashunifiedaddress_parse: (a: number, b: number, c: number, d: number, e: number) => void;
107
135
  export const zcashunifiedaddress_saplingReceiver: (a: number, b: number) => void;
@@ -127,36 +155,33 @@ export const wasmzcashtransaction_lock_time: (a: number) => number;
127
155
  export const wasmzcashtransaction_version: (a: number) => number;
128
156
  export const wrappsbt_lock_time: (a: number) => number;
129
157
  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;
158
+ export const __wbg_addressnamespace_free: (a: number, b: number) => void;
159
+ export const __wbg_messagenamespace_free: (a: number, b: number) => void;
160
+ export const __wbg_wasmecpair_free: (a: number, b: number) => void;
161
+ export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
162
+ export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
163
+ export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
164
+ export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
165
+ export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
166
+ export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
167
+ export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
168
+ export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
169
+ export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
170
+ export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
171
+ export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
172
+ export const wasmecpair_private_key: (a: number) => number;
173
+ export const wasmecpair_public_key: (a: number) => number;
174
+ export const wasmecpair_to_wif: (a: number, b: number) => void;
175
+ export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
176
+ export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
177
+ export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
178
+ export const isInspectEnabled: () => number;
179
+ export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
180
+ export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
155
181
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
156
182
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
183
+ export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
157
184
  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
185
  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
186
  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
187
  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;
@@ -253,6 +278,8 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
253
278
  export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
254
279
  export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
255
280
  export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
281
+ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
282
+ 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
283
  export const wasmbip32_chain_code: (a: number) => number;
257
284
  export const wasmbip32_depth: (a: number) => number;
258
285
  export const wasmbip32_derive: (a: number, b: number, c: number) => void;
@@ -275,53 +302,32 @@ export const wasmbip32_private_key: (a: number) => number;
275
302
  export const wasmbip32_public_key: (a: number) => number;
276
303
  export const wasmbip32_to_base58: (a: number, b: number) => void;
277
304
  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
305
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
306
+ export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
294
307
  export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
295
308
  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;
309
+ export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
310
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
311
+ export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
312
+ export const wrapdescriptor_descType: (a: number, b: number) => void;
313
+ export const wrapdescriptor_encode: (a: number, b: number) => void;
314
+ export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
315
+ export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
316
+ export const wrapdescriptor_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
317
+ export const wrapdescriptor_hasWildcard: (a: number) => number;
318
+ export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
319
+ export const wrapdescriptor_node: (a: number, b: number) => void;
320
+ export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
321
+ export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
322
+ export const wrapdescriptor_toString: (a: number, b: number) => void;
323
+ export const wrapminiscript_encode: (a: number, b: number) => void;
324
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
325
+ export const wrapminiscript_fromBitcoinScriptExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
326
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
327
+ export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
328
+ export const wrapminiscript_node: (a: number, b: number) => void;
329
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
330
+ export const wrapminiscript_toString: (a: number, b: number) => void;
325
331
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
326
332
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
327
333
  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.0.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",