@bitgo/wasm-utxo 4.26.0 → 4.28.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.
@@ -0,0 +1,45 @@
1
+ import { ZcashV6Transaction as WasmZcashV6Transaction } from "../wasm/wasm_utxo.js";
2
+ /**
3
+ * A parsed Zcash v6 (Ironwood / NU6.3) transaction — for inspection and txid.
4
+ *
5
+ * The transaction id is an instance method ({@link getId}) returning the canonical
6
+ * display-order hex, consistent with the `getId()` convention on the other
7
+ * transaction/PSBT wrappers. Callers never pass raw bytes to a txid function or have
8
+ * to reverse internal byte order themselves.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const tx = ZcashV6Transaction.fromBytes(rawV6Bytes);
13
+ * tx.getId(); // canonical (display-order) txid hex
14
+ * tx.ironwoodActionCount; // 0 when the Ironwood slot is empty
15
+ * ```
16
+ */
17
+ export declare class ZcashV6Transaction {
18
+ private _wasm;
19
+ private constructor();
20
+ /**
21
+ * Decode a v6 transaction from raw wire bytes.
22
+ * @throws If the bytes are not a valid v6 (Ironwood) transaction
23
+ */
24
+ static fromBytes(bytes: Uint8Array): ZcashV6Transaction;
25
+ /** Serialize back to raw v6 wire bytes. */
26
+ toBytes(): Uint8Array;
27
+ /** The canonical (display-order) ZIP-244 txid as a lowercase hex string. */
28
+ getId(): string;
29
+ /** The ZIP-244 txid in internal (non-reversed) byte order. */
30
+ txidBytes(): Uint8Array;
31
+ /** Consensus branch id carried in the v6 header. */
32
+ get consensusBranchId(): number;
33
+ /** Expiry height. */
34
+ get expiryHeight(): number;
35
+ /** Number of Ironwood actions (0 when the Ironwood slot is empty). */
36
+ get ironwoodActionCount(): number;
37
+ /** Net value crossing the Ironwood pool boundary (0 when there is no bundle). */
38
+ get ironwoodValueBalance(): bigint;
39
+ /** The Ironwood bundle flag byte, or `undefined` when there is no bundle. */
40
+ get ironwoodFlags(): number | undefined;
41
+ /** The Ironwood note-commitment tree anchor (32 bytes), or `undefined`. */
42
+ get ironwoodAnchor(): Uint8Array | undefined;
43
+ /** @internal */
44
+ get wasm(): WasmZcashV6Transaction;
45
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZcashV6Transaction = void 0;
4
+ const wasm_utxo_js_1 = require("../wasm/wasm_utxo.js");
5
+ /**
6
+ * A parsed Zcash v6 (Ironwood / NU6.3) transaction — for inspection and txid.
7
+ *
8
+ * The transaction id is an instance method ({@link getId}) returning the canonical
9
+ * display-order hex, consistent with the `getId()` convention on the other
10
+ * transaction/PSBT wrappers. Callers never pass raw bytes to a txid function or have
11
+ * to reverse internal byte order themselves.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const tx = ZcashV6Transaction.fromBytes(rawV6Bytes);
16
+ * tx.getId(); // canonical (display-order) txid hex
17
+ * tx.ironwoodActionCount; // 0 when the Ironwood slot is empty
18
+ * ```
19
+ */
20
+ class ZcashV6Transaction {
21
+ _wasm;
22
+ constructor(_wasm) {
23
+ this._wasm = _wasm;
24
+ }
25
+ /**
26
+ * Decode a v6 transaction from raw wire bytes.
27
+ * @throws If the bytes are not a valid v6 (Ironwood) transaction
28
+ */
29
+ static fromBytes(bytes) {
30
+ return new ZcashV6Transaction(wasm_utxo_js_1.ZcashV6Transaction.fromBytes(bytes));
31
+ }
32
+ /** Serialize back to raw v6 wire bytes. */
33
+ toBytes() {
34
+ return this._wasm.toBytes();
35
+ }
36
+ /** The canonical (display-order) ZIP-244 txid as a lowercase hex string. */
37
+ getId() {
38
+ return this._wasm.getId();
39
+ }
40
+ /** The ZIP-244 txid in internal (non-reversed) byte order. */
41
+ txidBytes() {
42
+ return this._wasm.txidBytes();
43
+ }
44
+ /** Consensus branch id carried in the v6 header. */
45
+ get consensusBranchId() {
46
+ return this._wasm.consensusBranchId;
47
+ }
48
+ /** Expiry height. */
49
+ get expiryHeight() {
50
+ return this._wasm.expiryHeight;
51
+ }
52
+ /** Number of Ironwood actions (0 when the Ironwood slot is empty). */
53
+ get ironwoodActionCount() {
54
+ return this._wasm.ironwoodActionCount;
55
+ }
56
+ /** Net value crossing the Ironwood pool boundary (0 when there is no bundle). */
57
+ get ironwoodValueBalance() {
58
+ return this._wasm.ironwoodValueBalance;
59
+ }
60
+ /** The Ironwood bundle flag byte, or `undefined` when there is no bundle. */
61
+ get ironwoodFlags() {
62
+ return this._wasm.ironwoodFlags;
63
+ }
64
+ /** The Ironwood note-commitment tree anchor (32 bytes), or `undefined`. */
65
+ get ironwoodAnchor() {
66
+ return this._wasm.ironwoodAnchor;
67
+ }
68
+ /** @internal */
69
+ get wasm() {
70
+ return this._wasm;
71
+ }
72
+ }
73
+ exports.ZcashV6Transaction = ZcashV6Transaction;
@@ -10,6 +10,7 @@ export { BitGoPsbt, getWalletKeysFromPsbt, type NetworkName, type ScriptId, type
10
10
  export { BitGoKeySubtype, type PsbtKvKey } from "./BitGoKeySubtype.js";
11
11
  export { ZcashBitGoPsbt, type ZcashNetworkName, type CreateEmptyZcashOptions, } from "./ZcashBitGoPsbt.js";
12
12
  export { ZcashUnifiedAddress } from "./ZcashUnifiedAddress.js";
13
+ export { ZcashV6Transaction } from "./ZcashV6Transaction.js";
13
14
  import type { ScriptType } from "./scriptType.js";
14
15
  /**
15
16
  * Check if a network supports a given fixed-script wallet script type
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZcashUnifiedAddress = exports.ZcashBitGoPsbt = exports.BitGoKeySubtype = exports.getWalletKeysFromPsbt = exports.BitGoPsbt = exports.requiresPrevTxForP2sh = exports.assertChainCode = exports.chainCodes = exports.ChainCode = exports.inputScriptTypes = exports.outputScriptTypes = exports.Dimensions = exports.address = exports.outputScript = exports.ReplayProtection = exports.RootWalletKeys = void 0;
3
+ exports.ZcashV6Transaction = exports.ZcashUnifiedAddress = exports.ZcashBitGoPsbt = exports.BitGoKeySubtype = exports.getWalletKeysFromPsbt = exports.BitGoPsbt = exports.requiresPrevTxForP2sh = exports.assertChainCode = exports.chainCodes = exports.ChainCode = exports.inputScriptTypes = exports.outputScriptTypes = exports.Dimensions = exports.address = exports.outputScript = exports.ReplayProtection = exports.RootWalletKeys = void 0;
4
4
  exports.supportsScriptType = supportsScriptType;
5
5
  exports.createOpReturnScript = createOpReturnScript;
6
6
  exports.p2shP2pkOutputScript = p2shP2pkOutputScript;
@@ -36,6 +36,9 @@ Object.defineProperty(exports, "ZcashBitGoPsbt", { enumerable: true, get: functi
36
36
  // Zcash ZIP-316 Unified Address
37
37
  var ZcashUnifiedAddress_js_1 = require("./ZcashUnifiedAddress.js");
38
38
  Object.defineProperty(exports, "ZcashUnifiedAddress", { enumerable: true, get: function () { return ZcashUnifiedAddress_js_1.ZcashUnifiedAddress; } });
39
+ // Zcash v6 (Ironwood / NU6.3) transaction
40
+ var ZcashV6Transaction_js_1 = require("./ZcashV6Transaction.js");
41
+ Object.defineProperty(exports, "ZcashV6Transaction", { enumerable: true, get: function () { return ZcashV6Transaction_js_1.ZcashV6Transaction; } });
39
42
  /**
40
43
  * Check if a network supports a given fixed-script wallet script type
41
44
  *
@@ -1621,6 +1621,64 @@ export class ZcashUnifiedAddress {
1621
1621
  readonly transparentScript: Uint8Array | undefined;
1622
1622
  }
1623
1623
 
1624
+ /**
1625
+ * A parsed Zcash v6 (Ironwood / NU6.3) transaction — for inspection and txid.
1626
+ *
1627
+ * This wraps the raw v6 wire codec. The transaction id is exposed as an instance
1628
+ * method [`ZcashV6Transaction::get_id`] (canonical display-order hex), matching the
1629
+ * `getId()` convention used by the other transaction/PSBT wrappers, so callers never
1630
+ * pass raw bytes to a txid function or juggle internal vs display byte order.
1631
+ */
1632
+ export class ZcashV6Transaction {
1633
+ private constructor();
1634
+ free(): void;
1635
+ [Symbol.dispose](): void;
1636
+ /**
1637
+ * Decode a v6 transaction from raw wire bytes. Throws if the bytes are not a
1638
+ * valid v6 (Ironwood) transaction.
1639
+ */
1640
+ static fromBytes(bytes: Uint8Array): ZcashV6Transaction;
1641
+ /**
1642
+ * The canonical (display-order) ZIP-244 txid as a lowercase hex string.
1643
+ *
1644
+ * `Txid`'s `Display` emits display-order (byte-reversed) hex, matching how a
1645
+ * transaction id is printed everywhere else in the codebase.
1646
+ */
1647
+ getId(): string;
1648
+ /**
1649
+ * Serialize back to raw v6 wire bytes.
1650
+ */
1651
+ toBytes(): Uint8Array;
1652
+ /**
1653
+ * The ZIP-244 txid in internal (non-reversed) byte order.
1654
+ */
1655
+ txidBytes(): Uint8Array;
1656
+ /**
1657
+ * Consensus branch id carried in the v6 header.
1658
+ */
1659
+ readonly consensusBranchId: number;
1660
+ /**
1661
+ * Expiry height.
1662
+ */
1663
+ readonly expiryHeight: number;
1664
+ /**
1665
+ * Number of Ironwood actions (0 when the Ironwood slot is empty).
1666
+ */
1667
+ readonly ironwoodActionCount: number;
1668
+ /**
1669
+ * The Ironwood note-commitment tree anchor (32 bytes), or `undefined`.
1670
+ */
1671
+ readonly ironwoodAnchor: Uint8Array | undefined;
1672
+ /**
1673
+ * The Ironwood bundle flag byte, or `undefined` when there is no bundle.
1674
+ */
1675
+ readonly ironwoodFlags: number | undefined;
1676
+ /**
1677
+ * Net value crossing the Ironwood pool boundary (0 when there is no bundle).
1678
+ */
1679
+ readonly ironwoodValueBalance: bigint;
1680
+ }
1681
+
1624
1682
  /**
1625
1683
  * Check if the inspect feature is enabled.
1626
1684
  *
@@ -6355,6 +6355,181 @@ class ZcashUnifiedAddress {
6355
6355
  if (Symbol.dispose) ZcashUnifiedAddress.prototype[Symbol.dispose] = ZcashUnifiedAddress.prototype.free;
6356
6356
  exports.ZcashUnifiedAddress = ZcashUnifiedAddress;
6357
6357
 
6358
+ /**
6359
+ * A parsed Zcash v6 (Ironwood / NU6.3) transaction — for inspection and txid.
6360
+ *
6361
+ * This wraps the raw v6 wire codec. The transaction id is exposed as an instance
6362
+ * method [`ZcashV6Transaction::get_id`] (canonical display-order hex), matching the
6363
+ * `getId()` convention used by the other transaction/PSBT wrappers, so callers never
6364
+ * pass raw bytes to a txid function or juggle internal vs display byte order.
6365
+ */
6366
+ class ZcashV6Transaction {
6367
+ static __wrap(ptr) {
6368
+ ptr = ptr >>> 0;
6369
+ const obj = Object.create(ZcashV6Transaction.prototype);
6370
+ obj.__wbg_ptr = ptr;
6371
+ ZcashV6TransactionFinalization.register(obj, obj.__wbg_ptr, obj);
6372
+ return obj;
6373
+ }
6374
+ __destroy_into_raw() {
6375
+ const ptr = this.__wbg_ptr;
6376
+ this.__wbg_ptr = 0;
6377
+ ZcashV6TransactionFinalization.unregister(this);
6378
+ return ptr;
6379
+ }
6380
+ free() {
6381
+ const ptr = this.__destroy_into_raw();
6382
+ wasm.__wbg_zcashv6transaction_free(ptr, 0);
6383
+ }
6384
+ /**
6385
+ * Consensus branch id carried in the v6 header.
6386
+ * @returns {number}
6387
+ */
6388
+ get consensusBranchId() {
6389
+ const ret = wasm.zcashv6transaction_consensusBranchId(this.__wbg_ptr);
6390
+ return ret >>> 0;
6391
+ }
6392
+ /**
6393
+ * Expiry height.
6394
+ * @returns {number}
6395
+ */
6396
+ get expiryHeight() {
6397
+ const ret = wasm.zcashv6transaction_expiryHeight(this.__wbg_ptr);
6398
+ return ret >>> 0;
6399
+ }
6400
+ /**
6401
+ * Decode a v6 transaction from raw wire bytes. Throws if the bytes are not a
6402
+ * valid v6 (Ironwood) transaction.
6403
+ * @param {Uint8Array} bytes
6404
+ * @returns {ZcashV6Transaction}
6405
+ */
6406
+ static fromBytes(bytes) {
6407
+ try {
6408
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6409
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
6410
+ const len0 = WASM_VECTOR_LEN;
6411
+ wasm.zcashv6transaction_fromBytes(retptr, ptr0, len0);
6412
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6413
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6414
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6415
+ if (r2) {
6416
+ throw takeObject(r1);
6417
+ }
6418
+ return ZcashV6Transaction.__wrap(r0);
6419
+ } finally {
6420
+ wasm.__wbindgen_add_to_stack_pointer(16);
6421
+ }
6422
+ }
6423
+ /**
6424
+ * The canonical (display-order) ZIP-244 txid as a lowercase hex string.
6425
+ *
6426
+ * `Txid`'s `Display` emits display-order (byte-reversed) hex, matching how a
6427
+ * transaction id is printed everywhere else in the codebase.
6428
+ * @returns {string}
6429
+ */
6430
+ getId() {
6431
+ let deferred1_0;
6432
+ let deferred1_1;
6433
+ try {
6434
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6435
+ wasm.zcashv6transaction_getId(retptr, this.__wbg_ptr);
6436
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6437
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6438
+ deferred1_0 = r0;
6439
+ deferred1_1 = r1;
6440
+ return getStringFromWasm0(r0, r1);
6441
+ } finally {
6442
+ wasm.__wbindgen_add_to_stack_pointer(16);
6443
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
6444
+ }
6445
+ }
6446
+ /**
6447
+ * Number of Ironwood actions (0 when the Ironwood slot is empty).
6448
+ * @returns {number}
6449
+ */
6450
+ get ironwoodActionCount() {
6451
+ const ret = wasm.zcashv6transaction_ironwoodActionCount(this.__wbg_ptr);
6452
+ return ret >>> 0;
6453
+ }
6454
+ /**
6455
+ * The Ironwood note-commitment tree anchor (32 bytes), or `undefined`.
6456
+ * @returns {Uint8Array | undefined}
6457
+ */
6458
+ get ironwoodAnchor() {
6459
+ try {
6460
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6461
+ wasm.zcashv6transaction_ironwoodAnchor(retptr, this.__wbg_ptr);
6462
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6463
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6464
+ let v1;
6465
+ if (r0 !== 0) {
6466
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
6467
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
6468
+ }
6469
+ return v1;
6470
+ } finally {
6471
+ wasm.__wbindgen_add_to_stack_pointer(16);
6472
+ }
6473
+ }
6474
+ /**
6475
+ * The Ironwood bundle flag byte, or `undefined` when there is no bundle.
6476
+ * @returns {number | undefined}
6477
+ */
6478
+ get ironwoodFlags() {
6479
+ const ret = wasm.zcashv6transaction_ironwoodFlags(this.__wbg_ptr);
6480
+ return ret === 0xFFFFFF ? undefined : ret;
6481
+ }
6482
+ /**
6483
+ * Net value crossing the Ironwood pool boundary (0 when there is no bundle).
6484
+ * @returns {bigint}
6485
+ */
6486
+ get ironwoodValueBalance() {
6487
+ const ret = wasm.zcashv6transaction_ironwoodValueBalance(this.__wbg_ptr);
6488
+ return ret;
6489
+ }
6490
+ /**
6491
+ * Serialize back to raw v6 wire bytes.
6492
+ * @returns {Uint8Array}
6493
+ */
6494
+ toBytes() {
6495
+ try {
6496
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6497
+ wasm.zcashv6transaction_toBytes(retptr, this.__wbg_ptr);
6498
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6499
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6500
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
6501
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
6502
+ if (r3) {
6503
+ throw takeObject(r2);
6504
+ }
6505
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
6506
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
6507
+ return v1;
6508
+ } finally {
6509
+ wasm.__wbindgen_add_to_stack_pointer(16);
6510
+ }
6511
+ }
6512
+ /**
6513
+ * The ZIP-244 txid in internal (non-reversed) byte order.
6514
+ * @returns {Uint8Array}
6515
+ */
6516
+ txidBytes() {
6517
+ try {
6518
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
6519
+ wasm.zcashv6transaction_txidBytes(retptr, this.__wbg_ptr);
6520
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
6521
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
6522
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
6523
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
6524
+ return v1;
6525
+ } finally {
6526
+ wasm.__wbindgen_add_to_stack_pointer(16);
6527
+ }
6528
+ }
6529
+ }
6530
+ if (Symbol.dispose) ZcashV6Transaction.prototype[Symbol.dispose] = ZcashV6Transaction.prototype.free;
6531
+ exports.ZcashV6Transaction = ZcashV6Transaction;
6532
+
6358
6533
  /**
6359
6534
  * Check if the inspect feature is enabled.
6360
6535
  *
@@ -6858,6 +7033,9 @@ const WrapPsbtFinalization = (typeof FinalizationRegistry === 'undefined')
6858
7033
  const ZcashUnifiedAddressFinalization = (typeof FinalizationRegistry === 'undefined')
6859
7034
  ? { register: () => {}, unregister: () => {} }
6860
7035
  : new FinalizationRegistry(ptr => wasm.__wbg_zcashunifiedaddress_free(ptr >>> 0, 1));
7036
+ const ZcashV6TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
7037
+ ? { register: () => {}, unregister: () => {} }
7038
+ : new FinalizationRegistry(ptr => wasm.__wbg_zcashv6transaction_free(ptr >>> 0, 1));
6861
7039
 
6862
7040
  function addHeapObject(obj) {
6863
7041
  if (heap_next === heap.length) heap.push(heap.length + 1);
Binary file