@bitgo/wasm-utxo 1.16.0 → 1.18.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.
package/README.md CHANGED
@@ -20,7 +20,7 @@ This project is under active development.
20
20
  | Descriptor Wallet: Address Support | ✅ Complete | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 |
21
21
  | Descriptor Wallet: Transaction Support | ✅ Complete | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 |
22
22
  | FixedScript Wallet: Address Generation | ✅ Complete | ✅ Complete | ✅ Complete | ✅ Complete | ✅ Complete | ✅ Complete | ✅ Complete |
23
- | FixedScript Wallet: Transaction Support | ✅ Complete | ✅ Complete | ✅ Complete | TODO | TODO | ✅ Complete | ✅ Complete |
23
+ | FixedScript Wallet: Transaction Support | ✅ Complete | ✅ Complete | ✅ Complete | Complete | Complete | ✅ Complete | ✅ Complete |
24
24
 
25
25
  ### Zcash Features
26
26
 
@@ -39,3 +39,4 @@ declare module "./wasm/wasm_utxo.js" {
39
39
  export { WrapDescriptor as Descriptor } from "./wasm/wasm_utxo.js";
40
40
  export { WrapMiniscript as Miniscript } from "./wasm/wasm_utxo.js";
41
41
  export { WrapPsbt as Psbt } from "./wasm/wasm_utxo.js";
42
+ export { DashTransaction, Transaction, ZcashTransaction } from "./transaction.js";
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.Psbt = exports.Miniscript = exports.Descriptor = exports.BIP32 = exports.ECPair = exports.ecpair = exports.bip32 = exports.fixedScriptWallet = exports.utxolibCompat = exports.ast = exports.address = void 0;
36
+ exports.ZcashTransaction = exports.Transaction = exports.DashTransaction = exports.Psbt = exports.Miniscript = exports.Descriptor = exports.BIP32 = exports.ECPair = exports.ecpair = exports.bip32 = exports.fixedScriptWallet = exports.utxolibCompat = exports.ast = exports.address = void 0;
37
37
  const wasm = __importStar(require("./wasm/wasm_utxo.js"));
38
38
  // we need to access the wasm module here, otherwise webpack gets all weird
39
39
  // and forgets to include it in the bundle
@@ -57,3 +57,7 @@ var wasm_utxo_js_2 = require("./wasm/wasm_utxo.js");
57
57
  Object.defineProperty(exports, "Miniscript", { enumerable: true, get: function () { return wasm_utxo_js_2.WrapMiniscript; } });
58
58
  var wasm_utxo_js_3 = require("./wasm/wasm_utxo.js");
59
59
  Object.defineProperty(exports, "Psbt", { enumerable: true, get: function () { return wasm_utxo_js_3.WrapPsbt; } });
60
+ var transaction_js_1 = require("./transaction.js");
61
+ Object.defineProperty(exports, "DashTransaction", { enumerable: true, get: function () { return transaction_js_1.DashTransaction; } });
62
+ Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return transaction_js_1.Transaction; } });
63
+ Object.defineProperty(exports, "ZcashTransaction", { enumerable: true, get: function () { return transaction_js_1.ZcashTransaction; } });
@@ -0,0 +1,46 @@
1
+ import { WasmDashTransaction, WasmTransaction, WasmZcashTransaction } from "./wasm/wasm_utxo.js";
2
+ /**
3
+ * Transaction wrapper (Bitcoin-like networks)
4
+ *
5
+ * Provides a camelCase, strongly-typed API over the snake_case WASM bindings.
6
+ */
7
+ export declare class Transaction {
8
+ private _wasm;
9
+ private constructor();
10
+ static fromBytes(bytes: Uint8Array): Transaction;
11
+ toBytes(): Uint8Array;
12
+ /**
13
+ * @internal
14
+ */
15
+ get wasm(): WasmTransaction;
16
+ }
17
+ /**
18
+ * Zcash Transaction wrapper
19
+ *
20
+ * Provides a camelCase, strongly-typed API over the snake_case WASM bindings.
21
+ */
22
+ export declare class ZcashTransaction {
23
+ private _wasm;
24
+ private constructor();
25
+ static fromBytes(bytes: Uint8Array): ZcashTransaction;
26
+ toBytes(): Uint8Array;
27
+ /**
28
+ * @internal
29
+ */
30
+ get wasm(): WasmZcashTransaction;
31
+ }
32
+ /**
33
+ * Dash Transaction wrapper (supports EVO special transactions)
34
+ *
35
+ * Round-trip only: bytes -> parse -> bytes.
36
+ */
37
+ export declare class DashTransaction {
38
+ private _wasm;
39
+ private constructor();
40
+ static fromBytes(bytes: Uint8Array): DashTransaction;
41
+ toBytes(): Uint8Array;
42
+ /**
43
+ * @internal
44
+ */
45
+ get wasm(): WasmDashTransaction;
46
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DashTransaction = exports.ZcashTransaction = exports.Transaction = void 0;
4
+ const wasm_utxo_js_1 = require("./wasm/wasm_utxo.js");
5
+ /**
6
+ * Transaction wrapper (Bitcoin-like networks)
7
+ *
8
+ * Provides a camelCase, strongly-typed API over the snake_case WASM bindings.
9
+ */
10
+ class Transaction {
11
+ _wasm;
12
+ constructor(_wasm) {
13
+ this._wasm = _wasm;
14
+ }
15
+ static fromBytes(bytes) {
16
+ return new Transaction(wasm_utxo_js_1.WasmTransaction.from_bytes(bytes));
17
+ }
18
+ toBytes() {
19
+ return this._wasm.to_bytes();
20
+ }
21
+ /**
22
+ * @internal
23
+ */
24
+ get wasm() {
25
+ return this._wasm;
26
+ }
27
+ }
28
+ exports.Transaction = Transaction;
29
+ /**
30
+ * Zcash Transaction wrapper
31
+ *
32
+ * Provides a camelCase, strongly-typed API over the snake_case WASM bindings.
33
+ */
34
+ class ZcashTransaction {
35
+ _wasm;
36
+ constructor(_wasm) {
37
+ this._wasm = _wasm;
38
+ }
39
+ static fromBytes(bytes) {
40
+ return new ZcashTransaction(wasm_utxo_js_1.WasmZcashTransaction.from_bytes(bytes));
41
+ }
42
+ toBytes() {
43
+ return this._wasm.to_bytes();
44
+ }
45
+ /**
46
+ * @internal
47
+ */
48
+ get wasm() {
49
+ return this._wasm;
50
+ }
51
+ }
52
+ exports.ZcashTransaction = ZcashTransaction;
53
+ /**
54
+ * Dash Transaction wrapper (supports EVO special transactions)
55
+ *
56
+ * Round-trip only: bytes -> parse -> bytes.
57
+ */
58
+ class DashTransaction {
59
+ _wasm;
60
+ constructor(_wasm) {
61
+ this._wasm = _wasm;
62
+ }
63
+ static fromBytes(bytes) {
64
+ return new DashTransaction(wasm_utxo_js_1.WasmDashTransaction.from_bytes(bytes));
65
+ }
66
+ toBytes() {
67
+ return this._wasm.to_bytes();
68
+ }
69
+ /**
70
+ * @internal
71
+ */
72
+ get wasm() {
73
+ return this._wasm;
74
+ }
75
+ }
76
+ exports.DashTransaction = DashTransaction;
@@ -148,7 +148,7 @@ export class BitGoPsbt {
148
148
  * Extract the final transaction from a finalized PSBT
149
149
  *
150
150
  * This method should be called after all inputs have been finalized.
151
- * It extracts the fully signed transaction.
151
+ * It extracts the fully signed transaction with network-appropriate serialization.
152
152
  *
153
153
  * # Returns
154
154
  * - `Ok(Vec<u8>)` containing the serialized transaction bytes
@@ -488,6 +488,20 @@ export class WasmBIP32 {
488
488
  readonly index: number;
489
489
  }
490
490
 
491
+ export class WasmDashTransaction {
492
+ private constructor();
493
+ free(): void;
494
+ [Symbol.dispose](): void;
495
+ /**
496
+ * Deserialize a Dash transaction from bytes (supports EVO special tx extra payload).
497
+ */
498
+ static from_bytes(bytes: Uint8Array): WasmDashTransaction;
499
+ /**
500
+ * Serialize the Dash transaction to bytes (preserving tx_type and extra payload).
501
+ */
502
+ to_bytes(): Uint8Array;
503
+ }
504
+
491
505
  export class WasmECPair {
492
506
  private constructor();
493
507
  free(): void;
@@ -591,6 +605,58 @@ export class WasmRootWalletKeys {
591
605
  bitgo_key(): WasmBIP32;
592
606
  }
593
607
 
608
+ export class WasmTransaction {
609
+ private constructor();
610
+ free(): void;
611
+ [Symbol.dispose](): void;
612
+ /**
613
+ * Deserialize a transaction from bytes
614
+ *
615
+ * # Arguments
616
+ * * `bytes` - The serialized transaction bytes
617
+ *
618
+ * # Returns
619
+ * A WasmTransaction instance
620
+ *
621
+ * # Errors
622
+ * Returns an error if the bytes cannot be parsed as a valid transaction
623
+ */
624
+ static from_bytes(bytes: Uint8Array): WasmTransaction;
625
+ /**
626
+ * Serialize the transaction to bytes
627
+ *
628
+ * # Returns
629
+ * The serialized transaction bytes
630
+ */
631
+ to_bytes(): Uint8Array;
632
+ }
633
+
634
+ export class WasmZcashTransaction {
635
+ private constructor();
636
+ free(): void;
637
+ [Symbol.dispose](): void;
638
+ /**
639
+ * Deserialize a Zcash transaction from bytes
640
+ *
641
+ * # Arguments
642
+ * * `bytes` - The serialized transaction bytes
643
+ *
644
+ * # Returns
645
+ * A WasmZcashTransaction instance
646
+ *
647
+ * # Errors
648
+ * Returns an error if the bytes cannot be parsed as a valid Zcash transaction
649
+ */
650
+ static from_bytes(bytes: Uint8Array): WasmZcashTransaction;
651
+ /**
652
+ * Serialize the transaction to bytes
653
+ *
654
+ * # Returns
655
+ * The serialized transaction bytes
656
+ */
657
+ to_bytes(): Uint8Array;
658
+ }
659
+
594
660
  export class WrapDescriptor {
595
661
  private constructor();
596
662
  free(): void;
@@ -177,6 +177,10 @@ const WasmBIP32Finalization = (typeof FinalizationRegistry === 'undefined')
177
177
  ? { register: () => {}, unregister: () => {} }
178
178
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmbip32_free(ptr >>> 0, 1));
179
179
 
180
+ const WasmDashTransactionFinalization = (typeof FinalizationRegistry === 'undefined')
181
+ ? { register: () => {}, unregister: () => {} }
182
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmdashtransaction_free(ptr >>> 0, 1));
183
+
180
184
  const WasmECPairFinalization = (typeof FinalizationRegistry === 'undefined')
181
185
  ? { register: () => {}, unregister: () => {} }
182
186
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmecpair_free(ptr >>> 0, 1));
@@ -189,6 +193,14 @@ const WasmRootWalletKeysFinalization = (typeof FinalizationRegistry === 'undefin
189
193
  ? { register: () => {}, unregister: () => {} }
190
194
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmrootwalletkeys_free(ptr >>> 0, 1));
191
195
 
196
+ const WasmTransactionFinalization = (typeof FinalizationRegistry === 'undefined')
197
+ ? { register: () => {}, unregister: () => {} }
198
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmtransaction_free(ptr >>> 0, 1));
199
+
200
+ const WasmZcashTransactionFinalization = (typeof FinalizationRegistry === 'undefined')
201
+ ? { register: () => {}, unregister: () => {} }
202
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmzcashtransaction_free(ptr >>> 0, 1));
203
+
192
204
  const WrapDescriptorFinalization = (typeof FinalizationRegistry === 'undefined')
