@utexo/rgb-lib-linux-x64 0.3.0-beta.16.dev → 0.3.0-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utexo/rgb-lib-linux-x64",
3
- "version": "0.3.0-beta.16.dev",
3
+ "version": "0.3.0-beta.18",
4
4
  "description": "Node.js bindings for rgb-lib on linux-x64",
5
5
  "main": "wrapper.js",
6
6
  "os": [
@@ -207,6 +207,18 @@ CResultString rgblib_send_btc(const COpaqueStruct *wallet,
207
207
  const char *fee_rate,
208
208
  bool skip_sync);
209
209
 
210
+ CResultString rgblib_send_btc_begin(const COpaqueStruct *wallet,
211
+ const COpaqueStruct *online,
212
+ const char *address,
213
+ const char *amount,
214
+ const char *fee_rate,
215
+ bool skip_sync);
216
+
217
+ CResultString rgblib_send_btc_end(const COpaqueStruct *wallet,
218
+ const COpaqueStruct *online,
219
+ const char *signed_psbt,
220
+ bool skip_sync);
221
+
210
222
  CResultString rgblib_send_end(const COpaqueStruct *wallet,
211
223
  const COpaqueStruct *online,
212
224
  const char *signed_psbt,
package/swig_wrap.cxx CHANGED
@@ -2329,6 +2329,9 @@ static SwigV8ReturnValue _wrap_rgblib_blind_receive(const SwigV8Arguments &args)
2329
2329
  int res3 ;
2330
2330
  char *buf3 = 0 ;
2331
2331
  int alloc3 = 0 ;
2332
+ int res4 ;
2333
+ char *buf4 = 0 ;
2334
+ int alloc4 = 0 ;
2332
2335
  int res5 ;
2333
2336
  char *buf5 = 0 ;
2334
2337
  int alloc5 = 0 ;
@@ -2359,19 +2362,11 @@ static SwigV8ReturnValue _wrap_rgblib_blind_receive(const SwigV8Arguments &args)
2359
2362
  if (!SWIG_IsOK(res3)) {
2360
2363
  SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "rgblib_blind_receive" "', argument " "3"" of type '" "char const *""'");
2361
2364
  }
2362
- arg3 = reinterpret_cast< char * >(buf3);{
2363
- {
2364
- if (args[3] == v8::Null(v8::Isolate::GetCurrent())) {
2365
- arg4 = nullptr;
2366
- } else {
2367
- int res = SWIG_AsCharPtrAndSize(args[3], (char**)&arg4, NULL, NULL);
2368
- if (!SWIG_IsOK(res)) {
2369
- SWIG_exception_fail(SWIG_ArgError(res), "in method '" "rgblib_blind_receive" "', argument '" "4""' of type '" "char const *""'");
2370
- }
2371
- }
2372
- }
2365
+ arg3 = reinterpret_cast< char * >(buf3);res4 = SWIG_AsCharPtrAndSize(args[3], &buf4, NULL, &alloc4);
2366
+ if (!SWIG_IsOK(res4)) {
2367
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "rgblib_blind_receive" "', argument " "4"" of type '" "char const *""'");
2373
2368
  }
2374
- res5 = SWIG_AsCharPtrAndSize(args[4], &buf5, NULL, &alloc5);
2369
+ arg4 = reinterpret_cast< char * >(buf4);res5 = SWIG_AsCharPtrAndSize(args[4], &buf5, NULL, &alloc5);
2375
2370
  if (!SWIG_IsOK(res5)) {
2376
2371
  SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "rgblib_blind_receive" "', argument " "5"" of type '" "char const *""'");
2377
2372
  }
@@ -2397,6 +2392,7 @@ static SwigV8ReturnValue _wrap_rgblib_blind_receive(const SwigV8Arguments &args)
2397
2392
 
2398
2393
 
2399
2394
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
2395
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
2400
2396
  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
2401
2397
  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
2402
2398
 
