@bitgo/wasm-utxo 1.44.0 → 2.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.
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.d.ts +34 -50
- package/dist/cjs/js/fixedScriptWallet/BitGoPsbt.js +71 -32
- package/dist/cjs/js/fixedScriptWallet/RootWalletKeys.d.ts +5 -0
- package/dist/cjs/js/fixedScriptWallet/RootWalletKeys.js +7 -0
- package/dist/cjs/js/fixedScriptWallet/index.d.ts +1 -1
- package/dist/cjs/js/fixedScriptWallet/index.js +2 -1
- package/dist/cjs/js/index.d.ts +6 -1
- package/dist/cjs/js/psbt.d.ts +15 -6
- package/dist/cjs/js/transaction.d.ts +2 -6
- package/dist/cjs/js/transaction.js +6 -6
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +32 -86
- package/dist/cjs/js/wasm/wasm_utxo.js +463 -81
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +71 -54
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.d.ts +34 -50
- package/dist/esm/js/fixedScriptWallet/BitGoPsbt.js +71 -33
- package/dist/esm/js/fixedScriptWallet/RootWalletKeys.d.ts +5 -0
- package/dist/esm/js/fixedScriptWallet/RootWalletKeys.js +7 -0
- package/dist/esm/js/fixedScriptWallet/index.d.ts +1 -1
- package/dist/esm/js/fixedScriptWallet/index.js +1 -1
- package/dist/esm/js/index.d.ts +6 -1
- package/dist/esm/js/index.js +1 -1
- package/dist/esm/js/psbt.d.ts +15 -6
- package/dist/esm/js/transaction.d.ts +2 -6
- package/dist/esm/js/transaction.js +6 -6
- package/dist/esm/js/wasm/wasm_utxo.d.ts +32 -86
- package/dist/esm/js/wasm/wasm_utxo_bg.js +463 -81
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +71 -54
- package/package.json +11 -4
|
@@ -364,6 +364,36 @@ export class BitGoPsbt {
|
|
|
364
364
|
const ptr = this.__destroy_into_raw();
|
|
365
365
|
wasm.__wbg_bitgopsbt_free(ptr, 0);
|
|
366
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* @param {string} txid
|
|
369
|
+
* @param {number} vout
|
|
370
|
+
* @param {bigint} value
|
|
371
|
+
* @param {Uint8Array} script
|
|
372
|
+
* @param {number | null} [sequence]
|
|
373
|
+
* @param {Uint8Array | null} [prev_tx]
|
|
374
|
+
* @returns {number}
|
|
375
|
+
*/
|
|
376
|
+
add_input(txid, vout, value, script, sequence, prev_tx) {
|
|
377
|
+
try {
|
|
378
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
379
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
380
|
+
const len0 = WASM_VECTOR_LEN;
|
|
381
|
+
const ptr1 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
382
|
+
const len1 = WASM_VECTOR_LEN;
|
|
383
|
+
var ptr2 = isLikeNone(prev_tx) ? 0 : passArray8ToWasm0(prev_tx, wasm.__wbindgen_export);
|
|
384
|
+
var len2 = WASM_VECTOR_LEN;
|
|
385
|
+
wasm.bitgopsbt_add_input(retptr, this.__wbg_ptr, ptr0, len0, vout, value, ptr1, len1, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0, ptr2, len2);
|
|
386
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
387
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
388
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
389
|
+
if (r2) {
|
|
390
|
+
throw takeObject(r1);
|
|
391
|
+
}
|
|
392
|
+
return r0 >>> 0;
|
|
393
|
+
} finally {
|
|
394
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
367
397
|
/**
|
|
368
398
|
* Add an input to the PSBT
|
|
369
399
|
*
|
|
@@ -376,6 +406,7 @@ export class BitGoPsbt {
|
|
|
376
406
|
*
|
|
377
407
|
* # Returns
|
|
378
408
|
* The index of the newly added input
|
|
409
|
+
* @param {number} index
|
|
379
410
|
* @param {string} txid
|
|
380
411
|
* @param {number} vout
|
|
381
412
|
* @param {bigint} value
|
|
@@ -384,7 +415,7 @@ export class BitGoPsbt {
|
|
|
384
415
|
* @param {Uint8Array | null} [prev_tx]
|
|
385
416
|
* @returns {number}
|
|
386
417
|
*/
|
|
387
|
-
|
|
418
|
+
add_input_at_index(index, txid, vout, value, script, sequence, prev_tx) {
|
|
388
419
|
try {
|
|
389
420
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
390
421
|
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -393,7 +424,7 @@ export class BitGoPsbt {
|
|
|
393
424
|
const len1 = WASM_VECTOR_LEN;
|
|
394
425
|
var ptr2 = isLikeNone(prev_tx) ? 0 : passArray8ToWasm0(prev_tx, wasm.__wbindgen_export);
|
|
395
426
|
var len2 = WASM_VECTOR_LEN;
|
|
396
|
-
wasm.
|
|
427
|
+
wasm.bitgopsbt_add_input_at_index(retptr, this.__wbg_ptr, index, ptr0, len0, vout, value, ptr1, len1, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0, ptr2, len2);
|
|
397
428
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
398
429
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
399
430
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -406,14 +437,6 @@ export class BitGoPsbt {
|
|
|
406
437
|
}
|
|
407
438
|
}
|
|
408
439
|
/**
|
|
409
|
-
* Add an output to the PSBT
|
|
410
|
-
*
|
|
411
|
-
* # Arguments
|
|
412
|
-
* * `script` - The output script (scriptPubKey)
|
|
413
|
-
* * `value` - The value in satoshis
|
|
414
|
-
*
|
|
415
|
-
* # Returns
|
|
416
|
-
* The index of the newly added output
|
|
417
440
|
* @param {Uint8Array} script
|
|
418
441
|
* @param {bigint} value
|
|
419
442
|
* @returns {number}
|
|
@@ -436,14 +459,29 @@ export class BitGoPsbt {
|
|
|
436
459
|
}
|
|
437
460
|
}
|
|
438
461
|
/**
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
462
|
+
* @param {number} index
|
|
463
|
+
* @param {Uint8Array} script
|
|
464
|
+
* @param {bigint} value
|
|
465
|
+
* @returns {number}
|
|
466
|
+
*/
|
|
467
|
+
add_output_at_index(index, script, value) {
|
|
468
|
+
try {
|
|
469
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
470
|
+
const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
471
|
+
const len0 = WASM_VECTOR_LEN;
|
|
472
|
+
wasm.bitgopsbt_add_output_at_index(retptr, this.__wbg_ptr, index, ptr0, len0, value);
|
|
473
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
474
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
475
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
476
|
+
if (r2) {
|
|
477
|
+
throw takeObject(r1);
|
|
478
|
+
}
|
|
479
|
+
return r0 >>> 0;
|
|
480
|
+
} finally {
|
|
481
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
447
485
|
* @param {string} address
|
|
448
486
|
* @param {bigint} value
|
|
449
487
|
* @returns {number}
|
|
@@ -465,6 +503,29 @@ export class BitGoPsbt {
|
|
|
465
503
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
466
504
|
}
|
|
467
505
|
}
|
|
506
|
+
/**
|
|
507
|
+
* @param {number} index
|
|
508
|
+
* @param {string} address
|
|
509
|
+
* @param {bigint} value
|
|
510
|
+
* @returns {number}
|
|
511
|
+
*/
|
|
512
|
+
add_output_with_address_at_index(index, address, value) {
|
|
513
|
+
try {
|
|
514
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
515
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
516
|
+
const len0 = WASM_VECTOR_LEN;
|
|
517
|
+
wasm.bitgopsbt_add_output_with_address_at_index(retptr, this.__wbg_ptr, index, ptr0, len0, value);
|
|
518
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
519
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
520
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
521
|
+
if (r2) {
|
|
522
|
+
throw takeObject(r1);
|
|
523
|
+
}
|
|
524
|
+
return r0 >>> 0;
|
|
525
|
+
} finally {
|
|
526
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
468
529
|
/**
|
|
469
530
|
* Add a PayGo attestation to a PSBT output
|
|
470
531
|
*
|
|
@@ -498,20 +559,6 @@ export class BitGoPsbt {
|
|
|
498
559
|
}
|
|
499
560
|
}
|
|
500
561
|
/**
|
|
501
|
-
* Add a replay protection input to the PSBT
|
|
502
|
-
*
|
|
503
|
-
* Replay protection inputs are P2SH-P2PK inputs used on forked networks to prevent
|
|
504
|
-
* transaction replay attacks. They use a simple pubkey script without wallet derivation.
|
|
505
|
-
*
|
|
506
|
-
* # Arguments
|
|
507
|
-
* * `ecpair` - The ECPair containing the public key for the replay protection input
|
|
508
|
-
* * `txid` - The transaction ID (hex string) of the output being spent
|
|
509
|
-
* * `vout` - The output index being spent
|
|
510
|
-
* * `value` - The value in satoshis
|
|
511
|
-
* * `sequence` - Optional sequence number (default: 0xFFFFFFFE for RBF)
|
|
512
|
-
*
|
|
513
|
-
* # Returns
|
|
514
|
-
* The index of the newly added input
|
|
515
562
|
* @param {WasmECPair} ecpair
|
|
516
563
|
* @param {string} txid
|
|
517
564
|
* @param {number} vout
|
|
@@ -541,25 +588,36 @@ export class BitGoPsbt {
|
|
|
541
588
|
}
|
|
542
589
|
}
|
|
543
590
|
/**
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
*
|
|
549
|
-
*
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
591
|
+
* @param {number} index
|
|
592
|
+
* @param {WasmECPair} ecpair
|
|
593
|
+
* @param {string} txid
|
|
594
|
+
* @param {number} vout
|
|
595
|
+
* @param {bigint} value
|
|
596
|
+
* @param {number | null} [sequence]
|
|
597
|
+
* @param {Uint8Array | null} [prev_tx]
|
|
598
|
+
* @returns {number}
|
|
599
|
+
*/
|
|
600
|
+
add_replay_protection_input_at_index(index, ecpair, txid, vout, value, sequence, prev_tx) {
|
|
601
|
+
try {
|
|
602
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
603
|
+
_assertClass(ecpair, WasmECPair);
|
|
604
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
605
|
+
const len0 = WASM_VECTOR_LEN;
|
|
606
|
+
var ptr1 = isLikeNone(prev_tx) ? 0 : passArray8ToWasm0(prev_tx, wasm.__wbindgen_export);
|
|
607
|
+
var len1 = WASM_VECTOR_LEN;
|
|
608
|
+
wasm.bitgopsbt_add_replay_protection_input_at_index(retptr, this.__wbg_ptr, index, ecpair.__wbg_ptr, ptr0, len0, vout, value, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0, ptr1, len1);
|
|
609
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
610
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
611
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
612
|
+
if (r2) {
|
|
613
|
+
throw takeObject(r1);
|
|
614
|
+
}
|
|
615
|
+
return r0 >>> 0;
|
|
616
|
+
} finally {
|
|
617
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
563
621
|
* @param {string} txid
|
|
564
622
|
* @param {number} vout
|
|
565
623
|
* @param {bigint} value
|
|
@@ -597,19 +655,44 @@ export class BitGoPsbt {
|
|
|
597
655
|
}
|
|
598
656
|
}
|
|
599
657
|
/**
|
|
600
|
-
*
|
|
601
|
-
*
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
*
|
|
605
|
-
*
|
|
606
|
-
*
|
|
607
|
-
*
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
*
|
|
612
|
-
|
|
658
|
+
* @param {number} index
|
|
659
|
+
* @param {string} txid
|
|
660
|
+
* @param {number} vout
|
|
661
|
+
* @param {bigint} value
|
|
662
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
663
|
+
* @param {number} chain
|
|
664
|
+
* @param {number} derivation_index
|
|
665
|
+
* @param {string | null} [signer]
|
|
666
|
+
* @param {string | null} [cosigner]
|
|
667
|
+
* @param {number | null} [sequence]
|
|
668
|
+
* @param {Uint8Array | null} [prev_tx]
|
|
669
|
+
* @returns {number}
|
|
670
|
+
*/
|
|
671
|
+
add_wallet_input_at_index(index, txid, vout, value, wallet_keys, chain, derivation_index, signer, cosigner, sequence, prev_tx) {
|
|
672
|
+
try {
|
|
673
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
674
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
675
|
+
const len0 = WASM_VECTOR_LEN;
|
|
676
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
677
|
+
var ptr1 = isLikeNone(signer) ? 0 : passStringToWasm0(signer, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
678
|
+
var len1 = WASM_VECTOR_LEN;
|
|
679
|
+
var ptr2 = isLikeNone(cosigner) ? 0 : passStringToWasm0(cosigner, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
680
|
+
var len2 = WASM_VECTOR_LEN;
|
|
681
|
+
var ptr3 = isLikeNone(prev_tx) ? 0 : passArray8ToWasm0(prev_tx, wasm.__wbindgen_export);
|
|
682
|
+
var len3 = WASM_VECTOR_LEN;
|
|
683
|
+
wasm.bitgopsbt_add_wallet_input_at_index(retptr, this.__wbg_ptr, index, ptr0, len0, vout, value, wallet_keys.__wbg_ptr, chain, derivation_index, ptr1, len1, ptr2, len2, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0, ptr3, len3);
|
|
684
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
685
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
686
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
687
|
+
if (r2) {
|
|
688
|
+
throw takeObject(r1);
|
|
689
|
+
}
|
|
690
|
+
return r0 >>> 0;
|
|
691
|
+
} finally {
|
|
692
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
613
696
|
* @param {number} chain
|
|
614
697
|
* @param {number} index
|
|
615
698
|
* @param {bigint} value
|
|
@@ -632,6 +715,30 @@ export class BitGoPsbt {
|
|
|
632
715
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
633
716
|
}
|
|
634
717
|
}
|
|
718
|
+
/**
|
|
719
|
+
* @param {number} index
|
|
720
|
+
* @param {number} chain
|
|
721
|
+
* @param {number} derivation_index
|
|
722
|
+
* @param {bigint} value
|
|
723
|
+
* @param {WasmRootWalletKeys} wallet_keys
|
|
724
|
+
* @returns {number}
|
|
725
|
+
*/
|
|
726
|
+
add_wallet_output_at_index(index, chain, derivation_index, value, wallet_keys) {
|
|
727
|
+
try {
|
|
728
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
729
|
+
_assertClass(wallet_keys, WasmRootWalletKeys);
|
|
730
|
+
wasm.bitgopsbt_add_wallet_output_at_index(retptr, this.__wbg_ptr, index, chain, derivation_index, value, wallet_keys.__wbg_ptr);
|
|
731
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
732
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
733
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
734
|
+
if (r2) {
|
|
735
|
+
throw takeObject(r1);
|
|
736
|
+
}
|
|
737
|
+
return r0 >>> 0;
|
|
738
|
+
} finally {
|
|
739
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
635
742
|
/**
|
|
636
743
|
* Combine/merge data from another PSBT into this one
|
|
637
744
|
*
|
|
@@ -1014,6 +1121,14 @@ export class BitGoPsbt {
|
|
|
1014
1121
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1015
1122
|
}
|
|
1016
1123
|
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Returns the global xpubs from the PSBT as an array of WasmBIP32 instances.
|
|
1126
|
+
* @returns {any}
|
|
1127
|
+
*/
|
|
1128
|
+
get_global_xpubs() {
|
|
1129
|
+
const ret = wasm.bitgopsbt_get_global_xpubs(this.__wbg_ptr);
|
|
1130
|
+
return takeObject(ret);
|
|
1131
|
+
}
|
|
1017
1132
|
/**
|
|
1018
1133
|
* Get all PSBT inputs as an array of PsbtInputData
|
|
1019
1134
|
*
|
|
@@ -1218,6 +1333,38 @@ export class BitGoPsbt {
|
|
|
1218
1333
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1219
1334
|
}
|
|
1220
1335
|
}
|
|
1336
|
+
/**
|
|
1337
|
+
* @param {number} index
|
|
1338
|
+
*/
|
|
1339
|
+
remove_input(index) {
|
|
1340
|
+
try {
|
|
1341
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1342
|
+
wasm.bitgopsbt_remove_input(retptr, this.__wbg_ptr, index);
|
|
1343
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1344
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1345
|
+
if (r1) {
|
|
1346
|
+
throw takeObject(r0);
|
|
1347
|
+
}
|
|
1348
|
+
} finally {
|
|
1349
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* @param {number} index
|
|
1354
|
+
*/
|
|
1355
|
+
remove_output(index) {
|
|
1356
|
+
try {
|
|
1357
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1358
|
+
wasm.bitgopsbt_remove_output(retptr, this.__wbg_ptr, index);
|
|
1359
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1360
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1361
|
+
if (r1) {
|
|
1362
|
+
throw takeObject(r0);
|
|
1363
|
+
}
|
|
1364
|
+
} finally {
|
|
1365
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1221
1368
|
/**
|
|
1222
1369
|
* Serialize the PSBT to bytes
|
|
1223
1370
|
*
|
|
@@ -2016,6 +2163,35 @@ export class FixedScriptWalletNamespace {
|
|
|
2016
2163
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2017
2164
|
}
|
|
2018
2165
|
}
|
|
2166
|
+
/**
|
|
2167
|
+
* Sort an xpub triple into [user, backup, bitgo] order by validating
|
|
2168
|
+
* against the PSBT's wallet inputs. Returns a RootWalletKeys with the
|
|
2169
|
+
* correct ordering.
|
|
2170
|
+
* @param {BitGoPsbt} psbt
|
|
2171
|
+
* @param {WasmBIP32} user_or_a
|
|
2172
|
+
* @param {WasmBIP32} backup_or_b
|
|
2173
|
+
* @param {WasmBIP32} bitgo_or_c
|
|
2174
|
+
* @returns {WasmRootWalletKeys}
|
|
2175
|
+
*/
|
|
2176
|
+
static to_wallet_keys(psbt, user_or_a, backup_or_b, bitgo_or_c) {
|
|
2177
|
+
try {
|
|
2178
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2179
|
+
_assertClass(psbt, BitGoPsbt);
|
|
2180
|
+
_assertClass(user_or_a, WasmBIP32);
|
|
2181
|
+
_assertClass(backup_or_b, WasmBIP32);
|
|
2182
|
+
_assertClass(bitgo_or_c, WasmBIP32);
|
|
2183
|
+
wasm.fixedscriptwalletnamespace_to_wallet_keys(retptr, psbt.__wbg_ptr, user_or_a.__wbg_ptr, backup_or_b.__wbg_ptr, bitgo_or_c.__wbg_ptr);
|
|
2184
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2185
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2186
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2187
|
+
if (r2) {
|
|
2188
|
+
throw takeObject(r1);
|
|
2189
|
+
}
|
|
2190
|
+
return WasmRootWalletKeys.__wrap(r0);
|
|
2191
|
+
} finally {
|
|
2192
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2019
2195
|
}
|
|
2020
2196
|
if (Symbol.dispose) FixedScriptWalletNamespace.prototype[Symbol.dispose] = FixedScriptWalletNamespace.prototype.free;
|
|
2021
2197
|
|
|
@@ -3497,6 +3673,29 @@ export class WasmTransaction {
|
|
|
3497
3673
|
const ptr = this.__destroy_into_raw();
|
|
3498
3674
|
wasm.__wbg_wasmtransaction_free(ptr, 0);
|
|
3499
3675
|
}
|
|
3676
|
+
/**
|
|
3677
|
+
* @param {string} txid
|
|
3678
|
+
* @param {number} vout
|
|
3679
|
+
* @param {number | null} [sequence]
|
|
3680
|
+
* @returns {number}
|
|
3681
|
+
*/
|
|
3682
|
+
add_input(txid, vout, sequence) {
|
|
3683
|
+
try {
|
|
3684
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3685
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3686
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3687
|
+
wasm.wasmtransaction_add_input(retptr, this.__wbg_ptr, ptr0, len0, vout, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
|
|
3688
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3689
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3690
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
3691
|
+
if (r2) {
|
|
3692
|
+
throw takeObject(r1);
|
|
3693
|
+
}
|
|
3694
|
+
return r0 >>> 0;
|
|
3695
|
+
} finally {
|
|
3696
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3500
3699
|
/**
|
|
3501
3700
|
* Add an input to the transaction
|
|
3502
3701
|
*
|
|
@@ -3507,17 +3706,18 @@ export class WasmTransaction {
|
|
|
3507
3706
|
*
|
|
3508
3707
|
* # Returns
|
|
3509
3708
|
* The index of the newly added input
|
|
3709
|
+
* @param {number} index
|
|
3510
3710
|
* @param {string} txid
|
|
3511
3711
|
* @param {number} vout
|
|
3512
3712
|
* @param {number | null} [sequence]
|
|
3513
3713
|
* @returns {number}
|
|
3514
3714
|
*/
|
|
3515
|
-
|
|
3715
|
+
add_input_at_index(index, txid, vout, sequence) {
|
|
3516
3716
|
try {
|
|
3517
3717
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3518
3718
|
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3519
3719
|
const len0 = WASM_VECTOR_LEN;
|
|
3520
|
-
wasm.
|
|
3720
|
+
wasm.wasmtransaction_add_input_at_index(retptr, this.__wbg_ptr, index, ptr0, len0, vout, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
|
|
3521
3721
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3522
3722
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3523
3723
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -3530,14 +3730,6 @@ export class WasmTransaction {
|
|
|
3530
3730
|
}
|
|
3531
3731
|
}
|
|
3532
3732
|
/**
|
|
3533
|
-
* Add an output to the transaction
|
|
3534
|
-
*
|
|
3535
|
-
* # Arguments
|
|
3536
|
-
* * `script` - The output script (scriptPubKey)
|
|
3537
|
-
* * `value` - The value in satoshis
|
|
3538
|
-
*
|
|
3539
|
-
* # Returns
|
|
3540
|
-
* The index of the newly added output
|
|
3541
3733
|
* @param {Uint8Array} script
|
|
3542
3734
|
* @param {bigint} value
|
|
3543
3735
|
* @returns {number}
|
|
@@ -3548,6 +3740,29 @@ export class WasmTransaction {
|
|
|
3548
3740
|
const ret = wasm.wasmtransaction_add_output(this.__wbg_ptr, ptr0, len0, value);
|
|
3549
3741
|
return ret >>> 0;
|
|
3550
3742
|
}
|
|
3743
|
+
/**
|
|
3744
|
+
* @param {number} index
|
|
3745
|
+
* @param {Uint8Array} script
|
|
3746
|
+
* @param {bigint} value
|
|
3747
|
+
* @returns {number}
|
|
3748
|
+
*/
|
|
3749
|
+
add_output_at_index(index, script, value) {
|
|
3750
|
+
try {
|
|
3751
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3752
|
+
const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
3753
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3754
|
+
wasm.wasmtransaction_add_output_at_index(retptr, this.__wbg_ptr, index, ptr0, len0, value);
|
|
3755
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3756
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3757
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
3758
|
+
if (r2) {
|
|
3759
|
+
throw takeObject(r1);
|
|
3760
|
+
}
|
|
3761
|
+
return r0 >>> 0;
|
|
3762
|
+
} finally {
|
|
3763
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3551
3766
|
/**
|
|
3552
3767
|
* Create an empty transaction (version 1, locktime 0)
|
|
3553
3768
|
* @returns {WasmTransaction}
|
|
@@ -4218,6 +4433,33 @@ export class WrapPsbt {
|
|
|
4218
4433
|
const ptr = this.__destroy_into_raw();
|
|
4219
4434
|
wasm.__wbg_wrappsbt_free(ptr, 0);
|
|
4220
4435
|
}
|
|
4436
|
+
/**
|
|
4437
|
+
* @param {string} txid
|
|
4438
|
+
* @param {number} vout
|
|
4439
|
+
* @param {bigint} value
|
|
4440
|
+
* @param {Uint8Array} script
|
|
4441
|
+
* @param {number | null} [sequence]
|
|
4442
|
+
* @returns {number}
|
|
4443
|
+
*/
|
|
4444
|
+
addInput(txid, vout, value, script, sequence) {
|
|
4445
|
+
try {
|
|
4446
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4447
|
+
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4448
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4449
|
+
const ptr1 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
4450
|
+
const len1 = WASM_VECTOR_LEN;
|
|
4451
|
+
wasm.wrappsbt_addInput(retptr, this.__wbg_ptr, ptr0, len0, vout, value, ptr1, len1, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
|
|
4452
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4453
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4454
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4455
|
+
if (r2) {
|
|
4456
|
+
throw takeObject(r1);
|
|
4457
|
+
}
|
|
4458
|
+
return r0 >>> 0;
|
|
4459
|
+
} finally {
|
|
4460
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4461
|
+
}
|
|
4462
|
+
}
|
|
4221
4463
|
/**
|
|
4222
4464
|
* Add an input to the PSBT
|
|
4223
4465
|
*
|
|
@@ -4230,6 +4472,7 @@ export class WrapPsbt {
|
|
|
4230
4472
|
*
|
|
4231
4473
|
* # Returns
|
|
4232
4474
|
* The index of the newly added input
|
|
4475
|
+
* @param {number} index
|
|
4233
4476
|
* @param {string} txid
|
|
4234
4477
|
* @param {number} vout
|
|
4235
4478
|
* @param {bigint} value
|
|
@@ -4237,14 +4480,14 @@ export class WrapPsbt {
|
|
|
4237
4480
|
* @param {number | null} [sequence]
|
|
4238
4481
|
* @returns {number}
|
|
4239
4482
|
*/
|
|
4240
|
-
|
|
4483
|
+
addInputAtIndex(index, txid, vout, value, script, sequence) {
|
|
4241
4484
|
try {
|
|
4242
4485
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4243
4486
|
const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4244
4487
|
const len0 = WASM_VECTOR_LEN;
|
|
4245
4488
|
const ptr1 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
4246
4489
|
const len1 = WASM_VECTOR_LEN;
|
|
4247
|
-
wasm.
|
|
4490
|
+
wasm.wrappsbt_addInputAtIndex(retptr, this.__wbg_ptr, index, ptr0, len0, vout, value, ptr1, len1, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
|
|
4248
4491
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4249
4492
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4250
4493
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -4256,6 +4499,17 @@ export class WrapPsbt {
|
|
|
4256
4499
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4257
4500
|
}
|
|
4258
4501
|
}
|
|
4502
|
+
/**
|
|
4503
|
+
* @param {Uint8Array} script
|
|
4504
|
+
* @param {bigint} value
|
|
4505
|
+
* @returns {number}
|
|
4506
|
+
*/
|
|
4507
|
+
addOutput(script, value) {
|
|
4508
|
+
const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
4509
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4510
|
+
const ret = wasm.wrappsbt_addOutput(this.__wbg_ptr, ptr0, len0, value);
|
|
4511
|
+
return ret >>> 0;
|
|
4512
|
+
}
|
|
4259
4513
|
/**
|
|
4260
4514
|
* Add an output to the PSBT
|
|
4261
4515
|
*
|
|
@@ -4265,15 +4519,27 @@ export class WrapPsbt {
|
|
|
4265
4519
|
*
|
|
4266
4520
|
* # Returns
|
|
4267
4521
|
* The index of the newly added output
|
|
4522
|
+
* @param {number} index
|
|
4268
4523
|
* @param {Uint8Array} script
|
|
4269
4524
|
* @param {bigint} value
|
|
4270
4525
|
* @returns {number}
|
|
4271
4526
|
*/
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4527
|
+
addOutputAtIndex(index, script, value) {
|
|
4528
|
+
try {
|
|
4529
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4530
|
+
const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
|
|
4531
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4532
|
+
wasm.wrappsbt_addOutputAtIndex(retptr, this.__wbg_ptr, index, ptr0, len0, value);
|
|
4533
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4534
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4535
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4536
|
+
if (r2) {
|
|
4537
|
+
throw takeObject(r1);
|
|
4538
|
+
}
|
|
4539
|
+
return r0 >>> 0;
|
|
4540
|
+
} finally {
|
|
4541
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4542
|
+
}
|
|
4277
4543
|
}
|
|
4278
4544
|
/**
|
|
4279
4545
|
* @returns {WrapPsbt}
|
|
@@ -4342,6 +4608,14 @@ export class WrapPsbt {
|
|
|
4342
4608
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4343
4609
|
}
|
|
4344
4610
|
}
|
|
4611
|
+
/**
|
|
4612
|
+
* Get global xpubs from the PSBT as an array of WasmBIP32 instances.
|
|
4613
|
+
* @returns {any}
|
|
4614
|
+
*/
|
|
4615
|
+
getGlobalXpubs() {
|
|
4616
|
+
const ret = wasm.wrappsbt_getGlobalXpubs(this.__wbg_ptr);
|
|
4617
|
+
return takeObject(ret);
|
|
4618
|
+
}
|
|
4345
4619
|
/**
|
|
4346
4620
|
* Get all PSBT inputs as an array of PsbtInputData
|
|
4347
4621
|
*
|
|
@@ -4511,6 +4785,38 @@ export class WrapPsbt {
|
|
|
4511
4785
|
const ret = wasm.wrappsbt_outputCount(this.__wbg_ptr);
|
|
4512
4786
|
return ret >>> 0;
|
|
4513
4787
|
}
|
|
4788
|
+
/**
|
|
4789
|
+
* @param {number} index
|
|
4790
|
+
*/
|
|
4791
|
+
removeInput(index) {
|
|
4792
|
+
try {
|
|
4793
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4794
|
+
wasm.wrappsbt_removeInput(retptr, this.__wbg_ptr, index);
|
|
4795
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4796
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4797
|
+
if (r1) {
|
|
4798
|
+
throw takeObject(r0);
|
|
4799
|
+
}
|
|
4800
|
+
} finally {
|
|
4801
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
/**
|
|
4805
|
+
* @param {number} index
|
|
4806
|
+
*/
|
|
4807
|
+
removeOutput(index) {
|
|
4808
|
+
try {
|
|
4809
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4810
|
+
wasm.wrappsbt_removeOutput(retptr, this.__wbg_ptr, index);
|
|
4811
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4812
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4813
|
+
if (r1) {
|
|
4814
|
+
throw takeObject(r0);
|
|
4815
|
+
}
|
|
4816
|
+
} finally {
|
|
4817
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4514
4820
|
/**
|
|
4515
4821
|
* @returns {Uint8Array}
|
|
4516
4822
|
*/
|
|
@@ -4926,6 +5232,13 @@ export function __wbg_Error_8c4e43fe74559d73(arg0, arg1) {
|
|
|
4926
5232
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
4927
5233
|
return addHeapObject(ret);
|
|
4928
5234
|
}
|
|
5235
|
+
export function __wbg___wbindgen_debug_string_0bc8482c6e3508ae(arg0, arg1) {
|
|
5236
|
+
const ret = debugString(getObject(arg1));
|
|
5237
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
5238
|
+
const len1 = WASM_VECTOR_LEN;
|
|
5239
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
5240
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
5241
|
+
}
|
|
4929
5242
|
export function __wbg___wbindgen_is_function_0095a73b8b156f76(arg0) {
|
|
4930
5243
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
4931
5244
|
return ret;
|
|
@@ -5069,6 +5382,10 @@ export function __wbg_versions_c01dfd4722a88165(arg0) {
|
|
|
5069
5382
|
const ret = getObject(arg0).versions;
|
|
5070
5383
|
return addHeapObject(ret);
|
|
5071
5384
|
}
|
|
5385
|
+
export function __wbg_wasmbip32_new(arg0) {
|
|
5386
|
+
const ret = WasmBIP32.__wrap(arg0);
|
|
5387
|
+
return addHeapObject(ret);
|
|
5388
|
+
}
|
|
5072
5389
|
export function __wbg_wasmdashtransaction_new(arg0) {
|
|
5073
5390
|
const ret = WasmDashTransaction.__wrap(arg0);
|
|
5074
5391
|
return addHeapObject(ret);
|
|
@@ -5188,6 +5505,71 @@ function addBorrowedObject(obj) {
|
|
|
5188
5505
|
return stack_pointer;
|
|
5189
5506
|
}
|
|
5190
5507
|
|
|
5508
|
+
function debugString(val) {
|
|
5509
|
+
// primitive types
|
|
5510
|
+
const type = typeof val;
|
|
5511
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
5512
|
+
return `${val}`;
|
|
5513
|
+
}
|
|
5514
|
+
if (type == 'string') {
|
|
5515
|
+
return `"${val}"`;
|
|
5516
|
+
}
|
|
5517
|
+
if (type == 'symbol') {
|
|
5518
|
+
const description = val.description;
|
|
5519
|
+
if (description == null) {
|
|
5520
|
+
return 'Symbol';
|
|
5521
|
+
} else {
|
|
5522
|
+
return `Symbol(${description})`;
|
|
5523
|
+
}
|
|
5524
|
+
}
|
|
5525
|
+
if (type == 'function') {
|
|
5526
|
+
const name = val.name;
|
|
5527
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
5528
|
+
return `Function(${name})`;
|
|
5529
|
+
} else {
|
|
5530
|
+
return 'Function';
|
|
5531
|
+
}
|
|
5532
|
+
}
|
|
5533
|
+
// objects
|
|
5534
|
+
if (Array.isArray(val)) {
|
|
5535
|
+
const length = val.length;
|
|
5536
|
+
let debug = '[';
|
|
5537
|
+
if (length > 0) {
|
|
5538
|
+
debug += debugString(val[0]);
|
|
5539
|
+
}
|
|
5540
|
+
for(let i = 1; i < length; i++) {
|
|
5541
|
+
debug += ', ' + debugString(val[i]);
|
|
5542
|
+
}
|
|
5543
|
+
debug += ']';
|
|
5544
|
+
return debug;
|
|
5545
|
+
}
|
|
5546
|
+
// Test for built-in
|
|
5547
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
5548
|
+
let className;
|
|
5549
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
5550
|
+
className = builtInMatches[1];
|
|
5551
|
+
} else {
|
|
5552
|
+
// Failed to match the standard '[object ClassName]'
|
|
5553
|
+
return toString.call(val);
|
|
5554
|
+
}
|
|
5555
|
+
if (className == 'Object') {
|
|
5556
|
+
// we're a user defined class or Object
|
|
5557
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
5558
|
+
// easier than looping through ownProperties of `val`.
|
|
5559
|
+
try {
|
|
5560
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
5561
|
+
} catch (_) {
|
|
5562
|
+
return 'Object';
|
|
5563
|
+
}
|
|
5564
|
+
}
|
|
5565
|
+
// errors
|
|
5566
|
+
if (val instanceof Error) {
|
|
5567
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
5568
|
+
}
|
|
5569
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
5570
|
+
return className;
|
|
5571
|
+
}
|
|
5572
|
+
|
|
5191
5573
|
function dropObject(idx) {
|
|
5192
5574
|
if (idx < 132) return;
|
|
5193
5575
|
heap[idx] = heap_next;
|