@bitgo/wasm-utxo 1.26.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.
@@ -731,6 +731,25 @@ class BitGoPsbt {
731
731
  wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
732
732
  }
733
733
  }
734
+ /**
735
+ * Check if an input is a MuSig2 keypath input.
736
+ *
737
+ * MuSig2 inputs require special handling: nonces must be generated first with
738
+ * `generate_musig2_nonces()`, then signed with `sign_musig2_input()`.
739
+ *
740
+ * # Arguments
741
+ * - `input_index`: The index of the input to check (0-based)
742
+ *
743
+ * # Returns
744
+ * - `true` if the input is a MuSig2 keypath input
745
+ * - `false` otherwise (or if input_index is out of bounds)
746
+ * @param {number} input_index
747
+ * @returns {boolean}
748
+ */
749
+ is_musig2_input(input_index) {
750
+ const ret = wasm.bitgopsbt_is_musig2_input(this.__wbg_ptr, input_index);
751
+ return ret !== 0;
752
+ }
734
753
  /**
735
754
  * Sign a single input with an extended private key (xpriv)
736
755
  *
@@ -866,6 +885,75 @@ class BitGoPsbt {
866
885
  wasm.__wbindgen_add_to_stack_pointer(16);
867
886
  }
868
887
  }
888
+ /**
889
+ * Sign a single MuSig2 keypath input.
890
+ *
891
+ * This uses the FirstRound state generated by `generate_musig2_nonces()`.
892
+ * Each FirstRound can only be used once (nonce reuse is a security risk).
893
+ *
894
+ * For non-MuSig2 inputs, returns an error (use `sign_wallet_input` instead).
895
+ *
896
+ * # Arguments
897
+ * - `input_index`: The index of the input to sign (0-based)
898
+ * - `xpriv`: The extended private key as a WasmBIP32 instance
899
+ *
900
+ * # Returns
901
+ * - `Ok(())` if signing was successful
902
+ * - `Err(WasmUtxoError)` if signing fails, no FirstRound exists, or not a MuSig2 input
903
+ * @param {number} input_index
904
+ * @param {WasmBIP32} xpriv
905
+ */
906
+ sign_musig2_input(input_index, xpriv) {
907
+ try {
908
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
909
+ _assertClass(xpriv, WasmBIP32);
910
+ wasm.bitgopsbt_sign_musig2_input(retptr, this.__wbg_ptr, input_index, xpriv.__wbg_ptr);
911
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
912
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
913
+ if (r1) {
914
+ throw takeObject(r0);
915
+ }
916
+ } finally {
917
+ wasm.__wbindgen_add_to_stack_pointer(16);
918
+ }
919
+ }
920
+ /**
921
+ * Sign a single non-MuSig2 wallet input using save/restore pattern.
922
+ *
923
+ * For MuSig2 inputs, returns an error (use `sign_musig2_input` instead).
924
+ * For ECDSA inputs, this uses a save/restore pattern: clones the PSBT,
925
+ * signs all inputs on the clone, then copies only the target input's
926
+ * signatures back.
927
+ *
928
+ * **Important:** This is NOT faster than `sign_all_wallet_inputs()` for ECDSA inputs.
929
+ * The underlying library signs all inputs regardless. This method just ensures
930
+ * that only the specified input gets signatures added to the PSBT.
931
+ * Use `sign_all_wallet_inputs()` when signing multiple inputs with the same key.
932
+ *
933
+ * # Arguments
934
+ * - `input_index`: The index of the input to sign (0-based)
935
+ * - `xpriv`: The extended private key as a WasmBIP32 instance
936
+ *
937
+ * # Returns
938
+ * - `Ok(())` if the input was signed
939
+ * - `Err(WasmUtxoError)` if signing fails or input is MuSig2
940
+ * @param {number} input_index
941
+ * @param {WasmBIP32} xpriv
942
+ */
943
+ sign_wallet_input(input_index, xpriv) {
944
+ try {
945
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
946
+ _assertClass(xpriv, WasmBIP32);
947
+ wasm.bitgopsbt_sign_single_input_with_xpriv(retptr, this.__wbg_ptr, input_index, xpriv.__wbg_ptr);
948
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
949
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
950
+ if (r1) {
951
+ throw takeObject(r0);
952
+ }
953
+ } finally {
954
+ wasm.__wbindgen_add_to_stack_pointer(16);
955
+ }
956
+ }
869
957
  /**
870
958
  * Sign a single input with a raw private key
871
959
  *
@@ -994,6 +1082,41 @@ class BitGoPsbt {
994
1082
  wasm.__wbindgen_add_to_stack_pointer(16);
995
1083
  }
996
1084
  }
1085
+ /**
1086
+ * Sign all non-MuSig2 inputs with an extended private key (xpriv) in a single pass.
1087
+ *
1088
+ * This is more efficient than calling `sign_with_xpriv` for each input individually.
1089
+ * The underlying miniscript library's `sign` method signs all matching inputs at once.
1090
+ *
1091
+ * **Note:** MuSig2 inputs are skipped by this method because they require FirstRound
1092
+ * state from nonce generation. After calling this method, sign MuSig2 inputs
1093
+ * individually using `sign_with_xpriv`.
1094
+ *
1095
+ * # Arguments
1096
+ * - `xpriv`: The extended private key as a WasmBIP32 instance
1097
+ *
1098
+ * # Returns
1099
+ * - `Ok(JsValue)` with an array of input indices that were signed
1100
+ * - `Err(WasmUtxoError)` if signing fails
1101
+ * @param {WasmBIP32} xpriv
1102
+ * @returns {any}
1103
+ */
1104
+ sign_all_with_xpriv(xpriv) {
1105
+ try {
1106
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1107
+ _assertClass(xpriv, WasmBIP32);
1108
+ wasm.bitgopsbt_sign_all_wallet_inputs(retptr, this.__wbg_ptr, xpriv.__wbg_ptr);
1109
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1110
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1111
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1112
+ if (r2) {
1113
+ throw takeObject(r1);
1114
+ }
1115
+ return takeObject(r0);
1116
+ } finally {
1117
+ wasm.__wbindgen_add_to_stack_pointer(16);
1118
+ }
1119
+ }
997
1120
  /**
998
1121
  * Add a PayGo attestation to a PSBT output
999
1122
  *
@@ -1103,6 +1226,75 @@ class BitGoPsbt {
1103
1226
  wasm.__wbindgen_add_to_stack_pointer(16);
1104
1227
  }
1105
1228
  }
1229
+ /**
1230
+ * Sign all MuSig2 keypath inputs in a single pass with optimized sighash computation.
1231
+ *
1232
+ * This is more efficient than calling `sign_musig2_input()` for each input because
1233
+ * it reuses the SighashCache across all inputs, avoiding redundant computation of
1234
+ * sha_prevouts, sha_amounts, sha_scriptpubkeys, sha_sequences, and sha_outputs.
1235
+ *
1236
+ * Each MuSig2 input requires a FirstRound from `generate_musig2_nonces()`.
1237
+ * FirstRounds that have already been consumed (signed) are skipped.
1238
+ *
1239
+ * # Arguments
1240
+ * - `xpriv`: The extended private key as a WasmBIP32 instance
1241
+ *
1242
+ * # Returns
1243
+ * - `Ok(JsValue)` with an array of input indices that were signed
1244
+ * - `Err(WasmUtxoError)` if signing fails
1245
+ * @param {WasmBIP32} xpriv
1246
+ * @returns {any}
1247
+ */
1248
+ sign_all_musig2_inputs(xpriv) {
1249
+ try {
1250
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1251
+ _assertClass(xpriv, WasmBIP32);
1252
+ wasm.bitgopsbt_sign_all_musig2_inputs(retptr, this.__wbg_ptr, xpriv.__wbg_ptr);
1253
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1254
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1255
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1256
+ if (r2) {
1257
+ throw takeObject(r1);
1258
+ }
1259
+ return takeObject(r0);
1260
+ } finally {
1261
+ wasm.__wbindgen_add_to_stack_pointer(16);
1262
+ }
1263
+ }
1264
+ /**
1265
+ * Sign all non-MuSig2 wallet inputs in a single efficient pass.
1266
+ *
1267
+ * This signs all ECDSA (P2SH, P2SH-P2WSH, P2WSH) and Taproot script path (P2TR)
1268
+ * inputs that match the provided xpriv. MuSig2 keypath inputs are skipped.
1269
+ *
1270
+ * This is the most efficient way to sign wallet inputs. After calling this,
1271
+ * sign any MuSig2 inputs using `sign_all_musig2_inputs()` or `sign_musig2_input()`.
1272
+ *
1273
+ * # Arguments
1274
+ * - `xpriv`: The extended private key as a WasmBIP32 instance
1275
+ *
1276
+ * # Returns
1277
+ * - `Ok(JsValue)` with an array of input indices that were signed
1278
+ * - `Err(WasmUtxoError)` if signing fails
1279
+ * @param {WasmBIP32} xpriv
1280
+ * @returns {any}
1281
+ */
1282
+ sign_all_wallet_inputs(xpriv) {
1283
+ try {
1284
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1285
+ _assertClass(xpriv, WasmBIP32);
1286
+ wasm.bitgopsbt_sign_all_wallet_inputs(retptr, this.__wbg_ptr, xpriv.__wbg_ptr);
1287
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1288
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1289
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1290
+ if (r2) {
1291
+ throw takeObject(r1);
1292
+ }
1293
+ return takeObject(r0);
1294
+ } finally {
1295
+ wasm.__wbindgen_add_to_stack_pointer(16);
1296
+ }
1297
+ }
1106
1298
  /**
1107
1299
  * Add an output to the PSBT by address
1108
1300
  *
@@ -1292,6 +1484,72 @@ class BitGoPsbt {
1292
1484
  wasm.__wbindgen_add_to_stack_pointer(16);
1293
1485
  }
1294
1486
  }
1487
+ /**
1488
+ * Sign a single input with an extended private key, using save/restore for ECDSA inputs.
1489
+ *
1490
+ * For MuSig2 inputs, this returns an error (use sign_with_xpriv which handles FirstRound).
1491
+ * For ECDSA inputs, this clones the PSBT, signs all, then copies only the target
1492
+ * input's signatures back.
1493
+ *
1494
+ * **Important:** This is NOT faster than `sign_all_with_xpriv` for ECDSA inputs.
1495
+ * The underlying miniscript library signs all inputs regardless. This method
1496
+ * just prevents signatures from being added to other inputs.
1497
+ *
1498
+ * # Arguments
1499
+ * - `input_index`: The index of the input to sign (0-based)
1500
+ * - `xpriv`: The extended private key as a WasmBIP32 instance
1501
+ *
1502
+ * # Returns
1503
+ * - `Ok(())` if the input was signed
1504
+ * - `Err(WasmUtxoError)` if signing fails
1505
+ * @param {number} input_index
1506
+ * @param {WasmBIP32} xpriv
1507
+ */
1508
+ sign_single_input_with_xpriv(input_index, xpriv) {
1509
+ try {
1510
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1511
+ _assertClass(xpriv, WasmBIP32);
1512
+ wasm.bitgopsbt_sign_single_input_with_xpriv(retptr, this.__wbg_ptr, input_index, xpriv.__wbg_ptr);
1513
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1514
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1515
+ if (r1) {
1516
+ throw takeObject(r0);
1517
+ }
1518
+ } finally {
1519
+ wasm.__wbindgen_add_to_stack_pointer(16);
1520
+ }
1521
+ }
1522
+ /**
1523
+ * Sign all replay protection inputs with a raw private key.
1524
+ *
1525
+ * This iterates through all inputs looking for P2SH-P2PK (replay protection) inputs
1526
+ * that match the provided public key and signs them.
1527
+ *
1528
+ * # Arguments
1529
+ * - `ecpair`: The ECPair containing the private key
1530
+ *
1531
+ * # Returns
1532
+ * - `Ok(JsValue)` with an array of input indices that were signed
1533
+ * - `Err(WasmUtxoError)` if signing fails
1534
+ * @param {WasmECPair} ecpair
1535
+ * @returns {any}
1536
+ */
1537
+ sign_replay_protection_inputs(ecpair) {
1538
+ try {
1539
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1540
+ _assertClass(ecpair, WasmECPair);
1541
+ wasm.bitgopsbt_sign_all_replay_protection_inputs(retptr, this.__wbg_ptr, ecpair.__wbg_ptr);
1542
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1543
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1544
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1545
+ if (r2) {
1546
+ throw takeObject(r1);
1547
+ }
1548
+ return takeObject(r0);
1549
+ } finally {
1550
+ wasm.__wbindgen_add_to_stack_pointer(16);
1551
+ }
1552
+ }
1295
1553
  /**
1296
1554
  * Parse outputs with wallet keys to identify which outputs belong to a wallet
1297
1555
  *
@@ -1318,6 +1576,71 @@ class BitGoPsbt {
1318
1576
  wasm.__wbindgen_add_to_stack_pointer(16);
1319
1577
  }
1320
1578
  }
1579
+ /**
1580
+ * Sign a single input with a raw private key, using save/restore for regular inputs.
1581
+ *
1582
+ * For replay protection inputs (P2SH-P2PK), this uses direct signing which is
1583
+ * already single-input. For regular inputs, this clones the PSBT, signs all,
1584
+ * then copies only the target input's signatures back.
1585
+ *
1586
+ * **Important:** This is NOT faster than signing all inputs for regular (non-RP) inputs.
1587
+ * The underlying miniscript library signs all inputs regardless.
1588
+ *
1589
+ * # Arguments
1590
+ * - `input_index`: The index of the input to sign (0-based)
1591
+ * - `ecpair`: The ECPair containing the private key
1592
+ *
1593
+ * # Returns
1594
+ * - `Ok(())` if the input was signed
1595
+ * - `Err(WasmUtxoError)` if signing fails
1596
+ * @param {number} input_index
1597
+ * @param {WasmECPair} ecpair
1598
+ */
1599
+ sign_single_input_with_privkey(input_index, ecpair) {
1600
+ try {
1601
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1602
+ _assertClass(ecpair, WasmECPair);
1603
+ wasm.bitgopsbt_sign_single_input_with_privkey(retptr, this.__wbg_ptr, input_index, ecpair.__wbg_ptr);
1604
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1605
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1606
+ if (r1) {
1607
+ throw takeObject(r0);
1608
+ }
1609
+ } finally {
1610
+ wasm.__wbindgen_add_to_stack_pointer(16);
1611
+ }
1612
+ }
1613
+ /**
1614
+ * Sign all replay protection inputs with a raw private key.
1615
+ *
1616
+ * This iterates through all inputs looking for P2SH-P2PK (replay protection) inputs
1617
+ * that match the provided public key and signs them.
1618
+ *
1619
+ * # Arguments
1620
+ * - `ecpair`: The ECPair containing the private key
1621
+ *
1622
+ * # Returns
1623
+ * - `Ok(JsValue)` with an array of input indices that were signed
1624
+ * - `Err(WasmUtxoError)` if signing fails
1625
+ * @param {WasmECPair} ecpair
1626
+ * @returns {any}
1627
+ */
1628
+ sign_all_replay_protection_inputs(ecpair) {
1629
+ try {
1630
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1631
+ _assertClass(ecpair, WasmECPair);
1632
+ wasm.bitgopsbt_sign_all_replay_protection_inputs(retptr, this.__wbg_ptr, ecpair.__wbg_ptr);
1633
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1634
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1635
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1636
+ if (r2) {
1637
+ throw takeObject(r1);
1638
+ }
1639
+ return takeObject(r0);
1640
+ } finally {
1641
+ wasm.__wbindgen_add_to_stack_pointer(16);
1642
+ }
1643
+ }
1321
1644
  /**
1322
1645
  * Parse transaction with wallet keys to identify wallet inputs/outputs
1323
1646
  * @param {WasmRootWalletKeys} wallet_keys
@@ -3619,6 +3942,25 @@ class WrapPsbt {
3619
3942
  const ptr = this.__destroy_into_raw();
3620
3943
  wasm.__wbg_wrappsbt_free(ptr, 0);
3621
3944
  }
3945
+ /**
3946
+ * Add an output to the PSBT
3947
+ *
3948
+ * # Arguments
3949
+ * * `script` - The output script (scriptPubKey)
3950
+ * * `value` - Value in satoshis
3951
+ *
3952
+ * # Returns
3953
+ * The index of the newly added output
3954
+ * @param {Uint8Array} script
3955
+ * @param {bigint} value
3956
+ * @returns {number}
3957
+ */
3958
+ addOutput(script, value) {
3959
+ const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
3960
+ const len0 = WASM_VECTOR_LEN;
3961
+ const ret = wasm.wrappsbt_addOutput(this.__wbg_ptr, ptr0, len0, value);
3962
+ return ret >>> 0;
3963
+ }
3622
3964
  /**
3623
3965
  * @param {Uint8Array} psbt
3624
3966
  * @returns {WrapPsbt}
@@ -3695,6 +4037,26 @@ class WrapPsbt {
3695
4037
  wasm.__wbindgen_add_to_stack_pointer(16);
3696
4038
  }
3697
4039
  }
4040
+ /**
4041
+ * Get the unsigned transaction bytes
4042
+ *
4043
+ * # Returns
4044
+ * The serialized unsigned transaction
4045
+ * @returns {Uint8Array}
4046
+ */
4047
+ getUnsignedTx() {
4048
+ try {
4049
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4050
+ wasm.wrappsbt_getUnsignedTx(retptr, this.__wbg_ptr);
4051
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4052
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4053
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
4054
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
4055
+ return v1;
4056
+ } finally {
4057
+ wasm.__wbindgen_add_to_stack_pointer(16);
4058
+ }
4059
+ }
3698
4060
  /**
3699
4061
  * @param {number} input_index
3700
4062
  * @param {WrapDescriptor} descriptor
@@ -3731,6 +4093,21 @@ class WrapPsbt {
3731
4093
  wasm.__wbindgen_add_to_stack_pointer(16);
3732
4094
  }
3733
4095
  }
4096
+ /**
4097
+ * Create an empty PSBT
4098
+ *
4099
+ * # Arguments
4100
+ * * `version` - Transaction version (default: 2)
4101
+ * * `lock_time` - Transaction lock time (default: 0)
4102
+ * @param {number | null} [version]
4103
+ * @param {number | null} [lock_time]
4104
+ */
4105
+ constructor(version, lock_time) {
4106
+ const ret = wasm.wrappsbt_new(isLikeNone(version) ? 0x100000001 : (version) >> 0, isLikeNone(lock_time) ? 0x100000001 : (lock_time) >>> 0);
4107
+ this.__wbg_ptr = ret >>> 0;
4108
+ WrapPsbtFinalization.register(this, this.__wbg_ptr, this);
4109
+ return this;
4110
+ }
3734
4111
  /**
3735
4112
  * @returns {WrapPsbt}
3736
4113
  */
