@bitgo/wasm-utxo 1.27.0 → 1.28.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.
@@ -738,6 +738,25 @@ export class BitGoPsbt {
738
738
  wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
739
739
  }
740
740
  }
741
+ /**
742
+ * Check if an input is a MuSig2 keypath input.
743
+ *
744
+ * MuSig2 inputs require special handling: nonces must be generated first with
745
+ * `generate_musig2_nonces()`, then signed with `sign_musig2_input()`.
746
+ *
747
+ * # Arguments
748
+ * - `input_index`: The index of the input to check (0-based)
749
+ *
750
+ * # Returns
751
+ * - `true` if the input is a MuSig2 keypath input
752
+ * - `false` otherwise (or if input_index is out of bounds)
753
+ * @param {number} input_index
754
+ * @returns {boolean}
755
+ */
756
+ is_musig2_input(input_index) {
757
+ const ret = wasm.bitgopsbt_is_musig2_input(this.__wbg_ptr, input_index);
758
+ return ret !== 0;
759
+ }
741
760
  /**
742
761
  * Sign a single input with an extended private key (xpriv)
743
762
  *
@@ -873,6 +892,75 @@ export class BitGoPsbt {
873
892
  wasm.__wbindgen_add_to_stack_pointer(16);
874
893
  }
875
894
  }
895
+ /**
896
+ * Sign a single MuSig2 keypath input.
897
+ *
898
+ * This uses the FirstRound state generated by `generate_musig2_nonces()`.
899
+ * Each FirstRound can only be used once (nonce reuse is a security risk).
900
+ *
901
+ * For non-MuSig2 inputs, returns an error (use `sign_wallet_input` instead).
902
+ *
903
+ * # Arguments
904
+ * - `input_index`: The index of the input to sign (0-based)
905
+ * - `xpriv`: The extended private key as a WasmBIP32 instance
906
+ *
907
+ * # Returns
908
+ * - `Ok(())` if signing was successful
909
+ * - `Err(WasmUtxoError)` if signing fails, no FirstRound exists, or not a MuSig2 input
910
+ * @param {number} input_index
911
+ * @param {WasmBIP32} xpriv
912
+ */
913
+ sign_musig2_input(input_index, xpriv) {
914
+ try {
915
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
916
+ _assertClass(xpriv, WasmBIP32);
917
+ wasm.bitgopsbt_sign_musig2_input(retptr, this.__wbg_ptr, input_index, xpriv.__wbg_ptr);
918
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
919
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
920
+ if (r1) {
921
+ throw takeObject(r0);
922
+ }
923
+ } finally {
924
+ wasm.__wbindgen_add_to_stack_pointer(16);
925
+ }
926
+ }
927
+ /**
928
+ * Sign a single non-MuSig2 wallet input using save/restore pattern.
929
+ *
930
+ * For MuSig2 inputs, returns an error (use `sign_musig2_input` instead).
931
+ * For ECDSA inputs, this uses a save/restore pattern: clones the PSBT,
932
+ * signs all inputs on the clone, then copies only the target input's
933
+ * signatures back.
934
+ *
935
+ * **Important:** This is NOT faster than `sign_all_wallet_inputs()` for ECDSA inputs.
936
+ * The underlying library signs all inputs regardless. This method just ensures
937
+ * that only the specified input gets signatures added to the PSBT.
938
+ * Use `sign_all_wallet_inputs()` when signing multiple inputs with the same key.
939
+ *
940
+ * # Arguments
941
+ * - `input_index`: The index of the input to sign (0-based)
942
+ * - `xpriv`: The extended private key as a WasmBIP32 instance
943
+ *
944
+ * # Returns
945
+ * - `Ok(())` if the input was signed
946
+ * - `Err(WasmUtxoError)` if signing fails or input is MuSig2
947
+ * @param {number} input_index
948
+ * @param {WasmBIP32} xpriv
949
+ */
950
+ sign_wallet_input(input_index, xpriv) {
951
+ try {
952
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
953
+ _assertClass(xpriv, WasmBIP32);
954
+ wasm.bitgopsbt_sign_single_input_with_xpriv(retptr, this.__wbg_ptr, input_index, xpriv.__wbg_ptr);
955
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
956
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
957
+ if (r1) {
958
+ throw takeObject(r0);
959
+ }
960
+ } finally {
961
+ wasm.__wbindgen_add_to_stack_pointer(16);
962
+ }
963
+ }
876
964
  /**
877
965
  * Sign a single input with a raw private key
878
966
  *
@@ -1001,6 +1089,41 @@ export class BitGoPsbt {
1001
1089
  wasm.__wbindgen_add_to_stack_pointer(16);
1002
1090
  }
1003
1091
  }
1092
+ /**
1093
+ * Sign all non-MuSig2 inputs with an extended private key (xpriv) in a single pass.
1094
+ *
1095
+ * This is more efficient than calling `sign_with_xpriv` for each input individually.
1096
+ * The underlying miniscript library's `sign` method signs all matching inputs at once.
1097
+ *
1098
+ * **Note:** MuSig2 inputs are skipped by this method because they require FirstRound
1099
+ * state from nonce generation. After calling this method, sign MuSig2 inputs
1100
+ * individually using `sign_with_xpriv`.
1101
+ *
1102
+ * # Arguments
1103
+ * - `xpriv`: The extended private key as a WasmBIP32 instance
1104
+ *
1105
+ * # Returns
1106
+ * - `Ok(JsValue)` with an array of input indices that were signed
1107
+ * - `Err(WasmUtxoError)` if signing fails
1108
+ * @param {WasmBIP32} xpriv
1109
+ * @returns {any}
1110
+ */
1111
+ sign_all_with_xpriv(xpriv) {
1112
+ try {
1113
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1114
+ _assertClass(xpriv, WasmBIP32);
1115
+ wasm.bitgopsbt_sign_all_wallet_inputs(retptr, this.__wbg_ptr, xpriv.__wbg_ptr);
1116
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1117
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1118
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1119
+ if (r2) {
1120
+ throw takeObject(r1);
1121
+ }
1122
+ return takeObject(r0);
1123
+ } finally {
1124
+ wasm.__wbindgen_add_to_stack_pointer(16);
1125
+ }
1126
+ }
1004
1127
  /**
1005
1128
  * Add a PayGo attestation to a PSBT output
1006
1129
  *
@@ -1110,6 +1233,75 @@ export class BitGoPsbt {
1110
1233
  wasm.__wbindgen_add_to_stack_pointer(16);
1111
1234
  }
1112
1235
  }
1236
+ /**
1237
+ * Sign all MuSig2 keypath inputs in a single pass with optimized sighash computation.
1238
+ *
1239
+ * This is more efficient than calling `sign_musig2_input()` for each input because
1240
+ * it reuses the SighashCache across all inputs, avoiding redundant computation of
1241
+ * sha_prevouts, sha_amounts, sha_scriptpubkeys, sha_sequences, and sha_outputs.
1242
+ *
1243
+ * Each MuSig2 input requires a FirstRound from `generate_musig2_nonces()`.
1244
+ * FirstRounds that have already been consumed (signed) are skipped.
1245
+ *
1246
+ * # Arguments
1247
+ * - `xpriv`: The extended private key as a WasmBIP32 instance
1248
+ *
1249
+ * # Returns
1250
+ * - `Ok(JsValue)` with an array of input indices that were signed
1251
+ * - `Err(WasmUtxoError)` if signing fails
1252
+ * @param {WasmBIP32} xpriv
1253
+ * @returns {any}
1254
+ */
1255
+ sign_all_musig2_inputs(xpriv) {
1256
+ try {
1257
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1258
+ _assertClass(xpriv, WasmBIP32);
1259
+ wasm.bitgopsbt_sign_all_musig2_inputs(retptr, this.__wbg_ptr, xpriv.__wbg_ptr);
1260
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1261
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1262
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1263
+ if (r2) {
1264
+ throw takeObject(r1);
1265
+ }
1266
+ return takeObject(r0);
1267
+ } finally {
1268
+ wasm.__wbindgen_add_to_stack_pointer(16);
1269
+ }
1270
+ }
1271
+ /**
1272
+ * Sign all non-MuSig2 wallet inputs in a single efficient pass.
1273
+ *
1274
+ * This signs all ECDSA (P2SH, P2SH-P2WSH, P2WSH) and Taproot script path (P2TR)
1275
+ * inputs that match the provided xpriv. MuSig2 keypath inputs are skipped.
1276
+ *
1277
+ * This is the most efficient way to sign wallet inputs. After calling this,
1278
+ * sign any MuSig2 inputs using `sign_all_musig2_inputs()` or `sign_musig2_input()`.
1279
+ *
1280
+ * # Arguments
1281
+ * - `xpriv`: The extended private key as a WasmBIP32 instance
1282
+ *
1283
+ * # Returns
1284
+ * - `Ok(JsValue)` with an array of input indices that were signed
1285
+ * - `Err(WasmUtxoError)` if signing fails
1286
+ * @param {WasmBIP32} xpriv
1287
+ * @returns {any}
1288
+ */
1289
+ sign_all_wallet_inputs(xpriv) {
1290
+ try {
1291
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1292
+ _assertClass(xpriv, WasmBIP32);
1293
+ wasm.bitgopsbt_sign_all_wallet_inputs(retptr, this.__wbg_ptr, xpriv.__wbg_ptr);
1294
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1295
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1296
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1297
+ if (r2) {
1298
+ throw takeObject(r1);
1299
+ }
1300
+ return takeObject(r0);
1301
+ } finally {
1302
+ wasm.__wbindgen_add_to_stack_pointer(16);
1303
+ }
1304
+ }
1113
1305
  /**
1114
1306
  * Add an output to the PSBT by address
1115
1307
  *
@@ -1299,6 +1491,72 @@ export class BitGoPsbt {
1299
1491
  wasm.__wbindgen_add_to_stack_pointer(16);
1300
1492
  }
1301
1493
  }
1494
+ /**
1495
+ * Sign a single input with an extended private key, using save/restore for ECDSA inputs.
1496
+ *
1497
+ * For MuSig2 inputs, this returns an error (use sign_with_xpriv which handles FirstRound).
1498
+ * For ECDSA inputs, this clones the PSBT, signs all, then copies only the target
1499
+ * input's signatures back.
1500
+ *
1501
+ * **Important:** This is NOT faster than `sign_all_with_xpriv` for ECDSA inputs.
1502
+ * The underlying miniscript library signs all inputs regardless. This method
1503
+ * just prevents signatures from being added to other inputs.
1504
+ *
1505
+ * # Arguments
1506
+ * - `input_index`: The index of the input to sign (0-based)
1507
+ * - `xpriv`: The extended private key as a WasmBIP32 instance
1508
+ *
1509
+ * # Returns
1510
+ * - `Ok(())` if the input was signed
1511
+ * - `Err(WasmUtxoError)` if signing fails
1512
+ * @param {number} input_index
1513
+ * @param {WasmBIP32} xpriv
1514
+ */
1515
+ sign_single_input_with_xpriv(input_index, xpriv) {
1516
+ try {
1517
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1518
+ _assertClass(xpriv, WasmBIP32);
1519
+ wasm.bitgopsbt_sign_single_input_with_xpriv(retptr, this.__wbg_ptr, input_index, xpriv.__wbg_ptr);
1520
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1521
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1522
+ if (r1) {
1523
+ throw takeObject(r0);
1524
+ }
1525
+ } finally {
1526
+ wasm.__wbindgen_add_to_stack_pointer(16);
1527
+ }
1528
+ }
1529
+ /**
1530
+ * Sign all replay protection inputs with a raw private key.
1531
+ *
1532
+ * This iterates through all inputs looking for P2SH-P2PK (replay protection) inputs
1533
+ * that match the provided public key and signs them.
1534
+ *
1535
+ * # Arguments
1536
+ * - `ecpair`: The ECPair containing the private key
1537
+ *
1538
+ * # Returns
1539
+ * - `Ok(JsValue)` with an array of input indices that were signed
1540
+ * - `Err(WasmUtxoError)` if signing fails
1541
+ * @param {WasmECPair} ecpair
1542
+ * @returns {any}
1543
+ */
1544
+ sign_replay_protection_inputs(ecpair) {
1545
+ try {
1546
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1547
+ _assertClass(ecpair, WasmECPair);
1548
+ wasm.bitgopsbt_sign_all_replay_protection_inputs(retptr, this.__wbg_ptr, ecpair.__wbg_ptr);
1549
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1550
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1551
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1552
+ if (r2) {
1553
+ throw takeObject(r1);
1554
+ }
1555
+ return takeObject(r0);
1556
+ } finally {
1557
+ wasm.__wbindgen_add_to_stack_pointer(16);
1558
+ }
1559
+ }
1302
1560
  /**
1303
1561
  * Parse outputs with wallet keys to identify which outputs belong to a wallet
1304
1562
  *
@@ -1325,6 +1583,71 @@ export class BitGoPsbt {
1325
1583
  wasm.__wbindgen_add_to_stack_pointer(16);
1326
1584
  }
1327
1585
  }
1586
+ /**
1587
+ * Sign a single input with a raw private key, using save/restore for regular inputs.
1588
+ *
1589
+ * For replay protection inputs (P2SH-P2PK), this uses direct signing which is
1590
+ * already single-input. For regular inputs, this clones the PSBT, signs all,
1591
+ * then copies only the target input's signatures back.
1592
+ *
1593
+ * **Important:** This is NOT faster than signing all inputs for regular (non-RP) inputs.
1594
+ * The underlying miniscript library signs all inputs regardless.
1595
+ *
1596
+ * # Arguments
1597
+ * - `input_index`: The index of the input to sign (0-based)
1598
+ * - `ecpair`: The ECPair containing the private key
1599
+ *
1600
+ * # Returns
1601
+ * - `Ok(())` if the input was signed
1602
+ * - `Err(WasmUtxoError)` if signing fails
1603
+ * @param {number} input_index
1604
+ * @param {WasmECPair} ecpair
1605
+ */
1606
+ sign_single_input_with_privkey(input_index, ecpair) {
1607
+ try {
1608
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1609
+ _assertClass(ecpair, WasmECPair);
1610
+ wasm.bitgopsbt_sign_single_input_with_privkey(retptr, this.__wbg_ptr, input_index, ecpair.__wbg_ptr);
1611
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1612
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1613
+ if (r1) {
1614
+ throw takeObject(r0);
1615
+ }
1616
+ } finally {
1617
+ wasm.__wbindgen_add_to_stack_pointer(16);
1618
+ }
1619
+ }
1620
+ /**
1621
+ * Sign all replay protection inputs with a raw private key.
1622
+ *
1623
+ * This iterates through all inputs looking for P2SH-P2PK (replay protection) inputs
1624
+ * that match the provided public key and signs them.
1625
+ *
1626
+ * # Arguments
1627
+ * - `ecpair`: The ECPair containing the private key
1628
+ *
1629
+ * # Returns
1630
+ * - `Ok(JsValue)` with an array of input indices that were signed
1631
+ * - `Err(WasmUtxoError)` if signing fails
1632
+ * @param {WasmECPair} ecpair
1633
+ * @returns {any}
1634
+ */
1635
+ sign_all_replay_protection_inputs(ecpair) {
1636
+ try {
1637
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1638
+ _assertClass(ecpair, WasmECPair);
1639
+ wasm.bitgopsbt_sign_all_replay_protection_inputs(retptr, this.__wbg_ptr, ecpair.__wbg_ptr);
1640
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1641
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1642
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1643
+ if (r2) {
1644
+ throw takeObject(r1);
1645
+ }
1646
+ return takeObject(r0);
1647
+ } finally {
1648
+ wasm.__wbindgen_add_to_stack_pointer(16);
1649
+ }
1650
+ }
1328
1651
  /**
1329
1652
  * Parse transaction with wallet keys to identify wallet inputs/outputs
1330
1653
  * @param {WasmRootWalletKeys} wallet_keys
Binary file
@@ -2,16 +2,60 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_addressnamespace_free: (a: number, b: number) => void;
5
+ export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
6
+ export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
7
+ export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
8
+ export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
9
+ export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
10
+ export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
11
+ export const __wbg_wrappsbt_free: (a: number, b: number) => void;
12
+ export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
13
+ export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
14
+ export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
15
+ export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
16
+ export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
17
+ export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
18
+ export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
19
+ export const wasmtransaction_get_vsize: (a: number) => number;
20
+ export const wasmtransaction_to_bytes: (a: number, b: number) => void;
21
+ export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
22
+ export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
23
+ export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
24
+ export const wrapdescriptor_descType: (a: number, b: number) => void;
25
+ export const wrapdescriptor_encode: (a: number, b: number) => void;
26
+ export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
27
+ export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
28
+ export const wrapdescriptor_hasWildcard: (a: number) => number;
29
+ export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
30
+ export const wrapdescriptor_node: (a: number, b: number) => void;
31
+ export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
32
+ export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
33
+ export const wrapdescriptor_toString: (a: number, b: number) => void;
34
+ export const wrapminiscript_encode: (a: number, b: number) => void;
35
+ export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
36
+ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
37
+ export const wrapminiscript_node: (a: number, b: number) => void;
38
+ export const wrapminiscript_toAsmString: (a: number, b: number) => void;
39
+ export const wrapminiscript_toString: (a: number, b: number) => void;
40
+ export const wrappsbt_addInput: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number) => void;
41
+ export const wrappsbt_addOutput: (a: number, b: number, c: number, d: bigint) => number;
42
+ export const wrappsbt_clone: (a: number) => number;
43
+ export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
44
+ export const wrappsbt_finalize: (a: number, b: number) => void;
45
+ export const wrappsbt_getUnsignedTx: (a: number, b: number) => void;
46
+ export const wrappsbt_new: (a: number, b: number) => number;
47
+ export const wrappsbt_serialize: (a: number, b: number) => void;
48
+ export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
49
+ export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
50
+ export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
51
+ export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
5
52
  export const __wbg_bip322namespace_free: (a: number, b: number) => void;
6
53
  export const __wbg_bitgopsbt_free: (a: number, b: number) => void;
7
54
  export const __wbg_fixedscriptwalletnamespace_free: (a: number, b: number) => void;
8
- export const __wbg_utxolibcompatnamespace_free: (a: number, b: number) => void;
9
55
  export const __wbg_wasmbip32_free: (a: number, b: number) => void;
10
56
  export const __wbg_wasmdimensions_free: (a: number, b: number) => void;
11
57
  export const __wbg_wasmecpair_free: (a: number, b: number) => void;
12
- export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
13
- export const addressnamespace_from_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
14
- export const addressnamespace_to_output_script_with_coin: (a: number, b: number, c: number, d: number, e: number) => void;
58
+ export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
15
59
  export const bip322namespace_add_bip322_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
16
60
  export const bip322namespace_verify_bip322_psbt_input: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
17
61
  export const bip322namespace_verify_bip322_psbt_input_with_pubkeys: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
@@ -33,11 +77,18 @@ export const bitgopsbt_extract_transaction: (a: number, b: number) => void;
33
77
  export const bitgopsbt_finalize_all_inputs: (a: number, b: number) => void;
34
78
  export const bitgopsbt_from_bytes: (a: number, b: number, c: number, d: number, e: number) => void;
35
79
  export const bitgopsbt_generate_musig2_nonces: (a: number, b: number, c: number, d: number, e: number) => void;
80
+ export const bitgopsbt_is_musig2_input: (a: number, b: number) => number;
36
81
  export const bitgopsbt_lock_time: (a: number) => number;
37
82
  export const bitgopsbt_network: (a: number, b: number) => void;
38
83
  export const bitgopsbt_parse_outputs_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number) => void;
39
84
  export const bitgopsbt_parse_transaction_with_wallet_keys: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
40
85
  export const bitgopsbt_serialize: (a: number, b: number) => void;
86
+ export const bitgopsbt_sign_all_musig2_inputs: (a: number, b: number, c: number) => void;
87
+ export const bitgopsbt_sign_all_replay_protection_inputs: (a: number, b: number, c: number) => void;
88
+ export const bitgopsbt_sign_all_wallet_inputs: (a: number, b: number, c: number) => void;
89
+ export const bitgopsbt_sign_musig2_input: (a: number, b: number, c: number, d: number) => void;
90
+ export const bitgopsbt_sign_single_input_with_privkey: (a: number, b: number, c: number, d: number) => void;
91
+ export const bitgopsbt_sign_single_input_with_xpriv: (a: number, b: number, c: number, d: number) => void;
41
92
  export const bitgopsbt_sign_with_privkey: (a: number, b: number, c: number, d: number) => void;
42
93
  export const bitgopsbt_sign_with_xpriv: (a: number, b: number, c: number, d: number) => void;
43
94
  export const bitgopsbt_unsigned_txid: (a: number, b: number) => void;
@@ -52,8 +103,6 @@ export const fixedscriptwalletnamespace_chain_code_table: () => number;
52
103
  export const fixedscriptwalletnamespace_output_script: (a: number, b: number, c: number, d: number, e: number) => void;
53
104
  export const fixedscriptwalletnamespace_output_script_with_network_str: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
54
105
  export const fixedscriptwalletnamespace_supports_script_type: (a: number, b: number, c: number, d: number, e: number) => void;
55
- export const utxolibcompatnamespace_from_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
56
- export const utxolibcompatnamespace_to_output_script: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
57
106
  export const wasmbip32_chain_code: (a: number) => number;
58
107
  export const wasmbip32_depth: (a: number) => number;
59
108
  export const wasmbip32_derive: (a: number, b: number, c: number) => void;
@@ -99,61 +148,22 @@ export const wasmecpair_public_key: (a: number) => number;
99
148
  export const wasmecpair_to_wif: (a: number, b: number) => void;
100
149
  export const wasmecpair_to_wif_mainnet: (a: number, b: number) => void;
101
150
  export const wasmecpair_to_wif_testnet: (a: number, b: number) => void;
102
- export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
103
- export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
104
- export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
105
- export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
106
- export const __wbg_inscriptionsnamespace_free: (a: number, b: number) => void;
107
- export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
108
- export const __wbg_wasmrootwalletkeys_free: (a: number, b: number) => void;
109
- export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
110
- export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
111
- export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
112
- export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
113
- export const __wbg_wrappsbt_free: (a: number, b: number) => void;
114
- export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
115
- export const inscriptionsnamespace_sign_reveal_transaction: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: bigint) => void;
116
- export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
117
- export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
118
151
  export const wasmrootwalletkeys_backup_key: (a: number) => number;
119
152
  export const wasmrootwalletkeys_bitgo_key: (a: number) => number;
120
153
  export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number) => void;
121
154
  export const wasmrootwalletkeys_user_key: (a: number) => number;
122
155
  export const wasmrootwalletkeys_with_derivation_prefixes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
123
- export const wasmtransaction_from_bytes: (a: number, b: number, c: number) => void;
124
- export const wasmtransaction_get_vsize: (a: number) => number;
125
- export const wasmtransaction_to_bytes: (a: number, b: number) => void;
126
- export const wasmzcashtransaction_from_bytes: (a: number, b: number, c: number) => void;
127
- export const wasmzcashtransaction_to_bytes: (a: number, b: number) => void;
128
- export const wrapdescriptor_atDerivationIndex: (a: number, b: number, c: number) => void;
129
- export const wrapdescriptor_descType: (a: number, b: number) => void;
130
- export const wrapdescriptor_encode: (a: number, b: number) => void;
131
- export const wrapdescriptor_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
132
- export const wrapdescriptor_fromStringDetectType: (a: number, b: number, c: number) => void;
133
- export const wrapdescriptor_hasWildcard: (a: number) => number;
134
- export const wrapdescriptor_maxWeightToSatisfy: (a: number, b: number) => void;
135
- export const wrapdescriptor_node: (a: number, b: number) => void;
136
- export const wrapdescriptor_scriptPubkey: (a: number, b: number) => void;
137
- export const wrapdescriptor_toAsmString: (a: number, b: number) => void;
138
- export const wrapdescriptor_toString: (a: number, b: number) => void;
139
- export const wrapminiscript_encode: (a: number, b: number) => void;
140
- export const wrapminiscript_fromBitcoinScript: (a: number, b: number, c: number, d: number, e: number) => void;
141
- export const wrapminiscript_fromString: (a: number, b: number, c: number, d: number, e: number) => void;
142
- export const wrapminiscript_node: (a: number, b: number) => void;
143
- export const wrapminiscript_toAsmString: (a: number, b: number) => void;
144
- export const wrapminiscript_toString: (a: number, b: number) => void;
145
- export const wrappsbt_addInput: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number) => void;
146
- export const wrappsbt_addOutput: (a: number, b: number, c: number, d: bigint) => number;
147
- export const wrappsbt_clone: (a: number) => number;
148
- export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
149
- export const wrappsbt_finalize: (a: number, b: number) => void;
150
- export const wrappsbt_getUnsignedTx: (a: number, b: number) => void;
151
- export const wrappsbt_new: (a: number, b: number) => number;
152
- export const wrappsbt_serialize: (a: number, b: number) => void;
153
- export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
154
- export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
155
- export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
156
- export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
156
+ export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
157
+ export const bitgopsbt_sign_all_with_xpriv: (a: number, b: number, c: number) => void;
158
+ export const bitgopsbt_sign_replay_protection_inputs: (a: number, b: number, c: number) => void;
159
+ export const bitgopsbt_sign_wallet_input: (a: number, b: number, c: number, d: number) => void;
160
+ export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
161
+ export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
162
+ export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
163
+ export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
164
+ export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
165
+ export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
166
+ export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: number) => void;
157
167
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
158
168
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
159
169
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitgo/wasm-utxo",
3
3
  "description": "WebAssembly wrapper for rust-bitcoin (beta)",
4
- "version": "1.27.0",
4
+ "version": "1.28.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
@@ -35,6 +35,7 @@
35
35
  "scripts": {
36
36
  "test": "npm run test:mocha && npm run test:wasm-pack && npm run test:imports",
37
37
  "test:mocha": "mocha --recursive test",
38
+ "test:benchmark": "mocha test/benchmark/signing.ts --timeout 600000",
38
39
  "test:wasm-pack": "npm run test:wasm-pack-node && npm run test:wasm-pack-chrome",
39
40
  "test:wasm-pack-node": "./scripts/wasm-pack-test.sh --node",
40
41
  "test:wasm-pack-chrome": "./scripts/wasm-pack-test.sh --headless --chrome",