@bitgo/wasm-utxo 4.35.0 → 4.37.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.
@@ -4,5 +4,13 @@ import type { CoinName } from "./coinName.js";
4
4
  * For Bitcoin Cash and eCash, we can select between base58check and cashaddr.
5
5
  */
6
6
  export type AddressFormat = "default" | "cashaddr";
7
- export declare function toOutputScriptWithCoin(address: string, coin: CoinName): Uint8Array;
7
+ /**
8
+ * @param canBeShieldedOutput - When set and `address` is a ZIP-316 unified address carrying an
9
+ * Orchard/Ironwood receiver, returns that raw 43-byte receiver instead of a transparent
10
+ * scriptPubKey (there is no scriptPubKey for a shielded output). `address` is only even
11
+ * attempted as a unified address when this is set. If `address` looks like a unified address for
12
+ * this coin's network but is malformed, or has no Orchard/Ironwood receiver (e.g. Sapling-only),
13
+ * this throws rather than falling back to the transparent path.
14
+ */
15
+ export declare function toOutputScriptWithCoin(address: string, coin: CoinName, canBeShieldedOutput?: boolean): Uint8Array;
8
16
  export declare function fromOutputScriptWithCoin(script: Uint8Array, coin: CoinName, format?: AddressFormat): string;
@@ -3,8 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toOutputScriptWithCoin = toOutputScriptWithCoin;
4
4
  exports.fromOutputScriptWithCoin = fromOutputScriptWithCoin;
5
5
  const wasm_utxo_js_1 = require("./wasm/wasm_utxo.js");
