@bitgo/wasm-utxo 1.43.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Inspect - TypeScript bindings for PSBT and Transaction parsing
3
+ *
4
+ * Provides typed wrappers around the WASM inspect functions that return
5
+ * hierarchical node structures suitable for display as collapsible trees.
6
+ *
7
+ * Import via: `import { ... } from "@bitgo/wasm-utxo/inspect"`
8
+ */
9
+ import type { CoinName } from "../coinName.js";
10
+ /** Re-export CoinName for convenience */
11
+ export type { CoinName };
12
+ /** All supported networks in order of parsing priority */
13
+ export declare const allNetworks: CoinName[];
14
+ /**
15
+ * Primitive value types that can appear in a Node.
16
+ * Buffer values are hex-encoded strings, Integer is a decimal string for BigInt support.
17
+ */
18
+ export type PrimitiveType = "String" | "Buffer" | "Integer" | "U8" | "U16" | "U32" | "U64" | "I8" | "I16" | "I32" | "I64" | "Boolean" | "None";
19
+ /**
20
+ * A tagged union representing primitive values in the parse tree.
21
+ */
22
+ export interface Primitive {
23
+ type: PrimitiveType;
24
+ value?: string | number | boolean;
25
+ }
26
+ /**
27
+ * A node in the parse tree representing a PSBT or transaction element.
28
+ */
29
+ export interface Node {
30
+ label: string;
31
+ value: Primitive;
32
+ children: Node[];
33
+ }
34
+ /**
35
+ * Parse a PSBT and return a typed node tree.
36
+ *
37
+ * @param psbtBytes - The raw PSBT bytes
38
+ * @param network - The network coin name (e.g., "btc", "ltc", "bch")
39
+ * @returns A Node tree representing the parsed PSBT structure
40
+ * @throws If the PSBT bytes are invalid or network is unknown
41
+ */
42
+ export declare function parsePsbtToNode(psbtBytes: Uint8Array, network: CoinName): Node;
43
+ /**
44
+ * Parse a transaction and return a typed node tree.
45
+ *
46
+ * @param txBytes - The raw transaction bytes
47
+ * @param network - The network coin name (e.g., "btc", "ltc", "bch")
48
+ * @returns A Node tree representing the parsed transaction structure
49
+ * @throws If the transaction bytes are invalid or network is unknown
50
+ */
51
+ export declare function parseTxToNode(txBytes: Uint8Array, network: CoinName): Node;
52
+ /**
53
+ * Try to parse a PSBT with all networks and return the first one that succeeds.
54
+ *
55
+ * @param psbtBytes - The raw PSBT bytes
56
+ * @param networks - Optional list of networks to try (defaults to all networks)
57
+ * @returns An object with the parsed Node and detected network, or null if all fail
58
+ */
59
+ export declare function tryParsePsbt(psbtBytes: Uint8Array, networks?: CoinName[]): {
60
+ node: Node;
61
+ network: CoinName;
62
+ } | null;
63
+ /**
64
+ * Try to parse a transaction with all networks and return the first one that succeeds.
65
+ *
66
+ * @param txBytes - The raw transaction bytes
67
+ * @param networks - Optional list of networks to try (defaults to all networks)
68
+ * @returns An object with the parsed Node and detected network, or null if all fail
69
+ */
70
+ export declare function tryParseTx(txBytes: Uint8Array, networks?: CoinName[]): {
71
+ node: Node;
72
+ network: CoinName;
73
+ } | null;
74
+ /**
75
+ * Parse a PSBT at the raw byte level and return a typed node tree.
76
+ *
77
+ * Unlike `parsePsbtToNode`, this function exposes the raw key-value pair
78
+ * structure as defined in BIP-174, showing:
79
+ * - Raw key type IDs and their human-readable names
80
+ * - Proprietary keys with their structured format
81
+ * - Unknown/unrecognized keys that standard parsers might skip
82
+ *
83
+ * @param psbtBytes - The raw PSBT bytes
84
+ * @param network - The network coin name (e.g., "btc", "ltc", "zec")
85
+ * @returns A Node tree representing the raw PSBT key-value structure
86
+ * @throws If the PSBT bytes are invalid or network is unknown
87
+ */
88
+ export declare function parsePsbtRawToNode(psbtBytes: Uint8Array, network: CoinName): Node;
89
+ /**
90
+ * Try to parse a raw PSBT with all networks and return the first one that succeeds.
91
+ *
92
+ * @param psbtBytes - The raw PSBT bytes
93
+ * @param networks - Optional list of networks to try (defaults to all networks)
94
+ * @returns An object with the parsed Node and detected network, or null if all fail
95
+ */
96
+ export declare function tryParsePsbtRaw(psbtBytes: Uint8Array, networks?: CoinName[]): {
97
+ node: Node;
98
+ network: CoinName;
99
+ } | null;
100
+ /**
101
+ * Check if the inspect feature is enabled in the WASM build.
102
+ *
103
+ * @returns true if the feature is enabled, false otherwise
104
+ */
105
+ export declare function isInspectEnabled(): boolean;
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Inspect - TypeScript bindings for PSBT and Transaction parsing
3
+ *
4
+ * Provides typed wrappers around the WASM inspect functions that return
5
+ * hierarchical node structures suitable for display as collapsible trees.
6
+ *
7
+ * Import via: `import { ... } from "@bitgo/wasm-utxo/inspect"`
8
+ */
9
+ import { parsePsbtToJson as wasmParsePsbtToJson, parseTxToJson as wasmParseTxToJson, parsePsbtRawToJson as wasmParsePsbtRawToJson, isInspectEnabled as wasmIsInspectEnabled, } from "../wasm/wasm_utxo.js";
10
+ /** All supported networks in order of parsing priority */
11
+ export const allNetworks = [
12
+ "btc",
13
+ "tbtc",
14
+ "tbtc4",
15
+ "tbtcsig",
16
+ "tbtcbgsig",
17
+ "ltc",
18
+ "tltc",
19
+ "bch",
20
+ "tbch",
21
+ "bcha",
22
+ "tbcha",
23
+ "btg",
24
+ "tbtg",
25
+ "bsv",
26
+ "tbsv",
27
+ "dash",
28
+ "tdash",
29
+ "doge",
30
+ "tdoge",
31
+ "zec",
32
+ "tzec",
33
+ ];
34
+ /**
35
+ * Parse a PSBT and return a typed node tree.
36
+ *
37
+ * @param psbtBytes - The raw PSBT bytes
38
+ * @param network - The network coin name (e.g., "btc", "ltc", "bch")
39
+ * @returns A Node tree representing the parsed PSBT structure
40
+ * @throws If the PSBT bytes are invalid or network is unknown
41
+ */
42
+ export function parsePsbtToNode(psbtBytes, network) {
43
+ const json = wasmParsePsbtToJson(psbtBytes, network);
44
+ return JSON.parse(json);
45
+ }
46
+ /**
47
+ * Parse a transaction and return a typed node tree.
48
+ *
49
+ * @param txBytes - The raw transaction bytes
50
+ * @param network - The network coin name (e.g., "btc", "ltc", "bch")
51
+ * @returns A Node tree representing the parsed transaction structure
52
+ * @throws If the transaction bytes are invalid or network is unknown
53
+ */
54
+ export function parseTxToNode(txBytes, network) {
55
+ const json = wasmParseTxToJson(txBytes, network);
56
+ return JSON.parse(json);
57
+ }
58
+ /**
59
+ * Try to parse a PSBT with all networks and return the first one that succeeds.
60
+ *
61
+ * @param psbtBytes - The raw PSBT bytes
62
+ * @param networks - Optional list of networks to try (defaults to all networks)
63
+ * @returns An object with the parsed Node and detected network, or null if all fail
64
+ */
65
+ export function tryParsePsbt(psbtBytes, networks = allNetworks) {
66
+ for (const network of networks) {
67
+ try {
68
+ const node = parsePsbtToNode(psbtBytes, network);
69
+ return { node, network };
70
+ }
71
+ catch {
72
+ // Try next network
73
+ }
74
+ }
75
+ return null;
76
+ }
77
+ /**
78
+ * Try to parse a transaction with all networks and return the first one that succeeds.
79
+ *
80
+ * @param txBytes - The raw transaction bytes
81
+ * @param networks - Optional list of networks to try (defaults to all networks)
82
+ * @returns An object with the parsed Node and detected network, or null if all fail
83
+ */
84
+ export function tryParseTx(txBytes, networks = allNetworks) {
85
+ for (const network of networks) {
86
+ try {
87
+ const node = parseTxToNode(txBytes, network);
88
+ return { node, network };
89
+ }
90
+ catch {
91
+ // Try next network
92
+ }
93
+ }
94
+ return null;
95
+ }
96
+ /**
97
+ * Parse a PSBT at the raw byte level and return a typed node tree.
98
+ *
99
+ * Unlike `parsePsbtToNode`, this function exposes the raw key-value pair
100
+ * structure as defined in BIP-174, showing:
101
+ * - Raw key type IDs and their human-readable names
102
+ * - Proprietary keys with their structured format
103
+ * - Unknown/unrecognized keys that standard parsers might skip
104
+ *
105
+ * @param psbtBytes - The raw PSBT bytes
106
+ * @param network - The network coin name (e.g., "btc", "ltc", "zec")
107
+ * @returns A Node tree representing the raw PSBT key-value structure
108
+ * @throws If the PSBT bytes are invalid or network is unknown
109
+ */
110
+ export function parsePsbtRawToNode(psbtBytes, network) {
111
+ const json = wasmParsePsbtRawToJson(psbtBytes, network);
112
+ return JSON.parse(json);
113
+ }
114
+ /**
115
+ * Try to parse a raw PSBT with all networks and return the first one that succeeds.
116
+ *
117
+ * @param psbtBytes - The raw PSBT bytes
118
+ * @param networks - Optional list of networks to try (defaults to all networks)
119
+ * @returns An object with the parsed Node and detected network, or null if all fail
120
+ */
121
+ export function tryParsePsbtRaw(psbtBytes, networks = allNetworks) {
122
+ for (const network of networks) {
123
+ try {
124
+ const node = parsePsbtRawToNode(psbtBytes, network);
125
+ return { node, network };
126
+ }
127
+ catch {
128
+ // Try next network
129
+ }
130
+ }
131
+ return null;
132
+ }
133
+ /**
134
+ * Check if the inspect feature is enabled in the WASM build.
135
+ *
136
+ * @returns true if the feature is enabled, false otherwise
137
+ */
138
+ export function isInspectEnabled() {
139
+ return wasmIsInspectEnabled();
140
+ }
@@ -1,13 +1,20 @@
1
1
  import type { PsbtInputData, PsbtOutputData, PsbtOutputDataWithAddress } from "./wasm/wasm_utxo.js";
