@bitgo/wasm-utxo 4.1.0 → 4.3.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.
@@ -1,42 +1,23 @@
1
- import { WrapPsbt as WasmPsbt, type WasmBIP32, type WasmECPair, type WrapDescriptor, type PsbtInputData, type PsbtOutputData, type PsbtOutputDataWithAddress } from "../wasm/wasm_utxo.js";
1
+ import { WrapPsbt as WasmPsbt, type WasmBIP32, type WasmECPair, type WrapDescriptor, type PsbtOutputDataWithAddress } from "../wasm/wasm_utxo.js";
2
2
  import type { IPsbt } from "../psbt.js";
3
- import type { PsbtKvKey } from "../fixedScriptWallet/BitGoKeySubtype.js";
4
3
  import type { CoinName } from "../coinName.js";
5
- import type { BIP32 } from "../bip32.js";
6
4
  import { Transaction } from "../transaction.js";
5
+ import { PsbtBase } from "../psbtBase.js";
7
6
  export type SignPsbtResult = {
8
7
  [inputIndex: number]: [pubkey: string][];
9
8
  };
10
- export declare class Psbt implements IPsbt {
11
- private _wasm;
9
+ export declare class Psbt extends PsbtBase<WasmPsbt> implements IPsbt {
12
10
  constructor(versionOrWasm?: number | WasmPsbt, lockTime?: number);
13
11
  /** @internal Access the underlying WASM instance */
14
12
  get wasm(): WasmPsbt;
15
13
  static create(version?: number, lockTime?: number): Psbt;
16
14
  static deserialize(bytes: Uint8Array): Psbt;
17
- serialize(): Uint8Array;
18
15
  clone(): Psbt;
19
- inputCount(): number;
20
- outputCount(): number;
21
- version(): number;
22
- lockTime(): number;
23
- unsignedTxId(): string;
24
- getInputs(): PsbtInputData[];
25
- getOutputs(): PsbtOutputData[];
26
- getGlobalXpubs(): BIP32[];
27
16
  getOutputsWithAddress(coin: CoinName): PsbtOutputDataWithAddress[];
28
17
  addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number): number;
29
18
  addInput(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number): number;
30
19
  addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
31
20
  addOutput(script: Uint8Array, value: bigint): number;
32
- removeInput(index: number): void;
33
- removeOutput(index: number): void;
34
- setKV(key: PsbtKvKey, value: Uint8Array): void;
35
- getKV(key: PsbtKvKey): Uint8Array | undefined;
36
- setInputKV(index: number, key: PsbtKvKey, value: Uint8Array): void;
37
- getInputKV(index: number, key: PsbtKvKey): Uint8Array | undefined;
38
- setOutputKV(index: number, key: PsbtKvKey, value: Uint8Array): void;
39
- getOutputKV(index: number, key: PsbtKvKey): Uint8Array | undefined;
40
21
  updateInputWithDescriptor(inputIndex: number, descriptor: WrapDescriptor): void;
41
22
  updateOutputWithDescriptor(outputIndex: number, descriptor: WrapDescriptor): void;
42
23
  signWithXprv(xprv: string): SignPsbtResult;
@@ -3,15 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Psbt = void 0;
4
4
  const wasm_utxo_js_1 = require("../wasm/wasm_utxo.js");
5
5
  const transaction_js_1 = require("../transaction.js");
6
- class Psbt {
7
- _wasm;
6
+ const psbtBase_js_1 = require("../psbtBase.js");
7
+ class Psbt extends psbtBase_js_1.PsbtBase {
8
8
  constructor(versionOrWasm, lockTime) {
9
- if (versionOrWasm instanceof wasm_utxo_js_1.WrapPsbt) {
10
- this._wasm = versionOrWasm;
11
- }
12
- else {
13
- this._wasm = new wasm_utxo_js_1.WrapPsbt(versionOrWasm, lockTime);
14
- }
9
+ super(versionOrWasm instanceof wasm_utxo_js_1.WrapPsbt ? versionOrWasm : new wasm_utxo_js_1.WrapPsbt(versionOrWasm, lockTime));
15
10
  }
16
11
  /** @internal Access the underlying WASM instance */
17
12
  get wasm() {
@@ -25,37 +20,10 @@ class Psbt {
25
20
  return new Psbt(wasm_utxo_js_1.WrapPsbt.deserialize(bytes));
26
21
  }
27
22
  // -- Serialization --
28
- serialize() {
29
- return this._wasm.serialize();
30
- }
31
23
  clone() {
32
24
  return new Psbt(this._wasm.clone());
33
25
  }
34
26
  // -- IPsbt: introspection --
35
- inputCount() {
36
- return this._wasm.input_count();
37
- }
38
- outputCount() {
39
- return this._wasm.output_count();
40
- }
41
- version() {
42
- return this._wasm.version();
43
- }
44
- lockTime() {
45
- return this._wasm.lock_time();
46
- }
47
- unsignedTxId() {
48
- return this._wasm.unsigned_tx_id();
49
- }
50
- getInputs() {
51
- return this._wasm.get_inputs();
52
- }
53
- getOutputs() {
54
- return this._wasm.get_outputs();
55
- }
56
- getGlobalXpubs() {
57
- return this._wasm.get_global_xpubs();
58
- }
59
27
  getOutputsWithAddress(coin) {
60
28
  return this._wasm.get_outputs_with_address(coin);
61
29
  }
@@ -72,30 +40,6 @@ class Psbt {
72
40
  addOutput(script, value) {
73
41
  return this._wasm.add_output(script, value);
74
42
  }
75
- removeInput(index) {
76
- this._wasm.remove_input(index);
77
- }
78
- removeOutput(index) {
79
- this._wasm.remove_output(index);
80
- }
81
- setKV(key, value) {
82
- this._wasm.set_kv(key, value);
83
- }
84
- getKV(key) {
85
- return this._wasm.get_kv(key) ?? undefined;
86
- }
87
- setInputKV(index, key, value) {
88
- this._wasm.set_input_kv(index, key, value);
89
- }
90
- getInputKV(index, key) {
91
- return this._wasm.get_input_kv(index, key) ?? undefined;
92
- }
93
- setOutputKV(index, key, value) {
94
- this._wasm.set_output_kv(index, key, value);
95
- }
96
- getOutputKV(index, key) {
97
- return this._wasm.get_output_kv(index, key) ?? undefined;
98
- }
99
43
  // -- Descriptor updates --
100
44
  updateInputWithDescriptor(inputIndex, descriptor) {
101
45
  this._wasm.update_input_with_descriptor(inputIndex, descriptor);
@@ -1,5 +1,6 @@
1
- import { BitGoPsbt as WasmBitGoPsbt, type PsbtInputData, type PsbtOutputData, type PsbtOutputDataWithAddress } from "../wasm/wasm_utxo.js";
1
+ import { BitGoPsbt as WasmBitGoPsbt, type PsbtOutputDataWithAddress } from "../wasm/wasm_utxo.js";
2
2
  import type { IPsbtWithAddress } from "../psbt.js";
3
+ import { PsbtBase } from "../psbtBase.js";
3
4
  import { type WalletKeysArg, RootWalletKeys } from "./RootWalletKeys.js";
4
5
  import { type ReplayProtectionArg } from "./ReplayProtection.js";
5
6
  import { type BIP32Arg, BIP32 } from "../bip32.js";
@@ -7,7 +8,6 @@ import { type ECPairArg } from "../ecpair.js";
7
8
  import type { UtxolibName } from "../utxolibCompat.js";
8
9
  import type { CoinName } from "../coinName.js";
9
10
  import type { InputScriptType } from "./scriptType.js";
10
- import type { PsbtKvKey } from "./BitGoKeySubtype.js";
11
11
  import { type ITransaction } from "../transaction.js";
12
12
  export type { InputScriptType };
13
13
  export type NetworkName = UtxolibName | CoinName;
@@ -103,10 +103,12 @@ export type HydrationUnspent = {
103
103
  chain: number;
104
104
  index: number;
105
105
  value: bigint;
106
+ } | {
107
+ pubkey: Uint8Array;
108
+ value: bigint;
106
109
  };
107
- export declare class BitGoPsbt implements IPsbtWithAddress {
108
- protected _wasm: WasmBitGoPsbt;
109
- protected constructor(_wasm: WasmBitGoPsbt);
110
+ export declare class BitGoPsbt extends PsbtBase<WasmBitGoPsbt> implements IPsbtWithAddress {
111
+ protected constructor(wasm: WasmBitGoPsbt);
110
112
  /**
111
113
  * Get the underlying WASM instance
112
114
  * @internal - for use by other wasm-utxo modules
@@ -289,31 +291,6 @@ export declare class BitGoPsbt implements IPsbtWithAddress {
289
291
  */
290
292
  addReplayProtectionInputAtIndex(index: number, inputOptions: AddInputOptions, key: ECPairArg): number;
291
293
  addReplayProtectionInput(inputOptions: AddInputOptions, key: ECPairArg): number;
292
- removeInput(index: number): void;
293
- removeOutput(index: number): void;
294
- /**
295
- * Get the unsigned transaction ID
296
- * @returns The unsigned transaction ID
297
- */
298
- unsignedTxId(): string;
299
- /**
300
- * Get the transaction version
301
- * @returns The transaction version number
302
- */
303
- version(): number;
304
- lockTime(): number;
305
- /** Set an arbitrary KV pair on the PSBT global map. */
306
- setKV(key: PsbtKvKey, value: Uint8Array): void;
307
- /** Get a KV value from the PSBT global map. Returns `undefined` if not present. */
308
- getKV(key: PsbtKvKey): Uint8Array | undefined;
309
- /** Set an arbitrary KV pair on a specific PSBT input. */
310
- setInputKV(index: number, key: PsbtKvKey, value: Uint8Array): void;
311
- /** Get a KV value from a specific PSBT input. Returns `undefined` if not present. */
312
- getInputKV(index: number, key: PsbtKvKey): Uint8Array | undefined;
313
- /** Set an arbitrary KV pair on a specific PSBT output. */
314
- setOutputKV(index: number, key: PsbtKvKey, value: Uint8Array): void;
315
- /** Get a KV value from a specific PSBT output. Returns `undefined` if not present. */
316
- getOutputKV(index: number, key: PsbtKvKey): Uint8Array | undefined;
317
294
  /**
318
295
  * Parse transaction with wallet keys to identify wallet inputs/outputs
319
296
  * @param walletKeys - The wallet keys to use for identification
@@ -480,12 +457,6 @@ export declare class BitGoPsbt implements IPsbtWithAddress {
480
457
  * @throws Error if the input is not a replay protection input, index is out of bounds, or scripts are invalid
481
458
  */
482
459
  verifyReplayProtectionSignature(inputIndex: number, replayProtection: ReplayProtectionArg): boolean;
483
- /**
484
- * Serialize the PSBT to bytes
485
- *
486
- * @returns The serialized PSBT as a byte array
487
- */
488
- serialize(): Uint8Array;
489
460
  /**
490
461
  * Generate and store MuSig2 nonces for all MuSig2 inputs
491
462
  *
@@ -584,31 +555,6 @@ export declare class BitGoPsbt implements IPsbtWithAddress {
584
555
  * ```
585
556
  */
586
557
  getHalfSignedLegacyFormat(): Uint8Array;
587
- /**
588
- * Get the number of inputs in the PSBT
589
- * @returns The number of inputs
590
- */
591
- inputCount(): number;
592
- outputCount(): number;
593
- /**
594
- * Get all PSBT inputs as an array
595
- *
596
- * Returns raw PSBT input data including witness_utxo and derivation info.
597
- * For parsed transaction data with address identification, use
598
- * parseTransactionWithWalletKeys() instead.
599
- *
600
- * @returns Array of PsbtInputData objects
601
- */
602
- getInputs(): PsbtInputData[];
603
- /**
604
- * Get all PSBT outputs as an array
605
- *
606
- * Returns raw PSBT output data without address resolution.
607
- * For output data with addresses, use getOutputsWithAddress().
608
- *
609
- * @returns Array of PsbtOutputData objects
610
- */
611
- getOutputs(): PsbtOutputData[];
612
558
  /**
613
559
  * Get all PSBT outputs with resolved address strings
614
560
  *
@@ -626,10 +572,6 @@ export declare class BitGoPsbt implements IPsbtWithAddress {
626
572
  * ```
627
573
  */
628
574
  getOutputsWithAddress(): PsbtOutputDataWithAddress[];
629
- /**
630
- * Returns the unordered global xpubs from this PSBT as BIP32 instances.
631
- */
632
- getGlobalXpubs(): BIP32[];
633
575
  }
634
576
  /**
635
577
  * Extract sorted wallet keys from a PSBT's global xpub fields.
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BitGoPsbt = void 0;
4
4
  exports.getWalletKeysFromPsbt = getWalletKeysFromPsbt;
5
5
  const wasm_utxo_js_1 = require("../wasm/wasm_utxo.js");
6
+ const psbtBase_js_1 = require("../psbtBase.js");
6
7
  const RootWalletKeys_js_1 = require("./RootWalletKeys.js");
7
8
  const ReplayProtection_js_1 = require("./ReplayProtection.js");
8
9
  const bip32_js_1 = require("../bip32.js");
9
10
  const ecpair_js_1 = require("../ecpair.js");
10
11
  const transaction_js_1 = require("../transaction.js");
11
- class BitGoPsbt {
12
- _wasm;
13
- constructor(_wasm) {
14
- this._wasm = _wasm;
12
+ class BitGoPsbt extends psbtBase_js_1.PsbtBase {
13
+ constructor(wasm) {
14
+ super(wasm);
15
15
  }
16
16
  /**
17
17
  * Get the underlying WASM instance
@@ -234,53 +234,6 @@ class BitGoPsbt {
234
234
  const ecpair = ecpair_js_1.ECPair.from(key);
235
235
  return this._wasm.add_replay_protection_input(ecpair.wasm, inputOptions.txid, inputOptions.vout, inputOptions.value, inputOptions.sequence, inputOptions.prevTx);
236
236
  }
237
- removeInput(index) {
238
- this._wasm.remove_input(index);
239
- }
240
- removeOutput(index) {
241
- this._wasm.remove_output(index);
242
- }
243
- /**
244
- * Get the unsigned transaction ID
245
- * @returns The unsigned transaction ID
246
- */
247
- unsignedTxId() {
248
- return this._wasm.unsigned_txid();
249
- }
250
- /**
251
- * Get the transaction version
252
- * @returns The transaction version number
253
- */
254
- version() {
255
- return this._wasm.version();
256
- }
257
- lockTime() {
258
- return this._wasm.lock_time();
259
- }
260
- /** Set an arbitrary KV pair on the PSBT global map. */
261
- setKV(key, value) {
262
- this._wasm.set_kv(key, value);
263
- }
264
- /** Get a KV value from the PSBT global map. Returns `undefined` if not present. */
265
- getKV(key) {
266
- return this._wasm.get_kv(key) ?? undefined;
267
- }
268
- /** Set an arbitrary KV pair on a specific PSBT input. */
269
- setInputKV(index, key, value) {
270
- this._wasm.set_input_kv(index, key, value);
271
- }
272
- /** Get a KV value from a specific PSBT input. Returns `undefined` if not present. */
273
- getInputKV(index, key) {
274
- return this._wasm.get_input_kv(index, key) ?? undefined;
275
- }
276
- /** Set an arbitrary KV pair on a specific PSBT output. */
277
- setOutputKV(index, key, value) {
278
- this._wasm.set_output_kv(index, key, value);
279
- }
280
- /** Get a KV value from a specific PSBT output. Returns `undefined` if not present. */
281
- getOutputKV(index, key) {
282
- return this._wasm.get_output_kv(index, key) ?? undefined;
283
- }
284
237
  /**
285
238
  * Parse transaction with wallet keys to identify wallet inputs/outputs
286
239
  * @param walletKeys - The wallet keys to use for identification
@@ -474,14 +427,6 @@ class BitGoPsbt {
474
427
  const rp = ReplayProtection_js_1.ReplayProtection.from(replayProtection, this._wasm.network());
475
428
  return this._wasm.verify_replay_protection_signature(inputIndex, rp.wasm);
476
429
  }
477
- /**
478
- * Serialize the PSBT to bytes
479
- *
480
- * @returns The serialized PSBT as a byte array
481
- */
482
- serialize() {
483
- return this._wasm.serialize();
484
- }
485
430
  /**
486
431
  * Generate and store MuSig2 nonces for all MuSig2 inputs
487
432
  *
@@ -600,39 +545,6 @@ class BitGoPsbt {
600
545
  getHalfSignedLegacyFormat() {
601
546
  return this._wasm.extract_half_signed_legacy_tx();
602
547
  }
603
- /**
604
- * Get the number of inputs in the PSBT
605
- * @returns The number of inputs
606
- */
607
- inputCount() {
608
- return this._wasm.input_count();
609
- }
610
- outputCount() {
611
- return this._wasm.output_count();
612
- }
613
- /**
614
- * Get all PSBT inputs as an array
615
- *
616
- * Returns raw PSBT input data including witness_utxo and derivation info.
617
- * For parsed transaction data with address identification, use
618
- * parseTransactionWithWalletKeys() instead.
619
- *
620
- * @returns Array of PsbtInputData objects
621
- */
622
- getInputs() {
623
- return this._wasm.get_inputs();
624
- }
625
- /**
626
- * Get all PSBT outputs as an array
627
- *
628
- * Returns raw PSBT output data without address resolution.
629
- * For output data with addresses, use getOutputsWithAddress().
630
- *
631
- * @returns Array of PsbtOutputData objects
632
- */
633
- getOutputs() {
634
- return this._wasm.get_outputs();
635
- }
636
548
  /**
637
549
  * Get all PSBT outputs with resolved address strings
638
550
  *
@@ -652,13 +564,6 @@ class BitGoPsbt {
652
564
  getOutputsWithAddress() {
653
565
  return this._wasm.get_outputs_with_address();
654
566
  }
655
- /**
656
- * Returns the unordered global xpubs from this PSBT as BIP32 instances.
657
- */
658
- getGlobalXpubs() {
659
- const result = this._wasm.get_global_xpubs();
660
- return result.map((w) => bip32_js_1.BIP32.fromWasm(w));
661
- }
662
567
  }
663
568
  exports.BitGoPsbt = BitGoPsbt;
664
569
  /**
@@ -0,0 +1,44 @@
1
+ import type { PsbtInputData, PsbtOutputData } from "./wasm/wasm_utxo.js";
2
+ import { BIP32 } from "./bip32.js";
3
+ import type { PsbtKvKey } from "./fixedScriptWallet/BitGoKeySubtype.js";
4
+ interface WasmPsbtBase {
5
+ input_count(): number;
6
+ output_count(): number;
7
+ version(): number;
8
+ lock_time(): number;
9
+ unsigned_tx_id(): string;
10
+ serialize(): Uint8Array;
11
+ get_inputs(): unknown;
12
+ get_outputs(): unknown;
13
+ get_global_xpubs(): unknown;
14
+ remove_input(index: number): void;
15
+ remove_output(index: number): void;
16
+ set_kv(key: unknown, value: Uint8Array): void;
17
+ get_kv(key: unknown): Uint8Array | null | undefined;
18
+ set_input_kv(index: number, key: unknown, value: Uint8Array): void;
19
+ get_input_kv(index: number, key: unknown): Uint8Array | null | undefined;
20
+ set_output_kv(index: number, key: unknown, value: Uint8Array): void;
21
+ get_output_kv(index: number, key: unknown): Uint8Array | null | undefined;
22
+ }
23
+ export declare abstract class PsbtBase<W extends WasmPsbtBase> {
24
+ protected _wasm: W;
25
+ constructor(wasm: W);
26
+ inputCount(): number;
27
+ outputCount(): number;
28
+ version(): number;
29
+ lockTime(): number;
30
+ unsignedTxId(): string;
31
+ serialize(): Uint8Array;
32
+ getInputs(): PsbtInputData[];
33
+ getOutputs(): PsbtOutputData[];
34
+ getGlobalXpubs(): BIP32[];
35
+ removeInput(index: number): void;
36
+ removeOutput(index: number): void;
37
+ setKV(key: PsbtKvKey, value: Uint8Array): void;
38
+ getKV(key: PsbtKvKey): Uint8Array | undefined;
39
+ setInputKV(index: number, key: PsbtKvKey, value: Uint8Array): void;
40
+ getInputKV(index: number, key: PsbtKvKey): Uint8Array | undefined;
41
+ setOutputKV(index: number, key: PsbtKvKey, value: Uint8Array): void;
42
+ getOutputKV(index: number, key: PsbtKvKey): Uint8Array | undefined;
43
+ }
44
+ export {};
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PsbtBase = void 0;
4
+ const bip32_js_1 = require("./bip32.js");
5
+ class PsbtBase {
6
+ _wasm;
7
+ constructor(wasm) {
8
+ this._wasm = wasm;
9
+ }
10
+ inputCount() {
11
+ return this._wasm.input_count();
12
+ }
13
+ outputCount() {
14
+ return this._wasm.output_count();
15
+ }
16
+ version() {
17
+ return this._wasm.version();
18
+ }
19
+ lockTime() {
20
+ return this._wasm.lock_time();
21
+ }
22
+ unsignedTxId() {
23
+ return this._wasm.unsigned_tx_id();
24
+ }
25
+ serialize() {
26
+ return this._wasm.serialize();
27
+ }
28
+ getInputs() {
29
+ return this._wasm.get_inputs();
30
+ }
31
+ getOutputs() {
32
+ return this._wasm.get_outputs();
33
+ }
34
+ getGlobalXpubs() {
35
+ return this._wasm.get_global_xpubs().map((w) => bip32_js_1.BIP32.fromWasm(w));
36
+ }
37
+ removeInput(index) {
38
+ this._wasm.remove_input(index);
39
+ }
40
+ removeOutput(index) {
41
+ this._wasm.remove_output(index);
42
+ }
43
+ setKV(key, value) {
44
+ this._wasm.set_kv(key, value);
45
+ }
46
+ getKV(key) {
47
+ return this._wasm.get_kv(key) ?? undefined;
48
+ }
49
+ setInputKV(index, key, value) {
50
+ this._wasm.set_input_kv(index, key, value);
51
+ }
52
+ getInputKV(index, key) {
53
+ return this._wasm.get_input_kv(index, key) ?? undefined;
54
+ }
55
+ setOutputKV(index, key, value) {
56
+ this._wasm.set_output_kv(index, key, value);
57
+ }
58
+ getOutputKV(index, key) {
59
+ return this._wasm.get_output_kv(index, key) ?? undefined;
60
+ }
61
+ }
62
+ exports.PsbtBase = PsbtBase;
@@ -1,5 +1,7 @@
1
- import { WasmDashTransaction, WasmTransaction, WasmZcashTransaction, type TxInputData, type TxOutputData, type TxOutputDataWithAddress } from "./wasm/wasm_utxo.js";
1
+ import { WasmDashTransaction, WasmTransaction, WasmZcashTransaction } from "./wasm/wasm_utxo.js";
2
+ import type { TxInputData, TxOutputData, TxOutputDataWithAddress } from "./wasm/wasm_utxo.js";
2
3
  import type { CoinName } from "./coinName.js";
4
+ import { TransactionBase } from "./transactionBase.js";
3
5
  /** Common read-only interface shared by transactions and PSBTs */
4
6
  export interface ITransactionCommon<TInput, TOutput> {
5
7
  inputCount(): number;
@@ -20,8 +22,7 @@ export interface ITransaction extends ITransactionCommon<TxInputData, TxOutputDa
20
22
  *
21
23
  * Provides a camelCase, strongly-typed API over the snake_case WASM bindings.
22
24
  */
23
- export declare class Transaction implements ITransaction {
24
- private _wasm;
25
+ export declare class Transaction extends TransactionBase<WasmTransaction> {
25
26
  private constructor();
26
27
  /**
27
28
  * Create an empty transaction (version 1, locktime 0)
@@ -41,16 +42,6 @@ export declare class Transaction implements ITransaction {
41
42
  addInput(txid: string, vout: number, sequence?: number): number;
42
43
  addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
43
44
  addOutput(script: Uint8Array, value: bigint): number;
44
- toBytes(): Uint8Array;
45
- /**
46
- * Get the transaction ID (txid)
47
- *
48
- * The txid is the double SHA256 of the transaction bytes (excluding witness
49
- * data for segwit transactions), displayed in reverse byte order as is standard.
50
- *
51
- * @returns The transaction ID as a hex string
52
- */
53
- getId(): string;
54
45
  /**
55
46
  * Get the virtual size of the transaction
56
47
  *
@@ -59,13 +50,6 @@ export declare class Transaction implements ITransaction {
59
50
  * @returns The virtual size in virtual bytes (vbytes)
60
51
  */
61
52
  getVSize(): number;
62
- inputCount(): number;
63
- outputCount(): number;
64
- version(): number;
65
- lockTime(): number;
66
- getInputs(): TxInputData[];
67
- getOutputs(): TxOutputData[];
68
- getOutputsWithAddress(coin: CoinName): TxOutputDataWithAddress[];
69
53
  /** @internal */
70
54
  get wasm(): WasmTransaction;
71
55
  }
@@ -74,29 +58,11 @@ export declare class Transaction implements ITransaction {
74
58
  *
75
59
  * Provides a camelCase, strongly-typed API over the snake_case WASM bindings.
76
60
  */
77
- export declare class ZcashTransaction implements ITransaction {
78
- private _wasm;
61
+ export declare class ZcashTransaction extends TransactionBase<WasmZcashTransaction> {
79
62
  private constructor();
80
63
  static fromBytes(bytes: Uint8Array): ZcashTransaction;
81
64
  /** @internal Create from WASM instance directly (avoids re-parsing bytes) */
82
65
  static fromWasm(wasm: WasmZcashTransaction): ZcashTransaction;
83
- toBytes(): Uint8Array;
84
- /**
85
- * Get the transaction ID (txid)
86
- *
87
- * The txid is the double SHA256 of the full Zcash transaction bytes,
88
- * displayed in reverse byte order as is standard.
89
- *
90
- * @returns The transaction ID as a hex string
91
- */
92
- getId(): string;
93
- inputCount(): number;
94
- outputCount(): number;
95
- version(): number;
96
- lockTime(): number;
97
- getInputs(): TxInputData[];
98
- getOutputs(): TxOutputData[];
99
- getOutputsWithAddress(coin: CoinName): TxOutputDataWithAddress[];
100
66
  /** @internal */
101
67
  get wasm(): WasmZcashTransaction;
102
68
  }
@@ -105,29 +71,11 @@ export declare class ZcashTransaction implements ITransaction {
105
71
  *
106
72
  * Round-trip only: bytes -> parse -> bytes.
107
73
  */
108
- export declare class DashTransaction implements ITransaction {
109
- private _wasm;
74
+ export declare class DashTransaction extends TransactionBase<WasmDashTransaction> {
110
75
  private constructor();
111
76
  static fromBytes(bytes: Uint8Array): DashTransaction;
112
77
  /** @internal Create from WASM instance directly (avoids re-parsing bytes) */
113
78
  static fromWasm(wasm: WasmDashTransaction): DashTransaction;
114
- toBytes(): Uint8Array;
115
- /**
116
- * Get the transaction ID (txid)
117
- *
118
- * The txid is the double SHA256 of the full Dash transaction bytes,
119
- * displayed in reverse byte order as is standard.
120
- *
121
- * @returns The transaction ID as a hex string
122
- */
123
- getId(): string;
124
- inputCount(): number;
125
- outputCount(): number;
126
- version(): number;
127
- lockTime(): number;
128
- getInputs(): TxInputData[];
129
- getOutputs(): TxOutputData[];
130
- getOutputsWithAddress(coin: CoinName): TxOutputDataWithAddress[];
131
79
  /** @internal */
132
80
  get wasm(): WasmDashTransaction;
133
81
  }