6
- function toOutputScriptWithCoin(address, coin) {
7
- return wasm_utxo_js_1.AddressNamespace.to_output_script_with_coin(address, coin);
6
+ /**
7
+ * @param canBeShieldedOutput - When set and `address` is a ZIP-316 unified address carrying an
8
+ * Orchard/Ironwood receiver, returns that raw 43-byte receiver instead of a transparent
9
+ * scriptPubKey (there is no scriptPubKey for a shielded output). `address` is only even
10
+ * attempted as a unified address when this is set. If `address` looks like a unified address for
11
+ * this coin's network but is malformed, or has no Orchard/Ironwood receiver (e.g. Sapling-only),
12
+ * this throws rather than falling back to the transparent path.
13
+ */
14
+ function toOutputScriptWithCoin(address, coin, canBeShieldedOutput) {
15
+ return wasm_utxo_js_1.AddressNamespace.to_output_script_with_coin(address, coin, canBeShieldedOutput);
8
16
  }
9
17
  function fromOutputScriptWithCoin(script, coin, format) {
10
18
  return wasm_utxo_js_1.AddressNamespace.from_output_script_with_coin(script, coin, format);
@@ -40,6 +40,16 @@ export type ParsedOutput = {
40
40
  paygo: boolean;
41
41
  /** Full BIP32 derivation path from the wallet xpub (e.g. "0/1"). Null for external outputs. */
42
42
  derivationPath: string | null;
43
+ /**
44
+ * True for a shielded (Orchard/Ironwood) output. Such an output has no `unsigned_tx` entry of
45
+ * its own — it lives in the PSBT's proprietary-map PCZT, read from its plaintext (not
46
+ * encrypted/decrypted) recipient field. `address` is a single-receiver ZIP-316 unified address
47
+ * (`u1...`/`utest1...`) encoding that receiver — a real, usable Zcash address, though not
48
+ * necessarily byte-identical to whatever multi-receiver UA the sender originally pasted in (a
49
+ * UA with a transparent/Sapling receiver too would round-trip to a different string carrying
50
+ * only the Orchard one). `script` holds the same receiver as raw 43 bytes.
51
+ */
52
+ isShielded: boolean;
43
53
  };
44
54
  export type ParsedTransaction = {
45
55
  inputs: ParsedInput[];
@@ -52,6 +52,19 @@ export declare class ZcashUnifiedAddress {
52
52
  * @throws If `candidate` is malformed or on the wrong network
53
53
  */
54
54
  contains(candidate: string): boolean;
55
+ /**
56
+ * Encode a raw 43-byte Orchard/Ironwood receiver as a single-receiver Unified Address.
57
+ *
58
+ * Deliberately narrower than a general UA encoder: this always produces exactly one receiver,
59
+ * so it can't reproduce a multi-receiver UA (transparent + Sapling + Orchard) a sender might
60
+ * have originally pasted in — it only gives back *a* valid, usable address for the
61
+ * Orchard/Ironwood receiver itself.
62
+ *
63
+ * @param receiver - 43-byte raw Orchard/Ironwood receiver
64
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
65
+ * @throws If `receiver` is not 43 bytes, or `network` is unrecognized
66
+ */
67
+ static encodeOrchardReceiver(receiver: Uint8Array, network: ZcashNetworkName): string;
55
68
  /** @internal */
56
69
  get wasm(): WasmZcashUnifiedAddress;
57
70
  }
@@ -66,6 +66,21 @@ class ZcashUnifiedAddress {
66
66
  contains(candidate) {
67
67
  return this._wasm.contains(candidate);
68
68
  }
69
+ /**
70
+ * Encode a raw 43-byte Orchard/Ironwood receiver as a single-receiver Unified Address.
71
+ *
72
+ * Deliberately narrower than a general UA encoder: this always produces exactly one receiver,
73
+ * so it can't reproduce a multi-receiver UA (transparent + Sapling + Orchard) a sender might
74
+ * have originally pasted in — it only gives back *a* valid, usable address for the
75
+ * Orchard/Ironwood receiver itself.
76
+ *
77
+ * @param receiver - 43-byte raw Orchard/Ironwood receiver
78
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
79
+ * @throws If `receiver` is not 43 bytes, or `network` is unrecognized
80
+ */
81
+ static encodeOrchardReceiver(receiver, network) {
82
+ return wasm_utxo_js_1.ZcashUnifiedAddress.encodeOrchardReceiver(receiver, network);
83
+ }
69
84
  /** @internal */
70
85
  get wasm() {
71
86
  return this._wasm;
@@ -40,6 +40,15 @@ export declare class ZcashV6Transaction {
40
40
  get ironwoodFlags(): number | undefined;
41
41
  /** The Ironwood note-commitment tree anchor (32 bytes), or `undefined`. */
42
42
  get ironwoodAnchor(): Uint8Array | undefined;
43
+ /**
44
+ * The ZIP-244 per-input transparent sighash (32 bytes) for transparent input `index` —
45
+ * for a transaction inspected directly from its raw bytes rather than one built via a
46
+ * PSBT (e.g. independently verifying an already-broadcast transaction's signatures).
47
+ *
48
+ * `inputAmounts`/`inputScriptPubkeys` are the spent outputs' values (zatoshi) and
49
+ * scriptPubKeys for *every* transparent input of this transaction, in input order.
50
+ */
51
+ transparentSighash(index: number, inputAmounts: bigint[], inputScriptPubkeys: Uint8Array[]): Uint8Array;
43
52
  /** @internal */
44
53
  get wasm(): WasmZcashV6Transaction;
45
54
  }
@@ -65,6 +65,17 @@ class ZcashV6Transaction {
65
65
  get ironwoodAnchor() {
66
66
  return this._wasm.ironwoodAnchor;
67
67
  }
68
+ /**
69
+ * The ZIP-244 per-input transparent sighash (32 bytes) for transparent input `index` —
70
+ * for a transaction inspected directly from its raw bytes rather than one built via a
71
+ * PSBT (e.g. independently verifying an already-broadcast transaction's signatures).
72
+ *
73
+ * `inputAmounts`/`inputScriptPubkeys` are the spent outputs' values (zatoshi) and
74
+ * scriptPubKeys for *every* transparent input of this transaction, in input order.
75
+ */
76
+ transparentSighash(index, inputAmounts, inputScriptPubkeys) {
77
+ return this._wasm.transparentSighash(index, BigInt64Array.from(inputAmounts), inputScriptPubkeys);
78
+ }
68
79
  /** @internal */
69
80
  get wasm() {
70
81
  return this._wasm;
@@ -6,7 +6,13 @@ export class AddressNamespace {
6
6
  free(): void;
7
7
  [Symbol.dispose](): void;
8
8
  static from_output_script_with_coin(script: Uint8Array, coin: string, format?: string | null): string;
9
- static to_output_script_with_coin(address: string, coin: string): Uint8Array;
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.
14
+ */
15
+ static to_output_script_with_coin(address: string, coin: string, can_be_shielded_output?: boolean | null): Uint8Array;
10
16
  }
11
17
 
12
18
  /**
@@ -1704,6 +1710,16 @@ export class ZcashUnifiedAddress {
1704
1710
  * on the same network) is a receiver of this Unified Address.
1705
1711
  */
1706
1712
  contains(candidate: string): boolean;
1713
+ /**
1714
+ * Encode a raw 43-byte Orchard/Ironwood receiver as a single-receiver Unified Address for
1715
+ * `network` ("zcash"/"zec" or "zcashTest"/"tzec").
1716
+ *
1717
+ * Deliberately narrower than a general UA encoder: this always produces exactly one
1718
+ * receiver, so it can't reproduce a multi-receiver UA (transparent + Sapling + Orchard) a
1719
+ * sender might have originally pasted in — only give back *a* valid, usable address for the
1720
+ * Orchard/Ironwood receiver itself.
1721
+ */
1722
+ static encodeOrchardReceiver(receiver: Uint8Array, network: string): string;
1707
1723
  /**
1708
1724
  * Parse a Unified Address for `network` ("zcash"/"zec" or "zcashTest"/"tzec").
1709
1725
  *
@@ -1753,6 +1769,18 @@ export class ZcashV6Transaction {
1753
1769
  * Serialize back to raw v6 wire bytes.
1754
1770
  */
1755
1771
  toBytes(): Uint8Array;
1772
+ /**
1773
+ * The ZIP-244 per-input transparent sighash (32 bytes) for transparent input `index` of
1774
+ * this transaction — the free-standing counterpart to
1775
+ * `ZcashIronwoodBitGoPsbt.transparentSighash`, for a transaction inspected directly from
1776
+ * its raw bytes rather than one built via this codebase's PSBT flow (e.g. independently
1777
+ * verifying an already-broadcast transaction's signatures).
1778
+ *
1779
+ * `input_amounts`/`input_script_pubkeys` are the spent outputs' values (zatoshi) and
1780
+ * scriptPubKeys for *every* transparent input of this transaction, in input order — the
1781
+ * same data `add-input`/`addWalletInput` would have carried in a PSBT's `witness_utxo`.
1782
+ */
1783
+ transparentSighash(index: number, input_amounts: BigInt64Array, input_script_pubkeys: Uint8Array[]): Uint8Array;
1756
1784
  /**
1757
1785
  * The ZIP-244 txid in internal (non-reversed) byte order.
1758
1786
  */
@@ -48,18 +48,23 @@ class AddressNamespace {
48
48
  }
49
49
  }
50
50
  /**
51
+ * `can_be_shielded_output`: when set and `address` is a ZIP-316 unified address carrying an
52
+ * Orchard/Ironwood receiver, returns that raw 43-byte receiver instead of a transparent
53
+ * scriptPubKey. See [`to_output_script_or_shielded_receiver_with_coin`] for the exact
54
+ * fallback/error rules.
51
55
  * @param {string} address
52
56
  * @param {string} coin
57
+ * @param {boolean | null} [can_be_shielded_output]
53
58
  * @returns {Uint8Array}
54
59
  */
55
- static to_output_script_with_coin(address, coin) {
60
+ static to_output_script_with_coin(address, coin, can_be_shielded_output) {
56
61
  try {
57
62
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
58
63
  const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
59
64
  const len0 = WASM_VECTOR_LEN;
60
65
  const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
61
66
  const len1 = WASM_VECTOR_LEN;
62
- wasm.addressnamespace_to_output_script_with_coin(retptr, ptr0, len0, ptr1, len1);
67
+ wasm.addressnamespace_to_output_script_with_coin(retptr, ptr0, len0, ptr1, len1, isLikeNone(can_be_shielded_output) ? 0xFFFFFF : can_be_shielded_output ? 1 : 0);
63
68
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
64
69
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
65
70
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -6576,6 +6581,46 @@ class ZcashUnifiedAddress {
6576
6581
  wasm.__wbindgen_add_to_stack_pointer(16);
6577
6582
  }
6578
6583
  }
6584
+ /**
6585
+ * Encode a raw 43-byte Orchard/Ironwood receiver as a single-receiver Unified Address for
6586
+ * `network` ("zcash"/"zec" or "zcashTest"/"tzec").
6587
+ *
6588
+ * Deliberately narrower than a general UA encoder: this always produces exactly one
6589
+ * receiver, so it can't reproduce a multi-receiver UA (transparent + Sapling + Orchard) a
6590
+ * sender might have originally pasted in — only give back *a* valid, usable address for the
6591
+ * Orchard/Ironwood receiver itself.
6592
+ * @param {Uint8Array} receiver
6593
+ * @param {string} network
6594
+ * @returns {string}
6595
+ */
6596
+ static encodeOrchardReceiver(receiver, network) {
6597
+ let deferred4_0;
6598
+ let deferred4_1;
6599
+ try {
6600
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6601
+ const ptr0 = passArray8ToWasm0(receiver, wasm.__wbindgen_export);
6602
+ const len0 = WASM_VECTOR_LEN;
6603
+ const ptr1 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
6604
+ const len1 = WASM_VECTOR_LEN;
6605
+ wasm.zcashunifiedaddress_encodeOrchardReceiver(retptr, ptr0, len0, ptr1, len1);
6606
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6607
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6608
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6609
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
6610
+ var ptr3 = r0;
6611
+ var len3 = r1;
6612
+ if (r3) {
6613
+ ptr3 = 0; len3 = 0;
6614
+ throw takeObject(r2);
6615
+ }
6616
+ deferred4_0 = ptr3;
6617
+ deferred4_1 = len3;
6618
+ return getStringFromWasm0(ptr3, len3);
6619
+ } finally {
6620
+ wasm.__wbindgen_add_to_stack_pointer(16);
6621
+ wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
6622
+ }
6623
+ }
6579
6624
  /**
6580
6625
  * The Orchard/Ironwood receiver's raw 43 bytes (diversifier + pk_d), or `undefined`.
6581
6626
  * @returns {Uint8Array | undefined}
@@ -6822,6 +6867,43 @@ class ZcashV6Transaction {
6822
6867
  wasm.__wbindgen_add_to_stack_pointer(16);
6823
6868
  }
6824
6869
  }
6870
+ /**
6871
+ * The ZIP-244 per-input transparent sighash (32 bytes) for transparent input `index` of
6872
+ * this transaction — the free-standing counterpart to
6873
+ * `ZcashIronwoodBitGoPsbt.transparentSighash`, for a transaction inspected directly from
6874
+ * its raw bytes rather than one built via this codebase's PSBT flow (e.g. independently
6875
+ * verifying an already-broadcast transaction's signatures).
6876
+ *
6877
+ * `input_amounts`/`input_script_pubkeys` are the spent outputs' values (zatoshi) and
6878
+ * scriptPubKeys for *every* transparent input of this transaction, in input order — the
6879
+ * same data `add-input`/`addWalletInput` would have carried in a PSBT's `witness_utxo`.
6880
+ * @param {number} index
6881
+ * @param {BigInt64Array} input_amounts
6882
+ * @param {Uint8Array[]} input_script_pubkeys
6883
+ * @returns {Uint8Array}
6884
+ */
6885
+ transparentSighash(index, input_amounts, input_script_pubkeys) {
6886
+ try {
6887
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6888
+ const ptr0 = passArray64ToWasm0(input_amounts, wasm.__wbindgen_export);
6889
+ const len0 = WASM_VECTOR_LEN;
6890
+ const ptr1 = passArrayJsValueToWasm0(input_script_pubkeys, wasm.__wbindgen_export);
6891
+ const len1 = WASM_VECTOR_LEN;
6892
+ wasm.zcashv6transaction_transparentSighash(retptr, this.__wbg_ptr, index, ptr0, len0, ptr1, len1);
6893
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6894
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6895
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6896
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
6897
+ if (r3) {
6898
+ throw takeObject(r2);
6899
+ }
6900
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
6901
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
6902
+ return v3;
6903
+ } finally {
6904
+ wasm.__wbindgen_add_to_stack_pointer(16);
6905
+ }
6906
+ }
6825
6907
  /**
6826
6908
  * The ZIP-244 txid in internal (non-reversed) byte order.
6827
6909
  * @returns {Uint8Array}
@@ -7476,6 +7558,14 @@ function getArrayU8FromWasm0(ptr, len) {
7476
7558
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
7477
7559
  }
7478
7560
 
7561
+ let cachedBigUint64ArrayMemory0 = null;
7562
+ function getBigUint64ArrayMemory0() {
7563
+ if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
7564
+ cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
7565
+ }
7566
+ return cachedBigUint64ArrayMemory0;
7567
+ }
7568
+
7479
7569
  let cachedDataViewMemory0 = null;
7480
7570
  function getDataViewMemory0() {
7481
7571
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -7524,6 +7614,13 @@ function isLikeNone(x) {
7524
7614
  return x === undefined || x === null;
7525
7615
  }
7526
7616
 
7617
+ function passArray64ToWasm0(arg, malloc) {
7618
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
7619
+ getBigUint64ArrayMemory0().set(arg, ptr / 8);
7620
+ WASM_VECTOR_LEN = arg.length;
7621
+ return ptr;
7622
+ }
7623
+
7527
7624
  function passArray8ToWasm0(arg, malloc) {
7528
7625
  const ptr = malloc(arg.length * 1, 1) >>> 0;
7529
7626
  getUint8ArrayMemory0().set(arg, ptr / 1);
Binary file
@@ -1,35 +1,12 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
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
4
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
27
5
  export const __wbg_bip322namespace_free: (a: number, b: number) => void;
28
6
  export const __wbg_messagenamespace_free: (a: number, b: number) => void;
29
7
  export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
30
8
  export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
31
9
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
32
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
33
10
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
34
11
  export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
35
12
  export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
@@ -37,7 +14,7 @@ export const __wbg_wrappsbt_free: (a: number, b: number) => void;
37
14
  export const __wbg_zcashunifiedaddress_free: (a: number, b: number) => void;
38
15
  export const __wbg_zcashv6transaction_free: (a: number, b: number) => void;
39
16
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
40
- export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
17
+ export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
41
18
  export const bip322namespace_add_bip322_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
42
19
  export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
43
20
  export const bip322namespace_verify_bip322_psbt_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
@@ -70,9 +47,6 @@ export const wasmecpair_public_key: (a: number) => number;
70
47
  export const wasmecpair_to_wif: (a: number, b: number) => void;
71
48
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
72
49
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
73
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
74
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
75
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
76
50
  export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
77
51
  export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
78
52
  export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
@@ -138,6 +112,7 @@ export const wrappsbt_verify_signature_with_key: (a: number, b: number, c: numbe
138
112
  export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
139
113
  export const zcash_ironwood_version_group_id: () => number;
140
114
  export const zcashunifiedaddress_contains: (a: number, b: number, c: number, d: number) => void;
115
+ export const zcashunifiedaddress_encodeOrchardReceiver: (a: number, b: number, c: number, d: number, e: number) => void;
141
116
  export const zcashunifiedaddress_orchardReceiver: (a: number, b: number) => void;
142
117
  export const zcashunifiedaddress_parse: (a: number, b: number, c: number, d: number, e: number) => void;
143
118
  export const zcashunifiedaddress_saplingReceiver: (a: number, b: number) => void;
@@ -151,6 +126,7 @@ export const zcashv6transaction_ironwoodAnchor: (a: number, b: number) => void;
151
126
  export const zcashv6transaction_ironwoodFlags: (a: number) => number;
152
127
  export const zcashv6transaction_ironwoodValueBalance: (a: number) => bigint;
153
128
  export const zcashv6transaction_toBytes: (a: number, b: number) => void;
129
+ export const zcashv6transaction_transparentSighash: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
154
130
  export const zcashv6transaction_txidBytes: (a: number, b: number) => void;
155
131
  export const wasmtransaction_input_count: (a: number) => number;
156
132
  export const wasmtransaction_output_count: (a: number) => number;
@@ -169,6 +145,7 @@ export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => vo
169
145
  export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
170
146
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
171
147
  export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
148
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
172
149
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
173
150
  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;
174
151
  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;
@@ -302,6 +279,9 @@ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => num
302
279
  export const wasmdimensions_has_segwit: (a: number) => number;
303
280
  export const wasmdimensions_plus: (a: number, b: number) => number;
304
281
  export const wasmdimensions_times: (a: number, b: number) => number;
282
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
283
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
284
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
305
285
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
306
286
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
307
287
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
@@ -311,6 +291,28 @@ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
311
291
  export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
312
292
  export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
313
293
  export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
294
+ export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
295
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
296
+ export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
297
+ export const wrapdescriptor_descType: (a: number, b: number) => void;
298
+ export const wrapdescriptor_encode: (a: number, b: number) => void;
299
+ export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
300
+ export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
301
+ export const wrapdescriptor_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
302
+ export const wrapdescriptor_hasWildcard: (a: number) => number;
303
+ export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
304
+ export const wrapdescriptor_node: (a: number, b: number) => void;
305
+ export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
306
+ export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
307
+ export const wrapdescriptor_toString: (a: number, b: number) => void;
308
+ export const wrapminiscript_encode: (a: number, b: number) => void;
309
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
310
+ export const wrapminiscript_fromBitcoinScriptExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
311
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
312
+ export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
313
+ export const wrapminiscript_node: (a: number, b: number) => void;
314
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
315
+ export const wrapminiscript_toString: (a: number, b: number) => void;
314
316
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
315
317
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
316
318
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -4,5 +4,13 @@ import type { CoinName } from "./coinName.js";
4
4
  * For Bitcoin Cash and eCash, we can select between base58check and cashaddr.
5
5
  */
6
6
  export type AddressFormat = "default" | "cashaddr";
7
- export declare function toOutputScriptWithCoin(address: string, coin: CoinName): Uint8Array;
7
+ /**
8
+ * @param canBeShieldedOutput - When set and `address` is a ZIP-316 unified address carrying an
9
+ * Orchard/Ironwood receiver, returns that raw 43-byte receiver instead of a transparent
10
+ * scriptPubKey (there is no scriptPubKey for a shielded output). `address` is only even
11
+ * attempted as a unified address when this is set. If `address` looks like a unified address for
12
+ * this coin's network but is malformed, or has no Orchard/Ironwood receiver (e.g. Sapling-only),
13
+ * this throws rather than falling back to the transparent path.
14
+ */
15
+ export declare function toOutputScriptWithCoin(address: string, coin: CoinName, canBeShieldedOutput?: boolean): Uint8Array;
8
16
  export declare function fromOutputScriptWithCoin(script: Uint8Array, coin: CoinName, format?: AddressFormat): string;
@@ -1,6 +1,14 @@
1
1
  import { AddressNamespace } from "./wasm/wasm_utxo.js";
2
- export function toOutputScriptWithCoin(address, coin) {
3
- return AddressNamespace.to_output_script_with_coin(address, coin);
2
+ /**
3
+ * @param canBeShieldedOutput - When set and `address` is a ZIP-316 unified address carrying an
4
+ * Orchard/Ironwood receiver, returns that raw 43-byte receiver instead of a transparent
5
+ * scriptPubKey (there is no scriptPubKey for a shielded output). `address` is only even
6
+ * attempted as a unified address when this is set. If `address` looks like a unified address for
7
+ * this coin's network but is malformed, or has no Orchard/Ironwood receiver (e.g. Sapling-only),
8
+ * this throws rather than falling back to the transparent path.
9
+ */
10
+ export function toOutputScriptWithCoin(address, coin, canBeShieldedOutput) {
11
+ return AddressNamespace.to_output_script_with_coin(address, coin, canBeShieldedOutput);
4
12
  }
5
13
  export function fromOutputScriptWithCoin(script, coin, format) {
6
14
  return AddressNamespace.from_output_script_with_coin(script, coin, format);
@@ -40,6 +40,16 @@ export type ParsedOutput = {
40
40
  paygo: boolean;
41
41
  /** Full BIP32 derivation path from the wallet xpub (e.g. "0/1"). Null for external outputs. */
42
42
  derivationPath: string | null;
43
+ /**
44
+ * True for a shielded (Orchard/Ironwood) output. Such an output has no `unsigned_tx` entry of
45
+ * its own — it lives in the PSBT's proprietary-map PCZT, read from its plaintext (not
46
+ * encrypted/decrypted) recipient field. `address` is a single-receiver ZIP-316 unified address
47
+ * (`u1...`/`utest1...`) encoding that receiver — a real, usable Zcash address, though not
48
+ * necessarily byte-identical to whatever multi-receiver UA the sender originally pasted in (a
49
+ * UA with a transparent/Sapling receiver too would round-trip to a different string carrying
50
+ * only the Orchard one). `script` holds the same receiver as raw 43 bytes.
51
+ */
52
+ isShielded: boolean;
43
53
  };
44
54
  export type ParsedTransaction = {
45
55
  inputs: ParsedInput[];
@@ -52,6 +52,19 @@ export declare class ZcashUnifiedAddress {
52
52
  * @throws If `candidate` is malformed or on the wrong network
53
53
  */
54
54
  contains(candidate: string): boolean;
55
+ /**
56
+ * Encode a raw 43-byte Orchard/Ironwood receiver as a single-receiver Unified Address.
57
+ *
58
+ * Deliberately narrower than a general UA encoder: this always produces exactly one receiver,
59
+ * so it can't reproduce a multi-receiver UA (transparent + Sapling + Orchard) a sender might
60
+ * have originally pasted in — it only gives back *a* valid, usable address for the
61
+ * Orchard/Ironwood receiver itself.
62
+ *
63
+ * @param receiver - 43-byte raw Orchard/Ironwood receiver
64
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
65
+ * @throws If `receiver` is not 43 bytes, or `network` is unrecognized
66
+ */
67
+ static encodeOrchardReceiver(receiver: Uint8Array, network: ZcashNetworkName): string;
55
68
  /** @internal */
56
69
  get wasm(): WasmZcashUnifiedAddress;
57
70
  }
@@ -63,6 +63,21 @@ export class ZcashUnifiedAddress {
63
63
  contains(candidate) {
64
64
  return this._wasm.contains(candidate);
65
65
  }
66
+ /**
67
+ * Encode a raw 43-byte Orchard/Ironwood receiver as a single-receiver Unified Address.
68
+ *
69
+ * Deliberately narrower than a general UA encoder: this always produces exactly one receiver,
70
+ * so it can't reproduce a multi-receiver UA (transparent + Sapling + Orchard) a sender might
71
+ * have originally pasted in — it only gives back *a* valid, usable address for the
72
+ * Orchard/Ironwood receiver itself.
73
+ *
74
+ * @param receiver - 43-byte raw Orchard/Ironwood receiver
75
+ * @param network - Zcash network name ("zcash", "zcashTest", "zec", "tzec")
76
+ * @throws If `receiver` is not 43 bytes, or `network` is unrecognized
77
+ */
78
+ static encodeOrchardReceiver(receiver, network) {
79
+ return WasmZcashUnifiedAddress.encodeOrchardReceiver(receiver, network);
80
+ }
66
81
  /** @internal */
67
82
  get wasm() {
68
83
  return this._wasm;
@@ -40,6 +40,15 @@ export declare class ZcashV6Transaction {
40
40
  get ironwoodFlags(): number | undefined;
41
41
  /** The Ironwood note-commitment tree anchor (32 bytes), or `undefined`. */
42
42
  get ironwoodAnchor(): Uint8Array | undefined;
43
+ /**
44
+ * The ZIP-244 per-input transparent sighash (32 bytes) for transparent input `index` —
45
+ * for a transaction inspected directly from its raw bytes rather than one built via a
46
+ * PSBT (e.g. independently verifying an already-broadcast transaction's signatures).
47
+ *
48
+ * `inputAmounts`/`inputScriptPubkeys` are the spent outputs' values (zatoshi) and
49
+ * scriptPubKeys for *every* transparent input of this transaction, in input order.
50
+ */
51
+ transparentSighash(index: number, inputAmounts: bigint[], inputScriptPubkeys: Uint8Array[]): Uint8Array;
43
52
  /** @internal */
44
53
  get wasm(): WasmZcashV6Transaction;
45
54
  }
@@ -62,6 +62,17 @@ export class ZcashV6Transaction {
62
62
  get ironwoodAnchor() {
63
63
  return this._wasm.ironwoodAnchor;
64
64
  }
65
+ /**
66
+ * The ZIP-244 per-input transparent sighash (32 bytes) for transparent input `index` —
67
+ * for a transaction inspected directly from its raw bytes rather than one built via a
68
+ * PSBT (e.g. independently verifying an already-broadcast transaction's signatures).
69
+ *
70
+ * `inputAmounts`/`inputScriptPubkeys` are the spent outputs' values (zatoshi) and
71
+ * scriptPubKeys for *every* transparent input of this transaction, in input order.
72
+ */
73
+ transparentSighash(index, inputAmounts, inputScriptPubkeys) {
74
+ return this._wasm.transparentSighash(index, BigInt64Array.from(inputAmounts), inputScriptPubkeys);
75
+ }
65
76
  /** @internal */
66
77
  get wasm() {
67
78
  return this._wasm;
@@ -6,7 +6,13 @@ export class AddressNamespace {
6
6
  free(): void;
7
7
  [Symbol.dispose](): void;
8
8
  static from_output_script_with_coin(script: Uint8Array, coin: string, format?: string | null): string;
9
- static to_output_script_with_coin(address: string, coin: string): Uint8Array;
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.
14
+ */
15
+ static to_output_script_with_coin(address: string, coin: string, can_be_shielded_output?: boolean | null): Uint8Array;
10
16
  }
11
17
 
12
18
  /**
@@ -1704,6 +1710,16 @@ export class ZcashUnifiedAddress {
1704
1710
  * on the same network) is a receiver of this Unified Address.
1705
1711
  */
1706
1712
  contains(candidate: string): boolean;
1713
+ /**
1714
+ * Encode a raw 43-byte Orchard/Ironwood receiver as a single-receiver Unified Address for
1715
+ * `network` ("zcash"/"zec" or "zcashTest"/"tzec").
1716
+ *
1717
+ * Deliberately narrower than a general UA encoder: this always produces exactly one
1718
+ * receiver, so it can't reproduce a multi-receiver UA (transparent + Sapling + Orchard) a
1719
+ * sender might have originally pasted in — only give back *a* valid, usable address for the
1720
+ * Orchard/Ironwood receiver itself.
1721
+ */
1722
+ static encodeOrchardReceiver(receiver: Uint8Array, network: string): string;
1707
1723
  /**
1708
1724
  * Parse a Unified Address for `network` ("zcash"/"zec" or "zcashTest"/"tzec").
1709
1725
  *
@@ -1753,6 +1769,18 @@ export class ZcashV6Transaction {
1753
1769
  * Serialize back to raw v6 wire bytes.
1754
1770
  */
1755
1771
  toBytes(): Uint8Array;
1772
+ /**
1773
+ * The ZIP-244 per-input transparent sighash (32 bytes) for transparent input `index` of
1774
+ * this transaction — the free-standing counterpart to
1775
+ * `ZcashIronwoodBitGoPsbt.transparentSighash`, for a transaction inspected directly from
1776
+ * its raw bytes rather than one built via this codebase's PSBT flow (e.g. independently
1777
+ * verifying an already-broadcast transaction's signatures).
1778
+ *
1779
+ * `input_amounts`/`input_script_pubkeys` are the spent outputs' values (zatoshi) and
1780
+ * scriptPubKeys for *every* transparent input of this transaction, in input order — the
1781
+ * same data `add-input`/`addWalletInput` would have carried in a PSBT's `witness_utxo`.
1782
+ */
1783
+ transparentSighash(index: number, input_amounts: BigInt64Array, input_script_pubkeys: Uint8Array[]): Uint8Array;
1756
1784
  /**
1757
1785
  * The ZIP-244 txid in internal (non-reversed) byte order.
1758
1786
  */
@@ -46,18 +46,23 @@ 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
53
  * @param {string} address
50
54
  * @param {string} coin
55
+ * @param {boolean | null} [can_be_shielded_output]
51
56
  * @returns {Uint8Array}
52
57
  */
53
- static to_output_script_with_coin(address, coin) {
58
+ static to_output_script_with_coin(address, coin, can_be_shielded_output) {
54
59
  try {
55
60
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
56
61
  const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
57
62
  const len0 = WASM_VECTOR_LEN;
58
63
  const ptr1 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
59
64
  const len1 = WASM_VECTOR_LEN;
60
- wasm.addressnamespace_to_output_script_with_coin(retptr, ptr0, len0, ptr1, len1);
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
66
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
62
67
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
63
68
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -6555,6 +6560,46 @@ export class ZcashUnifiedAddress {
6555
6560
  wasm.__wbindgen_add_to_stack_pointer(16);
6556
6561
  }
6557
6562
  }
6563
+ /**
6564
+ * Encode a raw 43-byte Orchard/Ironwood receiver as a single-receiver Unified Address for
6565
+ * `network` ("zcash"/"zec" or "zcashTest"/"tzec").
6566
+ *
6567
+ * Deliberately narrower than a general UA encoder: this always produces exactly one
6568
+ * receiver, so it can't reproduce a multi-receiver UA (transparent + Sapling + Orchard) a
6569
+ * sender might have originally pasted in — only give back *a* valid, usable address for the
6570
+ * Orchard/Ironwood receiver itself.
6571
+ * @param {Uint8Array} receiver
6572
+ * @param {string} network
6573
+ * @returns {string}
6574
+ */
6575
+ static encodeOrchardReceiver(receiver, network) {
6576
+ let deferred4_0;
6577
+ let deferred4_1;
6578
+ try {
6579
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6580
+ const ptr0 = passArray8ToWasm0(receiver, wasm.__wbindgen_export);
6581
+ const len0 = WASM_VECTOR_LEN;
6582
+ const ptr1 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
6583
+ const len1 = WASM_VECTOR_LEN;
6584
+ wasm.zcashunifiedaddress_encodeOrchardReceiver(retptr, ptr0, len0, ptr1, len1);
6585
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6586
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6587
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6588
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
6589
+ var ptr3 = r0;
6590
+ var len3 = r1;
6591
+ if (r3) {
6592
+ ptr3 = 0; len3 = 0;
6593
+ throw takeObject(r2);
6594
+ }
6595
+ deferred4_0 = ptr3;
6596
+ deferred4_1 = len3;
6597
+ return getStringFromWasm0(ptr3, len3);
6598
+ } finally {
6599
+ wasm.__wbindgen_add_to_stack_pointer(16);
6600
+ wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
6601
+ }
6602
+ }
6558
6603
  /**
6559
6604
  * The Orchard/Ironwood receiver's raw 43 bytes (diversifier + pk_d), or `undefined`.
6560
6605
  * @returns {Uint8Array | undefined}
@@ -6800,6 +6845,43 @@ export class ZcashV6Transaction {
6800
6845
  wasm.__wbindgen_add_to_stack_pointer(16);
6801
6846
  }
6802
6847
  }
6848
+ /**
6849
+ * The ZIP-244 per-input transparent sighash (32 bytes) for transparent input `index` of
6850
+ * this transaction — the free-standing counterpart to
6851
+ * `ZcashIronwoodBitGoPsbt.transparentSighash`, for a transaction inspected directly from
6852
+ * its raw bytes rather than one built via this codebase's PSBT flow (e.g. independently
6853
+ * verifying an already-broadcast transaction's signatures).
6854
+ *
6855
+ * `input_amounts`/`input_script_pubkeys` are the spent outputs' values (zatoshi) and
6856
+ * scriptPubKeys for *every* transparent input of this transaction, in input order — the
6857
+ * same data `add-input`/`addWalletInput` would have carried in a PSBT's `witness_utxo`.
6858
+ * @param {number} index
6859
+ * @param {BigInt64Array} input_amounts
6860
+ * @param {Uint8Array[]} input_script_pubkeys
6861
+ * @returns {Uint8Array}
6862
+ */
6863
+ transparentSighash(index, input_amounts, input_script_pubkeys) {
6864
+ try {
6865
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6866
+ const ptr0 = passArray64ToWasm0(input_amounts, wasm.__wbindgen_export);
6867
+ const len0 = WASM_VECTOR_LEN;
6868
+ const ptr1 = passArrayJsValueToWasm0(input_script_pubkeys, wasm.__wbindgen_export);
6869
+ const len1 = WASM_VECTOR_LEN;
6870
+ wasm.zcashv6transaction_transparentSighash(retptr, this.__wbg_ptr, index, ptr0, len0, ptr1, len1);
6871
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6872
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6873
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6874
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
6875
+ if (r3) {
6876
+ throw takeObject(r2);
6877
+ }
6878
+ var v3 = getArrayU8FromWasm0(r0, r1).slice();
6879
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
6880
+ return v3;
6881
+ } finally {
6882
+ wasm.__wbindgen_add_to_stack_pointer(16);
6883
+ }
6884
+ }
6803
6885
  /**
6804
6886
  * The ZIP-244 txid in internal (non-reversed) byte order.
6805
6887
  * @returns {Uint8Array}
@@ -7436,6 +7518,14 @@ function getArrayU8FromWasm0(ptr, len) {
7436
7518
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
7437
7519
  }
7438
7520
 
7521
+ let cachedBigUint64ArrayMemory0 = null;
7522
+ function getBigUint64ArrayMemory0() {
7523
+ if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
7524
+ cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
7525
+ }
7526
+ return cachedBigUint64ArrayMemory0;
7527
+ }
7528
+
7439
7529
  let cachedDataViewMemory0 = null;
7440
7530
  function getDataViewMemory0() {
7441
7531
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -7484,6 +7574,13 @@ function isLikeNone(x) {
7484
7574
  return x === undefined || x === null;
7485
7575
  }
7486
7576
 
7577
+ function passArray64ToWasm0(arg, malloc) {
7578
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
7579
+ getBigUint64ArrayMemory0().set(arg, ptr / 8);
7580
+ WASM_VECTOR_LEN = arg.length;
7581
+ return ptr;
7582
+ }
7583
+
7487
7584
  function passArray8ToWasm0(arg, malloc) {
7488
7585
  const ptr = malloc(arg.length * 1, 1) >>> 0;
7489
7586
  getUint8ArrayMemory0().set(arg, ptr / 1);
Binary file
@@ -1,35 +1,12 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
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
4
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
27
5
  export const __wbg_bip322namespace_free: (a: number, b: number) => void;
28
6
  export const __wbg_messagenamespace_free: (a: number, b: number) => void;
29
7
  export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
30
8
  export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
31
9
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
32
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
33
10
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
34
11
  export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
35
12
  export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
@@ -37,7 +14,7 @@ export const __wbg_wrappsbt_free: (a: number, b: number) => void;
37
14
  export const __wbg_zcashunifiedaddress_free: (a: number, b: number) => void;
38
15
  export const __wbg_zcashv6transaction_free: (a: number, b: number) => void;
39
16
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
40
- export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
17
+ export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
41
18
  export const bip322namespace_add_bip322_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
42
19
  export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
43
20
  export const bip322namespace_verify_bip322_psbt_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
@@ -70,9 +47,6 @@ export const wasmecpair_public_key: (a: number) => number;
70
47
  export const wasmecpair_to_wif: (a: number, b: number) => void;
71
48
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
72
49
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
73
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
74
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
75
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
76
50
  export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
77
51
  export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
78
52
  export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
@@ -138,6 +112,7 @@ export const wrappsbt_verify_signature_with_key: (a: number, b: number, c: numbe
138
112
  export const zcash_branch_id_for_height: (a: number, b: number, c: number, d: number) => void;
139
113
  export const zcash_ironwood_version_group_id: () => number;
140
114
  export const zcashunifiedaddress_contains: (a: number, b: number, c: number, d: number) => void;
115
+ export const zcashunifiedaddress_encodeOrchardReceiver: (a: number, b: number, c: number, d: number, e: number) => void;
141
116
  export const zcashunifiedaddress_orchardReceiver: (a: number, b: number) => void;
142
117
  export const zcashunifiedaddress_parse: (a: number, b: number, c: number, d: number, e: number) => void;
143
118
  export const zcashunifiedaddress_saplingReceiver: (a: number, b: number) => void;
@@ -151,6 +126,7 @@ export const zcashv6transaction_ironwoodAnchor: (a: number, b: number) => void;
151
126
  export const zcashv6transaction_ironwoodFlags: (a: number) => number;
152
127
  export const zcashv6transaction_ironwoodValueBalance: (a: number) => bigint;
153
128
  export const zcashv6transaction_toBytes: (a: number, b: number) => void;
129
+ export const zcashv6transaction_transparentSighash: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
154
130
  export const zcashv6transaction_txidBytes: (a: number, b: number) => void;
155
131
  export const wasmtransaction_input_count: (a: number) => number;
156
132
  export const wasmtransaction_output_count: (a: number) => number;
@@ -169,6 +145,7 @@ export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => vo
169
145
  export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
170
146
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
171
147
  export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
148
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
172
149
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
173
150
  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;
174
151
  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;
@@ -302,6 +279,9 @@ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => num
302
279
  export const wasmdimensions_has_segwit: (a: number) => number;
303
280
  export const wasmdimensions_plus: (a: number, b: number) => number;
304
281
  export const wasmdimensions_times: (a: number, b: number) => number;
282
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
283
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
284
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
305
285
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
306
286
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
307
287
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
@@ -311,6 +291,28 @@ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
311
291
  export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
312
292
  export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
313
293
  export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
294
+ export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
295
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
296
+ export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
297
+ export const wrapdescriptor_descType: (a: number, b: number) => void;
298
+ export const wrapdescriptor_encode: (a: number, b: number) => void;
299
+ export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
300
+ export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
301
+ export const wrapdescriptor_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
302
+ export const wrapdescriptor_hasWildcard: (a: number) => number;
303
+ export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
304
+ export const wrapdescriptor_node: (a: number, b: number) => void;
305
+ export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
306
+ export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
307
+ export const wrapdescriptor_toString: (a: number, b: number) => void;
308
+ export const wrapminiscript_encode: (a: number, b: number) => void;
309
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
310
+ export const wrapminiscript_fromBitcoinScriptExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
311
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
312
+ export const wrapminiscript_fromStringExt: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
313
+ export const wrapminiscript_node: (a: number, b: number) => void;
314
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
315
+ export const wrapminiscript_toString: (a: number, b: number) => void;
314
316
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
315
317
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
316
318
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: 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.35.0",
4
+ "version": "4.37.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",