@bitgo/wasm-utxo 4.1.0 → 4.2.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.
@@ -2,15 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DashTransaction = exports.ZcashTransaction = exports.Transaction = void 0;
4
4
  const wasm_utxo_js_1 = require("./wasm/wasm_utxo.js");
5
+ const transactionBase_js_1 = require("./transactionBase.js");
5
6
  /**
6
7
  * Transaction wrapper (Bitcoin-like networks)
7
8
  *
8
9
  * Provides a camelCase, strongly-typed API over the snake_case WASM bindings.
9
10
  */
10
- class Transaction {
11
- _wasm;
12
- constructor(_wasm) {
13
- this._wasm = _wasm;
11
+ class Transaction extends transactionBase_js_1.TransactionBase {
12
+ constructor(wasm) {
13
+ super(wasm);
14
14
  }
15
15
  /**
16
16
  * Create an empty transaction (version 1, locktime 0)
@@ -44,20 +44,6 @@ class Transaction {
44
44
  addOutput(script, value) {
45
45
  return this._wasm.add_output(script, value);
46
46
  }
47
- toBytes() {
48
- return this._wasm.to_bytes();
49
- }
50
- /**
51
- * Get the transaction ID (txid)
52
- *
53
- * The txid is the double SHA256 of the transaction bytes (excluding witness
54
- * data for segwit transactions), displayed in reverse byte order as is standard.
55
- *
56
- * @returns The transaction ID as a hex string
57
- */
58
- getId() {
59
- return this._wasm.get_txid();
60
- }
61
47
  /**
62
48
  * Get the virtual size of the transaction
63
49
  *
@@ -68,27 +54,6 @@ class Transaction {
68
54
  getVSize() {
69
55
  return this._wasm.get_vsize();
70
56
  }
71
- inputCount() {
72
- return this._wasm.input_count();
73
- }
74
- outputCount() {
75
- return this._wasm.output_count();
76
- }
77
- version() {
78
- return this._wasm.version();
79
- }
80
- lockTime() {
81
- return this._wasm.lock_time();
82
- }
83
- getInputs() {
84
- return this._wasm.get_inputs();
85
- }
86
- getOutputs() {
87
- return this._wasm.get_outputs();
88
- }
89
- getOutputsWithAddress(coin) {
90
- return this._wasm.get_outputs_with_address(coin);
91
- }
92
57
  /** @internal */
93
58
  get wasm() {
94
59
  return this._wasm;
@@ -100,10 +65,9 @@ exports.Transaction = Transaction;
100
65
  *
101
66
  * Provides a camelCase, strongly-typed API over the snake_case WASM bindings.
102
67
  */
103
- class ZcashTransaction {
104
- _wasm;
105
- constructor(_wasm) {
106
- this._wasm = _wasm;
68
+ class ZcashTransaction extends transactionBase_js_1.TransactionBase {
69
+ constructor(wasm) {
70
+ super(wasm);
107
71
  }
108
72
  static fromBytes(bytes) {
109
73
  return new ZcashTransaction(wasm_utxo_js_1.WasmZcashTransaction.from_bytes(bytes));
@@ -112,41 +76,6 @@ class ZcashTransaction {
112
76
  static fromWasm(wasm) {
113
77
  return new ZcashTransaction(wasm);
114
78
  }
115
- toBytes() {
116
- return this._wasm.to_bytes();
117
- }
118
- /**
119
- * Get the transaction ID (txid)
120
- *
121
- * The txid is the double SHA256 of the full Zcash transaction bytes,
122
- * displayed in reverse byte order as is standard.
123
- *
124
- * @returns The transaction ID as a hex string
125
- */
126
- getId() {
127
- return this._wasm.get_txid();
128
- }
129
- inputCount() {
130
- return this._wasm.input_count();
131
- }
132
- outputCount() {
133
- return this._wasm.output_count();
134
- }
135
- version() {
136
- return this._wasm.version();
137
- }
138
- lockTime() {
139
- return this._wasm.lock_time();
140
- }
141
- getInputs() {
142
- return this._wasm.get_inputs();
143
- }
144
- getOutputs() {
145
- return this._wasm.get_outputs();
146
- }
147
- getOutputsWithAddress(coin) {
148
- return this._wasm.get_outputs_with_address(coin);
149
- }
150
79
  /** @internal */
151
80
  get wasm() {
152
81
  return this._wasm;
@@ -158,10 +87,9 @@ exports.ZcashTransaction = ZcashTransaction;
158
87
  *
159
88
  * Round-trip only: bytes -> parse -> bytes.
160
89
  */
161
- class DashTransaction {
162
- _wasm;
163
- constructor(_wasm) {
164
- this._wasm = _wasm;
90
+ class DashTransaction extends transactionBase_js_1.TransactionBase {
91
+ constructor(wasm) {
92
+ super(wasm);
165
93
  }
166
94
  static fromBytes(bytes) {
167
95
  return new DashTransaction(wasm_utxo_js_1.WasmDashTransaction.from_bytes(bytes));
@@ -170,41 +98,6 @@ class DashTransaction {
170
98
  static fromWasm(wasm) {
171
99
  return new DashTransaction(wasm);
172
100
  }
173
- toBytes() {
174
- return this._wasm.to_bytes();
175
- }
176
- /**
177
- * Get the transaction ID (txid)
178
- *
179
- * The txid is the double SHA256 of the full Dash transaction bytes,
180
- * displayed in reverse byte order as is standard.
181
- *
182
- * @returns The transaction ID as a hex string
183
- */
184
- getId() {
185
- return this._wasm.get_txid();
186
- }
187
- inputCount() {
188
- return this._wasm.input_count();
189
- }
190
- outputCount() {
191
- return this._wasm.output_count();
192
- }
193
- version() {
194
- return this._wasm.version();
195
- }
196
- lockTime() {
197
- return this._wasm.lock_time();
198
- }
199
- getInputs() {
200
- return this._wasm.get_inputs();
201
- }
202
- getOutputs() {
203
- return this._wasm.get_outputs();
204
- }
205
- getOutputsWithAddress(coin) {
206
- return this._wasm.get_outputs_with_address(coin);
207
- }
208
101
  /** @internal */
209
102
  get wasm() {
210
103
  return this._wasm;
@@ -0,0 +1,28 @@
1
+ import type { TxInputData, TxOutputData, TxOutputDataWithAddress } from "./wasm/wasm_utxo.js";
2
+ import type { CoinName } from "./coinName.js";
3
+ import type { ITransaction } from "./transaction.js";
4
+ interface WasmTransactionLike {
5
+ input_count(): number;
6
+ output_count(): number;
7
+ version(): number;
8
+ lock_time(): number;
9
+ to_bytes(): Uint8Array;
10
+ get_txid(): string;
11
+ get_inputs(): unknown;
12
+ get_outputs(): unknown;
13
+ get_outputs_with_address(coin: string): unknown;
14
+ }
15
+ export declare abstract class TransactionBase<W extends WasmTransactionLike> implements ITransaction {
16
+ protected _wasm: W;
17
+ constructor(wasm: W);
18
+ inputCount(): number;
19
+ outputCount(): number;
20
+ version(): number;
21
+ lockTime(): number;
22
+ toBytes(): Uint8Array;
23
+ getId(): string;
24
+ getInputs(): TxInputData[];
25
+ getOutputs(): TxOutputData[];
26
+ getOutputsWithAddress(coin: CoinName): TxOutputDataWithAddress[];
27
+ }
28
+ export {};
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransactionBase = void 0;
4
+ class TransactionBase {
5
+ _wasm;
6
+ constructor(wasm) {
7
+ this._wasm = wasm;
8
+ }
9
+ inputCount() {
10
+ return this._wasm.input_count();
11
+ }
12
+ outputCount() {
13
+ return this._wasm.output_count();
14
+ }
15
+ version() {
16
+ return this._wasm.version();
17
+ }
18
+ lockTime() {
19
+ return this._wasm.lock_time();
20
+ }
21
+ toBytes() {
22
+ return this._wasm.to_bytes();
23
+ }
24
+ getId() {
25
+ return this._wasm.get_txid();
26
+ }
27
+ getInputs() {
28
+ return this._wasm.get_inputs();
29
+ }
30
+ getOutputs() {
31
+ return this._wasm.get_outputs();
32
+ }
33
+ getOutputsWithAddress(coin) {
34
+ return this._wasm.get_outputs_with_address(coin);
35
+ }
36
+ }
37
+ exports.TransactionBase = TransactionBase;
@@ -334,14 +334,8 @@ export class BitGoPsbt {
334
334
  */
335
335
  generate_musig2_nonces(xpriv: WasmBIP32, session_id_bytes?: Uint8Array | null): void;
336
336
  get_global_xpubs(): any;
337
- /**
338
- * Get a KV value from a specific PSBT input. Returns `undefined` if not present.
339
- */
340
337
  get_input_kv(index: number, key: any): Uint8Array | undefined;
341
338
  get_inputs(): any;
342
- /**
343
- * Get a KV value from the PSBT global map. Returns `undefined` if not present.
344
- */
345
339
  get_kv(key: any): Uint8Array | undefined;
346
340
  /**
347
341
  * Get the network type for transaction extraction
@@ -350,9 +344,6 @@ export class BitGoPsbt {
350
344
  * wrapper class should be used in TypeScript.
351
345
  */
352
346
  get_network_type(): string;
353
- /**
354
- * Get a KV value from a specific PSBT output. Returns `undefined` if not present.
355
- */
356
347
  get_output_kv(index: number, key: any): Uint8Array | undefined;
357
348
  get_outputs(): any;
358
349
  get_outputs_with_address(): any;
@@ -396,20 +387,8 @@ export class BitGoPsbt {
396
387
  * The serialized PSBT as a byte array
397
388
  */
398
389
  serialize(): Uint8Array;
399
- /**
400
- * Set an arbitrary KV pair on a specific PSBT input.
401
- */
402
390
  set_input_kv(index: number, key: any, value: Uint8Array): void;
403
- /**
404
- * Set an arbitrary KV pair on the PSBT global map.
405
- * `key` must be `{ type: "unknown", keyType: number, data?: Uint8Array }` or
406
- * `{ type: "proprietary", prefix: Uint8Array, subtype: number, key?: Uint8Array }` or
407
- * `{ type: "bitgo", subtype: number, key?: Uint8Array }`.
408
- */
409
391
  set_kv(key: any, value: Uint8Array): void;
410
- /**
411
- * Set an arbitrary KV pair on a specific PSBT output.
412
- */
413
392
  set_output_kv(index: number, key: any, value: Uint8Array): void;
414
393
  /**
415
394
  * Sign all MuSig2 keypath inputs in a single pass with optimized sighash computation.
@@ -610,10 +589,7 @@ export class BitGoPsbt {
610
589
  * - `Err(WasmUtxoError)` if signing fails
611
590
  */
612
591
  sign_with_xpriv(input_index: number, xpriv: WasmBIP32): void;
613
- /**
614
- * Get the unsigned transaction ID
615
- */
616
- unsigned_txid(): string;
592
+ unsigned_tx_id(): string;
617
593
  /**
618
594
  * Verify if a replay protection input has a valid signature
619
595
  *
@@ -1196,7 +1196,6 @@ class BitGoPsbt {
1196
1196
  return takeObject(ret);
1197
1197
  }
1198
1198
  /**
1199
- * Get a KV value from a specific PSBT input. Returns `undefined` if not present.
1200
1199
  * @param {number} index
1201
1200
  * @param {any} key
1202
1201
  * @returns {Uint8Array | undefined}
@@ -1241,7 +1240,6 @@ class BitGoPsbt {
1241
1240
  }
1242
1241
  }
1243
1242
  /**
1244
- * Get a KV value from the PSBT global map. Returns `undefined` if not present.
1245
1243
  * @param {any} key
1246
1244
  * @returns {Uint8Array | undefined}
1247
1245
  */
@@ -1290,7 +1288,6 @@ class BitGoPsbt {
1290
1288
  }
1291
1289
  }
1292
1290
  /**
1293
- * Get a KV value from a specific PSBT output. Returns `undefined` if not present.
1294
1291
  * @param {number} index
1295
1292
  * @param {any} key
1296
1293
  * @returns {Uint8Array | undefined}
@@ -1522,7 +1519,6 @@ class BitGoPsbt {
1522
1519
  }
1523
1520
  }
1524
1521
  /**
1525
- * Set an arbitrary KV pair on a specific PSBT input.
1526
1522
  * @param {number} index
1527
1523
  * @param {any} key
1528
1524
  * @param {Uint8Array} value
@@ -1543,10 +1539,6 @@ class BitGoPsbt {
1543
1539
  }
1544
1540
  }
1545
1541
  /**
1546
- * Set an arbitrary KV pair on the PSBT global map.
1547
- * `key` must be `{ type: "unknown", keyType: number, data?: Uint8Array }` or
1548
- * `{ type: "proprietary", prefix: Uint8Array, subtype: number, key?: Uint8Array }` or
1549
- * `{ type: "bitgo", subtype: number, key?: Uint8Array }`.
1550
1542
  * @param {any} key
1551
1543
  * @param {Uint8Array} value
1552
1544
  */
@@ -1566,7 +1558,6 @@ class BitGoPsbt {
1566
1558
  }
1567
1559
  }
1568
1560
  /**
1569
- * Set an arbitrary KV pair on a specific PSBT output.
1570
1561
  * @param {number} index
1571
1562
  * @param {any} key
1572
1563
  * @param {Uint8Array} value
@@ -1961,15 +1952,14 @@ class BitGoPsbt {
1961
1952
  }
1962
1953
  }
1963
1954
  /**
1964
- * Get the unsigned transaction ID
1965
1955
  * @returns {string}
1966
1956
  */
1967
- unsigned_txid() {
1957
+ unsigned_tx_id() {
1968
1958
  let deferred1_0;
1969
1959
  let deferred1_1;
1970
1960
  try {
1971
1961
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1972
- wasm.bitgopsbt_unsigned_txid(retptr, this.__wbg_ptr);
1962
+ wasm.bitgopsbt_unsigned_tx_id(retptr, this.__wbg_ptr);
1973
1963
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1974
1964
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1975
1965
  deferred1_0 = r0;
Binary file
@@ -2,16 +2,41 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
5
- export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
5
+ export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
6
+ export const __wbg_wasmbip32_free: (a: number, b: number) => void;
6
7
  export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
7
- export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
8
+ export const __wbg_wasmecpair_free: (a: number, b: number) => void;
8
9
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
9
10
  export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
10
11
  export const __wbg_wrappsbt_free: (a: number, b: number) => void;
11
12
  export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
12
13
  export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
13
- export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
14
- export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
14
+ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
15
+ export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
16
+ export const isInspectEnabled: () => number;
17
+ export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
18
+ export const wasmbip32_chain_code: (a: number) => number;
19
+ export const wasmbip32_depth: (a: number) => number;
20
+ export const wasmbip32_derive: (a: number, b: number, c: number) => void;
21
+ export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
22
+ export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
23
+ export const wasmbip32_equals: (a: number, b: number) => number;
24
+ export const wasmbip32_fingerprint: (a: number) => number;
25
+ export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
26
+ export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
27
+ export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
28
+ export const wasmbip32_from_seed_sha256: (a: number, b: number, c: number, d: number, e: number) => void;
29
+ export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
30
+ export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
31
+ export const wasmbip32_identifier: (a: number) => number;
32
+ export const wasmbip32_index: (a: number) => number;
33
+ export const wasmbip32_is_neutered: (a: number) => number;
34
+ export const wasmbip32_neutered: (a: number) => number;
35
+ export const wasmbip32_parent_fingerprint: (a: number) => number;
36
+ export const wasmbip32_private_key: (a: number) => number;
37
+ export const wasmbip32_public_key: (a: number) => number;
38
+ export const wasmbip32_to_base58: (a: number, b: number) => void;
39
+ export const wasmbip32_to_wif: (a: number, b: number) => void;
15
40
  export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
16
41
  export const wasmdashtransaction_get_inputs: (a: number, b: number) => void;
17
42
  export const wasmdashtransaction_get_outputs: (a: number, b: number) => void;
@@ -22,21 +47,16 @@ export const wasmdashtransaction_lock_time: (a: number) => number;
22
47
  export const wasmdashtransaction_output_count: (a: number) => number;
23
48
  export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
24
49
  export const wasmdashtransaction_version: (a: number) => number;
25
- export const wasmdimensions_empty: () => number;
26
- export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
27
- export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
28
- export const wasmdimensions_from_output_script_length: (a: number) => number;
29
- export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
30
- export const wasmdimensions_from_psbt: (a: number, b: number) => void;
31
- export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
32
- export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
33
- export const wasmdimensions_get_output_vsize: (a: number) => number;
34
- export const wasmdimensions_get_output_weight: (a: number) => number;
35
- export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
36
- export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
37
- export const wasmdimensions_has_segwit: (a: number) => number;
38
- export const wasmdimensions_plus: (a: number, b: number) => number;
39
- export const wasmdimensions_times: (a: number, b: number) => number;
50
+ export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
51
+ export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
52
+ export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
53
+ export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
54
+ export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
55
+ export const wasmecpair_private_key: (a: number) => number;
56
+ export const wasmecpair_public_key: (a: number) => number;
57
+ export const wasmecpair_to_wif: (a: number, b: number) => void;
58
+ export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
59
+ export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
40
60
  export const wasmtransaction_add_input: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
41
61
  export const wasmtransaction_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
42
62
  export const wasmtransaction_add_output: (a: number, b: number, c: number, d: bigint) => number;
@@ -91,47 +111,56 @@ export const wrappsbt_update_input_with_descriptor: (a: number, b: number, c: nu
91
111
  export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: number, d: number) => void;
92
112
  export const wrappsbt_validate_signature_at_input: (a: number, b: number, c: number, d: number, e: number) => void;
93
113
  export const wrappsbt_verify_signature_with_key: (a: number, b: number, c: number, d: number) => void;
114
+ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
94
115
  export const wasmtransaction_input_count: (a: number) => number;
95
116
  export const wasmtransaction_output_count: (a: number) => number;
96
117
  export const wasmzcashtransaction_input_count: (a: number) => number;
97
118
  export const wasmzcashtransaction_output_count: (a: number) => number;
119
+ export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
120
+ export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
98
121
  export const wasmtransaction_lock_time: (a: number) => number;
99
122
  export const wasmtransaction_version: (a: number) => number;
100
123
  export const wasmzcashtransaction_lock_time: (a: number) => number;
101
124
  export const wasmzcashtransaction_version: (a: number) => number;
102
125
  export const wrappsbt_lock_time: (a: number) => number;
103
126
  export const wrappsbt_version: (a: number) => number;
104
- export const __wbg_messagenamespace_free: (a: number, b: number) => void;
105
- export const __wbg_wasmecpair_free: (a: number, b: number) => void;
127
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
106
128
  export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
107
129
  export const __wbg_wasmutxonamespace_free: (a: number, b: number) => void;
108
- export const isInspectEnabled: () => number;
109
- export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
110
- export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
111
- export const parsePsbtRawToJson: (a: number, b: number, c: number, d: number, e: number) => void;
112
- export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
113
- export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
114
- export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
115
- export const wasmecpair_from_wif_mainnet: (a: number, b: number, c: number) => void;
116
- export const wasmecpair_from_wif_testnet: (a: number, b: number, c: number) => void;
117
- export const wasmecpair_private_key: (a: number) => number;
118
- export const wasmecpair_public_key: (a: number) => number;
119
- export const wasmecpair_to_wif: (a: number, b: number) => void;
120
- export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
121
- export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
130
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
131
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
132
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
122
133
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
123
134
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
124
135
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
125
136
  export const wasmrootwalletkeys_user_key: (a: number) => number;
126
137
  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;
127
138
  export const wasmutxonamespace_get_wasm_utxo_version: (a: number) => void;
128
- export const parsePsbtToJson: (a: number, b: number, c: number, d: number, e: number) => void;
129
- export const parseTxToJson: (a: number, b: number, c: number, d: number, e: number) => void;
139
+ export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
140
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
141
+ export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
142
+ export const wrapdescriptor_descType: (a: number, b: number) => void;
143
+ export const wrapdescriptor_encode: (a: number, b: number) => void;
144
+ export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
145
+ export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
146
+ export const wrapdescriptor_hasWildcard: (a: number) => number;
147
+ export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
148
+ export const wrapdescriptor_node: (a: number, b: number) => void;
149
+ export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
150
+ export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
151
+ export const wrapdescriptor_toString: (a: number, b: number) => void;
152
+ export const wrapminiscript_encode: (a: number, b: number) => void;
153
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
154
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
155
+ export const wrapminiscript_node: (a: number, b: number) => void;
156
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
157
+ export const wrapminiscript_toString: (a: number, b: number) => void;
130
158
  export const __wbg_bip322namespace_free: (a: number, b: number) => void;
131
159
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
132
160
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
133
- export const __wbg_wasmbip32_free: (a: number, b: number) => void;
134
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
161
+ export const __wbg_messagenamespace_free: (a: number, b: number) => void;
162
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
163
+ export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
135
164
  export const bip322namespace_add_bip322_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
136
165
  export const bip322namespace_get_bip322_message: (a: number, b: number, c: number) => void;
137
166
  export const bip322namespace_verify_bip322_psbt_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
@@ -194,7 +223,7 @@ export const bitgopsbt_sign_single_input_with_privkey: (a: number, b: number, c:
194
223
  export const bitgopsbt_sign_single_input_with_xpriv: (a: number, b: number, c: number, d: number) => void;
195
224
  export const bitgopsbt_sign_with_privkey: (a: number, b: number, c: number, d: number) => void;
196
225
  export const bitgopsbt_sign_with_xpriv: (a: number, b: number, c: number, d: number) => void;
197
- export const bitgopsbt_unsigned_txid: (a: number, b: number) => void;
226
+ export const bitgopsbt_unsigned_tx_id: (a: number, b: number) => void;
198
227
  export const bitgopsbt_verify_replay_protection_signature: (a: number, b: number, c: number, d: number) => void;
199
228
  export const bitgopsbt_verify_signature_with_pub: (a: number, b: number, c: number, d: number) => void;
200
229
  export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: number, d: number) => void;
@@ -210,57 +239,28 @@ export const fixedscriptwalletnamespace_output_script_with_network_str: (a: numb
210
239
  export const fixedscriptwalletnamespace_p2sh_p2pk_output_script: (a: number, b: number, c: number) => void;
211
240
  export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
212
241
  export const fixedscriptwalletnamespace_to_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
213
- export const wasmbip32_chain_code: (a: number) => number;
214
- export const wasmbip32_depth: (a: number) => number;
215
- export const wasmbip32_derive: (a: number, b: number, c: number) => void;
216
- export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
217
- export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
218
- export const wasmbip32_equals: (a: number, b: number) => number;
219
- export const wasmbip32_fingerprint: (a: number) => number;
220
- export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
221
- export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
222
- export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
223
- export const wasmbip32_from_seed_sha256: (a: number, b: number, c: number, d: number, e: number) => void;
224
- export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
225
- export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
226
- export const wasmbip32_identifier: (a: number) => number;
227
- export const wasmbip32_index: (a: number) => number;
228
- export const wasmbip32_is_neutered: (a: number) => number;
229
- export const wasmbip32_neutered: (a: number) => number;
230
- export const wasmbip32_parent_fingerprint: (a: number) => number;
231
- export const wasmbip32_private_key: (a: number) => number;
232
- export const wasmbip32_public_key: (a: number) => number;
233
- export const wasmbip32_to_base58: (a: number, b: number) => void;
234
- export const wasmbip32_to_wif: (a: number, b: number) => void;
235
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
236
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
237
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
238
- export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
242
+ export const messagenamespace_sign_message: (a: number, b: number, c: number, d: number) => void;
243
+ export const messagenamespace_verify_message: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
244
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
245
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
246
+ export const wasmdimensions_empty: () => number;
247
+ export const wasmdimensions_from_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
248
+ export const wasmdimensions_from_input_script_type: (a: number, b: number, c: number, d: number) => void;
249
+ export const wasmdimensions_from_output_script_length: (a: number) => number;
250
+ export const wasmdimensions_from_output_script_type: (a: number, b: number, c: number) => void;
251
+ export const wasmdimensions_from_psbt: (a: number, b: number) => void;
252
+ export const wasmdimensions_get_input_vsize: (a: number, b: number, c: number) => number;
253
+ export const wasmdimensions_get_input_weight: (a: number, b: number, c: number) => number;
254
+ export const wasmdimensions_get_output_vsize: (a: number) => number;
255
+ export const wasmdimensions_get_output_weight: (a: number) => number;
256
+ export const wasmdimensions_get_vsize: (a: number, b: number, c: number) => number;
257
+ export const wasmdimensions_get_weight: (a: number, b: number, c: number) => number;
258
+ export const wasmdimensions_has_segwit: (a: number) => number;
259
+ export const wasmdimensions_plus: (a: number, b: number) => number;
260
+ export const wasmdimensions_times: (a: number, b: number) => number;
239
261
  export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
240
- export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
241
262
  export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
242
- export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
243
- export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
244
- export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
245
- export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
246
- export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
247
- export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
248
- export const wrapdescriptor_descType: (a: number, b: number) => void;
249
- export const wrapdescriptor_encode: (a: number, b: number) => void;
250
- export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
251
- export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
252
- export const wrapdescriptor_hasWildcard: (a: number) => number;
253
- export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
254
- export const wrapdescriptor_node: (a: number, b: number) => void;
255
- export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
256
- export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
257
- export const wrapdescriptor_toString: (a: number, b: number) => void;
258
- export const wrapminiscript_encode: (a: number, b: number) => void;
259
- export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
260
- export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
261
- export const wrapminiscript_node: (a: number, b: number) => void;
262
- export const wrapminiscript_toAsmString: (a: number, b: number) => void;
263
- export const wrapminiscript_toString: (a: number, b: number) => void;
263
+ export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
264
264
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
265
265
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
266
266
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -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;