@bitgo/wasm-utxo 2.1.0 → 3.1.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.
Files changed (33) hide show
  1. package/dist/cjs/js/bip322/index.d.ts +5 -0
  2. package/dist/cjs/js/bip322/index.js +8 -0
  3. package/dist/cjs/js/coinName.d.ts +3 -0
  4. package/dist/cjs/js/coinName.js +49 -0
  5. package/dist/cjs/js/descriptorWallet/Psbt.d.ts +49 -0
  6. package/dist/cjs/js/descriptorWallet/Psbt.js +126 -0
  7. package/dist/cjs/js/descriptorWallet/index.d.ts +1 -0
  8. package/dist/cjs/js/descriptorWallet/index.js +4 -0
  9. package/dist/cjs/js/index.d.ts +1 -31
  10. package/dist/cjs/js/index.js +2 -2
  11. package/dist/cjs/js/testutils/AcidTest.d.ts +3 -3
  12. package/dist/cjs/js/testutils/AcidTest.js +79 -80
  13. package/dist/cjs/js/wasm/wasm_utxo.d.ts +32 -110
  14. package/dist/cjs/js/wasm/wasm_utxo.js +83 -97
  15. package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
  16. package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +75 -74
  17. package/dist/esm/js/bip322/index.d.ts +5 -0
  18. package/dist/esm/js/bip322/index.js +7 -0
  19. package/dist/esm/js/coinName.d.ts +3 -0
  20. package/dist/esm/js/coinName.js +48 -0
  21. package/dist/esm/js/descriptorWallet/Psbt.d.ts +49 -0
  22. package/dist/esm/js/descriptorWallet/Psbt.js +122 -0
  23. package/dist/esm/js/descriptorWallet/index.d.ts +1 -0
  24. package/dist/esm/js/descriptorWallet/index.js +2 -0
  25. package/dist/esm/js/index.d.ts +1 -31
  26. package/dist/esm/js/index.js +1 -1
  27. package/dist/esm/js/testutils/AcidTest.d.ts +3 -3
  28. package/dist/esm/js/testutils/AcidTest.js +80 -81
  29. package/dist/esm/js/wasm/wasm_utxo.d.ts +32 -110
  30. package/dist/esm/js/wasm/wasm_utxo_bg.js +83 -97
  31. package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
  32. package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +75 -74
  33. package/package.json +1 -1
