@bitgo/wasm-utxo 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1126,7 +1126,6 @@ class BitGoPsbt {
1126
1126
  }
1127
1127
  }
1128
1128
  /**
1129
- * Returns the global xpubs from the PSBT as an array of WasmBIP32 instances.
1130
1129
  * @returns {any}
1131
1130
  */
1132
1131
  get_global_xpubs() {
@@ -1134,10 +1133,6 @@ class BitGoPsbt {
1134
1133
  return takeObject(ret);
1135
1134
  }
1136
1135
  /**
1137
- * Get all PSBT inputs as an array of PsbtInputData
1138
- *
1139
- * Returns an array with witness_utxo, bip32_derivation, and tap_bip32_derivation
1140
- * for each input.
1141
1136
  * @returns {any}
1142
1137
  */
1143
1138
  get_inputs() {
@@ -1179,10 +1174,6 @@ class BitGoPsbt {
1179
1174
  }
1180
1175
  }
1181
1176
  /**
1182
- * Get all PSBT outputs as an array of PsbtOutputData
1183
- *
1184
- * Returns an array with script, value, bip32_derivation, and tap_bip32_derivation
1185
- * for each output.
1186
1177
  * @returns {any}
1187
1178
  */
1188
1179
  get_outputs() {
@@ -1201,10 +1192,6 @@ class BitGoPsbt {
1201
1192
  }
1202
1193
  }
1203
1194
  /**
1204
- * Get all PSBT outputs with resolved address strings.
1205
- *
1206
- * Unlike the generic WrapPsbt which requires a coin parameter, BitGoPsbt
1207
- * uses the network it was created/deserialized with to resolve addresses.
1208
1195
  * @returns {any}
1209
1196
  */
1210
1197
  get_outputs_with_address() {
@@ -1223,7 +1210,6 @@ class BitGoPsbt {
1223
1210
  }
1224
1211
  }
1225
1212
  /**
1226
- * Get the number of inputs in the PSBT
1227
1213
  * @returns {number}
1228
1214
  */
1229
1215
  input_count() {
@@ -1250,7 +1236,6 @@ class BitGoPsbt {
1250
1236
  return ret !== 0;
1251
1237
  }
1252
1238
  /**
1253
- * Get the transaction lock time
1254
1239
  * @returns {number}
1255
1240
  */
1256
1241
  lock_time() {
@@ -1278,7 +1263,6 @@ class BitGoPsbt {
1278
1263
  }
1279
1264
  }
1280
1265
  /**
1281
- * Get the number of outputs in the PSBT
1282
1266
  * @returns {number}
1283
1267
  */
1284
1268
  output_count() {
@@ -1900,7 +1884,6 @@ class BitGoPsbt {
1900
1884
  }
1901
1885
  }
1902
1886
  /**
1903
- * Get the transaction version
1904
1887
  * @returns {number}
1905
1888
  */
1906
1889
  version() {
@@ -4460,14 +4443,14 @@ class WrapPsbt {
4460
4443
  * @param {number | null} [sequence]
4461
4444
  * @returns {number}
4462
4445
  */
4463
- addInput(txid, vout, value, script, sequence) {
4446
+ add_input(txid, vout, value, script, sequence) {
4464
4447
  try {
4465
4448
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4466
4449
  const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
4467
4450
  const len0 = WASM_VECTOR_LEN;
4468
4451
  const ptr1 = passArray8ToWasm0(script, wasm.__wbindgen_export);
4469
4452
  const len1 = WASM_VECTOR_LEN;
4470
- wasm.wrappsbt_addInput(retptr, this.__wbg_ptr, ptr0, len0, vout, value, ptr1, len1, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
4453
+ wasm.wrappsbt_add_input(retptr, this.__wbg_ptr, ptr0, len0, vout, value, ptr1, len1, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
4471
4454
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4472
4455
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4473
4456
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4499,14 +4482,14 @@ class WrapPsbt {
4499
4482
  * @param {number | null} [sequence]
4500
4483
  * @returns {number}
4501
4484
  */
4502
- addInputAtIndex(index, txid, vout, value, script, sequence) {
4485
+ add_input_at_index(index, txid, vout, value, script, sequence) {
4503
4486
  try {
4504
4487
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4505
4488
  const ptr0 = passStringToWasm0(txid, wasm.__wbindgen_export, wasm.__wbindgen_export2);
4506
4489
  const len0 = WASM_VECTOR_LEN;
4507
4490
  const ptr1 = passArray8ToWasm0(script, wasm.__wbindgen_export);
4508
4491
  const len1 = WASM_VECTOR_LEN;
4509
- wasm.wrappsbt_addInputAtIndex(retptr, this.__wbg_ptr, index, ptr0, len0, vout, value, ptr1, len1, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
4492
+ wasm.wrappsbt_add_input_at_index(retptr, this.__wbg_ptr, index, ptr0, len0, vout, value, ptr1, len1, isLikeNone(sequence) ? 0x100000001 : (sequence) >>> 0);
4510
4493
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4511
4494
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4512
4495
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4523,10 +4506,10 @@ class WrapPsbt {
4523
4506
  * @param {bigint} value
4524
4507
  * @returns {number}
4525
4508
  */
4526
- addOutput(script, value) {
4509
+ add_output(script, value) {
4527
4510
  const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
4528
4511
  const len0 = WASM_VECTOR_LEN;
4529
- const ret = wasm.wrappsbt_addOutput(this.__wbg_ptr, ptr0, len0, value);
4512
+ const ret = wasm.wrappsbt_add_output(this.__wbg_ptr, ptr0, len0, value);
4530
4513
  return ret >>> 0;
4531
4514
  }
4532
4515
  /**
@@ -4543,12 +4526,12 @@ class WrapPsbt {
4543
4526
  * @param {bigint} value
4544
4527
  * @returns {number}
4545
4528
  */
4546
- addOutputAtIndex(index, script, value) {
4529
+ add_output_at_index(index, script, value) {
4547
4530
  try {
4548
4531
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4549
4532
  const ptr0 = passArray8ToWasm0(script, wasm.__wbindgen_export);
4550
4533
  const len0 = WASM_VECTOR_LEN;
4551
- wasm.wrappsbt_addOutputAtIndex(retptr, this.__wbg_ptr, index, ptr0, len0, value);
4534
+ wasm.wrappsbt_add_output_at_index(retptr, this.__wbg_ptr, index, ptr0, len0, value);
4552
4535
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4553
4536
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4554
4537
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4599,10 +4582,10 @@ class WrapPsbt {
4599
4582
  * - `Err(WasmUtxoError)` if the PSBT is not fully finalized or extraction fails
4600
4583
  * @returns {WasmTransaction}
4601
4584
  */
4602
- extractTransaction() {
4585
+ extract_transaction() {
4603
4586
  try {
4604
4587
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4605
- wasm.wrappsbt_extractTransaction(retptr, this.__wbg_ptr);
4588
+ wasm.wrappsbt_extract_transaction(retptr, this.__wbg_ptr);
4606
4589
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4607
4590
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4608
4591
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4614,10 +4597,10 @@ class WrapPsbt {
4614
4597
  wasm.__wbindgen_add_to_stack_pointer(16);
4615
4598
  }
4616
4599
  }
4617
- finalize() {
4600
+ finalize_mut() {
4618
4601
  try {
4619
4602
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4620
- wasm.wrappsbt_finalize(retptr, this.__wbg_ptr);
4603
+ wasm.wrappsbt_finalize_mut(retptr, this.__wbg_ptr);
4621
4604
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4622
4605
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4623
4606
  if (r1) {
@@ -4628,24 +4611,19 @@ class WrapPsbt {
4628
4611
  }
4629
4612
  }
4630
4613
  /**
4631
- * Get global xpubs from the PSBT as an array of WasmBIP32 instances.
4632
4614
  * @returns {any}
4633
4615
  */
4634
- getGlobalXpubs() {
4635
- const ret = wasm.wrappsbt_getGlobalXpubs(this.__wbg_ptr);
4616
+ get_global_xpubs() {
4617
+ const ret = wasm.wrappsbt_get_global_xpubs(this.__wbg_ptr);
4636
4618
  return takeObject(ret);
4637
4619
  }
4638
4620
  /**
4639
- * Get all PSBT inputs as an array of PsbtInputData
4640
- *
4641
- * Returns an array with witness_utxo, bip32_derivation, and tap_bip32_derivation
4642
- * for each input. This is useful for introspecting the PSBT structure.
4643
4621
  * @returns {any}
4644
4622
  */
4645
- getInputs() {
4623
+ get_inputs() {
4646
4624
  try {
4647
4625
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4648
- wasm.wrappsbt_getInputs(retptr, this.__wbg_ptr);
4626
+ wasm.wrappsbt_get_inputs(retptr, this.__wbg_ptr);
4649
4627
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4650
4628
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4651
4629
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4658,16 +4636,12 @@ class WrapPsbt {
4658
4636
  }
4659
4637
  }
4660
4638
  /**
4661
- * Get all PSBT outputs as an array of PsbtOutputData
4662
- *
4663
- * Returns an array with script, value, bip32_derivation, and tap_bip32_derivation
4664
- * for each output. This is useful for introspecting the PSBT structure.
4665
4639
  * @returns {any}
4666
4640
  */
4667
- getOutputs() {
4641
+ get_outputs() {
4668
4642
  try {
4669
4643
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4670
- wasm.wrappsbt_getOutputs(retptr, this.__wbg_ptr);
4644
+ wasm.wrappsbt_get_outputs(retptr, this.__wbg_ptr);
4671
4645
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4672
4646
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4673
4647
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4680,19 +4654,15 @@ class WrapPsbt {
4680
4654
  }
4681
4655
  }
4682
4656
  /**
4683
- * Get all PSBT outputs with resolved address strings.
4684
- *
4685
- * Like `getOutputs()` but each element also includes an `address` field
4686
- * derived from the output script using the given coin name (e.g. "btc", "tbtc").
4687
4657
  * @param {string} coin
4688
4658
  * @returns {any}
4689
4659
  */
4690
- getOutputsWithAddress(coin) {
4660
+ get_outputs_with_address(coin) {
4691
4661
  try {
4692
4662
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4693
4663
  const ptr0 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
4694
4664
  const len0 = WASM_VECTOR_LEN;
4695
- wasm.wrappsbt_getOutputsWithAddress(retptr, this.__wbg_ptr, ptr0, len0);
4665
+ wasm.wrappsbt_get_outputs_with_address(retptr, this.__wbg_ptr, ptr0, len0);
4696
4666
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4697
4667
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4698
4668
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4705,15 +4675,13 @@ class WrapPsbt {
4705
4675
  }
4706
4676
  }
4707
4677
  /**
4708
- * Get partial signatures for an input
4709
- * Returns array of { pubkey: Uint8Array, signature: Uint8Array }
4710
4678
  * @param {number} input_index
4711
4679
  * @returns {any}
4712
4680
  */
4713
- getPartialSignatures(input_index) {
4681
+ get_partial_signatures(input_index) {
4714
4682
  try {
4715
4683
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4716
- wasm.wrappsbt_getPartialSignatures(retptr, this.__wbg_ptr, input_index);
4684
+ wasm.wrappsbt_get_partial_signatures(retptr, this.__wbg_ptr, input_index);
4717
4685
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4718
4686
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4719
4687
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4732,10 +4700,10 @@ class WrapPsbt {
4732
4700
  * The serialized unsigned transaction
4733
4701
  * @returns {Uint8Array}
4734
4702
  */
4735
- getUnsignedTx() {
4703
+ get_unsigned_tx() {
4736
4704
  try {
4737
4705
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4738
- wasm.wrappsbt_getUnsignedTx(retptr, this.__wbg_ptr);
4706
+ wasm.wrappsbt_get_unsigned_tx(retptr, this.__wbg_ptr);
4739
4707
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4740
4708
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4741
4709
  var v1 = getArrayU8FromWasm0(r0, r1).slice();
@@ -4746,14 +4714,13 @@ class WrapPsbt {
4746
4714
  }
4747
4715
  }
4748
4716
  /**
4749
- * Check if an input has any partial signatures
4750
4717
  * @param {number} input_index
4751
4718
  * @returns {boolean}
4752
4719
  */
4753
- hasPartialSignatures(input_index) {
4720
+ has_partial_signatures(input_index) {
4754
4721
  try {
4755
4722
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4756
- wasm.wrappsbt_hasPartialSignatures(retptr, this.__wbg_ptr, input_index);
4723
+ wasm.wrappsbt_has_partial_signatures(retptr, this.__wbg_ptr, input_index);
4757
4724
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4758
4725
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4759
4726
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4766,19 +4733,17 @@ class WrapPsbt {
4766
4733
  }
4767
4734
  }
4768
4735
  /**
4769
- * Get the number of inputs in the PSBT
4770
4736
  * @returns {number}
4771
4737
  */
4772
- inputCount() {
4773
- const ret = wasm.wrappsbt_inputCount(this.__wbg_ptr);
4738
+ input_count() {
4739
+ const ret = wasm.wrappsbt_input_count(this.__wbg_ptr);
4774
4740
  return ret >>> 0;
4775
4741
  }
4776
4742
  /**
4777
- * Get the transaction lock time
4778
4743
  * @returns {number}
4779
4744
  */
4780
- lockTime() {
4781
- const ret = wasm.wrappsbt_lockTime(this.__wbg_ptr);
4745
+ lock_time() {
4746
+ const ret = wasm.wrappsbt_lock_time(this.__wbg_ptr);
4782
4747
  return ret >>> 0;
4783
4748
  }
4784
4749
  /**
@@ -4797,20 +4762,19 @@ class WrapPsbt {
4797
4762
  return this;
4798
4763
  }
4799
4764
  /**
4800
- * Get the number of outputs in the PSBT
4801
4765
  * @returns {number}
4802
4766
  */
4803
- outputCount() {
4804
- const ret = wasm.wrappsbt_outputCount(this.__wbg_ptr);
4767
+ output_count() {
4768
+ const ret = wasm.wrappsbt_output_count(this.__wbg_ptr);
4805
4769
  return ret >>> 0;
4806
4770
  }
4807
4771
  /**
4808
4772
  * @param {number} index
4809
4773
  */
4810
- removeInput(index) {
4774
+ remove_input(index) {
4811
4775
  try {
4812
4776
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4813
- wasm.wrappsbt_removeInput(retptr, this.__wbg_ptr, index);
4777
+ wasm.wrappsbt_remove_input(retptr, this.__wbg_ptr, index);
4814
4778
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4815
4779
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4816
4780
  if (r1) {
@@ -4823,10 +4787,10 @@ class WrapPsbt {
4823
4787
  /**
4824
4788
  * @param {number} index
4825
4789
  */
4826
- removeOutput(index) {
4790
+ remove_output(index) {
4827
4791
  try {
4828
4792
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4829
- wasm.wrappsbt_removeOutput(retptr, this.__wbg_ptr, index);
4793
+ wasm.wrappsbt_remove_output(retptr, this.__wbg_ptr, index);
4830
4794
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4831
4795
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4832
4796
  if (r1) {
@@ -4866,11 +4830,11 @@ class WrapPsbt {
4866
4830
  * @param {WasmBIP32} key
4867
4831
  * @returns {any}
4868
4832
  */
4869
- signAll(key) {
4833
+ sign_all(key) {
4870
4834
  try {
4871
4835
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4872
4836
  _assertClass(key, WasmBIP32);
4873
- wasm.wrappsbt_signAll(retptr, this.__wbg_ptr, key.__wbg_ptr);
4837
+ wasm.wrappsbt_sign_all(retptr, this.__wbg_ptr, key.__wbg_ptr);
4874
4838
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4875
4839
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4876
4840
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4896,11 +4860,11 @@ class WrapPsbt {
4896
4860
  * @param {WasmECPair} key
4897
4861
  * @returns {any}
4898
4862
  */
4899
- signAllWithEcpair(key) {
4863
+ sign_all_with_ecpair(key) {
4900
4864
  try {
4901
4865
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4902
4866
  _assertClass(key, WasmECPair);
4903
- wasm.wrappsbt_signAllWithEcpair(retptr, this.__wbg_ptr, key.__wbg_ptr);
4867
+ wasm.wrappsbt_sign_all_with_ecpair(retptr, this.__wbg_ptr, key.__wbg_ptr);
4904
4868
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4905
4869
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4906
4870
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4916,12 +4880,12 @@ class WrapPsbt {
4916
4880
  * @param {Uint8Array} prv
4917
4881
  * @returns {any}
4918
4882
  */
4919
- signWithPrv(prv) {
4883
+ sign_with_prv(prv) {
4920
4884
  try {
4921
4885
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4922
4886
  const ptr0 = passArray8ToWasm0(prv, wasm.__wbindgen_export);
4923
4887
  const len0 = WASM_VECTOR_LEN;
4924
- wasm.wrappsbt_signWithPrv(retptr, this.__wbg_ptr, ptr0, len0);
4888
+ wasm.wrappsbt_sign_with_prv(retptr, this.__wbg_ptr, ptr0, len0);
4925
4889
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4926
4890
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4927
4891
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4937,12 +4901,12 @@ class WrapPsbt {
4937
4901
  * @param {string} xprv
4938
4902
  * @returns {any}
4939
4903
  */
4940
- signWithXprv(xprv) {
4904
+ sign_with_xprv(xprv) {
4941
4905
  try {
4942
4906
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4943
4907
  const ptr0 = passStringToWasm0(xprv, wasm.__wbindgen_export, wasm.__wbindgen_export2);
4944
4908
  const len0 = WASM_VECTOR_LEN;
4945
- wasm.wrappsbt_signWithXprv(retptr, this.__wbg_ptr, ptr0, len0);
4909
+ wasm.wrappsbt_sign_with_xprv(retptr, this.__wbg_ptr, ptr0, len0);
4946
4910
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4947
4911
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4948
4912
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4955,15 +4919,14 @@ class WrapPsbt {
4955
4919
  }
4956
4920
  }
4957
4921
  /**
4958
- * Get the unsigned transaction ID as a hex string
4959
4922
  * @returns {string}
4960
4923
  */
4961
- unsignedTxId() {
4924
+ unsigned_tx_id() {
4962
4925
  let deferred1_0;
4963
4926
  let deferred1_1;
4964
4927
  try {
4965
4928
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4966
- wasm.wrappsbt_unsignedTxId(retptr, this.__wbg_ptr);
4929
+ wasm.wrappsbt_unsigned_tx_id(retptr, this.__wbg_ptr);
4967
4930
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4968
4931
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4969
4932
  deferred1_0 = r0;
@@ -4978,11 +4941,11 @@ class WrapPsbt {
4978
4941
  * @param {number} input_index
4979
4942
  * @param {WrapDescriptor} descriptor
4980
4943
  */
4981
- updateInputWithDescriptor(input_index, descriptor) {
4944
+ update_input_with_descriptor(input_index, descriptor) {
4982
4945
  try {
4983
4946
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4984
4947
  _assertClass(descriptor, WrapDescriptor);
4985
- wasm.wrappsbt_updateInputWithDescriptor(retptr, this.__wbg_ptr, input_index, descriptor.__wbg_ptr);
4948
+ wasm.wrappsbt_update_input_with_descriptor(retptr, this.__wbg_ptr, input_index, descriptor.__wbg_ptr);
4986
4949
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
4987
4950
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
4988
4951
  if (r1) {
@@ -4996,11 +4959,11 @@ class WrapPsbt {
4996
4959
  * @param {number} output_index
4997
4960
  * @param {WrapDescriptor} descriptor
4998
4961
  */
4999
- updateOutputWithDescriptor(output_index, descriptor) {
4962
+ update_output_with_descriptor(output_index, descriptor) {
5000
4963
  try {
5001
4964
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
5002
4965
  _assertClass(descriptor, WrapDescriptor);
5003
- wasm.wrappsbt_updateOutputWithDescriptor(retptr, this.__wbg_ptr, output_index, descriptor.__wbg_ptr);
4966
+ wasm.wrappsbt_update_output_with_descriptor(retptr, this.__wbg_ptr, output_index, descriptor.__wbg_ptr);
5004
4967
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
5005
4968
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
5006
4969
  if (r1) {
@@ -5011,21 +4974,16 @@ class WrapPsbt {
5011
4974
  }
5012
4975
  }
5013
4976
  /**
5014
- * Validate a signature at a specific input against a pubkey
5015
- * Returns true if the signature is valid
5016
- *
5017
- * This method handles both ECDSA (legacy/SegWit) and Schnorr (Taproot) signatures.
5018
- * The pubkey should be provided as bytes (33 bytes for compressed ECDSA, 32 bytes for x-only Schnorr).
5019
4977
  * @param {number} input_index
5020
4978
  * @param {Uint8Array} pubkey
5021
4979
  * @returns {boolean}
5022
4980
  */
5023
- validateSignatureAtInput(input_index, pubkey) {
4981
+ validate_signature_at_input(input_index, pubkey) {
5024
4982
  try {
5025
4983
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
5026
4984
  const ptr0 = passArray8ToWasm0(pubkey, wasm.__wbindgen_export);
5027
4985
  const len0 = WASM_VECTOR_LEN;
5028
- wasm.wrappsbt_validateSignatureAtInput(retptr, this.__wbg_ptr, input_index, ptr0, len0);
4986
+ wasm.wrappsbt_validate_signature_at_input(retptr, this.__wbg_ptr, input_index, ptr0, len0);
5029
4987
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
5030
4988
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
5031
4989
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -5056,11 +5014,11 @@ class WrapPsbt {
5056
5014
  * @param {WasmBIP32} key
5057
5015
  * @returns {boolean}
5058
5016
  */
5059
- verifySignatureWithKey(input_index, key) {
5017
+ verify_signature_with_key(input_index, key) {
5060
5018
  try {
5061
5019
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
5062
5020
  _assertClass(key, WasmBIP32);
5063
- wasm.wrappsbt_verifySignatureWithKey(retptr, this.__wbg_ptr, input_index, key.__wbg_ptr);
5021
+ wasm.wrappsbt_verify_signature_with_key(retptr, this.__wbg_ptr, input_index, key.__wbg_ptr);
5064
5022
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
5065
5023
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
5066
5024
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -5073,7 +5031,6 @@ class WrapPsbt {
5073
5031
  }
5074
5032
  }
5075
5033
  /**
5076
- * Get the transaction version
5077
5034
  * @returns {number}
5078
5035
  */
5079
5036
  version() {
Binary file
@@ -42,37 +42,37 @@ export const wrapminiscript_fromString: (a: number, b: number, c: number, d: num
42
42
  export const wrapminiscript_node: (a: number, b: number) => void;
43
43
  export const wrapminiscript_toAsmString: (a: number, b: number) => void;
44
44
  export const wrapminiscript_toString: (a: number, b: number) => void;
45
- export const wrappsbt_addInput: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number) => void;
46
- export const wrappsbt_addInputAtIndex: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number) => void;
47
- export const wrappsbt_addOutput: (a: number, b: number, c: number, d: bigint) => number;
48
- export const wrappsbt_addOutputAtIndex: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
45
+ export const wrappsbt_add_input: (a: number, b: number, c: number, d: number, e: number, f: bigint, g: number, h: number, i: number) => void;
46
+ export const wrappsbt_add_input_at_index: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: number, i: number, j: number) => void;
47
+ export const wrappsbt_add_output: (a: number, b: number, c: number, d: bigint) => number;
48
+ export const wrappsbt_add_output_at_index: (a: number, b: number, c: number, d: number, e: number, f: bigint) => void;
49
49
  export const wrappsbt_clone: (a: number) => number;
50
50
  export const wrappsbt_deserialize: (a: number, b: number, c: number) => void;
51
- export const wrappsbt_extractTransaction: (a: number, b: number) => void;
52
- export const wrappsbt_finalize: (a: number, b: number) => void;
53
- export const wrappsbt_getGlobalXpubs: (a: number) => number;
54
- export const wrappsbt_getInputs: (a: number, b: number) => void;
55
- export const wrappsbt_getOutputs: (a: number, b: number) => void;
56
- export const wrappsbt_getOutputsWithAddress: (a: number, b: number, c: number, d: number) => void;
57
- export const wrappsbt_getPartialSignatures: (a: number, b: number, c: number) => void;
58
- export const wrappsbt_getUnsignedTx: (a: number, b: number) => void;
59
- export const wrappsbt_hasPartialSignatures: (a: number, b: number, c: number) => void;
60
- export const wrappsbt_inputCount: (a: number) => number;
61
- export const wrappsbt_lockTime: (a: number) => number;
51
+ export const wrappsbt_extract_transaction: (a: number, b: number) => void;
52
+ export const wrappsbt_finalize_mut: (a: number, b: number) => void;
53
+ export const wrappsbt_get_global_xpubs: (a: number) => number;
54
+ export const wrappsbt_get_inputs: (a: number, b: number) => void;
55
+ export const wrappsbt_get_outputs: (a: number, b: number) => void;
56
+ export const wrappsbt_get_outputs_with_address: (a: number, b: number, c: number, d: number) => void;
57
+ export const wrappsbt_get_partial_signatures: (a: number, b: number, c: number) => void;
58
+ export const wrappsbt_get_unsigned_tx: (a: number, b: number) => void;
59
+ export const wrappsbt_has_partial_signatures: (a: number, b: number, c: number) => void;
60
+ export const wrappsbt_input_count: (a: number) => number;
61
+ export const wrappsbt_lock_time: (a: number) => number;
62
62
  export const wrappsbt_new: (a: number, b: number) => number;
63
- export const wrappsbt_outputCount: (a: number) => number;
64
- export const wrappsbt_removeInput: (a: number, b: number, c: number) => void;
65
- export const wrappsbt_removeOutput: (a: number, b: number, c: number) => void;
63
+ export const wrappsbt_output_count: (a: number) => number;
64
+ export const wrappsbt_remove_input: (a: number, b: number, c: number) => void;
65
+ export const wrappsbt_remove_output: (a: number, b: number, c: number) => void;
66
66
  export const wrappsbt_serialize: (a: number, b: number) => void;
67
- export const wrappsbt_signAll: (a: number, b: number, c: number) => void;
68
- export const wrappsbt_signAllWithEcpair: (a: number, b: number, c: number) => void;
69
- export const wrappsbt_signWithPrv: (a: number, b: number, c: number, d: number) => void;
70
- export const wrappsbt_signWithXprv: (a: number, b: number, c: number, d: number) => void;
71
- export const wrappsbt_unsignedTxId: (a: number, b: number) => void;
72
- export const wrappsbt_updateInputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
73
- export const wrappsbt_updateOutputWithDescriptor: (a: number, b: number, c: number, d: number) => void;
74
- export const wrappsbt_validateSignatureAtInput: (a: number, b: number, c: number, d: number, e: number) => void;
75
- export const wrappsbt_verifySignatureWithKey: (a: number, b: number, c: number, d: number) => void;
67
+ export const wrappsbt_sign_all: (a: number, b: number, c: number) => void;
68
+ export const wrappsbt_sign_all_with_ecpair: (a: number, b: number, c: number) => void;
69
+ export const wrappsbt_sign_with_prv: (a: number, b: number, c: number, d: number) => void;
70
+ export const wrappsbt_sign_with_xprv: (a: number, b: number, c: number, d: number) => void;
71
+ export const wrappsbt_unsigned_tx_id: (a: number, b: number) => void;
72
+ export const wrappsbt_update_input_with_descriptor: (a: number, b: number, c: number, d: number) => void;
73
+ export const wrappsbt_update_output_with_descriptor: (a: number, b: number, c: number, d: number) => void;
74
+ export const wrappsbt_validate_signature_at_input: (a: number, b: number, c: number, d: number, e: number) => void;
75
+ export const wrappsbt_verify_signature_with_key: (a: number, b: number, c: number, d: number) => void;
76
76
  export const wrappsbt_version: (a: number) => number;
77
77
  export const __wbg_wasmdashtransaction_free: (a: number, b: number) => void;
78
78
  export const __wbg_wasmtransaction_free: (a: number, b: number) => void;
@@ -4,3 +4,6 @@ export declare function getMainnet(name: CoinName): CoinName;
4
4
  export declare function isMainnet(name: CoinName): boolean;
5
5
  export declare function isTestnet(name: CoinName): boolean;
6
6
  export declare function isCoinName(v: string): v is CoinName;
7
+ import type { UtxolibName } from "./utxolibCompat.js";
8
+ /** Convert a CoinName or UtxolibName to CoinName */
9
+ export declare function toCoinName(name: CoinName | UtxolibName): CoinName;
@@ -58,3 +58,51 @@ export function isTestnet(name) {
58
58
  export function isCoinName(v) {
59
59
  return coinNames.includes(v);
60
60
  }
61
+ /** Convert a CoinName or UtxolibName to CoinName */
62
+ export function toCoinName(name) {
63
+ switch (name) {
64
+ case "bitcoin":
65
+ return "btc";
66
+ case "testnet":
67
+ return "tbtc";
68
+ case "bitcoinTestnet4":
69
+ return "tbtc4";
70
+ case "bitcoinPublicSignet":
71
+ return "tbtcsig";
72
+ case "bitcoinBitGoSignet":
73
+ return "tbtcbgsig";
74
+ case "bitcoincash":
75
+ return "bch";
76
+ case "bitcoincashTestnet":
77
+ return "tbch";
78
+ case "ecash":
79
+ return "bcha";
80
+ case "ecashTest":
81
+ return "tbcha";
82
+ case "bitcoingold":
83
+ return "btg";
84
+ case "bitcoingoldTestnet":
85
+ return "tbtg";
86
+ case "bitcoinsv":
87
+ return "bsv";
88
+ case "bitcoinsvTestnet":
89
+ return "tbsv";
90
+ case "dashTest":
91
+ return "tdash";
92
+ case "dogecoin":
93
+ return "doge";
94
+ case "dogecoinTest":
95
+ return "tdoge";
96
+ case "litecoin":
97
+ return "ltc";
98
+ case "litecoinTest":
99
+ return "tltc";
100
+ case "zcash":
101
+ return "zec";
102
+ case "zcashTest":
103
+ return "tzec";
104
+ default:
105
+ // CoinName values pass through (including "dash" which is both CoinName and UtxolibName)
106
+ return name;
107
+ }
108
+ }
@@ -0,0 +1,49 @@
1
+ import { WrapPsbt as WasmPsbt, type WasmBIP32, type WasmECPair, type WrapDescriptor, type PsbtInputData, type PsbtOutputData, type PsbtOutputDataWithAddress } from "../wasm/wasm_utxo.js";
2
+ import type { IPsbt } from "../psbt.js";
3
+ import type { CoinName } from "../coinName.js";
4
+ import type { BIP32 } from "../bip32.js";
5
+ import { Transaction } from "../transaction.js";
6
+ export type SignPsbtResult = {
7
+ [inputIndex: number]: [pubkey: string][];
8
+ };
9
+ export declare class Psbt implements IPsbt {
10
+ private _wasm;
11
+ constructor(versionOrWasm?: number | WasmPsbt, lockTime?: number);
12
+ /** @internal Access the underlying WASM instance */
13
+ get wasm(): WasmPsbt;
14
+ static create(version?: number, lockTime?: number): Psbt;
15
+ static deserialize(bytes: Uint8Array): Psbt;
16
+ serialize(): Uint8Array;
17
+ clone(): Psbt;
18
+ inputCount(): number;
19
+ outputCount(): number;
20
+ version(): number;
21
+ lockTime(): number;
22
+ unsignedTxId(): string;
23
+ getInputs(): PsbtInputData[];
24
+ getOutputs(): PsbtOutputData[];
25
+ getGlobalXpubs(): BIP32[];
26
+ getOutputsWithAddress(coin: CoinName): PsbtOutputDataWithAddress[];
27
+ addInputAtIndex(index: number, txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number): number;
28
+ addInput(txid: string, vout: number, value: bigint, script: Uint8Array, sequence?: number): number;
29
+ addOutputAtIndex(index: number, script: Uint8Array, value: bigint): number;
30
+ addOutput(script: Uint8Array, value: bigint): number;
31
+ removeInput(index: number): void;
32
+ removeOutput(index: number): void;
33
+ updateInputWithDescriptor(inputIndex: number, descriptor: WrapDescriptor): void;
34
+ updateOutputWithDescriptor(outputIndex: number, descriptor: WrapDescriptor): void;
35
+ signWithXprv(xprv: string): SignPsbtResult;
36
+ signWithPrv(prv: Uint8Array): SignPsbtResult;
37
+ signAll(key: WasmBIP32): SignPsbtResult;
38
+ signAllWithEcpair(key: WasmECPair): SignPsbtResult;
39
+ getPartialSignatures(inputIndex: number): Array<{
40
+ pubkey: Uint8Array;
41
+ signature: Uint8Array;
42
+ }>;
43
+ hasPartialSignatures(inputIndex: number): boolean;
44
+ validateSignatureAtInput(inputIndex: number, pubkey: Uint8Array): boolean;
45
+ verifySignatureWithKey(inputIndex: number, key: WasmBIP32): boolean;
46
+ getUnsignedTx(): Uint8Array;
47
+ finalize(): void;
48
+ extractTransaction(): Transaction;
49
+ }