@@ -2733,6 +2729,9 @@ static SwigV8ReturnValue _wrap_rgblib_delete_transfers(const SwigV8Arguments &ar
2733
2729
  bool arg3 ;
2734
2730
  void *argp1 = 0 ;
2735
2731
  int res1 = 0 ;
2732
+ int res2 ;
2733
+ char *buf2 = 0 ;
2734
+ int alloc2 = 0 ;
2736
2735
  bool val3 ;
2737
2736
  int ecode3 = 0 ;
2738
2737
  CResultString result;
@@ -2743,19 +2742,11 @@ static SwigV8ReturnValue _wrap_rgblib_delete_transfers(const SwigV8Arguments &ar
2743
2742
  if (!SWIG_IsOK(res1)) {
2744
2743
  SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rgblib_delete_transfers" "', argument " "1"" of type '" "COpaqueStruct const *""'");
2745
2744
  }
2746
- arg1 = reinterpret_cast< COpaqueStruct * >(argp1);{
2747
- {
2748
- if (args[1] == v8::Null(v8::Isolate::GetCurrent())) {
2749
- arg2 = nullptr;
2750
- } else {
2751
- int res = SWIG_AsCharPtrAndSize(args[1], (char**)&arg2, NULL, NULL);
2752
- if (!SWIG_IsOK(res)) {
2753
- SWIG_exception_fail(SWIG_ArgError(res), "in method '" "rgblib_delete_transfers" "', argument '" "2""' of type '" "char const *""'");
2754
- }
2755
- }
2756
- }
2745
+ arg1 = reinterpret_cast< COpaqueStruct * >(argp1);res2 = SWIG_AsCharPtrAndSize(args[1], &buf2, NULL, &alloc2);
2746
+ if (!SWIG_IsOK(res2)) {
2747
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "rgblib_delete_transfers" "', argument " "2"" of type '" "char const *""'");
2757
2748
  }
2758
- ecode3 = SWIG_AsVal_bool(args[2], &val3);
2749
+ arg2 = reinterpret_cast< char * >(buf2);ecode3 = SWIG_AsVal_bool(args[2], &val3);
2759
2750
  if (!SWIG_IsOK(ecode3)) {
2760
2751
  SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "rgblib_delete_transfers" "', argument " "3"" of type '" "bool""'");
2761
2752
  }
@@ -2776,6 +2767,7 @@ static SwigV8ReturnValue _wrap_rgblib_delete_transfers(const SwigV8Arguments &ar
2776
2767
  }
2777
2768
 
2778
2769
 
2770
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2779
2771
 
2780
2772
 
2781
2773
  SWIGV8_RETURN(jsresult);
@@ -2840,6 +2832,9 @@ static SwigV8ReturnValue _wrap_rgblib_fail_transfers(const SwigV8Arguments &args
2840
2832
  int res1 = 0 ;
2841
2833
  void *argp2 = 0 ;
2842
2834
  int res2 = 0 ;
2835
+ int res3 ;
2836
+ char *buf3 = 0 ;
2837
+ int alloc3 = 0 ;
2843
2838
  bool val4 ;
2844
2839
  int ecode4 = 0 ;
2845
2840
  bool val5 ;
@@ -2856,19 +2851,11 @@ static SwigV8ReturnValue _wrap_rgblib_fail_transfers(const SwigV8Arguments &args
2856
2851
  if (!SWIG_IsOK(res2)) {
2857
2852
  SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "rgblib_fail_transfers" "', argument " "2"" of type '" "COpaqueStruct const *""'");
2858
2853
  }
2859
- arg2 = reinterpret_cast< COpaqueStruct * >(argp2);{
2860
- {
2861
- if (args[2] == v8::Null(v8::Isolate::GetCurrent())) {
2862
- arg3 = nullptr;
2863
- } else {
2864
- int res = SWIG_AsCharPtrAndSize(args[2], (char**)&arg3, NULL, NULL);
2865
- if (!SWIG_IsOK(res)) {
2866
- SWIG_exception_fail(SWIG_ArgError(res), "in method '" "rgblib_fail_transfers" "', argument '" "3""' of type '" "char const *""'");
2867
- }
2868
- }
2869
- }
2854
+ arg2 = reinterpret_cast< COpaqueStruct * >(argp2);res3 = SWIG_AsCharPtrAndSize(args[2], &buf3, NULL, &alloc3);
2855
+ if (!SWIG_IsOK(res3)) {
2856
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "rgblib_fail_transfers" "', argument " "3"" of type '" "char const *""'");
2870
2857
  }
2871
- ecode4 = SWIG_AsVal_bool(args[3], &val4);
2858
+ arg3 = reinterpret_cast< char * >(buf3);ecode4 = SWIG_AsVal_bool(args[3], &val4);
2872
2859
  if (!SWIG_IsOK(ecode4)) {
2873
2860
  SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "rgblib_fail_transfers" "', argument " "4"" of type '" "bool""'");
2874
2861
  }
@@ -2894,6 +2881,7 @@ static SwigV8ReturnValue _wrap_rgblib_fail_transfers(const SwigV8Arguments &args
2894
2881
 
2895
2882
 
2896
2883
 
2884
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
2897
2885
 
2898
2886
 
2899
2887
 
@@ -4537,6 +4525,9 @@ static SwigV8ReturnValue _wrap_rgblib_send(const SwigV8Arguments &args) {
4537
4525
  int res6 ;
4538
4526
  char *buf6 = 0 ;
4539
4527
  int alloc6 = 0 ;
4528
+ int res7 ;
4529
+ char *buf7 = 0 ;
4530
+ int alloc7 = 0 ;
4540
4531
  bool val8 ;
4541
4532
  int ecode8 = 0 ;
4542
4533
  CResultString result;
@@ -4567,19 +4558,11 @@ static SwigV8ReturnValue _wrap_rgblib_send(const SwigV8Arguments &args) {
4567
4558
  if (!SWIG_IsOK(res6)) {
4568
4559
  SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "rgblib_send" "', argument " "6"" of type '" "char const *""'");
4569
4560
  }
4570
- arg6 = reinterpret_cast< char * >(buf6);{
4571
- {
4572
- if (args[6] == v8::Null(v8::Isolate::GetCurrent())) {
4573
- arg7 = nullptr;
4574
- } else {
4575
- int res = SWIG_AsCharPtrAndSize(args[6], (char**)&arg7, NULL, NULL);
4576
- if (!SWIG_IsOK(res)) {
4577
- SWIG_exception_fail(SWIG_ArgError(res), "in method '" "rgblib_send" "', argument '" "7""' of type '" "char const *""'");
4578
- }
4579
- }
4580
- }
4561
+ arg6 = reinterpret_cast< char * >(buf6);res7 = SWIG_AsCharPtrAndSize(args[6], &buf7, NULL, &alloc7);
4562
+ if (!SWIG_IsOK(res7)) {
4563
+ SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "rgblib_send" "', argument " "7"" of type '" "char const *""'");
4581
4564
  }
4582
- ecode8 = SWIG_AsVal_bool(args[7], &val8);
4565
+ arg7 = reinterpret_cast< char * >(buf7);ecode8 = SWIG_AsVal_bool(args[7], &val8);
4583
4566
  if (!SWIG_IsOK(ecode8)) {
4584
4567
  SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "rgblib_send" "', argument " "8"" of type '" "bool""'");
4585
4568
  }
@@ -4605,6 +4588,7 @@ static SwigV8ReturnValue _wrap_rgblib_send(const SwigV8Arguments &args) {
4605
4588
 
4606
4589
  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
4607
4590
  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
4591
+ if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
4608
4592
 
4609
4593
 
4610
4594
  SWIGV8_RETURN(jsresult);
@@ -4642,6 +4626,9 @@ static SwigV8ReturnValue _wrap_rgblib_send_begin(const SwigV8Arguments &args) {
4642
4626
  int res6 ;
4643
4627
  char *buf6 = 0 ;
4644
4628
  int alloc6 = 0 ;
4629
+ int res7 ;
4630
+ char *buf7 = 0 ;
4631
+ int alloc7 = 0 ;
4645
4632
  bool val8 ;
4646
4633
  int ecode8 = 0 ;
4647
4634
  CResultString result;
@@ -4672,19 +4659,11 @@ static SwigV8ReturnValue _wrap_rgblib_send_begin(const SwigV8Arguments &args) {
4672
4659
  if (!SWIG_IsOK(res6)) {
4673
4660
  SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "rgblib_send_begin" "', argument " "6"" of type '" "char const *""'");
4674
4661
  }
4675
- arg6 = reinterpret_cast< char * >(buf6);{
4676
- {
4677
- if (args[6] == v8::Null(v8::Isolate::GetCurrent())) {
4678
- arg7 = nullptr;
4679
- } else {
4680
- int res = SWIG_AsCharPtrAndSize(args[6], (char**)&arg7, NULL, NULL);
4681
- if (!SWIG_IsOK(res)) {
4682
- SWIG_exception_fail(SWIG_ArgError(res), "in method '" "rgblib_send_begin" "', argument '" "7""' of type '" "char const *""'");
4683
- }
4684
- }
4685
- }
4662
+ arg6 = reinterpret_cast< char * >(buf6);res7 = SWIG_AsCharPtrAndSize(args[6], &buf7, NULL, &alloc7);
4663
+ if (!SWIG_IsOK(res7)) {
4664
+ SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "rgblib_send_begin" "', argument " "7"" of type '" "char const *""'");
4686
4665
  }
4687
- ecode8 = SWIG_AsVal_bool(args[7], &val8);
4666
+ arg7 = reinterpret_cast< char * >(buf7);ecode8 = SWIG_AsVal_bool(args[7], &val8);
4688
4667
  if (!SWIG_IsOK(ecode8)) {
4689
4668
  SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "rgblib_send_begin" "', argument " "8"" of type '" "bool""'");
4690
4669
  }
@@ -4710,6 +4689,7 @@ static SwigV8ReturnValue _wrap_rgblib_send_begin(const SwigV8Arguments &args) {
4710
4689
 
4711
4690
  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
4712
4691
  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
4692
+ if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
4713
4693
 
4714
4694
 
4715
4695
  SWIGV8_RETURN(jsresult);
@@ -4804,6 +4784,156 @@ fail:
4804
4784
  }
4805
4785
 
4806
4786
 
4787
+ static SwigV8ReturnValue _wrap_rgblib_send_btc_begin(const SwigV8Arguments &args) {
4788
+ SWIGV8_HANDLESCOPE();
4789
+
4790
+ SWIGV8_VALUE jsresult;
4791
+ COpaqueStruct *arg1 = (COpaqueStruct *) 0 ;
4792
+ COpaqueStruct *arg2 = (COpaqueStruct *) 0 ;
4793
+ char *arg3 = (char *) 0 ;
4794
+ char *arg4 = (char *) 0 ;
4795
+ char *arg5 = (char *) 0 ;
4796
+ bool arg6 ;
4797
+ void *argp1 = 0 ;
4798
+ int res1 = 0 ;
4799
+ void *argp2 = 0 ;
4800
+ int res2 = 0 ;
4801
+ int res3 ;
4802
+ char *buf3 = 0 ;
4803
+ int alloc3 = 0 ;
4804
+ int res4 ;
4805
+ char *buf4 = 0 ;
4806
+ int alloc4 = 0 ;
4807
+ int res5 ;
4808
+ char *buf5 = 0 ;
4809
+ int alloc5 = 0 ;
4810
+ bool val6 ;
4811
+ int ecode6 = 0 ;
4812
+ CResultString result;
4813
+
4814
+ if (args.Length() < 6 || args.Length() > 6) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_rgblib_send_btc_begin.");
4815
+
4816
+ res1 = SWIG_ConvertPtr(args[0], &argp1,SWIGTYPE_p_COpaqueStruct, 0 | 0 );
4817
+ if (!SWIG_IsOK(res1)) {
4818
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rgblib_send_btc_begin" "', argument " "1"" of type '" "COpaqueStruct const *""'");
4819
+ }
4820
+ arg1 = reinterpret_cast< COpaqueStruct * >(argp1);res2 = SWIG_ConvertPtr(args[1], &argp2,SWIGTYPE_p_COpaqueStruct, 0 | 0 );
4821
+ if (!SWIG_IsOK(res2)) {
4822
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "rgblib_send_btc_begin" "', argument " "2"" of type '" "COpaqueStruct const *""'");
4823
+ }
4824
+ arg2 = reinterpret_cast< COpaqueStruct * >(argp2);res3 = SWIG_AsCharPtrAndSize(args[2], &buf3, NULL, &alloc3);
4825
+ if (!SWIG_IsOK(res3)) {
4826
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "rgblib_send_btc_begin" "', argument " "3"" of type '" "char const *""'");
4827
+ }
4828
+ arg3 = reinterpret_cast< char * >(buf3);res4 = SWIG_AsCharPtrAndSize(args[3], &buf4, NULL, &alloc4);
4829
+ if (!SWIG_IsOK(res4)) {
4830
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "rgblib_send_btc_begin" "', argument " "4"" of type '" "char const *""'");
4831
+ }
4832
+ arg4 = reinterpret_cast< char * >(buf4);res5 = SWIG_AsCharPtrAndSize(args[4], &buf5, NULL, &alloc5);
4833
+ if (!SWIG_IsOK(res5)) {
4834
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "rgblib_send_btc_begin" "', argument " "5"" of type '" "char const *""'");
4835
+ }
4836
+ arg5 = reinterpret_cast< char * >(buf5);ecode6 = SWIG_AsVal_bool(args[5], &val6);
4837
+ if (!SWIG_IsOK(ecode6)) {
4838
+ SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "rgblib_send_btc_begin" "', argument " "6"" of type '" "bool""'");
4839
+ }
4840
+ arg6 = static_cast< bool >(val6);result = rgblib_send_btc_begin((COpaqueStruct const *)arg1,(COpaqueStruct const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,arg6);
4841
+
4842
+ switch ((&result)->result) {
4843
+ case CResultValue::Ok:
4844
+ if ((&result)->inner == nullptr) {
4845
+ jsresult = v8::Null(v8::Isolate::GetCurrent());
4846
+ } else {
4847
+ jsresult = v8::String::NewFromUtf8(args.GetIsolate(), (const char*) (&result)->inner).ToLocalChecked();
4848
+ delete ((&result)->inner);
4849
+ }
4850
+ break;
4851
+ case CResultValue::Err:
4852
+ SWIG_V8_Raise((const char*) (&result)->inner);
4853
+ break;
4854
+ }
4855
+
4856
+
4857
+
4858
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
4859
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
4860
+ if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
4861
+
4862
+
4863
+ SWIGV8_RETURN(jsresult);
4864
+
4865
+ goto fail;
4866
+ fail:
4867
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
4868
+ }
4869
+
4870
+
4871
+ static SwigV8ReturnValue _wrap_rgblib_send_btc_end(const SwigV8Arguments &args) {
4872
+ SWIGV8_HANDLESCOPE();
4873
+
4874
+ SWIGV8_VALUE jsresult;
4875
+ COpaqueStruct *arg1 = (COpaqueStruct *) 0 ;
4876
+ COpaqueStruct *arg2 = (COpaqueStruct *) 0 ;
4877
+ char *arg3 = (char *) 0 ;
4878
+ bool arg4 ;
4879
+ void *argp1 = 0 ;
4880
+ int res1 = 0 ;
4881
+ void *argp2 = 0 ;
4882
+ int res2 = 0 ;
4883
+ int res3 ;
4884
+ char *buf3 = 0 ;
4885
+ int alloc3 = 0 ;
4886
+ bool val4 ;
4887
+ int ecode4 = 0 ;
4888
+ CResultString result;
4889
+
4890
+ if (args.Length() < 4 || args.Length() > 4) SWIG_exception_fail(SWIG_ERROR, "Illegal number of arguments for _wrap_rgblib_send_btc_end.");
4891
+
4892
+ res1 = SWIG_ConvertPtr(args[0], &argp1,SWIGTYPE_p_COpaqueStruct, 0 | 0 );
4893
+ if (!SWIG_IsOK(res1)) {
4894
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "rgblib_send_btc_end" "', argument " "1"" of type '" "COpaqueStruct const *""'");
4895
+ }
4896
+ arg1 = reinterpret_cast< COpaqueStruct * >(argp1);res2 = SWIG_ConvertPtr(args[1], &argp2,SWIGTYPE_p_COpaqueStruct, 0 | 0 );
4897
+ if (!SWIG_IsOK(res2)) {
4898
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "rgblib_send_btc_end" "', argument " "2"" of type '" "COpaqueStruct const *""'");
4899
+ }
4900
+ arg2 = reinterpret_cast< COpaqueStruct * >(argp2);res3 = SWIG_AsCharPtrAndSize(args[2], &buf3, NULL, &alloc3);
4901
+ if (!SWIG_IsOK(res3)) {
4902
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "rgblib_send_btc_end" "', argument " "3"" of type '" "char const *""'");
4903
+ }
4904
+ arg3 = reinterpret_cast< char * >(buf3);ecode4 = SWIG_AsVal_bool(args[3], &val4);
4905
+ if (!SWIG_IsOK(ecode4)) {
4906
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "rgblib_send_btc_end" "', argument " "4"" of type '" "bool""'");
4907
+ }
4908
+ arg4 = static_cast< bool >(val4);result = rgblib_send_btc_end((COpaqueStruct const *)arg1,(COpaqueStruct const *)arg2,(char const *)arg3,arg4);
4909
+
4910
+ switch ((&result)->result) {
4911
+ case CResultValue::Ok:
4912
+ if ((&result)->inner == nullptr) {
4913
+ jsresult = v8::Null(v8::Isolate::GetCurrent());
4914
+ } else {
4915
+ jsresult = v8::String::NewFromUtf8(args.GetIsolate(), (const char*) (&result)->inner).ToLocalChecked();
4916
+ delete ((&result)->inner);
4917
+ }
4918
+ break;
4919
+ case CResultValue::Err:
4920
+ SWIG_V8_Raise((const char*) (&result)->inner);
4921
+ break;
4922
+ }
4923
+
4924
+
4925
+
4926
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
4927
+
4928
+
4929
+ SWIGV8_RETURN(jsresult);
4930
+
4931
+ goto fail;
4932
+ fail:
4933
+ SWIGV8_RETURN(SWIGV8_UNDEFINED());
4934
+ }
4935
+
4936
+
4807
4937
  static SwigV8ReturnValue _wrap_rgblib_send_end(const SwigV8Arguments &args) {
4808
4938
  SWIGV8_HANDLESCOPE();
4809
4939
 
@@ -5293,6 +5423,9 @@ static SwigV8ReturnValue _wrap_rgblib_witness_receive(const SwigV8Arguments &arg
5293
5423
  int res3 ;
5294
5424
  char *buf3 = 0 ;
5295
5425
  int alloc3 = 0 ;
5426
+ int res4 ;
5427
+ char *buf4 = 0 ;
5428
+ int alloc4 = 0 ;
5296
5429
  int res5 ;
5297
5430
  char *buf5 = 0 ;
5298
5431
  int alloc5 = 0 ;
@@ -5323,19 +5456,11 @@ static SwigV8ReturnValue _wrap_rgblib_witness_receive(const SwigV8Arguments &arg
5323
5456
  if (!SWIG_IsOK(res3)) {
5324
5457
  SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "rgblib_witness_receive" "', argument " "3"" of type '" "char const *""'");
5325
5458
  }
5326
- arg3 = reinterpret_cast< char * >(buf3);{
5327
- {
5328
- if (args[3] == v8::Null(v8::Isolate::GetCurrent())) {
5329
- arg4 = nullptr;
5330
- } else {
5331
- int res = SWIG_AsCharPtrAndSize(args[3], (char**)&arg4, NULL, NULL);
5332
- if (!SWIG_IsOK(res)) {
5333
- SWIG_exception_fail(SWIG_ArgError(res), "in method '" "rgblib_witness_receive" "', argument '" "4""' of type '" "char const *""'");
5334
- }
5335
- }
5336
- }
5459
+ arg3 = reinterpret_cast< char * >(buf3);res4 = SWIG_AsCharPtrAndSize(args[3], &buf4, NULL, &alloc4);
5460
+ if (!SWIG_IsOK(res4)) {
5461
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "rgblib_witness_receive" "', argument " "4"" of type '" "char const *""'");
5337
5462
  }
5338
- res5 = SWIG_AsCharPtrAndSize(args[4], &buf5, NULL, &alloc5);
5463
+ arg4 = reinterpret_cast< char * >(buf4);res5 = SWIG_AsCharPtrAndSize(args[4], &buf5, NULL, &alloc5);
5339
5464
  if (!SWIG_IsOK(res5)) {
5340
5465
  SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "rgblib_witness_receive" "', argument " "5"" of type '" "char const *""'");
5341
5466
  }
@@ -5361,6 +5486,7 @@ static SwigV8ReturnValue _wrap_rgblib_witness_receive(const SwigV8Arguments &arg
5361
5486
 
5362
5487
 
5363
5488
  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
5489
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
5364
5490
  if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
5365
5491
  if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
5366
5492
 
@@ -5829,6 +5955,8 @@ SWIGV8_AddStaticFunction(exports_obj, "rgblib_rotate_vanilla_address", _wrap_rgb
5829
5955
  SWIGV8_AddStaticFunction(exports_obj, "rgblib_send", _wrap_rgblib_send, context);
5830
5956
  SWIGV8_AddStaticFunction(exports_obj, "rgblib_send_begin", _wrap_rgblib_send_begin, context);
5831
5957
  SWIGV8_AddStaticFunction(exports_obj, "rgblib_send_btc", _wrap_rgblib_send_btc, context);
5958
+ SWIGV8_AddStaticFunction(exports_obj, "rgblib_send_btc_begin", _wrap_rgblib_send_btc_begin, context);
5959
+ SWIGV8_AddStaticFunction(exports_obj, "rgblib_send_btc_end", _wrap_rgblib_send_btc_end, context);
5832
5960
  SWIGV8_AddStaticFunction(exports_obj, "rgblib_send_end", _wrap_rgblib_send_end, context);
5833
5961
  SWIGV8_AddStaticFunction(exports_obj, "rgblib_sign_psbt", _wrap_rgblib_sign_psbt, context);
5834
5962
  SWIGV8_AddStaticFunction(exports_obj, "rgblib_sync", _wrap_rgblib_sync, context);
package/wrapper.js CHANGED
@@ -102,16 +102,7 @@ function validateArrayElements(array, expectedElementType) {
102
102
  function validateEnumValues(object, enumValidValues) {
103
103
  Object.keys(enumValidValues).forEach((key) => {
104
104
  const allowedValues = Object.values(enumValidValues[key]);
105
- const value = object[key];
106
- if (Array.isArray(value)) {
107
- value.forEach((item, index) => {
108
- if (!allowedValues.includes(item)) {
109
- throw new Error(
110
- `${key}[${index}] is invalid. Expected one of: ${allowedValues.join(", ")}`,
111
- );
112
- }
113
- });
114
- } else if (!allowedValues.includes(value)) {
105
+ if (!allowedValues.includes(object[key])) {
115
106
  throw new Error(
116
107
  `${key} is invalid. Expected one of: ${allowedValues.join(", ")}`,
117
108
  );
@@ -121,24 +112,14 @@ function validateEnumValues(object, enumValidValues) {
121
112
 
122
113
  function validateTypes(values, expectedTypes) {
123
114
  Object.keys(expectedTypes).forEach((key) => {
124
- const type = expectedTypes[key];
125
- const isOptional = type.endsWith("?");
126
- const baseType = isOptional ? type.slice(0, -1) : type;
127
-
128
- if (isOptional) {
129
- if (
130
- !(key in values) ||
131
- values[key] === undefined ||
132
- values[key] === null
133
- ) {
134
- return;
135
- }
136
- } else if (!(key in values) || values[key] === undefined) {
115
+ if (!(key in values)) {
137
116
  throw new Error(`${key} must be defined`);
138
117
  }
139
-
118
+ const type = expectedTypes[key];
119
+ const isOptional = type.endsWith("?");
140
120
  let val = values[key];
141
121
  let actualType = trueTypeOf(val);
122
+ const baseType = isOptional ? type.slice(0, -1) : type;
142
123
 
143
124
  if (val !== null && isNumberType(baseType)) {
144
125
  if (actualType != "string") {
@@ -154,8 +135,13 @@ function validateTypes(values, expectedTypes) {
154
135
  }
155
136
  const elementType = arrayMatch[1];
156
137
  validateArrayElements(val, elementType);
157
- } else if (!isTypeSubset(actualType, baseType)) {
158
- throw new Error(`${key} type must be ${baseType}`);
138
+ } else if (
139
+ !isTypeSubset(actualType, baseType) &&
140
+ !(isOptional && val === null)
141
+ ) {
142
+ throw new Error(
143
+ `${key} type must be ${baseType}${isOptional ? " or null" : ""}`,
144
+ );
159
145
  }
160
146
  });
161
147
  }
@@ -171,7 +157,6 @@ exports.BitcoinNetwork = BitcoinNetwork = {
171
157
  Testnet: "Testnet",
172
158
  Testnet4: "Testnet4",
173
159
  Signet: "Signet",
174
- SignetCustom: "SignetCustom",
175
160
  Regtest: "Regtest",
176
161
  };
177
162
 
@@ -215,20 +200,6 @@ exports.restoreKeys = function (bitcoinNetwork, mnemonic) {
215
200
  return JSON.parse(lib.rgblib_restore_keys(bitcoinNetwork, mnemonic));
216
201
  };
217
202
 
218
- exports.SinglesigKeys = class SinglesigKeys {
219
- constructor(singlesigKeys) {
220
- const expectedTypes = {
221
- accountXpubVanilla: "string",
222
- accountXpubColored: "string",
223
- vanillaKeychain: "u8?",
224
- masterFingerprint: "string",
225
- mnemonic: "string?",
226
- };
227
- validateTypes(singlesigKeys, expectedTypes);
228
- return singlesigKeys;
229
- }
230
- };
231
-
232
203
  exports.restoreFromVss = function (config, targetDir) {
233
204
  const expectedTypes = {
234
205
  server_url: "string",
@@ -271,26 +242,23 @@ exports.WalletData = class WalletData {
271
242
  dataDir: "string",
272
243
  bitcoinNetwork: "string",
273
244
  databaseType: "string",
245
+ accountXpubVanilla: "string",
246
+ accountXpubColored: "string",
274
247
  maxAllocationsPerUtxo: "u32",
275
- supportedSchemas: "array[string]",
276
- reuseAddresses: "boolean?",
248
+ vanillaKeychain: "u8?",
277
249
  };
278
250
  validateTypes(walletData, expectedTypes);
279
251
  validateEnumValues(walletData, {
280
252
  bitcoinNetwork: BitcoinNetwork,
281
253
  databaseType: DatabaseType,
282
- supportedSchemas: AssetSchema,
283
254
  });
284
255
  return walletData;
285
256
  }
286
257
  };
287
258
 
288
259
  exports.Wallet = class Wallet {
289
- constructor(walletData, singlesigKeys) {
290
- this.wallet = lib.rgblib_new_wallet(
291
- JSON.stringify(walletData),
292
- JSON.stringify(singlesigKeys),
293
- );
260
+ constructor(walletData) {
261
+ this.wallet = lib.rgblib_new_wallet(JSON.stringify(walletData));
294
262
  }
295
263
 
296
264
  drop() {
@@ -347,21 +315,21 @@ exports.Wallet = class Wallet {
347
315
  blindReceive(
348
316
  assetId,
349
317
  assignment,
350
- expirationTimestamp,
318
+ durationSeconds,
351
319
  transportEndpoints,
352
320
  minConfirmations,
353
321
  ) {
354
322
  const params = {
355
323
  assetId,
356
324
  assignment,
357
- expirationTimestamp,
325
+ durationSeconds,
358
326
  transportEndpoints,
359
327
  minConfirmations,
360
328
  };
361
329
  const expectedTypes = {
362
330
  assetId: "string?",
363
331
  assignment: "string",
364
- expirationTimestamp: "u64?",
332
+ durationSeconds: "u32?",
365
333
  transportEndpoints: "array[string]",
366
334
  minConfirmations: "u8",
367
335
  };
@@ -371,7 +339,7 @@ exports.Wallet = class Wallet {
371
339
  this.wallet,
372
340
  assetId,
373
341
  assignment,
374
- expirationTimestamp,
342
+ durationSeconds,
375
343
  JSON.stringify(transportEndpoints),
376
344
  minConfirmations,
377
345
  ),
@@ -440,62 +408,10 @@ exports.Wallet = class Wallet {
440
408
  );
441
409
  }
442
410
 
443
- deleteTransfers(batchTransferIdx, noAssetOnly) {
444
- const params = {
445
- batchTransferIdx,
446
- noAssetOnly,
447
- };
448
- const expectedTypes = {
449
- batchTransferIdx: "i32?",
450
- noAssetOnly: "boolean",
451
- };
452
- validateTypes(params, expectedTypes);
453
- return JSON.parse(
454
- lib.rgblib_delete_transfers(
455
- this.wallet,
456
- batchTransferIdx,
457
- noAssetOnly,
458
- ),
459
- );
460
- }
461
-
462
- failTransfers(online, batchTransferIdx, noAssetOnly, skipSync) {
463
- const params = {
464
- online,
465
- batchTransferIdx,
466
- noAssetOnly,
467
- skipSync,
468
- };
469
- const expectedTypes = {
470
- online: "object",
471
- batchTransferIdx: "i32?",
472
- noAssetOnly: "boolean",
473
- skipSync: "boolean",
474
- };
475
- validateTypes(params, expectedTypes);
476
- return JSON.parse(
477
- lib.rgblib_fail_transfers(
478
- this.wallet,
479
- online,
480
- batchTransferIdx,
481
- noAssetOnly,
482
- skipSync,
483
- ),
484
- );
485
- }
486
-
487
411
  getAddress() {
488
412
  return lib.rgblib_get_address(this.wallet);
489
413
  }
490
414
 
491
- rotateVanillaAddress() {
492
- return lib.rgblib_rotate_vanilla_address(this.wallet);
493
- }
494
-
495
- rotateColoredAddress() {
496
- return lib.rgblib_rotate_colored_address(this.wallet);
497
- }
498
-
499
415
  getAssetBalance(assetId) {
500
416
  const params = { assetId };
501
417
  const expectedTypes = {
@@ -505,15 +421,6 @@ exports.Wallet = class Wallet {
505
421
  return JSON.parse(lib.rgblib_get_asset_balance(this.wallet, assetId));
506
422
  }
507
423
 
508
- getAssetMetadata(assetId) {
509
- const params = { assetId };
510
- const expectedTypes = {
511
- assetId: "string",
512
- };
513
- validateTypes(params, expectedTypes);
514
- return JSON.parse(lib.rgblib_get_asset_metadata(this.wallet, assetId));
515
- }
516
-
517
424
  getBtcBalance(online, skipSync) {
518
425
  const params = { online, skipSync };
519
426
  const expectedTypes = {
@@ -648,9 +555,6 @@ exports.Wallet = class Wallet {
648
555
  filterAssetSchemas: "array[string]",
649
556
  };
650
557
  validateTypes(params, expectedTypes);
651
- validateEnumValues(params, {
652
- filterAssetSchemas: AssetSchema,
653
- });
654
558
  return JSON.parse(
655
559
  lib.rgblib_list_assets(
656
560
  this.wallet,
@@ -729,22 +633,57 @@ exports.Wallet = class Wallet {
729
633
  );
730
634
  }
731
635
 
732
- send(
733
- online,
734
- recipientMap,
735
- donation,
736
- feeRate,
737
- minConfirmations,
738
- expirationTimestamp,
739
- skipSync,
740
- ) {
636
+ deleteTransfers(batchTransferIdx, noAssetOnly) {
637
+ const params = {
638
+ batchTransferIdx,
639
+ noAssetOnly,
640
+ };
641
+ const expectedTypes = {
642
+ batchTransferIdx: "i32?",
643
+ noAssetOnly: "boolean",
644
+ };
645
+ validateTypes(params, expectedTypes);
646
+ return JSON.parse(
647
+ lib.rgblib_delete_transfers(
648
+ this.wallet,
649
+ batchTransferIdx,
650
+ noAssetOnly,
651
+ ),
652
+ );
653
+ }
654
+
655
+ failTransfers(online, batchTransferIdx, noAssetOnly, skipSync) {
656
+ const params = {
657
+ online,
658
+ batchTransferIdx,
659
+ noAssetOnly,
660
+ skipSync,
661
+ };
662
+ const expectedTypes = {
663
+ online: "object",
664
+ batchTransferIdx: "i32?",
665
+ noAssetOnly: "boolean",
666
+ skipSync: "boolean",
667
+ };
668
+ validateTypes(params, expectedTypes);
669
+ return JSON.parse(
670
+ lib.rgblib_fail_transfers(
671
+ this.wallet,
672
+ online,
673
+ batchTransferIdx,
674
+ noAssetOnly,
675
+ skipSync,
676
+ ),
677
+ );
678
+ }
679
+
680
+ send(online, recipientMap, donation, feeRate, minConfirmations, skipSync) {
741
681
  const params = {
742
682
  online,
743
683
  recipientMap,
744
684
  donation,
745
685
  feeRate,
746
686
  minConfirmations,
747
- expirationTimestamp,
748
687
  skipSync,
749
688
  };
750
689
  const expectedTypes = {
@@ -753,7 +692,6 @@ exports.Wallet = class Wallet {
753
692
  donation: "boolean",
754
693
  feeRate: "u64",
755
694
  minConfirmations: "u8",
756
- expirationTimestamp: "u64?",
757
695
  skipSync: "boolean",
758
696
  };
759
697
  validateTypes(params, expectedTypes);
@@ -765,29 +703,18 @@ exports.Wallet = class Wallet {
765
703
  donation,
766
704
  feeRate,
767
705
  minConfirmations,
768
- expirationTimestamp,
769
706
  skipSync,
770
707
  ),
771
708
  );
772
709
  }
773
710
 
774
- sendBegin(
775
- online,
776
- recipientMap,
777
- donation,
778
- feeRate,
779
- minConfirmations,
780
- expirationTimestamp,
781
- dryRun,
782
- ) {
711
+ sendBegin(online, recipientMap, donation, feeRate, minConfirmations) {
783
712
  const params = {
784
713
  online,
785
714
  recipientMap,
786
715
  donation,
787
716
  feeRate,
788
717
  minConfirmations,
789
- expirationTimestamp,
790
- dryRun,
791
718
  };
792
719
  const expectedTypes = {
793
720
  online: "object",
@@ -795,8 +722,6 @@ exports.Wallet = class Wallet {
795
722
  donation: "boolean",
796
723
  feeRate: "u64",
797
724
  minConfirmations: "u8",
798
- expirationTimestamp: "u64?",
799
- dryRun: "boolean",
800
725
  };
801
726
  validateTypes(params, expectedTypes);
802
727
  return lib.rgblib_send_begin(
@@ -806,8 +731,28 @@ exports.Wallet = class Wallet {
806
731
  donation,
807
732
  feeRate,
808
733
  minConfirmations,
809
- expirationTimestamp,
810
- dryRun,
734
+ );
735
+ }
736
+
737
+ sendEnd(online, signedPsbt, skipSync) {
738
+ const params = {
739
+ online,
740
+ signedPsbt,
741
+ skipSync,
742
+ };
743
+ const expectedTypes = {
744
+ online: "object",
745
+ signedPsbt: "string",
746
+ skipSync: "boolean",
747
+ };
748
+ validateTypes(params, expectedTypes);
749
+ return JSON.parse(
750
+ lib.rgblib_send_end(
751
+ this.wallet,
752
+ online,
753
+ signedPsbt,
754
+ skipSync,
755
+ ),
811
756
  );
812
757
  }
813
758
 
@@ -837,7 +782,33 @@ exports.Wallet = class Wallet {
837
782
  );
838
783
  }
839
784
 
840
- sendEnd(online, signedPsbt, skipSync) {
785
+ sendBtcBegin(online, address, amount, feeRate, skipSync) {
786
+ const params = {
787
+ online,
788
+ address,
789
+ amount,
790
+ feeRate,
791
+ skipSync,
792
+ };
793
+ const expectedTypes = {
794
+ online: "object",
795
+ address: "string",
796
+ amount: "u64",
797
+ feeRate: "u64",
798
+ skipSync: "boolean",
799
+ };
800
+ validateTypes(params, expectedTypes);
801
+ return lib.rgblib_send_btc_begin(
802
+ this.wallet,
803
+ online,
804
+ address,
805
+ amount,
806
+ feeRate,
807
+ skipSync,
808
+ );
809
+ }
810
+
811
+ sendBtcEnd(online, signedPsbt, skipSync) {
841
812
  const params = {
842
813
  online,
843
814
  signedPsbt,
@@ -849,8 +820,11 @@ exports.Wallet = class Wallet {
849
820
  skipSync: "boolean",
850
821
  };
851
822
  validateTypes(params, expectedTypes);
852
- return JSON.parse(
853
- lib.rgblib_send_end(this.wallet, online, signedPsbt, skipSync),
823
+ return lib.rgblib_send_btc_end(
824
+ this.wallet,
825
+ online,
826
+ signedPsbt,
827
+ skipSync,
854
828
  );
855
829
  }
856
830
 
@@ -875,21 +849,21 @@ exports.Wallet = class Wallet {
875
849
  witnessReceive(
876
850
  assetId,
877
851
  assignment,
878
- expirationTimestamp,
852
+ durationSeconds,
879
853
  transportEndpoints,
880
854
  minConfirmations,
881
855
  ) {
882
856
  const params = {
883
857
  assetId,
884
858
  assignment,
885
- expirationTimestamp,
859
+ durationSeconds,
886
860
  transportEndpoints,
887
861
  minConfirmations,
888
862
  };
889
863
  const expectedTypes = {
890
864
  assetId: "string?",
891
865
  assignment: "string",
892
- expirationTimestamp: "u64?",
866
+ durationSeconds: "u32?",
893
867
  transportEndpoints: "array[string]",
894
868
  minConfirmations: "u8",
895
869
  };
@@ -899,7 +873,7 @@ exports.Wallet = class Wallet {
899
873
  this.wallet,
900
874
  assetId,
901
875
  assignment,
902
- expirationTimestamp,
876
+ durationSeconds,
903
877
  JSON.stringify(transportEndpoints),
904
878
  minConfirmations,
905
879
  ),
@@ -924,34 +898,6 @@ exports.validateConsignment = function validateConsignment(filePath, indexerUrl,
924
898
  );
925
899
  };
926
900
 
927
- exports.validateConsignmentOffchain = function validateConsignmentOffchain(
928
- filePath,
929
- txid,
930
- indexerUrl,
931
- bitcoinNetwork,
932
- ) {
933
- const params = { filePath, txid, indexerUrl, bitcoinNetwork };
934
- const expectedTypes = {
935
- filePath: "string",
936
- txid: "string",
937
- indexerUrl: "string",
938
- bitcoinNetwork: "string",
939
- };
940
- validateTypes(params, expectedTypes);
941
- validateEnumValues(
942
- { bitcoinNetwork },
943
- { bitcoinNetwork: BitcoinNetwork },
944
- );
945
- return JSON.parse(
946
- lib.rgblib_validate_consignment_offchain(
947
- filePath,
948
- txid,
949
- indexerUrl,
950
- bitcoinNetwork,
951
- ),
952
- );
953
- };
954
-
955
901
  exports.Invoice = class Invoice {
956
902
  constructor(invoiceString) {
957
903
  const params = { invoiceString };