@@ -36,6 +36,11 @@ export class Bip322Namespace {
36
36
  * The index of the added input
37
37
  */
38
38
  static add_bip322_input(psbt: BitGoPsbt, message: string, chain: number, index: number, wallet_keys: WasmRootWalletKeys, signer?: string | null, cosigner?: string | null, tag?: string | null): number;
39
+ /**
40
+ * Get the BIP322 message stored at a PSBT input index.
41
+ * Returns null if no message is stored.
42
+ */
43
+ static get_bip322_message(psbt: BitGoPsbt, input_index: number): string | undefined;
39
44
  /**
40
45
  * Verify a single input of a BIP-0322 PSBT proof
41
46
  *
@@ -318,16 +323,7 @@ export class BitGoPsbt {
318
323
  * generated for security. Custom session_id is only allowed on testnets for testing purposes.
319
324
  */
320
325
  generate_musig2_nonces(xpriv: WasmBIP32, session_id_bytes?: Uint8Array | null): void;
321
- /**
322
- * Returns the global xpubs from the PSBT as an array of WasmBIP32 instances.
323
- */
324
326
  get_global_xpubs(): any;
325
- /**
326
- * Get all PSBT inputs as an array of PsbtInputData
327
- *
328
- * Returns an array with witness_utxo, bip32_derivation, and tap_bip32_derivation
329
- * for each input.
330
- */
331
327
  get_inputs(): any;
332
328
  /**
333
329
  * Get the network type for transaction extraction
@@ -336,23 +332,8 @@ export class BitGoPsbt {
336
332
  * wrapper class should be used in TypeScript.
337
333
  */
338
334
  get_network_type(): string;
339
- /**
340
- * Get all PSBT outputs as an array of PsbtOutputData
341
- *
342
- * Returns an array with script, value, bip32_derivation, and tap_bip32_derivation
343
- * for each output.
344
- */
345
335
  get_outputs(): any;
346
- /**
347
- * Get all PSBT outputs with resolved address strings.
348
- *
349
- * Unlike the generic WrapPsbt which requires a coin parameter, BitGoPsbt
350
- * uses the network it was created/deserialized with to resolve addresses.
351
- */
352
336
  get_outputs_with_address(): any;
353
- /**
354
- * Get the number of inputs in the PSBT
355
- */
356
337
  input_count(): number;
357
338
  /**
358
339
  * Check if an input is a MuSig2 keypath input.
@@ -368,17 +349,11 @@ export class BitGoPsbt {
368
349
  * - `false` otherwise (or if input_index is out of bounds)
369
350
  */
370
351
  is_musig2_input(input_index: number): boolean;
371
- /**
372
- * Get the transaction lock time
373
- */
374
352
  lock_time(): number;
375
353
  /**
376
354
  * Get the network of the PSBT
377
355
  */
378
356
  network(): string;
379
- /**
380
- * Get the number of outputs in the PSBT
381
- */
382
357
  output_count(): number;
383
358
  /**
384
359
  * Parse outputs with wallet keys to identify which outputs belong to a wallet
@@ -659,9 +634,6 @@ export class BitGoPsbt {
659
634
  * - `Err(WasmUtxoError)` if the input index is out of bounds, derivation fails, or verification fails
660
635
  */
661
636
  verify_signature_with_xpub(input_index: number, xpub: WasmBIP32): boolean;
662
- /**
663
- * Get the transaction version
664
- */
665
637
  version(): number;
666
638
  /**
667
639
  * Get the Zcash version group ID (returns None for non-Zcash PSBTs)
@@ -1311,7 +1283,7 @@ export class WrapMiniscript {
1311
1283
  export class WrapPsbt {
1312
1284
  free(): void;
1313
1285
  [Symbol.dispose](): void;
1314
- addInput(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1286
+ add_input(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1315
1287
  /**
1316
1288
  * Add an input to the PSBT
1317
1289
  *
@@ -1325,8 +1297,8 @@ export class WrapPsbt {
1325
1297
  * # Returns
1326
1298
  * The index of the newly added input
1327
1299
  */
1328
- addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1329
- addOutput(script: Uint8Array, value: bigint): number;
1300
+ add_input_at_index(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1301
+ add_output(script: Uint8Array, value: bigint): number;
1330
1302
  /**
1331
1303
  * Add an output to the PSBT
1332
1304
  *
@@ -1337,7 +1309,7 @@ export class WrapPsbt {
1337
1309
  * # Returns
1338
1310
  * The index of the newly added output
1339
1311
  */
1340
- addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
1312
+ add_output_at_index(index: number, script: Uint8Array, value: bigint): number;
1341
1313
  clone(): WrapPsbt;
1342
1314
  static deserialize(psbt: Uint8Array): WrapPsbt;
1343
1315
  /**
@@ -1350,57 +1322,23 @@ export class WrapPsbt {
1350
1322
  * - `Ok(WasmTransaction)` containing the extracted transaction
1351
1323
  * - `Err(WasmUtxoError)` if the PSBT is not fully finalized or extraction fails
1352
1324
  */
1353
- extractTransaction(): WasmTransaction;
1354
- finalize(): void;
1355
- /**
1356
- * Get global xpubs from the PSBT as an array of WasmBIP32 instances.
1357
- */
1358
- getGlobalXpubs(): any;
1359
- /**
1360
- * Get all PSBT inputs as an array of PsbtInputData
1361
- *
1362
- * Returns an array with witness_utxo, bip32_derivation, and tap_bip32_derivation
1363
- * for each input. This is useful for introspecting the PSBT structure.
1364
- */
1365
- getInputs(): any;
1366
- /**
1367
- * Get all PSBT outputs as an array of PsbtOutputData
1368
- *
1369
- * Returns an array with script, value, bip32_derivation, and tap_bip32_derivation
1370
- * for each output. This is useful for introspecting the PSBT structure.
1371
- */
1372
- getOutputs(): any;
1373
- /**
1374
- * Get all PSBT outputs with resolved address strings.
1375
- *
1376
- * Like `getOutputs()` but each element also includes an `address` field
1377
- * derived from the output script using the given coin name (e.g. "btc", "tbtc").
1378
- */
1379
- getOutputsWithAddress(coin: string): any;
1380
- /**
1381
- * Get partial signatures for an input
1382
- * Returns array of { pubkey: Uint8Array, signature: Uint8Array }
1383
- */
1384
- getPartialSignatures(input_index: number): any;
1325
+ extract_transaction(): WasmTransaction;
1326
+ finalize_mut(): void;
1327
+ get_global_xpubs(): any;
1328
+ get_inputs(): any;
1329
+ get_outputs(): any;
1330
+ get_outputs_with_address(coin: string): any;
1331
+ get_partial_signatures(input_index: number): any;
1385
1332
  /**
1386
1333
  * Get the unsigned transaction bytes
1387
1334
  *
1388
1335
  * # Returns
1389
1336
  * The serialized unsigned transaction
1390
1337
  */
1391
- getUnsignedTx(): Uint8Array;
1392
- /**
1393
- * Check if an input has any partial signatures
1394
- */
1395
- hasPartialSignatures(input_index: number): boolean;
1396
- /**
1397
- * Get the number of inputs in the PSBT
1398
- */
1399
- inputCount(): number;
1400
- /**
1401
- * Get the transaction lock time
1402
- */
1403
- lockTime(): number;
1338
+ get_unsigned_tx(): Uint8Array;
1339
+ has_partial_signatures(input_index: number): boolean;
1340
+ input_count(): number;
1341
+ lock_time(): number;
1404
1342
  /**
1405
1343
  * Create an empty PSBT
1406
1344
  *
@@ -1409,12 +1347,9 @@ export class WrapPsbt {
1409
1347
  * * `lock_time` - Transaction lock time (default: 0)
1410
1348
  */
1411
1349
  constructor(version?: number | null, lock_time?: number | null);
1412
- /**
1413
- * Get the number of outputs in the PSBT
1414
- */
1415
- outputCount(): number;
1416
- removeInput(index: number): void;
1417
- removeOutput(index: number): void;
1350
+ output_count(): number;
1351
+ remove_input(index: number): void;
1352
+ remove_output(index: number): void;
1418
1353
  serialize(): Uint8Array;
1419
1354
  /**
1420
1355
  * Sign all inputs with a WasmBIP32 key
@@ -1428,7 +1363,7 @@ export class WrapPsbt {
1428
1363
  * # Returns
1429
1364
  * A SigningKeysMap converted to JsValue (object mapping input indices to signing keys)
1430
1365
  */
1431
- signAll(key: WasmBIP32): any;
1366
+ sign_all(key: WasmBIP32): any;
1432
1367
  /**
1433
1368
  * Sign all inputs with a WasmECPair key
1434
1369
  *
@@ -1441,23 +1376,13 @@ export class WrapPsbt {
1441
1376
  * # Returns
1442
1377
  * A SigningKeysMap converted to JsValue (object mapping input indices to signing keys)
1443
1378
  */
1444
- signAllWithEcpair(key: WasmECPair): any;
1445
- signWithPrv(prv: Uint8Array): any;
1446
- signWithXprv(xprv: string): any;
1447
- /**
1448
- * Get the unsigned transaction ID as a hex string
1449
- */
1450
- unsignedTxId(): string;
1451
- updateInputWithDescriptor(input_index: number, descriptor: WrapDescriptor): void;
1452
- updateOutputWithDescriptor(output_index: number, descriptor: WrapDescriptor): void;
1453
- /**
1454
- * Validate a signature at a specific input against a pubkey
1455
- * Returns true if the signature is valid
1456
- *
1457
- * This method handles both ECDSA (legacy/SegWit) and Schnorr (Taproot) signatures.
1458
- * The pubkey should be provided as bytes (33 bytes for compressed ECDSA, 32 bytes for x-only Schnorr).
1459
- */
1460
- validateSignatureAtInput(input_index: number, pubkey: Uint8Array): boolean;
1379
+ sign_all_with_ecpair(key: WasmECPair): any;
1380
+ sign_with_prv(prv: Uint8Array): any;
1381
+ sign_with_xprv(xprv: string): any;
1382
+ unsigned_tx_id(): string;
1383
+ update_input_with_descriptor(input_index: number, descriptor: WrapDescriptor): void;
1384
+ update_output_with_descriptor(output_index: number, descriptor: WrapDescriptor): void;
1385
+ validate_signature_at_input(input_index: number, pubkey: Uint8Array): boolean;
1461
1386
  /**
1462
1387
  * Verify a signature at a specific input using a WasmBIP32 key
1463
1388
  *
@@ -1474,10 +1399,7 @@ export class WrapPsbt {
1474
1399
  * # Returns
1475
1400
  * `true` if a valid signature exists for the key, `false` otherwise
1476
1401
  */
1477
- verifySignatureWithKey(input_index: number, key: WasmBIP32): boolean;
1478
- /**
1479
- * Get the transaction version
1480
- */
1402
+ verify_signature_with_key(input_index: number, key: WasmBIP32): boolean;
1481
1403
  version(): number;
1482
1404
  }
1483
1405