@bitgo/wasm-utxo 2.1.0 → 3.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.
@@ -318,16 +318,7 @@ export class BitGoPsbt {
318
318
  * generated for security. Custom session_id is only allowed on testnets for testing purposes.
319
319
  */
320
320
  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
321
  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
322
  get_inputs(): any;
332
323
  /**
333
324
  * Get the network type for transaction extraction
@@ -336,23 +327,8 @@ export class BitGoPsbt {
336
327
  * wrapper class should be used in TypeScript.
337
328
  */
338
329
  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
330
  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
331
  get_outputs_with_address(): any;
353
- /**
354
- * Get the number of inputs in the PSBT
355
- */
356
332
  input_count(): number;
357
333
  /**
358
334
  * Check if an input is a MuSig2 keypath input.
@@ -368,17 +344,11 @@ export class BitGoPsbt {
368
344
  * - `false` otherwise (or if input_index is out of bounds)
369
345
  */
370
346
  is_musig2_input(input_index: number): boolean;
371
- /**
372
- * Get the transaction lock time
373
- */
374
347
  lock_time(): number;
375
348
  /**
376
349
  * Get the network of the PSBT
377
350
  */
378
351
  network(): string;
379
- /**
380
- * Get the number of outputs in the PSBT
381
- */
382
352
  output_count(): number;
383
353
  /**
384
354
  * Parse outputs with wallet keys to identify which outputs belong to a wallet
@@ -659,9 +629,6 @@ export class BitGoPsbt {
659
629
  * - `Err(WasmUtxoError)` if the input index is out of bounds, derivation fails, or verification fails
660
630
  */
661
631
  verify_signature_with_xpub(input_index: number, xpub: WasmBIP32): boolean;
662
- /**
663
- * Get the transaction version
664
- */
665
632
  version(): number;
666
633
  /**
667
634
  * Get the Zcash version group ID (returns None for non-Zcash PSBTs)
@@ -1311,7 +1278,7 @@ export class WrapMiniscript {
1311
1278
  export class WrapPsbt {
1312
1279
  free(): void;
1313
1280
  [Symbol.dispose](): void;
1314
- addInput(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1281
+ add_input(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1315
1282
  /**
1316
1283
  * Add an input to the PSBT
1317
1284
  *
@@ -1325,8 +1292,8 @@ export class WrapPsbt {
1325
1292
  * # Returns
1326
1293
  * The index of the newly added input
1327
1294
  */
1328
- addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1329
- addOutput(script: Uint8Array, value: bigint): number;
1295
+ add_input_at_index(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number | null): number;
1296
+ add_output(script: Uint8Array, value: bigint): number;
1330
1297
  /**
1331
1298
  * Add an output to the PSBT
1332
1299
  *
@@ -1337,7 +1304,7 @@ export class WrapPsbt {
1337
1304
  * # Returns
1338
1305
  * The index of the newly added output
1339
1306
  */
1340
- addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
1307
+ add_output_at_index(index: number, script: Uint8Array, value: bigint): number;
1341
1308
  clone(): WrapPsbt;
1342
1309
  static deserialize(psbt: Uint8Array): WrapPsbt;
1343
1310
  /**
@@ -1350,57 +1317,23 @@ export class WrapPsbt {
1350
1317
  * - `Ok(WasmTransaction)` containing the extracted transaction
1351
1318
  * - `Err(WasmUtxoError)` if the PSBT is not fully finalized or extraction fails
1352
1319
  */
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;
1320
+ extract_transaction(): WasmTransaction;
1321
+ finalize_mut(): void;
1322
+ get_global_xpubs(): any;
1323
+ get_inputs(): any;
1324
+ get_outputs(): any;
1325
+ get_outputs_with_address(coin: string): any;
1326
+ get_partial_signatures(input_index: number): any;
1385
1327
  /**
1386
1328
  * Get the unsigned transaction bytes
1387
1329
  *
1388
1330
  * # Returns
1389
1331
  * The serialized unsigned transaction
1390
1332
  */
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;
1333
+ get_unsigned_tx(): Uint8Array;
1334
+ has_partial_signatures(input_index: number): boolean;
1335
+ input_count(): number;
1336
+ lock_time(): number;
1404
1337
  /**
1405
1338
  * Create an empty PSBT
1406
1339
  *
@@ -1409,12 +1342,9 @@ export class WrapPsbt {
1409
1342
  * * `lock_time` - Transaction lock time (default: 0)
1410
1343
  */
1411
1344
  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;
1345
+ output_count(): number;
1346
+ remove_input(index: number): void;
1347
+ remove_output(index: number): void;
1418
1348
  serialize(): Uint8Array;
1419
1349
  /**
1420
1350
  * Sign all inputs with a WasmBIP32 key
@@ -1428,7 +1358,7 @@ export class WrapPsbt {
1428
1358
  * # Returns
1429
1359
  * A SigningKeysMap converted to JsValue (object mapping input indices to signing keys)
1430
1360
  */
1431
- signAll(key: WasmBIP32): any;
1361
+ sign_all(key: WasmBIP32): any;
1432
1362
  /**
1433
1363
  * Sign all inputs with a WasmECPair key
1434
1364
  *
@@ -1441,23 +1371,13 @@ export class WrapPsbt {
1441
1371
  * # Returns
1442
1372
  * A SigningKeysMap converted to JsValue (object mapping input indices to signing keys)
1443
1373
  */
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;
1374
+ sign_all_with_ecpair(key: WasmECPair): any;
1375
+ sign_with_prv(prv: Uint8Array): any;
1376
+ sign_with_xprv(xprv: string): any;
1377
+ unsigned_tx_id(): string;
1378
+ update_input_with_descriptor(input_index: number, descriptor: WrapDescriptor): void;
1379
+ update_output_with_descriptor(output_index: number, descriptor: WrapDescriptor): void;
1380
+ validate_signature_at_input(input_index: number, pubkey: Uint8Array): boolean;
1461
1381
  /**
1462
1382
  * Verify a signature at a specific input using a WasmBIP32 key
1463
1383
  *
@@ -1474,10 +1394,7 @@ export class WrapPsbt {
1474
1394
  * # Returns
1475
1395
  * `true` if a valid signature exists for the key, `false` otherwise
1476
1396
  */
1477
- verifySignatureWithKey(input_index: number, key: WasmBIP32): boolean;
1478
- /**
1479
- * Get the transaction version
1480
- */
1397
+ verify_signature_with_key(input_index: number, key: WasmBIP32): boolean;
1481
1398
  version(): number;
1482
1399
  }
1483
1400