@bitgo/wasm-utxo 1.14.1 → 1.16.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.
- package/README.md +10 -1
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.d.ts +210 -2
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.js +180 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashBitGoPsbt.d.ts +113 -0
- package/dist/cjs/js/fixedScriptWallet/ZcashBitGoPsbt.js +114 -0
- package/dist/cjs/js/fixedScriptWallet/index.d.ts +2 -1
- package/dist/cjs/js/fixedScriptWallet/index.js +5 -1
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +141 -0
- package/dist/cjs/js/wasm/wasm_utxo.js +352 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +53 -41
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +210 -2
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.js +180 -0
- package/dist/esm/js/fixedScriptWallet/ZcashBitGoPsbt.d.ts +113 -0
- package/dist/esm/js/fixedScriptWallet/ZcashBitGoPsbt.js +110 -0
- package/dist/esm/js/fixedScriptWallet/index.d.ts +2 -1
- package/dist/esm/js/fixedScriptWallet/index.js +3 -0
- package/dist/esm/js/wasm/wasm_utxo.d.ts +141 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.js +352 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +53 -41
- package/package.json +1 -1
|
@@ -305,6 +305,36 @@ export class BitGoPsbt {
|
|
|
305
305
|
const ptr = this.__destroy_into_raw();
|
|
306
306
|
wasm.__wbg_bitgopsbt_free(ptr, 0);
|
|
307
307
|
}
|
|
308
|
+
/**
|
|
309
|
+
* Add an output to the PSBT
|
|
310
|
+
*
|
|
311
|
+
* # Arguments
|
|
312
|
+
* * `script` - The output script (scriptPubKey)
|
|
313
|
+
* * `value` - The value in satoshis
|
|
314
|
+
*
|
|
315
|
+
* # Returns
|
|
316
|
+
* The index of the newly added output
|
|
317
|
+
* @param {Uint8Array} script
|
|
318
|
+
* @param {bigint} value
|
|
319
|
+
* @returns {number}
|
|
320
|
+
*/
|
|
321
|
+
add_output(script, value) {
|
|
322
|
+
try {
|
|
323
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
324
|
+
const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
325
|
+
const len0 = WASM_VECTOR_LEN;
|
|
326
|
+
wasm.bitgopsbt_add_output(retptr, this.__wbg_ptr, ptr0, len0, value);
|
|
327
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
328
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
329
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
330
|
+
if (r2) {
|
|
331
|
+
throw takeObject(r1);
|
|
332
|
+
}
|
|
333
|
+
return r0 >>> 0;
|
|
334
|
+
} finally {
|
|
335
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
308
338
|
/**
|
|
309
339
|
* Deserialize a PSBT from bytes with network-specific logic
|
|
310
340
|
* @param {Uint8Array} bytes
|
|
@@ -330,6 +360,46 @@ export class BitGoPsbt {
|
|
|
330
360
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
331
361
|
}
|
|
332
362
|
}
|
|
363
|
+
/**
|
|
364
|
+
* Create an empty PSBT for the given network with wallet keys
|
|
365
|
+
*
|
|
366
|
+
* # Arguments
|
|
367
|
+
* * `network` - Network name (utxolib or coin name)
|
|
368
|
+
* * `wallet_keys` - The wallet's root keys (used to set global xpubs)
|
|
369
|
+
* * `version` - Optional transaction version (default: 2)
|
|
370
|
+
* * `lock_time` - Optional lock time (default: 0)
|
|
371
|
+
* @param {string} network
|
|
372
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
373
|
+
* @param {number | null} [version]
|
|
374
|
+
* @param {number | null} [lock_time]
|
|
375
|
+
* @returns {BitGoPsbt}
|
|
376
|
+
*/
|
|
377
|
+
static create_empty(network, wallet_keys, version, lock_time) {
|
|
378
|
+
try {
|
|
379
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
380
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
381
|
+
const len0 = WASM_VECTOR_LEN;
|
|
382
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
383
|
+
wasm.bitgopsbt_create_empty(retptr, ptr0, len0, wallet_keys.__wbg_ptr, isLikeNone(version) ? 0x100000001 : (version) >> 0, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0);
|
|
384
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
385
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
386
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
387
|
+
if (r2) {
|
|
388
|
+
throw takeObject(r1);
|
|
389
|
+
}
|
|
390
|
+
return BitGoPsbt.__wrap(r0);
|
|
391
|
+
} finally {
|
|
392
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Get the Zcash expiry height (returns None for non-Zcash PSBTs)
|
|
397
|
+
* @returns {number | undefined}
|
|
398
|
+
*/
|
|
399
|
+
expiry_height() {
|
|
400
|
+
const ret = wasm.bitgopsbt_expiry_height(this.__wbg_ptr);
|
|
401
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
402
|
+
}
|
|
333
403
|
/**
|
|
334
404
|
* Get the unsigned transaction ID
|
|
335
405
|
* @returns {string}
|
|
@@ -385,6 +455,106 @@ export class BitGoPsbt {
|
|
|
385
455
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
386
456
|
}
|
|
387
457
|
}
|
|
458
|
+
/**
|
|
459
|
+
* Add a wallet input with full PSBT metadata
|
|
460
|
+
*
|
|
461
|
+
* This is a higher-level method that adds an input and populates all required
|
|
462
|
+
* PSBT fields (scripts, derivation info, etc.) based on the wallet's chain type.
|
|
463
|
+
*
|
|
464
|
+
* # Arguments
|
|
465
|
+
* * `txid` - The transaction ID (hex string)
|
|
466
|
+
* * `vout` - The output index being spent
|
|
467
|
+
* * `value` - The value in satoshis
|
|
468
|
+
* * `chain` - The chain code (0/1=p2sh, 10/11=p2shP2wsh, 20/21=p2wsh, 30/31=p2tr, 40/41=p2trMusig2)
|
|
469
|
+
* * `index` - The derivation index
|
|
470
|
+
* * `wallet_keys` - The root wallet keys
|
|
471
|
+
* * `signer` - The key that will sign ("user", "backup", or "bitgo") - required for p2tr/p2trMusig2
|
|
472
|
+
* * `cosigner` - The key that will co-sign - required for p2tr/p2trMusig2
|
|
473
|
+
* * `sequence` - Optional sequence number (default: 0xFFFFFFFE for RBF)
|
|
474
|
+
* * `prev_tx` - Optional full previous transaction bytes (for non-segwit)
|
|
475
|
+
*
|
|
476
|
+
* # Returns
|
|
477
|
+
* The index of the newly added input
|
|
478
|
+
* @param {string} txid
|
|
479
|
+
* @param {number} vout
|
|
480
|
+
* @param {bigint} value
|
|
481
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
482
|
+
* @param {number} chain
|
|
483
|
+
* @param {number} index
|
|
484
|
+
* @param {string | null} [signer]
|
|
485
|
+
* @param {string | null} [cosigner]
|
|
486
|
+
* @param {number | null} [sequence]
|
|
487
|
+
* @param {Uint8Array | null} [prev_tx]
|
|
488
|
+
* @returns {number}
|
|
489
|
+
*/
|
|
490
|
+
add_wallet_input(txid, vout, value, wallet_keys, chain, index, signer, cosigner, sequence, prev_tx) {
|
|
491
|
+
try {
|
|
492
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
493
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
494
|
+
const len0 = WASM_VECTOR_LEN;
|
|
495
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
496
|
+
var ptr1 = isLikeNone(signer) ? 0 : passStringToWasm0(signer, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
497
|
+
var len1 = WASM_VECTOR_LEN;
|
|
498
|
+
var ptr2 = isLikeNone(cosigner) ? 0 : passStringToWasm0(cosigner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
499
|
+
var len2 = WASM_VECTOR_LEN;
|
|
500
|
+
var ptr3 = isLikeNone(prev_tx) ? 0 : passArray8ToWasm0(prev_tx, wasm.__wbindgen_export);
|
|
501
|
+
var len3 = WASM_VECTOR_LEN;
|
|
502
|
+
wasm.bitgopsbt_add_wallet_input(retptr, this.__wbg_ptr, ptr0, len0, vout, value, wallet_keys.__wbg_ptr, chain, index, ptr1, len1, ptr2, len2, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0, ptr3, len3);
|
|
503
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
504
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
505
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
506
|
+
if (r2) {
|
|
507
|
+
throw takeObject(r1);
|
|
508
|
+
}
|
|
509
|
+
return r0 >>> 0;
|
|
510
|
+
} finally {
|
|
511
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Get the Zcash version group ID (returns None for non-Zcash PSBTs)
|
|
516
|
+
* @returns {number | undefined}
|
|
517
|
+
*/
|
|
518
|
+
version_group_id() {
|
|
519
|
+
const ret = wasm.bitgopsbt_version_group_id(this.__wbg_ptr);
|
|
520
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Add a wallet output with full PSBT metadata
|
|
524
|
+
*
|
|
525
|
+
* This creates a verifiable wallet output (typically for change) with all required
|
|
526
|
+
* PSBT fields (scripts, derivation info) based on the wallet's chain type.
|
|
527
|
+
*
|
|
528
|
+
* # Arguments
|
|
529
|
+
* * `chain` - The chain code (0/1=p2sh, 10/11=p2shP2wsh, 20/21=p2wsh, 30/31=p2tr, 40/41=p2trMusig2)
|
|
530
|
+
* * `index` - The derivation index
|
|
531
|
+
* * `value` - The value in satoshis
|
|
532
|
+
* * `wallet_keys` - The root wallet keys
|
|
533
|
+
*
|
|
534
|
+
* # Returns
|
|
535
|
+
* The index of the newly added output
|
|
536
|
+
* @param {number} chain
|
|
537
|
+
* @param {number} index
|
|
538
|
+
* @param {bigint} value
|
|
539
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
540
|
+
* @returns {number}
|
|
541
|
+
*/
|
|
542
|
+
add_wallet_output(chain, index, value, wallet_keys) {
|
|
543
|
+
try {
|
|
544
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
545
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
546
|
+
wasm.bitgopsbt_add_wallet_output(retptr, this.__wbg_ptr, chain, index, value, wallet_keys.__wbg_ptr);
|
|
547
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
548
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
549
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
550
|
+
if (r2) {
|
|
551
|
+
throw takeObject(r1);
|
|
552
|
+
}
|
|
553
|
+
return r0 >>> 0;
|
|
554
|
+
} finally {
|
|
555
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
388
558
|
/**
|
|
389
559
|
* Sign a single input with a raw private key
|
|
390
560
|
*
|
|
@@ -420,6 +590,47 @@ export class BitGoPsbt {
|
|
|
420
590
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
421
591
|
}
|
|
422
592
|
}
|
|
593
|
+
/**
|
|
594
|
+
* Create an empty Zcash PSBT with the required consensus branch ID
|
|
595
|
+
*
|
|
596
|
+
* This method is specifically for Zcash networks which require additional
|
|
597
|
+
* parameters for sighash computation.
|
|
598
|
+
*
|
|
599
|
+
* # Arguments
|
|
600
|
+
* * `network` - Network name (must be "zcash" or "zcashTest")
|
|
601
|
+
* * `wallet_keys` - The wallet's root keys (used to set global xpubs)
|
|
602
|
+
* * `consensus_branch_id` - Zcash consensus branch ID (e.g., 0xC2D6D0B4 for NU5)
|
|
603
|
+
* * `version` - Optional transaction version (default: 4 for Zcash Sapling+)
|
|
604
|
+
* * `lock_time` - Optional lock time (default: 0)
|
|
605
|
+
* * `version_group_id` - Optional version group ID (defaults to Sapling: 0x892F2085)
|
|
606
|
+
* * `expiry_height` - Optional expiry height
|
|
607
|
+
* @param {string} network
|
|
608
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
609
|
+
* @param {number} consensus_branch_id
|
|
610
|
+
* @param {number | null} [version]
|
|
611
|
+
* @param {number | null} [lock_time]
|
|
612
|
+
* @param {number | null} [version_group_id]
|
|
613
|
+
* @param {number | null} [expiry_height]
|
|
614
|
+
* @returns {BitGoPsbt}
|
|
615
|
+
*/
|
|
616
|
+
static create_empty_zcash(network, wallet_keys, consensus_branch_id, version, lock_time, version_group_id, expiry_height) {
|
|
617
|
+
try {
|
|
618
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
619
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
620
|
+
const len0 = WASM_VECTOR_LEN;
|
|
621
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
622
|
+
wasm.bitgopsbt_create_empty_zcash(retptr, ptr0, len0, wallet_keys.__wbg_ptr, consensus_branch_id, isLikeNone(version) ? 0x100000001 : (version) >> 0, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
|
|
623
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
624
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
625
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
626
|
+
if (r2) {
|
|
627
|
+
throw takeObject(r1);
|
|
628
|
+
}
|
|
629
|
+
return BitGoPsbt.__wrap(r0);
|
|
630
|
+
} finally {
|
|
631
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
423
634
|
/**
|
|
424
635
|
* Extract the final transaction from a finalized PSBT
|
|
425
636
|
*
|
|
@@ -656,6 +867,90 @@ export class BitGoPsbt {
|
|
|
656
867
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
657
868
|
}
|
|
658
869
|
}
|
|
870
|
+
/**
|
|
871
|
+
* Add a replay protection input to the PSBT
|
|
872
|
+
*
|
|
873
|
+
* Replay protection inputs are P2SH-P2PK inputs used on forked networks to prevent
|
|
874
|
+
* transaction replay attacks. They use a simple pubkey script without wallet derivation.
|
|
875
|
+
*
|
|
876
|
+
* # Arguments
|
|
877
|
+
* * `ecpair` - The ECPair containing the public key for the replay protection input
|
|
878
|
+
* * `txid` - The transaction ID (hex string) of the output being spent
|
|
879
|
+
* * `vout` - The output index being spent
|
|
880
|
+
* * `value` - The value in satoshis
|
|
881
|
+
* * `sequence` - Optional sequence number (default: 0xFFFFFFFE for RBF)
|
|
882
|
+
*
|
|
883
|
+
* # Returns
|
|
884
|
+
* The index of the newly added input
|
|
885
|
+
* @param {WasmECPair} ecpair
|
|
886
|
+
* @param {string} txid
|
|
887
|
+
* @param {number} vout
|
|
888
|
+
* @param {bigint} value
|
|
889
|
+
* @param {number | null} [sequence]
|
|
890
|
+
* @returns {number}
|
|
891
|
+
*/
|
|
892
|
+
add_replay_protection_input(ecpair, txid, vout, value, sequence) {
|
|
893
|
+
try {
|
|
894
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
895
|
+
_assertClass(ecpair, WasmECPair);
|
|
896
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
897
|
+
const len0 = WASM_VECTOR_LEN;
|
|
898
|
+
wasm.bitgopsbt_add_replay_protection_input(retptr, this.__wbg_ptr, ecpair.__wbg_ptr, ptr0, len0, vout, value, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
|
|
899
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
900
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
901
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
902
|
+
if (r2) {
|
|
903
|
+
throw takeObject(r1);
|
|
904
|
+
}
|
|
905
|
+
return r0 >>> 0;
|
|
906
|
+
} finally {
|
|
907
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Create an empty Zcash PSBT with consensus branch ID determined from block height
|
|
912
|
+
*
|
|
913
|
+
* This method automatically determines the correct consensus branch ID based on
|
|
914
|
+
* the network and block height using the network upgrade activation heights.
|
|
915
|
+
*
|
|
916
|
+
* # Arguments
|
|
917
|
+
* * `network` - Network name (must be "zcash" or "zcashTest")
|
|
918
|
+
* * `wallet_keys` - The wallet's root keys (used to set global xpubs)
|
|
919
|
+
* * `block_height` - Block height to determine consensus rules
|
|
920
|
+
* * `version` - Optional transaction version (default: 4 for Zcash Sapling+)
|
|
921
|
+
* * `lock_time` - Optional lock time (default: 0)
|
|
922
|
+
* * `version_group_id` - Optional version group ID (defaults to Sapling: 0x892F2085)
|
|
923
|
+
* * `expiry_height` - Optional expiry height
|
|
924
|
+
*
|
|
925
|
+
* # Errors
|
|
926
|
+
* Returns error if block height is before Overwinter activation
|
|
927
|
+
* @param {string} network
|
|
928
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
929
|
+
* @param {number} block_height
|
|
930
|
+
* @param {number | null} [version]
|
|
931
|
+
* @param {number | null} [lock_time]
|
|
932
|
+
* @param {number | null} [version_group_id]
|
|
933
|
+
* @param {number | null} [expiry_height]
|
|
934
|
+
* @returns {BitGoPsbt}
|
|
935
|
+
*/
|
|
936
|
+
static create_empty_zcash_at_height(network, wallet_keys, block_height, version, lock_time, version_group_id, expiry_height) {
|
|
937
|
+
try {
|
|
938
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
939
|
+
const ptr0 = passStringToWasm0(network, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
940
|
+
const len0 = WASM_VECTOR_LEN;
|
|
941
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
942
|
+
wasm.bitgopsbt_create_empty_zcash_at_height(retptr, ptr0, len0, wallet_keys.__wbg_ptr, block_height, isLikeNone(version) ? 0x100000001 : (version) >> 0, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0, isLikeNone(version_group_id) ? 0x100000001 : (version_group_id) >>> 0, isLikeNone(expiry_height) ? 0x100000001 : (expiry_height) >>> 0);
|
|
943
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
944
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
945
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
946
|
+
if (r2) {
|
|
947
|
+
throw takeObject(r1);
|
|
948
|
+
}
|
|
949
|
+
return BitGoPsbt.__wrap(r0);
|
|
950
|
+
} finally {
|
|
951
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
659
954
|
/**
|
|
660
955
|
* Parse outputs with wallet keys to identify which outputs belong to a wallet
|
|
661
956
|
*
|
|
@@ -764,6 +1059,63 @@ export class BitGoPsbt {
|
|
|
764
1059
|
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
765
1060
|
}
|
|
766
1061
|
}
|
|
1062
|
+
/**
|
|
1063
|
+
* Get the transaction version
|
|
1064
|
+
* @returns {number}
|
|
1065
|
+
*/
|
|
1066
|
+
version() {
|
|
1067
|
+
const ret = wasm.bitgopsbt_version(this.__wbg_ptr);
|
|
1068
|
+
return ret;
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Add an input to the PSBT
|
|
1072
|
+
*
|
|
1073
|
+
* # Arguments
|
|
1074
|
+
* * `txid` - The transaction ID (hex string) of the output being spent
|
|
1075
|
+
* * `vout` - The output index being spent
|
|
1076
|
+
* * `value` - The value in satoshis of the output being spent
|
|
1077
|
+
* * `script` - The output script (scriptPubKey) of the output being spent
|
|
1078
|
+
* * `sequence` - Optional sequence number (default: 0xFFFFFFFE for RBF)
|
|
1079
|
+
*
|
|
1080
|
+
* # Returns
|
|
1081
|
+
* The index of the newly added input
|
|
1082
|
+
* @param {string} txid
|
|
1083
|
+
* @param {number} vout
|
|
1084
|
+
* @param {bigint} value
|
|
1085
|
+
* @param {Uint8Array} script
|
|
1086
|
+
* @param {number | null} [sequence]
|
|
1087
|
+
* @param {Uint8Array | null} [prev_tx]
|
|
1088
|
+
* @returns {number}
|
|
1089
|
+
*/
|
|
1090
|
+
add_input(txid, vout, value, script, sequence, prev_tx) {
|
|
1091
|
+
try {
|
|
1092
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1093
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1094
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1095
|
+
const ptr1 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
1096
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1097
|
+
var ptr2 = isLikeNone(prev_tx) ? 0 : passArray8ToWasm0(prev_tx, wasm.__wbindgen_export);
|
|
1098
|
+
var len2 = WASM_VECTOR_LEN;
|
|
1099
|
+
wasm.bitgopsbt_add_input(retptr, this.__wbg_ptr, ptr0, len0, vout, value, ptr1, len1, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0, ptr2, len2);
|
|
1100
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1101
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1102
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1103
|
+
if (r2) {
|
|
1104
|
+
throw takeObject(r1);
|
|
1105
|
+
}
|
|
1106
|
+
return r0 >>> 0;
|
|
1107
|
+
} finally {
|
|
1108
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Get the transaction lock time
|
|
1113
|
+
* @returns {number}
|
|
1114
|
+
*/
|
|
1115
|
+
lock_time() {
|
|
1116
|
+
const ret = wasm.bitgopsbt_lock_time(this.__wbg_ptr);
|
|
1117
|
+
return ret >>> 0;
|
|
1118
|
+
}
|
|
767
1119
|
/**
|
|
768
1120
|
* Serialize the PSBT to bytes
|
|
769
1121
|
*
|
|
Binary file
|
|
@@ -1,22 +1,43 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
|
|
5
|
+
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
6
|
+
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
7
|
+
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
8
|
+
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
9
|
+
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
10
|
+
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
11
|
+
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
12
|
+
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
13
|
+
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
14
|
+
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
15
|
+
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
4
16
|
export const __wbg_addressnamespace_free: (a: number, b: number) => void;
|
|
5
17
|
export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
|
|
6
18
|
export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
|
|
7
|
-
export const
|
|
19
|
+
export const __wbg_wasmbip32_free: (a: number, b: number) => void;
|
|
8
20
|
export const __wbg_wasmecpair_free: (a: number, b: number) => void;
|
|
9
|
-
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
10
21
|
export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
|
|
11
22
|
export const __wbg_wrappsbt_free: (a: number, b: number) => void;
|
|
12
23
|
export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
13
24
|
export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
25
|
+
export const bitgopsbt_add_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number) => void;
|
|
26
|
+
export const bitgopsbt_add_output: (a: number, b: number, c: number, d: number, e: bigint) => void;
|
|
14
27
|
export const bitgopsbt_add_paygo_attestation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
28
|
+
export const bitgopsbt_add_replay_protection_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number) => void;
|
|
29
|
+
export const bitgopsbt_add_wallet_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => void;
|
|
30
|
+
export const bitgopsbt_add_wallet_output: (a: number, b: number, c: number, d: number, e: bigint, f: number) => void;
|
|
15
31
|
export const bitgopsbt_combine_musig2_nonces: (a: number, b: number, c: number) => void;
|
|
32
|
+
export const bitgopsbt_create_empty: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
33
|
+
export const bitgopsbt_create_empty_zcash: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
34
|
+
export const bitgopsbt_create_empty_zcash_at_height: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
35
|
+
export const bitgopsbt_expiry_height: (a: number) => number;
|
|
16
36
|
export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
|
|
17
37
|
export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
|
|
18
38
|
export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
19
39
|
export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
40
|
+
export const bitgopsbt_lock_time: (a: number) => number;
|
|
20
41
|
export const bitgopsbt_network: (a: number, b: number) => void;
|
|
21
42
|
export const bitgopsbt_parse_outputs_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
22
43
|
export const bitgopsbt_parse_transaction_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
@@ -27,10 +48,30 @@ export const bitgopsbt_unsigned_txid: (a: number, b: number) => void;
|
|
|
27
48
|
export const bitgopsbt_verify_replay_protection_signature: (a: number, b: number, c: number, d: number) => void;
|
|
28
49
|
export const bitgopsbt_verify_signature_with_pub: (a: number, b: number, c: number, d: number) => void;
|
|
29
50
|
export const bitgopsbt_verify_signature_with_xpub: (a: number, b: number, c: number, d: number) => void;
|
|
51
|
+
export const bitgopsbt_version: (a: number) => number;
|
|
52
|
+
export const bitgopsbt_version_group_id: (a: number) => number;
|
|
30
53
|
export const fixedscriptwalletnamespace_address: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
31
54
|
export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
32
|
-
export const
|
|
33
|
-
export const
|
|
55
|
+
export const wasmbip32_chain_code: (a: number) => number;
|
|
56
|
+
export const wasmbip32_depth: (a: number) => number;
|
|
57
|
+
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
58
|
+
export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
|
|
59
|
+
export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
|
|
60
|
+
export const wasmbip32_fingerprint: (a: number) => number;
|
|
61
|
+
export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
|
|
62
|
+
export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
|
|
63
|
+
export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
64
|
+
export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
|
|
65
|
+
export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
|
|
66
|
+
export const wasmbip32_identifier: (a: number) => number;
|
|
67
|
+
export const wasmbip32_index: (a: number) => number;
|
|
68
|
+
export const wasmbip32_is_neutered: (a: number) => number;
|
|
69
|
+
export const wasmbip32_neutered: (a: number) => number;
|
|
70
|
+
export const wasmbip32_parent_fingerprint: (a: number) => number;
|
|
71
|
+
export const wasmbip32_private_key: (a: number) => number;
|
|
72
|
+
export const wasmbip32_public_key: (a: number) => number;
|
|
73
|
+
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
74
|
+
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
34
75
|
export const wasmecpair_from_private_key: (a: number, b: number, c: number) => void;
|
|
35
76
|
export const wasmecpair_from_public_key: (a: number, b: number, c: number) => void;
|
|
36
77
|
export const wasmecpair_from_wif: (a: number, b: number, c: number) => void;
|
|
@@ -41,9 +82,6 @@ export const wasmecpair_public_key: (a: number) => number;
|
|
|
41
82
|
export const wasmecpair_to_wif: (a: number, b: number) => void;
|
|
42
83
|
export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
|
|
43
84
|
export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
|
|
44
|
-
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
45
|
-
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
46
|
-
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
47
85
|
export const wasmrootwalletkeys_backup_key: (a: number) => number;
|
|
48
86
|
export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
|
|
49
87
|
export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
|
|
@@ -57,47 +95,21 @@ export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number)
|
|
|
57
95
|
export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
|
|
58
96
|
export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
59
97
|
export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
|
|
60
|
-
export const
|
|
61
|
-
export const
|
|
98
|
+
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
99
|
+
export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
|
|
100
|
+
export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
101
|
+
export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
|
|
102
|
+
export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
|
|
103
|
+
export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
|
|
62
104
|
export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
|
|
63
|
-
export const
|
|
64
|
-
export const
|
|
65
|
-
export const wasmbip32_derive: (a: number, b: number, c: number) => void;
|
|
66
|
-
export const wasmbip32_derive_hardened: (a: number, b: number, c: number) => void;
|
|
67
|
-
export const wasmbip32_derive_path: (a: number, b: number, c: number, d: number) => void;
|
|
68
|
-
export const wasmbip32_fingerprint: (a: number) => number;
|
|
69
|
-
export const wasmbip32_from_base58: (a: number, b: number, c: number) => void;
|
|
70
|
-
export const wasmbip32_from_bip32_interface: (a: number, b: number) => void;
|
|
71
|
-
export const wasmbip32_from_seed: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
72
|
-
export const wasmbip32_from_xprv: (a: number, b: number, c: number) => void;
|
|
73
|
-
export const wasmbip32_from_xpub: (a: number, b: number, c: number) => void;
|
|
74
|
-
export const wasmbip32_identifier: (a: number) => number;
|
|
75
|
-
export const wasmbip32_index: (a: number) => number;
|
|
76
|
-
export const wasmbip32_is_neutered: (a: number) => number;
|
|
77
|
-
export const wasmbip32_neutered: (a: number) => number;
|
|
78
|
-
export const wasmbip32_parent_fingerprint: (a: number) => number;
|
|
79
|
-
export const wasmbip32_private_key: (a: number) => number;
|
|
80
|
-
export const wasmbip32_public_key: (a: number) => number;
|
|
81
|
-
export const wasmbip32_to_base58: (a: number, b: number) => void;
|
|
82
|
-
export const wasmbip32_to_wif: (a: number, b: number) => void;
|
|
83
|
-
export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
|
|
84
|
-
export const wrapdescriptor_descType: (a: number, b: number) => void;
|
|
85
|
-
export const wrapdescriptor_encode: (a: number, b: number) => void;
|
|
86
|
-
export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
87
|
-
export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
|
|
88
|
-
export const wrapdescriptor_hasWildcard: (a: number) => number;
|
|
89
|
-
export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
|
|
90
|
-
export const wrapdescriptor_node: (a: number, b: number) => void;
|
|
91
|
-
export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
|
|
92
|
-
export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
|
|
93
|
-
export const wrapdescriptor_toString: (a: number, b: number) => void;
|
|
105
|
+
export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
106
|
+
export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
94
107
|
export const wrapminiscript_encode: (a: number, b: number) => void;
|
|
95
108
|
export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
96
109
|
export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
97
110
|
export const wrapminiscript_node: (a: number, b: number) => void;
|
|
98
111
|
export const wrapminiscript_toAsmString: (a: number, b: number) => void;
|
|
99
112
|
export const wrapminiscript_toString: (a: number, b: number) => void;
|
|
100
|
-
export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
|
|
101
113
|
export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
102
114
|
export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
103
115
|
export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
|