@@ -3738,6 +4115,44 @@ class WrapPsbt {
3738
4115
  const ret = wasm.wrappsbt_clone(this.__wbg_ptr);
3739
4116
  return WrapPsbt.__wrap(ret);
3740
4117
  }
4118
+ /**
4119
+ * Add an input to the PSBT
4120
+ *
4121
+ * # Arguments
4122
+ * * `txid` - Transaction ID (hex string, 32 bytes reversed)
4123
+ * * `vout` - Output index being spent
4124
+ * * `value` - Value in satoshis of the output being spent
4125
+ * * `script` - The scriptPubKey of the output being spent
4126
+ * * `sequence` - Sequence number (default: 0xFFFFFFFE for RBF)
4127
+ *
4128
+ * # Returns
4129
+ * The index of the newly added input
4130
+ * @param {string} txid
4131
+ * @param {number} vout
4132
+ * @param {bigint} value
4133
+ * @param {Uint8Array} script
4134
+ * @param {number | null} [sequence]
4135
+ * @returns {number}
4136
+ */
4137
+ addInput(txid, vout, value, script, sequence) {
4138
+ try {
4139
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4140
+ const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
4141
+ const len0 = WASM_VECTOR_LEN;
4142
+ const ptr1 = passArray8ToWasm0(script, wasm.__wbindgen_export);
4143
+ const len1 = WASM_VECTOR_LEN;
4144
+ wasm.wrappsbt_addInput(retptr, this.__wbg_ptr, ptr0, len0, vout, value, ptr1, len1, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
4145
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4146
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4147
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
4148
+ if (r2) {
4149
+ throw takeObject(r1);
4150
+ }
4151
+ return r0 >>> 0;
4152
+ } finally {
4153
+ wasm.__wbindgen_add_to_stack_pointer(16);
4154
+ }
4155
+ }
3741
4156
  /**
3742
4157
  * @returns {Uint8Array}
3743
4158
  */
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
58
  export const __wbg_wasmrootwalletkeys_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;
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;
@@ -105,51 +154,16 @@ export const wasmrootwalletkeys_new: (a: number, b: number, c: number, d: number
105
154
  export const wasmrootwalletkeys_user_key: (a: number) => number;
106
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;
107
156
  export const wasmbip32_from_bip32_properties: (a: number, b: number) => void;
108
- export const __wbg_inscriptionsnamespace_free: (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;
109
160
  export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
110
161
  export const __wbg_wasmreplayprotection_free: (a: number, b: number) => void;
111
- export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
112
- export const __wbg_wasmzcashtransaction_free: (a: number, b: number) => void;
113
- export const __wbg_wrapdescriptor_free: (a: number, b: number) => void;
114
- export const __wbg_wrapminiscript_free: (a: number, b: number) => void;
115
- export const __wbg_wrappsbt_free: (a: number, b: number) => void;
116
- export const inscriptionsnamespace_create_inscription_reveal_data: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
117
- 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;
118
162
  export const wasmdashtransaction_from_bytes: (a: number, b: number, c: number) => void;
119
163
  export const wasmdashtransaction_to_bytes: (a: number, b: number) => void;
120
164
  export const wasmreplayprotection_from_addresses: (a: number, b: number, c: number, d: number, e: number) => void;
121
165
  export const wasmreplayprotection_from_output_scripts: (a: number, b: number) => number;
122
166
  export const wasmreplayprotection_from_public_keys: (a: number, b: number, c: 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_clone: (a: number) => number;
146
- export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
147
- export const wrappsbt_finalize: (a: number, b: number) => void;
148
- export const wrappsbt_serialize: (a: number, b: number) => void;
149
- export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
150
- export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
151
- export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
152
- export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
153
167
  export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
154
168
  export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
155
169
  export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
@@ -138,3 +138,10 @@ export declare class BIP32 implements BIP32Interface {
138
138
  */
139
139
  get wasm(): WasmBIP32;
140
140
  }
141
+ /**
142
+ * Type guard to check if a value is a BIP32Arg
143
+ *
144
+ * @param key - The value to check
145
+ * @returns true if the value is a BIP32Arg (string, BIP32, WasmBIP32, or BIP32Interface)
146
+ */
147
+ export declare function isBIP32Arg(key: unknown): key is BIP32Arg;
@@ -171,3 +171,18 @@ export class BIP32 {
171
171
  return this._wasm;
172
172
  }
173
173
  }
174
+ /**
175
+ * Type guard to check if a value is a BIP32Arg
176
+ *
177
+ * @param key - The value to check
178
+ * @returns true if the value is a BIP32Arg (string, BIP32, WasmBIP32, or BIP32Interface)
179
+ */
180
+ export function isBIP32Arg(key) {
181
+ return (typeof key === "string" ||
182
+ key instanceof BIP32 ||
183
+ key instanceof WasmBIP32 ||
184
+ (typeof key === "object" &&
185
+ key !== null &&
186
+ "derive" in key &&
187
+ typeof key.derive === "function"));
188
+ }
@@ -1 +1,6 @@
1
- export type CoinName = "btc" | "tbtc" | "tbtc4" | "tbtcsig" | "tbtcbgsig" | "bch" | "tbch" | "bcha" | "tbcha" | "btg" | "tbtg" | "bsv" | "tbsv" | "dash" | "tdash" | "doge" | "tdoge" | "ltc" | "tltc" | "zec" | "tzec";
1
+ export declare const coinNames: readonly ["btc", "tbtc", "tbtc4", "tbtcsig", "tbtcbgsig", "bch", "tbch", "bcha", "tbcha", "btg", "tbtg", "bsv", "tbsv", "dash", "tdash", "doge", "tdoge", "ltc", "tltc", "zec", "tzec"];
2
+ export type CoinName = (typeof coinNames)[number];
3
+ export declare function getMainnet(name: CoinName): CoinName;
4
+ export declare function isMainnet(name: CoinName): boolean;
5
+ export declare function isTestnet(name: CoinName): boolean;
6
+ export declare function isCoinName(v: string): v is CoinName;