2
- /** Common interface for PSBT introspection methods */
3
- export interface IPsbtIntrospection {
4
- readonly inputCount: number;
5
- readonly outputCount: number;
2
+ /** Common interface for PSBT types */
3
+ export interface IPsbt {
4
+ inputCount(): number;
5
+ outputCount(): number;
6
6
  getInputs(): PsbtInputData[];
7
7
  getOutputs(): PsbtOutputData[];
8
+ version(): number;
9
+ lockTime(): number;
10
+ unsignedTxId(): string;
11
+ addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number): number;
12
+ addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
13
+ removeInput(index: number): void;
14
+ removeOutput(index: number): void;
8
15
  }
9
- /** Extended introspection with address resolution (no coin parameter needed) */
10
- export interface IPsbtIntrospectionWithAddress extends IPsbtIntrospection {
16
+ /** Extended PSBT with address resolution (no coin parameter needed) */
17
+ export interface IPsbtWithAddress extends IPsbt {
11
18
  getOutputsWithAddress(): PsbtOutputDataWithAddress[];
12
19
  }
13
20
  /**
@@ -30,13 +30,9 @@ export declare class Transaction implements ITransaction {
30
30
  * @param sequence - Optional sequence number (default: 0xFFFFFFFF)
31
31
  * @returns The index of the newly added input
32
32
  */
33
+ addInputAtIndex(index: number, txid: string, vout: number, sequence?: number): number;
33
34
  addInput(txid: string, vout: number, sequence?: number): number;
34
- /**
35
- * Add an output to the transaction
36
- * @param script - Output script (scriptPubKey)
37
- * @param value - Value in satoshis
38
- * @returns The index of the newly added output
39
- */
35
+ addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
40
36
  addOutput(script: Uint8Array, value: bigint): number;
41
37
  toBytes(): Uint8Array;
42
38
  /**
@@ -31,15 +31,15 @@ export class Transaction {
31
31
  * @param sequence - Optional sequence number (default: 0xFFFFFFFF)
32
32
  * @returns The index of the newly added input
33
33
  */
34
+ addInputAtIndex(index, txid, vout, sequence) {
35
+ return this._wasm.add_input_at_index(index, txid, vout, sequence);
36
+ }
34
37
  addInput(txid, vout, sequence) {
35
38
  return this._wasm.add_input(txid, vout, sequence);
36
39
  }
37
- /**
38
- * Add an output to the transaction
39
- * @param script - Output script (scriptPubKey)
40
- * @param value - Value in satoshis
41
- * @returns The index of the newly added output
42
- */
40
+ addOutputAtIndex(index, script, value) {
41
+ return this._wasm.add_output_at_index(index, script, value);
42
+ }
43
43
  addOutput(script, value) {
44
44
  return this._wasm.add_output(script, value);
45
45
  }
@@ -116,6 +116,7 @@ export class BitGoPsbt {
116
116
  private constructor();
117
117
  free(): void;
118
118
  [Symbol.dispose](): void;
119
+ add_input(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null, prev_tx?: Uint8Array | null): number;
119
120
  /**
120
121
  * Add an input to the PSBT
121
122
  *
@@ -129,29 +130,11 @@ export class BitGoPsbt {
129
130
  * # Returns
130
131
  * The index of the newly added input
131
132
  */
132
- add_input(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null, prev_tx?: Uint8Array | null): number;
133
- /**
134
- * Add an output to the PSBT
135
- *
136
- * # Arguments
137
- * * `script` - The output script (scriptPubKey)
138
- * * `value` - The value in satoshis
139
- *
140
- * # Returns
141
- * The index of the newly added output
142
- */
133
+ add_input_at_index(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null, prev_tx?: Uint8Array | null): number;
143
134
  add_output(script: Uint8Array, value: bigint): number;
144
- /**
145
- * Add an output to the PSBT by address
146
- *
147
- * # Arguments
148
- * * `address` - The destination address
149
- * * `value` - The value in satoshis
150
- *
151
- * # Returns
152
- * The index of the newly added output
153
- */
135
+ add_output_at_index(index: number, script: Uint8Array, value: bigint): number;
154
136
  add_output_with_address(address: string, value: bigint): number;
137
+ add_output_with_address_at_index(index: number, address: string, value: bigint): number;
155
138
  /**
156
139
  * Add a PayGo attestation to a PSBT output
157
140
  *
@@ -165,61 +148,12 @@ export class BitGoPsbt {
165
148
  * - `Err(WasmUtxoError)` if the output index is out of bounds or entropy is invalid
166
149
  */
167
150
  add_paygo_attestation(output_index: number, entropy: Uint8Array, signature: Uint8Array): void;
168
- /**
169
- * Add a replay protection input to the PSBT
170
- *
171
- * Replay protection inputs are P2SH-P2PK inputs used on forked networks to prevent
172
- * transaction replay attacks. They use a simple pubkey script without wallet derivation.
173
- *
174
- * # Arguments
175
- * * `ecpair` - The ECPair containing the public key for the replay protection input
176
- * * `txid` - The transaction ID (hex string) of the output being spent
177
- * * `vout` - The output index being spent
178
- * * `value` - The value in satoshis
179
- * * `sequence` - Optional sequence number (default: 0xFFFFFFFE for RBF)
180
- *
181
- * # Returns
182
- * The index of the newly added input
183
- */
184
151
  add_replay_protection_input(ecpair: WasmECPair, txid: string, vout: number, value: bigint, sequence?: number | null, prev_tx?: Uint8Array | null): number;
185
- /**
186
- * Add a wallet input with full PSBT metadata
187
- *
188
- * This is a higher-level method that adds an input and populates all required
189
- * PSBT fields (scripts, derivation info, etc.) based on the wallet's chain type.
190
- *
191
- * # Arguments
192
- * * `txid` - The transaction ID (hex string)
193
- * * `vout` - The output index being spent
194
- * * `value` - The value in satoshis
195
- * * `chain` - The chain code (0/1=p2sh, 10/11=p2shP2wsh, 20/21=p2wsh, 30/31=p2tr, 40/41=p2trMusig2)
196
- * * `index` - The derivation index
197
- * * `wallet_keys` - The root wallet keys
198
- * * `signer` - The key that will sign ("user", "backup", or "bitgo") - required for p2tr/p2trMusig2
199
- * * `cosigner` - The key that will co-sign - required for p2tr/p2trMusig2
200
- * * `sequence` - Optional sequence number (default: 0xFFFFFFFE for RBF)
201
- * * `prev_tx` - Optional full previous transaction bytes (for non-segwit)
202
- *
203
- * # Returns
204
- * The index of the newly added input
205
- */
152
+ add_replay_protection_input_at_index(index: number, ecpair: WasmECPair, txid: string, vout: number, value: bigint, sequence?: number | null, prev_tx?: Uint8Array | null): number;
206
153
  add_wallet_input(txid: string, vout: number, value: bigint, wallet_keys: WasmRootWalletKeys, chain: number, index: number, signer?: string | null, cosigner?: string | null, sequence?: number | null, prev_tx?: Uint8Array | null): number;
207
- /**
208
- * Add a wallet output with full PSBT metadata
209
- *
210
- * This creates a verifiable wallet output (typically for change) with all required
211
- * PSBT fields (scripts, derivation info) based on the wallet's chain type.
212
- *
213
- * # Arguments
214
- * * `chain` - The chain code (0/1=p2sh, 10/11=p2shP2wsh, 20/21=p2wsh, 30/31=p2tr, 40/41=p2trMusig2)
215
- * * `index` - The derivation index
216
- * * `value` - The value in satoshis
217
- * * `wallet_keys` - The root wallet keys
218
- *
219
- * # Returns
220
- * The index of the newly added output
221
- */
154
+ add_wallet_input_at_index(index: number, txid: string, vout: number, value: bigint, wallet_keys: WasmRootWalletKeys, chain: number, derivation_index: number, signer?: string | null, cosigner?: string | null, sequence?: number | null, prev_tx?: Uint8Array | null): number;
222
155
  add_wallet_output(chain: number, index: number, value: bigint, wallet_keys: WasmRootWalletKeys): number;
156
+ add_wallet_output_at_index(index: number, chain: number, derivation_index: number, value: bigint, wallet_keys: WasmRootWalletKeys): number;
223
157
  /**
224
158
  * Combine/merge data from another PSBT into this one
225
159
  *
@@ -452,6 +386,8 @@ export class BitGoPsbt {
452
386
  * Parse transaction with wallet keys to identify wallet inputs/outputs
453
387
  */
454
388
  parse_transaction_with_wallet_keys(wallet_keys: WasmRootWalletKeys, replay_protection: WasmReplayProtection, paygo_pubkeys?: WasmECPair[] | null): any;
389
+ remove_input(index: number): void;
390
+ remove_output(index: number): void;
455
391
  /**
456
392
  * Serialize the PSBT to bytes
457
393
  *
@@ -1230,6 +1166,7 @@ export class WasmTransaction {
1230
1166
  private constructor();
1231
1167
  free(): void;
1232
1168
  [Symbol.dispose](): void;
1169
+ add_input(txid: string, vout: number, sequence?: number | null): number;
1233
1170
  /**
1234
1171
  * Add an input to the transaction
1235
1172
  *
@@ -1241,18 +1178,9 @@ export class WasmTransaction {
1241
1178
  * # Returns
1242
1179
  * The index of the newly added input
1243
1180
  */
1244
- add_input(txid: string, vout: number, sequence?: number | null): number;
1245
- /**
1246
- * Add an output to the transaction
1247
- *
1248
- * # Arguments
1249
- * * `script` - The output script (scriptPubKey)
1250
- * * `value` - The value in satoshis
1251
- *
1252
- * # Returns
1253
- * The index of the newly added output
1254
- */
1181
+ add_input_at_index(index: number, txid: string, vout: number, sequence?: number | null): number;
1255
1182
  add_output(script: Uint8Array, value: bigint): number;
1183
+ add_output_at_index(index: number, script: Uint8Array, value: bigint): number;
1256
1184
  /**
1257
1185
  * Create an empty transaction (version 1, locktime 0)
1258
1186
  */
@@ -1373,6 +1301,7 @@ export class WrapMiniscript {
1373
1301
  export class WrapPsbt {
1374
1302
  free(): void;
1375
1303
  [Symbol.dispose](): void;
1304
+ addInput(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1376
1305
  /**
1377
1306
  * Add an input to the PSBT
1378
1307
  *
@@ -1386,7 +1315,8 @@ export class WrapPsbt {
1386
1315
  * # Returns
1387
1316
  * The index of the newly added input
1388
1317
  */
1389
- addInput(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1318
+ addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1319
+ addOutput(script: Uint8Array, value: bigint): number;
1390
1320
  /**
1391
1321
  * Add an output to the PSBT
1392
1322
  *
@@ -1397,7 +1327,7 @@ export class WrapPsbt {
1397
1327
  * # Returns
1398
1328
  * The index of the newly added output
1399
1329
  */
1400
- addOutput(script: Uint8Array, value: bigint): number;
1330
+ addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
1401
1331
  clone(): WrapPsbt;
1402
1332
  static deserialize(psbt: Uint8Array): WrapPsbt;
1403
1333
  /**
@@ -1469,6 +1399,8 @@ export class WrapPsbt {
1469
1399
  * Get the number of outputs in the PSBT
1470
1400
  */
1471
1401
  outputCount(): number;
1402
+ removeInput(index: number): void;
1403
+ removeOutput(index: number): void;
1472
1404
  serialize(): Uint8Array;
1473
1405
  /**
1474
1406
  * Sign all inputs with a WasmBIP32 key
@@ -1534,3 +1466,74 @@ export class WrapPsbt {
1534
1466
  */
1535
1467
  version(): number;
1536
1468
  }
1469
+
1470
+ /**
1471
+ * Check if the inspect feature is enabled.
1472
+ *
1473
+ * # Returns
1474
+ * `true` if the feature is enabled, `false` otherwise
1475
+ */
1476
+ export function isInspectEnabled(): boolean;
1477
+
1478
+ /**
1479
+ * Parse a PSBT at the raw byte level and return a JSON representation.
1480
+ *
1481
+ * Unlike `parsePsbtToJson`, this function exposes the raw key-value pair
1482
+ * structure as defined in BIP-174, showing:
1483
+ * - Raw key type IDs and their human-readable names
1484
+ * - Proprietary keys with their structured format
1485
+ * - Unknown/unrecognized keys that standard parsers might skip
1486
+ *
1487
+ * # Arguments
1488
+ * * `psbt_bytes` - The raw PSBT bytes
1489
+ * * `coin_name` - The network coin name (e.g., "btc", "ltc", "zec")
1490
+ *
1491
+ * # Returns
1492
+ * A JSON string representing the raw PSBT key-value structure
1493
+ *
1494
+ * # Errors
1495
+ * Returns an error if:
1496
+ * - The `inspect` feature is not enabled
1497
+ * - The PSBT bytes are invalid
1498
+ * - The network name is unknown
1499
+ */
1500
+ export function parsePsbtRawToJson(psbt_bytes: Uint8Array, coin_name: string): string;
1501
+
1502
+ /**
1503
+ * Parse a PSBT and return a JSON representation of its structure.
1504
+ *
1505
+ * This function parses the PSBT using the standard bitcoin crate parser
1506
+ * and returns a hierarchical node structure suitable for display.
1507
+ *
1508
+ * # Arguments
1509
+ * * `psbt_bytes` - The raw PSBT bytes
1510
+ * * `coin_name` - The network coin name (e.g., "btc", "ltc", "bch")
1511
+ *
1512
+ * # Returns
1513
+ * A JSON string representing the parsed PSBT structure
1514
+ *
1515
+ * # Errors
1516
+ * Returns an error if:
1517
+ * - The `inspect` feature is not enabled
1518
+ * - The PSBT bytes are invalid
1519
+ * - The network name is unknown
1520
+ */
1521
+ export function parsePsbtToJson(psbt_bytes: Uint8Array, coin_name: string): string;
1522
+
1523
+ /**
1524
+ * Parse a transaction and return a JSON representation of its structure.
1525
+ *
1526
+ * # Arguments
1527
+ * * `tx_bytes` - The raw transaction bytes
1528
+ * * `coin_name` - The network coin name (e.g., "btc", "ltc", "bch")
1529
+ *
1530
+ * # Returns
1531
+ * A JSON string representing the parsed transaction structure
1532
+ *
1533
+ * # Errors
1534
+ * Returns an error if:
1535
+ * - The `inspect` feature is not enabled
1536
+ * - The transaction bytes are invalid
1537
+ * - The network name is unknown
1538
+ */
1539
+ export function parseTxToJson(tx_bytes: Uint8Array, coin_name: string): string;
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./wasm_utxo_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
 
7
7
  export {
8
- AddressNamespace, Bip322Namespace, BitGoPsbt, FixedScriptWalletNamespace, InscriptionsNamespace, MessageNamespace, UtxolibCompatNamespace, WasmBIP32, WasmDashTransaction, WasmDimensions, WasmECPair, WasmReplayProtection, WasmRootWalletKeys, WasmTransaction, WasmZcashTransaction, WrapDescriptor, WrapMiniscript, WrapPsbt
8
+ AddressNamespace, Bip322Namespace, BitGoPsbt, FixedScriptWalletNamespace, InscriptionsNamespace, MessageNamespace, UtxolibCompatNamespace, WasmBIP32, WasmDashTransaction, WasmDimensions, WasmECPair, WasmReplayProtection, WasmRootWalletKeys, WasmTransaction, WasmZcashTransaction, WrapDescriptor, WrapMiniscript, WrapPsbt, isInspectEnabled, parsePsbtRawToJson, parsePsbtToJson, parseTxToJson
9
9
  } from "./wasm_utxo_bg.js";