193
205
  ? { register: () => {}, unregister: () => {} }
194
206
  : new FinalizationRegistry(ptr => wasm.__wbg_wrapdescriptor_free(ptr >>> 0, 1));
@@ -627,7 +639,7 @@ class BitGoPsbt {
627
639
  * Extract the final transaction from a finalized PSBT
628
640
  *
629
641
  * This method should be called after all inputs have been finalized.
630
- * It extracts the fully signed transaction.
642
+ * It extracts the fully signed transaction with network-appropriate serialization.
631
643
  *
632
644
  * # Returns
633
645
  * - `Ok(Vec<u8>)` containing the serialized transaction bytes
@@ -1654,6 +1666,75 @@ class WasmBIP32 {
1654
1666
  if (Symbol.dispose) WasmBIP32.prototype[Symbol.dispose] = WasmBIP32.prototype.free;
1655
1667
  exports.WasmBIP32 = WasmBIP32;
1656
1668
 
1669
+ /**
1670
+ * Dash transaction wrapper that supports Dash special transactions (EVO) by preserving extra payload.
1671
+ */
1672
+ class WasmDashTransaction {
1673
+ static __wrap(ptr) {
1674
+ ptr = ptr >>> 0;
1675
+ const obj = Object.create(WasmDashTransaction.prototype);
1676
+ obj.__wbg_ptr = ptr;
1677
+ WasmDashTransactionFinalization.register(obj, obj.__wbg_ptr, obj);
1678
+ return obj;
1679
+ }
1680
+ __destroy_into_raw() {
1681
+ const ptr = this.__wbg_ptr;
1682
+ this.__wbg_ptr = 0;
1683
+ WasmDashTransactionFinalization.unregister(this);
1684
+ return ptr;
1685
+ }
1686
+ free() {
1687
+ const ptr = this.__destroy_into_raw();
1688
+ wasm.__wbg_wasmdashtransaction_free(ptr, 0);
1689
+ }
1690
+ /**
1691
+ * Deserialize a Dash transaction from bytes (supports EVO special tx extra payload).
1692
+ * @param {Uint8Array} bytes
1693
+ * @returns {WasmDashTransaction}
1694
+ */
1695
+ static from_bytes(bytes) {
1696
+ try {
1697
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1698
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1699
+ const len0 = WASM_VECTOR_LEN;
1700
+ wasm.wasmdashtransaction_from_bytes(retptr, ptr0, len0);
1701
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1702
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1703
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1704
+ if (r2) {
1705
+ throw takeObject(r1);
1706
+ }
1707
+ return WasmDashTransaction.__wrap(r0);
1708
+ } finally {
1709
+ wasm.__wbindgen_add_to_stack_pointer(16);
1710
+ }
1711
+ }
1712
+ /**
1713
+ * Serialize the Dash transaction to bytes (preserving tx_type and extra payload).
1714
+ * @returns {Uint8Array}
1715
+ */
1716
+ to_bytes() {
1717
+ try {
1718
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1719
+ wasm.wasmdashtransaction_to_bytes(retptr, this.__wbg_ptr);
1720
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1721
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1722
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1723
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1724
+ if (r3) {
1725
+ throw takeObject(r2);
1726
+ }
1727
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1728
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1729
+ return v1;
1730
+ } finally {
1731
+ wasm.__wbindgen_add_to_stack_pointer(16);
1732
+ }
1733
+ }
1734
+ }
1735
+ if (Symbol.dispose) WasmDashTransaction.prototype[Symbol.dispose] = WasmDashTransaction.prototype.free;
1736
+ exports.WasmDashTransaction = WasmDashTransaction;
1737
+
1657
1738
  /**
1658
1739
  * WASM wrapper for elliptic curve key pairs (always uses compressed keys)
1659
1740
  */
@@ -2102,6 +2183,169 @@ class WasmRootWalletKeys {
2102
2183
  if (Symbol.dispose) WasmRootWalletKeys.prototype[Symbol.dispose] = WasmRootWalletKeys.prototype.free;
2103
2184
  exports.WasmRootWalletKeys = WasmRootWalletKeys;
2104
2185
 
2186
+ /**
2187
+ * A Bitcoin-like transaction (for all networks except Zcash)
2188
+ *
2189
+ * This class provides basic transaction parsing and serialization for testing
2190
+ * compatibility with third-party transaction fixtures.
2191
+ */
2192
+ class WasmTransaction {
2193
+ static __wrap(ptr) {
2194
+ ptr = ptr >>> 0;
2195
+ const obj = Object.create(WasmTransaction.prototype);
2196
+ obj.__wbg_ptr = ptr;
2197
+ WasmTransactionFinalization.register(obj, obj.__wbg_ptr, obj);
2198
+ return obj;
2199
+ }
2200
+ __destroy_into_raw() {
2201
+ const ptr = this.__wbg_ptr;
2202
+ this.__wbg_ptr = 0;
2203
+ WasmTransactionFinalization.unregister(this);
2204
+ return ptr;
2205
+ }
2206
+ free() {
2207
+ const ptr = this.__destroy_into_raw();
2208
+ wasm.__wbg_wasmtransaction_free(ptr, 0);
2209
+ }
2210
+ /**
2211
+ * Deserialize a transaction from bytes
2212
+ *
2213
+ * # Arguments
2214
+ * * `bytes` - The serialized transaction bytes
2215
+ *
2216
+ * # Returns
2217
+ * A WasmTransaction instance
2218
+ *
2219
+ * # Errors
2220
+ * Returns an error if the bytes cannot be parsed as a valid transaction
2221
+ * @param {Uint8Array} bytes
2222
+ * @returns {WasmTransaction}
2223
+ */
2224
+ static from_bytes(bytes) {
2225
+ try {
2226
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2227
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2228
+ const len0 = WASM_VECTOR_LEN;
2229
+ wasm.wasmtransaction_from_bytes(retptr, ptr0, len0);
2230
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2231
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2232
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2233
+ if (r2) {
2234
+ throw takeObject(r1);
2235
+ }
2236
+ return WasmTransaction.__wrap(r0);
2237
+ } finally {
2238
+ wasm.__wbindgen_add_to_stack_pointer(16);
2239
+ }
2240
+ }
2241
+ /**
2242
+ * Serialize the transaction to bytes
2243
+ *
2244
+ * # Returns
2245
+ * The serialized transaction bytes
2246
+ * @returns {Uint8Array}
2247
+ */
2248
+ to_bytes() {
2249
+ try {
2250
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2251
+ wasm.wasmtransaction_to_bytes(retptr, this.__wbg_ptr);
2252
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2253
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2254
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2255
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
2256
+ return v1;
2257
+ } finally {
2258
+ wasm.__wbindgen_add_to_stack_pointer(16);
2259
+ }
2260
+ }
2261
+ }
2262
+ if (Symbol.dispose) WasmTransaction.prototype[Symbol.dispose] = WasmTransaction.prototype.free;
2263
+ exports.WasmTransaction = WasmTransaction;
2264
+
2265
+ /**
2266
+ * A Zcash transaction with network-specific fields
2267
+ *
2268
+ * This class provides basic transaction parsing and serialization for Zcash
2269
+ * transactions, which use the Overwinter transaction format.
2270
+ */
2271
+ class WasmZcashTransaction {
2272
+ static __wrap(ptr) {
2273
+ ptr = ptr >>> 0;
2274
+ const obj = Object.create(WasmZcashTransaction.prototype);
2275
+ obj.__wbg_ptr = ptr;
2276
+ WasmZcashTransactionFinalization.register(obj, obj.__wbg_ptr, obj);
2277
+ return obj;
2278
+ }
2279
+ __destroy_into_raw() {
2280
+ const ptr = this.__wbg_ptr;
2281
+ this.__wbg_ptr = 0;
2282
+ WasmZcashTransactionFinalization.unregister(this);
2283
+ return ptr;
2284
+ }
2285
+ free() {
2286
+ const ptr = this.__destroy_into_raw();
2287
+ wasm.__wbg_wasmzcashtransaction_free(ptr, 0);
2288
+ }
2289
+ /**
2290
+ * Deserialize a Zcash transaction from bytes
2291
+ *
2292
+ * # Arguments
2293
+ * * `bytes` - The serialized transaction bytes
2294
+ *
2295
+ * # Returns
2296
+ * A WasmZcashTransaction instance
2297
+ *
2298
+ * # Errors
2299
+ * Returns an error if the bytes cannot be parsed as a valid Zcash transaction
2300
+ * @param {Uint8Array} bytes
2301
+ * @returns {WasmZcashTransaction}
2302
+ */
2303
+ static from_bytes(bytes) {
2304
+ try {
2305
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2306
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2307
+ const len0 = WASM_VECTOR_LEN;
2308
+ wasm.wasmzcashtransaction_from_bytes(retptr, ptr0, len0);
2309
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2310
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2311
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2312
+ if (r2) {
2313
+ throw takeObject(r1);
2314
+ }
2315
+ return WasmZcashTransaction.__wrap(r0);
2316
+ } finally {
2317
+ wasm.__wbindgen_add_to_stack_pointer(16);
2318
+ }
2319
+ }
2320
+ /**
2321
+ * Serialize the transaction to bytes
2322
+ *
2323
+ * # Returns
2324
+ * The serialized transaction bytes
2325
+ * @returns {Uint8Array}
2326
+ */
2327
+ to_bytes() {
2328
+ try {
2329
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2330
+ wasm.wasmzcashtransaction_to_bytes(retptr, this.__wbg_ptr);
2331
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2332
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2333
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2334
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2335
+ if (r3) {
2336
+ throw takeObject(r2);
2337
+ }
2338
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2339
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
2340
+ return v1;
2341
+ } finally {
2342
+ wasm.__wbindgen_add_to_stack_pointer(16);
2343
+ }
2344
+ }
2345
+ }
2346
+ if (Symbol.dispose) WasmZcashTransaction.prototype[Symbol.dispose] = WasmZcashTransaction.prototype.free;
2347
+ exports.WasmZcashTransaction = WasmZcashTransaction;
2348
+
2105
2349
  class WrapDescriptor {
2106
2350
  static __wrap(ptr) {
2107
2351
  ptr = ptr >>> 0;
Binary file
@@ -13,12 +13,28 @@ export const wrapdescriptor_node: (a: number, b: number) => void;
13
13
  export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
14
14
  export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
15
15
  export const wrapdescriptor_toString: (a: number, b: number) => void;
16
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
17
+ export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
18
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
19
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
20
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
21
+ export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
22
+ export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
23
+ export const wrapminiscript_encode: (a: number, b: number) => void;
24
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
25
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
26
+ export const wrapminiscript_node: (a: number, b: number) => void;
27
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
28
+ export const wrapminiscript_toString: (a: number, b: number) => void;
16
29
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
17
30
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
18
31
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
19
32
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
20
33
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
34
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
21
35
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
36
+ export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
37
+ export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
22
38
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
23
39
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
24
40
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
@@ -82,11 +98,18 @@ export const wasmecpair_public_key: (a: number) => number;
82
98
  export const wasmecpair_to_wif: (a: number, b: number) => void;
83
99
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
84
100
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
101
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
102
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
103
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
85
104
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
86
105
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
87
106
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
88
107
  export const wasmrootwalletkeys_user_key: (a: number) => number;
89
108
  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;
109
+ export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
110
+ export const wasmtransaction_to_bytes: (a: number, b: number) => void;
111
+ export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
112
+ export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
90
113
  export const wrappsbt_clone: (a: number) => number;
91
114
  export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
92
115
  export const wrappsbt_finalize: (a: number, b: number) => void;
@@ -96,20 +119,6 @@ export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number)
96
119
  export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
97
120
  export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
98
121
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
99
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
100
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
101
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
102
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
103
- export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
104
- export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
105
- export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
106
- export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
107
- export const wrapminiscript_encode: (a: number, b: number) => void;
108
- export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
109
- export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
110
- export const wrapminiscript_node: (a: number, b: number) => void;
111
- export const wrapminiscript_toAsmString: (a: number, b: number) => void;
112
- export const wrapminiscript_toString: (a: number, b: number) => void;
113
122
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
114
123
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
115
124
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -39,3 +39,4 @@ declare module "./wasm/wasm_utxo.js" {
39
39
  export { WrapDescriptor as Descriptor } from "./wasm/wasm_utxo.js";
40
40
  export { WrapMiniscript as Miniscript } from "./wasm/wasm_utxo.js";
41
41
  export { WrapPsbt as Psbt } from "./wasm/wasm_utxo.js";
42
+ export { DashTransaction, Transaction, ZcashTransaction } from "./transaction.js";
@@ -16,3 +16,4 @@ export { BIP32 } from "./bip32.js";
16
16
  export { WrapDescriptor as Descriptor } from "./wasm/wasm_utxo.js";
17
17
  export { WrapMiniscript as Miniscript } from "./wasm/wasm_utxo.js";
18
18
  export { WrapPsbt as Psbt } from "./wasm/wasm_utxo.js";
19
+ export { DashTransaction, Transaction, ZcashTransaction } from "./transaction.js";
@@ -0,0 +1,46 @@
1
+ import { WasmDashTransaction, WasmTransaction, WasmZcashTransaction } from "./wasm/wasm_utxo.js";
2
+ /**
3
+ * Transaction wrapper (Bitcoin-like networks)
4
+ *
5
+ * Provides a camelCase, strongly-typed API over the snake_case WASM bindings.
6
+ */
7
+ export declare class Transaction {
8
+ private _wasm;
9
+ private constructor();
10
+ static fromBytes(bytes: Uint8Array): Transaction;
11
+ toBytes(): Uint8Array;
12
+ /**
13
+ * @internal
14
+ */
15
+ get wasm(): WasmTransaction;
16
+ }
17
+ /**
18
+ * Zcash Transaction wrapper
19
+ *
20
+ * Provides a camelCase, strongly-typed API over the snake_case WASM bindings.
21
+ */
22
+ export declare class ZcashTransaction {
23
+ private _wasm;
24
+ private constructor();
25
+ static fromBytes(bytes: Uint8Array): ZcashTransaction;
26
+ toBytes(): Uint8Array;
27
+ /**
28
+ * @internal
29
+ */
30
+ get wasm(): WasmZcashTransaction;
31
+ }
32
+ /**
33
+ * Dash Transaction wrapper (supports EVO special transactions)
34
+ *
35
+ * Round-trip only: bytes -> parse -> bytes.
36
+ */
37
+ export declare class DashTransaction {
38
+ private _wasm;
39
+ private constructor();
40
+ static fromBytes(bytes: Uint8Array): DashTransaction;
41
+ toBytes(): Uint8Array;
42
+ /**
43
+ * @internal
44
+ */
45
+ get wasm(): WasmDashTransaction;
46
+ }
@@ -0,0 +1,70 @@
1
+ import { WasmDashTransaction, WasmTransaction, WasmZcashTransaction } from "./wasm/wasm_utxo.js";
2
+ /**
3
+ * Transaction wrapper (Bitcoin-like networks)
4
+ *
5
+ * Provides a camelCase, strongly-typed API over the snake_case WASM bindings.
6
+ */
7
+ export class Transaction {
8
+ _wasm;
9
+ constructor(_wasm) {
10
+ this._wasm = _wasm;
11
+ }
12
+ static fromBytes(bytes) {
13
+ return new Transaction(WasmTransaction.from_bytes(bytes));
14
+ }
15
+ toBytes() {
16
+ return this._wasm.to_bytes();
17
+ }
18
+ /**
19
+ * @internal
20
+ */
21
+ get wasm() {
22
+ return this._wasm;
23
+ }
24
+ }
25
+ /**
26
+ * Zcash Transaction wrapper
27
+ *
28
+ * Provides a camelCase, strongly-typed API over the snake_case WASM bindings.
29
+ */
30
+ export class ZcashTransaction {
31
+ _wasm;
32
+ constructor(_wasm) {
33
+ this._wasm = _wasm;
34
+ }
35
+ static fromBytes(bytes) {
36
+ return new ZcashTransaction(WasmZcashTransaction.from_bytes(bytes));
37
+ }
38
+ toBytes() {
39
+ return this._wasm.to_bytes();
40
+ }
41
+ /**
42
+ * @internal
43
+ */
44
+ get wasm() {
45
+ return this._wasm;
46
+ }
47
+ }
48
+ /**
49
+ * Dash Transaction wrapper (supports EVO special transactions)
50
+ *
51
+ * Round-trip only: bytes -> parse -> bytes.
52
+ */
53
+ export class DashTransaction {
54
+ _wasm;
55
+ constructor(_wasm) {
56
+ this._wasm = _wasm;
57
+ }
58
+ static fromBytes(bytes) {
59
+ return new DashTransaction(WasmDashTransaction.from_bytes(bytes));
60
+ }
61
+ toBytes() {
62
+ return this._wasm.to_bytes();
63
+ }
64
+ /**
65
+ * @internal
66
+ */
67
+ get wasm() {
68
+ return this._wasm;
69
+ }
70
+ }
@@ -148,7 +148,7 @@ export class BitGoPsbt {
148
148
  * Extract the final transaction from a finalized PSBT
149
149
  *
150
150
  * This method should be called after all inputs have been finalized.
151
- * It extracts the fully signed transaction.
151
+ * It extracts the fully signed transaction with network-appropriate serialization.
152
152
  *
153
153
  * # Returns
154
154
  * - `Ok(Vec<u8>)` containing the serialized transaction bytes
@@ -488,6 +488,20 @@ export class WasmBIP32 {
488
488
  readonly index: number;
489
489
  }
490
490
 
491
+ export class WasmDashTransaction {
492
+ private constructor();
493
+ free(): void;
494
+ [Symbol.dispose](): void;
495
+ /**
496
+ * Deserialize a Dash transaction from bytes (supports EVO special tx extra payload).
497
+ */
498
+ static from_bytes(bytes: Uint8Array): WasmDashTransaction;
499
+ /**
500
+ * Serialize the Dash transaction to bytes (preserving tx_type and extra payload).
501
+ */
502
+ to_bytes(): Uint8Array;
503
+ }
504
+
491
505
  export class WasmECPair {
492
506
  private constructor();
493
507
  free(): void;
@@ -591,6 +605,58 @@ export class WasmRootWalletKeys {
591
605
  bitgo_key(): WasmBIP32;
592
606
  }
593
607
 
608
+ export class WasmTransaction {
609
+ private constructor();
610
+ free(): void;
611
+ [Symbol.dispose](): void;
612
+ /**
613
+ * Deserialize a transaction from bytes
614
+ *
615
+ * # Arguments
616
+ * * `bytes` - The serialized transaction bytes
617
+ *
618
+ * # Returns
619
+ * A WasmTransaction instance
620
+ *
621
+ * # Errors
622
+ * Returns an error if the bytes cannot be parsed as a valid transaction
623
+ */
624
+ static from_bytes(bytes: Uint8Array): WasmTransaction;
625
+ /**
626
+ * Serialize the transaction to bytes
627
+ *
628
+ * # Returns
629
+ * The serialized transaction bytes
630
+ */
631
+ to_bytes(): Uint8Array;
632
+ }
633
+
634
+ export class WasmZcashTransaction {
635
+ private constructor();
636
+ free(): void;
637
+ [Symbol.dispose](): void;
638
+ /**
639
+ * Deserialize a Zcash transaction from bytes
640
+ *
641
+ * # Arguments
642
+ * * `bytes` - The serialized transaction bytes
643
+ *
644
+ * # Returns
645
+ * A WasmZcashTransaction instance
646
+ *
647
+ * # Errors
648
+ * Returns an error if the bytes cannot be parsed as a valid Zcash transaction
649
+ */
650
+ static from_bytes(bytes: Uint8Array): WasmZcashTransaction;
651
+ /**
652
+ * Serialize the transaction to bytes
653
+ *
654
+ * # Returns
655
+ * The serialized transaction bytes
656
+ */
657
+ to_bytes(): Uint8Array;
658
+ }
659
+
594
660
  export class WrapDescriptor {
595
661
  private constructor();
596
662
  free(): void;
@@ -186,6 +186,10 @@ const WasmBIP32Finalization = (typeof FinalizationRegistry === 'undefined')
186
186
  ? { register: () => {}, unregister: () => {} }
187
187
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmbip32_free(ptr >>> 0, 1));
188
188
 
189
+ const WasmDashTransactionFinalization = (typeof FinalizationRegistry === 'undefined')
190
+ ? { register: () => {}, unregister: () => {} }
191
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmdashtransaction_free(ptr >>> 0, 1));
192
+
189
193
  const WasmECPairFinalization = (typeof FinalizationRegistry === 'undefined')
190
194
  ? { register: () => {}, unregister: () => {} }
191
195
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmecpair_free(ptr >>> 0, 1));
@@ -198,6 +202,14 @@ const WasmRootWalletKeysFinalization = (typeof FinalizationRegistry === 'undefin
198
202
  ? { register: () => {}, unregister: () => {} }
199
203
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmrootwalletkeys_free(ptr >>> 0, 1));
200
204
 
205
+ const WasmTransactionFinalization = (typeof FinalizationRegistry === 'undefined')
206
+ ? { register: () => {}, unregister: () => {} }
207
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmtransaction_free(ptr >>> 0, 1));
208
+
209
+ const WasmZcashTransactionFinalization = (typeof FinalizationRegistry === 'undefined')
210
+ ? { register: () => {}, unregister: () => {} }
211
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmzcashtransaction_free(ptr >>> 0, 1));
212
+
201
213
  const WrapDescriptorFinalization = (typeof FinalizationRegistry === 'undefined')
202
214
  ? { register: () => {}, unregister: () => {} }
203
215
  : new FinalizationRegistry(ptr => wasm.__wbg_wrapdescriptor_free(ptr >>> 0, 1));
@@ -635,7 +647,7 @@ export class BitGoPsbt {
635
647
  * Extract the final transaction from a finalized PSBT
636
648
  *
637
649
  * This method should be called after all inputs have been finalized.
638
- * It extracts the fully signed transaction.
650
+ * It extracts the fully signed transaction with network-appropriate serialization.
639
651
  *
640
652
  * # Returns
641
653
  * - `Ok(Vec<u8>)` containing the serialized transaction bytes
@@ -1658,6 +1670,74 @@ export class WasmBIP32 {
1658
1670
  }
1659
1671
  if (Symbol.dispose) WasmBIP32.prototype[Symbol.dispose] = WasmBIP32.prototype.free;
1660
1672
 
1673
+ /**
1674
+ * Dash transaction wrapper that supports Dash special transactions (EVO) by preserving extra payload.
1675
+ */
1676
+ export class WasmDashTransaction {
1677
+ static __wrap(ptr) {
1678
+ ptr = ptr >>> 0;
1679
+ const obj = Object.create(WasmDashTransaction.prototype);
1680
+ obj.__wbg_ptr = ptr;
1681
+ WasmDashTransactionFinalization.register(obj, obj.__wbg_ptr, obj);
1682
+ return obj;
1683
+ }
1684
+ __destroy_into_raw() {
1685
+ const ptr = this.__wbg_ptr;
1686
+ this.__wbg_ptr = 0;
1687
+ WasmDashTransactionFinalization.unregister(this);
1688
+ return ptr;
1689
+ }
1690
+ free() {
1691
+ const ptr = this.__destroy_into_raw();
1692
+ wasm.__wbg_wasmdashtransaction_free(ptr, 0);
1693
+ }
1694
+ /**
1695
+ * Deserialize a Dash transaction from bytes (supports EVO special tx extra payload).
1696
+ * @param {Uint8Array} bytes
1697
+ * @returns {WasmDashTransaction}
1698
+ */
1699
+ static from_bytes(bytes) {
1700
+ try {
1701
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1702
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
1703
+ const len0 = WASM_VECTOR_LEN;
1704
+ wasm.wasmdashtransaction_from_bytes(retptr, ptr0, len0);
1705
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1706
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1707
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1708
+ if (r2) {
1709
+ throw takeObject(r1);
1710
+ }
1711
+ return WasmDashTransaction.__wrap(r0);
1712
+ } finally {
1713
+ wasm.__wbindgen_add_to_stack_pointer(16);
1714
+ }
1715
+ }
1716
+ /**
1717
+ * Serialize the Dash transaction to bytes (preserving tx_type and extra payload).
1718
+ * @returns {Uint8Array}
1719
+ */
1720
+ to_bytes() {
1721
+ try {
1722
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1723
+ wasm.wasmdashtransaction_to_bytes(retptr, this.__wbg_ptr);
1724
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1725
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1726
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1727
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1728
+ if (r3) {
1729
+ throw takeObject(r2);
1730
+ }
1731
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1732
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1733
+ return v1;
1734
+ } finally {
1735
+ wasm.__wbindgen_add_to_stack_pointer(16);
1736
+ }
1737
+ }
1738
+ }
1739
+ if (Symbol.dispose) WasmDashTransaction.prototype[Symbol.dispose] = WasmDashTransaction.prototype.free;
1740
+
1661
1741
  /**
1662
1742
  * WASM wrapper for elliptic curve key pairs (always uses compressed keys)
1663
1743
  */
@@ -2103,6 +2183,167 @@ export class WasmRootWalletKeys {
2103
2183
  }
2104
2184
  if (Symbol.dispose) WasmRootWalletKeys.prototype[Symbol.dispose] = WasmRootWalletKeys.prototype.free;
2105
2185
 
2186
+ /**
2187
+ * A Bitcoin-like transaction (for all networks except Zcash)
2188
+ *
2189
+ * This class provides basic transaction parsing and serialization for testing
2190
+ * compatibility with third-party transaction fixtures.
2191
+ */
2192
+ export class WasmTransaction {
2193
+ static __wrap(ptr) {
2194
+ ptr = ptr >>> 0;
2195
+ const obj = Object.create(WasmTransaction.prototype);
2196
+ obj.__wbg_ptr = ptr;
2197
+ WasmTransactionFinalization.register(obj, obj.__wbg_ptr, obj);
2198
+ return obj;
2199
+ }
2200
+ __destroy_into_raw() {
2201
+ const ptr = this.__wbg_ptr;
2202
+ this.__wbg_ptr = 0;
2203
+ WasmTransactionFinalization.unregister(this);
2204
+ return ptr;
2205
+ }
2206
+ free() {
2207
+ const ptr = this.__destroy_into_raw();
2208
+ wasm.__wbg_wasmtransaction_free(ptr, 0);
2209
+ }
2210
+ /**
2211
+ * Deserialize a transaction from bytes
2212
+ *
2213
+ * # Arguments
2214
+ * * `bytes` - The serialized transaction bytes
2215
+ *
2216
+ * # Returns
2217
+ * A WasmTransaction instance
2218
+ *
2219
+ * # Errors
2220
+ * Returns an error if the bytes cannot be parsed as a valid transaction
2221
+ * @param {Uint8Array} bytes
2222
+ * @returns {WasmTransaction}
2223
+ */
2224
+ static from_bytes(bytes) {
2225
+ try {
2226
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2227
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2228
+ const len0 = WASM_VECTOR_LEN;
2229
+ wasm.wasmtransaction_from_bytes(retptr, ptr0, len0);
2230
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2231
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2232
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2233
+ if (r2) {
2234
+ throw takeObject(r1);
2235
+ }
2236
+ return WasmTransaction.__wrap(r0);
2237
+ } finally {
2238
+ wasm.__wbindgen_add_to_stack_pointer(16);
2239
+ }
2240
+ }
2241
+ /**
2242
+ * Serialize the transaction to bytes
2243
+ *
2244
+ * # Returns
2245
+ * The serialized transaction bytes
2246
+ * @returns {Uint8Array}
2247
+ */
2248
+ to_bytes() {
2249
+ try {
2250
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2251
+ wasm.wasmtransaction_to_bytes(retptr, this.__wbg_ptr);
2252
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2253
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2254
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2255
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
2256
+ return v1;
2257
+ } finally {
2258
+ wasm.__wbindgen_add_to_stack_pointer(16);
2259
+ }
2260
+ }
2261
+ }
2262
+ if (Symbol.dispose) WasmTransaction.prototype[Symbol.dispose] = WasmTransaction.prototype.free;
2263
+
2264
+ /**
2265
+ * A Zcash transaction with network-specific fields
2266
+ *
2267
+ * This class provides basic transaction parsing and serialization for Zcash
2268
+ * transactions, which use the Overwinter transaction format.
2269
+ */
2270
+ export class WasmZcashTransaction {
2271
+ static __wrap(ptr) {
2272
+ ptr = ptr >>> 0;
2273
+ const obj = Object.create(WasmZcashTransaction.prototype);
2274
+ obj.__wbg_ptr = ptr;
2275
+ WasmZcashTransactionFinalization.register(obj, obj.__wbg_ptr, obj);
2276
+ return obj;
2277
+ }
2278
+ __destroy_into_raw() {
2279
+ const ptr = this.__wbg_ptr;
2280
+ this.__wbg_ptr = 0;
2281
+ WasmZcashTransactionFinalization.unregister(this);
2282
+ return ptr;
2283
+ }
2284
+ free() {
2285
+ const ptr = this.__destroy_into_raw();
2286
+ wasm.__wbg_wasmzcashtransaction_free(ptr, 0);
2287
+ }
2288
+ /**
2289
+ * Deserialize a Zcash transaction from bytes
2290
+ *
2291
+ * # Arguments
2292
+ * * `bytes` - The serialized transaction bytes
2293
+ *
2294
+ * # Returns
2295
+ * A WasmZcashTransaction instance
2296
+ *
2297
+ * # Errors
2298
+ * Returns an error if the bytes cannot be parsed as a valid Zcash transaction
2299
+ * @param {Uint8Array} bytes
2300
+ * @returns {WasmZcashTransaction}
2301
+ */
2302
+ static from_bytes(bytes) {
2303
+ try {
2304
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2305
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
2306
+ const len0 = WASM_VECTOR_LEN;
2307
+ wasm.wasmzcashtransaction_from_bytes(retptr, ptr0, len0);
2308
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2309
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2310
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2311
+ if (r2) {
2312
+ throw takeObject(r1);
2313
+ }
2314
+ return WasmZcashTransaction.__wrap(r0);
2315
+ } finally {
2316
+ wasm.__wbindgen_add_to_stack_pointer(16);
2317
+ }
2318
+ }
2319
+ /**
2320
+ * Serialize the transaction to bytes
2321
+ *
2322
+ * # Returns
2323
+ * The serialized transaction bytes
2324
+ * @returns {Uint8Array}
2325
+ */
2326
+ to_bytes() {
2327
+ try {
2328
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2329
+ wasm.wasmzcashtransaction_to_bytes(retptr, this.__wbg_ptr);
2330
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2331
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2332
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2333
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2334
+ if (r3) {
2335
+ throw takeObject(r2);
2336
+ }
2337
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
2338
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
2339
+ return v1;
2340
+ } finally {
2341
+ wasm.__wbindgen_add_to_stack_pointer(16);
2342
+ }
2343
+ }
2344
+ }
2345
+ if (Symbol.dispose) WasmZcashTransaction.prototype[Symbol.dispose] = WasmZcashTransaction.prototype.free;
2346
+
2106
2347
  export class WrapDescriptor {
2107
2348
  static __wrap(ptr) {
2108
2349
  ptr = ptr >>> 0;
Binary file
@@ -13,12 +13,28 @@ export const wrapdescriptor_node: (a: number, b: number) => void;
13
13
  export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
14
14
  export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
15
15
  export const wrapdescriptor_toString: (a: number, b: number) => void;
16
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
17
+ export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
18
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
19
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
20
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
21
+ export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
22
+ export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
23
+ export const wrapminiscript_encode: (a: number, b: number) => void;
24
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
25
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
26
+ export const wrapminiscript_node: (a: number, b: number) => void;
27
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
28
+ export const wrapminiscript_toString: (a: number, b: number) => void;
16
29
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
17
30
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
18
31
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
19
32
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
20
33
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
34
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
21
35
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
36
+ export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
37
+ export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
22
38
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
23
39
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
24
40
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
@@ -82,11 +98,18 @@ export const wasmecpair_public_key: (a: number) => number;
82
98
  export const wasmecpair_to_wif: (a: number, b: number) => void;
83
99
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
84
100
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
101
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
102
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
103
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
85
104
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
86
105
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
87
106
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
88
107
  export const wasmrootwalletkeys_user_key: (a: number) => number;
89
108
  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;
109
+ export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
110
+ export const wasmtransaction_to_bytes: (a: number, b: number) => void;
111
+ export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
112
+ export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
90
113
  export const wrappsbt_clone: (a: number) => number;
91
114
  export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
92
115
  export const wrappsbt_finalize: (a: number, b: number) => void;
@@ -96,20 +119,6 @@ export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number)
96
119
  export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
97
120
  export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
98
121
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
99
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
100
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
101
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
102
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
103
- export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
104
- export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
105
- export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
106
- export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
107
- export const wrapminiscript_encode: (a: number, b: number) => void;
108
- export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
109
- export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
110
- export const wrapminiscript_node: (a: number, b: number) => void;
111
- export const wrapminiscript_toAsmString: (a: number, b: number) => void;
112
- export const wrapminiscript_toString: (a: number, b: number) => void;
113
122
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
114
123
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
115
124
  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": "1.16.0",
4
+ "version": "1.18.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",