@alephium/web3 0.2.0-rc.11 → 0.2.0-rc.12

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.
@@ -12,14 +12,7 @@
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.Api = exports.HttpClient = exports.ContentType = void 0;
14
14
  require("cross-fetch/polyfill");
15
- function convertHttpResponse(response) {
16
- if (response.error) {
17
- throw new Error(response.error.detail);
18
- }
19
- else {
20
- return response.data;
21
- }
22
- }
15
+ const utils_1 = require("./utils");
23
16
  var ContentType;
24
17
  (function (ContentType) {
25
18
  ContentType["Json"] = "application/json";
@@ -113,8 +106,6 @@ class HttpClient {
113
106
  if (cancelToken) {
114
107
  this.abortControllers.delete(cancelToken);
115
108
  }
116
- if (!response.ok)
117
- throw data;
118
109
  return data;
119
110
  });
120
111
  };
@@ -178,7 +169,7 @@ class Api extends HttpClient {
178
169
  method: 'GET',
179
170
  format: 'json',
180
171
  ...params
181
- }).then(convertHttpResponse),
172
+ }).then(utils_1.convertHttpResponse),
182
173
  /**
183
174
  * No description
184
175
  *
@@ -194,7 +185,7 @@ class Api extends HttpClient {
194
185
  type: ContentType.Json,
195
186
  format: 'json',
196
187
  ...params
197
- }).then(convertHttpResponse),
188
+ }).then(utils_1.convertHttpResponse),
198
189
  /**
199
190
  * @description A new wallet will be created and respond with a mnemonic. Make sure to keep that mnemonic safely as it will allows you to recover your wallet. Default mnemonic size is 24, (options: 12, 15, 18, 21, 24).
200
191
  *
@@ -210,7 +201,7 @@ class Api extends HttpClient {
210
201
  type: ContentType.Json,
211
202
  format: 'json',
212
203
  ...params
213
- }).then(convertHttpResponse),
204
+ }).then(utils_1.convertHttpResponse),
214
205
  /**
215
206
  * No description
216
207
  *
@@ -224,7 +215,7 @@ class Api extends HttpClient {
224
215
  method: 'GET',
225
216
  format: 'json',
226
217
  ...params
227
- }).then(convertHttpResponse),
218
+ }).then(utils_1.convertHttpResponse),
228
219
  /**
229
220
  * No description
230
221
  *
@@ -239,7 +230,7 @@ class Api extends HttpClient {
239
230
  body: data,
240
231
  type: ContentType.Json,
241
232
  ...params
242
- }).then(convertHttpResponse),
233
+ }).then(utils_1.convertHttpResponse),
243
234
  /**
244
235
  * No description
245
236
  *
@@ -252,7 +243,7 @@ class Api extends HttpClient {
252
243
  path: `/wallets/${walletName}/lock`,
253
244
  method: 'POST',
254
245
  ...params
255
- }).then(convertHttpResponse),
246
+ }).then(utils_1.convertHttpResponse),
256
247
  /**
257
248
  * No description
258
249
  *
@@ -267,7 +258,7 @@ class Api extends HttpClient {
267
258
  body: data,
268
259
  type: ContentType.Json,
269
260
  ...params
270
- }).then(convertHttpResponse),
261
+ }).then(utils_1.convertHttpResponse),
271
262
  /**
272
263
  * No description
273
264
  *
@@ -281,7 +272,7 @@ class Api extends HttpClient {
281
272
  method: 'GET',
282
273
  format: 'json',
283
274
  ...params
284
- }).then(convertHttpResponse),
275
+ }).then(utils_1.convertHttpResponse),
285
276
  /**
286
277
  * No description
287
278
  *
@@ -297,7 +288,7 @@ class Api extends HttpClient {
297
288
  type: ContentType.Json,
298
289
  format: 'json',
299
290
  ...params
300
- }).then(convertHttpResponse),
291
+ }).then(utils_1.convertHttpResponse),
301
292
  /**
302
293
  * No description
303
294
  *
@@ -313,7 +304,7 @@ class Api extends HttpClient {
313
304
  type: ContentType.Json,
314
305
  format: 'json',
315
306
  ...params
316
- }).then(convertHttpResponse),
307
+ }).then(utils_1.convertHttpResponse),
317
308
  /**
318
309
  * No description
319
310
  *
@@ -329,7 +320,7 @@ class Api extends HttpClient {
329
320
  type: ContentType.Json,
330
321
  format: 'json',
331
322
  ...params
332
- }).then(convertHttpResponse),
323
+ }).then(utils_1.convertHttpResponse),
333
324
  /**
334
325
  * No description
335
326
  *
@@ -345,7 +336,7 @@ class Api extends HttpClient {
345
336
  type: ContentType.Json,
346
337
  format: 'json',
347
338
  ...params
348
- }).then(convertHttpResponse),
339
+ }).then(utils_1.convertHttpResponse),
349
340
  /**
350
341
  * No description
351
342
  *
@@ -361,7 +352,7 @@ class Api extends HttpClient {
361
352
  type: ContentType.Json,
362
353
  format: 'json',
363
354
  ...params
364
- }).then(convertHttpResponse),
355
+ }).then(utils_1.convertHttpResponse),
365
356
  /**
366
357
  * No description
367
358
  *
@@ -375,7 +366,7 @@ class Api extends HttpClient {
375
366
  method: 'GET',
376
367
  format: 'json',
377
368
  ...params
378
- }).then(convertHttpResponse),
369
+ }).then(utils_1.convertHttpResponse),
379
370
  /**
380
371
  * No description
381
372
  *
@@ -389,7 +380,7 @@ class Api extends HttpClient {
389
380
  method: 'GET',
390
381
  format: 'json',
391
382
  ...params
392
- }).then(convertHttpResponse),
383
+ }).then(utils_1.convertHttpResponse),
393
384
  /**
394
385
  * @description This endpoint can only be called if the wallet was created with the `isMiner = true` flag
395
386
  *
@@ -403,7 +394,7 @@ class Api extends HttpClient {
403
394
  method: 'GET',
404
395
  format: 'json',
405
396
  ...params
406
- }).then(convertHttpResponse),
397
+ }).then(utils_1.convertHttpResponse),
407
398
  /**
408
399
  * @description Cannot be called from a miner wallet
409
400
  *
@@ -418,7 +409,7 @@ class Api extends HttpClient {
418
409
  query: query,
419
410
  format: 'json',
420
411
  ...params
421
- }).then(convertHttpResponse),
412
+ }).then(utils_1.convertHttpResponse),
422
413
  /**
423
414
  * @description Your wallet need to have been created with the miner flag set to true
424
415
  *
@@ -432,7 +423,7 @@ class Api extends HttpClient {
432
423
  method: 'POST',
433
424
  format: 'json',
434
425
  ...params
435
- }).then(convertHttpResponse),
426
+ }).then(utils_1.convertHttpResponse),
436
427
  /**
437
428
  * No description
438
429
  *
@@ -447,7 +438,7 @@ class Api extends HttpClient {
447
438
  body: data,
448
439
  type: ContentType.Json,
449
440
  ...params
450
- }).then(convertHttpResponse)
441
+ }).then(utils_1.convertHttpResponse)
451
442
  };
452
443
  this.infos = {
453
444
  /**
@@ -463,7 +454,7 @@ class Api extends HttpClient {
463
454
  method: 'GET',
464
455
  format: 'json',
465
456
  ...params
466
- }).then(convertHttpResponse),
457
+ }).then(utils_1.convertHttpResponse),
467
458
  /**
468
459
  * No description
469
460
  *
@@ -477,7 +468,7 @@ class Api extends HttpClient {
477
468
  method: 'GET',
478
469
  format: 'json',
479
470
  ...params
480
- }).then(convertHttpResponse),
471
+ }).then(utils_1.convertHttpResponse),
481
472
  /**
482
473
  * No description
483
474
  *
@@ -491,7 +482,7 @@ class Api extends HttpClient {
491
482
  method: 'GET',
492
483
  format: 'json',
493
484
  ...params
494
- }).then(convertHttpResponse),
485
+ }).then(utils_1.convertHttpResponse),
495
486
  /**
496
487
  * No description
497
488
  *
@@ -505,7 +496,7 @@ class Api extends HttpClient {
505
496
  method: 'GET',
506
497
  format: 'json',
507
498
  ...params
508
- }).then(convertHttpResponse),
499
+ }).then(utils_1.convertHttpResponse),
509
500
  /**
510
501
  * No description
511
502
  *
@@ -519,7 +510,7 @@ class Api extends HttpClient {
519
510
  method: 'GET',
520
511
  format: 'json',
521
512
  ...params
522
- }).then(convertHttpResponse),
513
+ }).then(utils_1.convertHttpResponse),
523
514
  /**
524
515
  * No description
525
516
  *
@@ -533,7 +524,7 @@ class Api extends HttpClient {
533
524
  method: 'GET',
534
525
  format: 'json',
535
526
  ...params
536
- }).then(convertHttpResponse),
527
+ }).then(utils_1.convertHttpResponse),
537
528
  /**
538
529
  * No description
539
530
  *
@@ -547,7 +538,7 @@ class Api extends HttpClient {
547
538
  method: 'GET',
548
539
  format: 'json',
549
540
  ...params
550
- }).then(convertHttpResponse),
541
+ }).then(utils_1.convertHttpResponse),
551
542
  /**
552
543
  * No description
553
544
  *
@@ -562,7 +553,7 @@ class Api extends HttpClient {
562
553
  body: data,
563
554
  type: ContentType.Json,
564
555
  ...params
565
- }).then(convertHttpResponse),
556
+ }).then(utils_1.convertHttpResponse),
566
557
  /**
567
558
  * No description
568
559
  *
@@ -576,7 +567,7 @@ class Api extends HttpClient {
576
567
  method: 'GET',
577
568
  format: 'json',
578
569
  ...params
579
- }).then(convertHttpResponse),
570
+ }).then(utils_1.convertHttpResponse),
580
571
  /**
581
572
  * No description
582
573
  *
@@ -591,7 +582,7 @@ class Api extends HttpClient {
591
582
  body: data,
592
583
  type: ContentType.Json,
593
584
  ...params
594
- }).then(convertHttpResponse),
585
+ }).then(utils_1.convertHttpResponse),
595
586
  /**
596
587
  * No description
597
588
  *
@@ -606,7 +597,7 @@ class Api extends HttpClient {
606
597
  query: query,
607
598
  format: 'json',
608
599
  ...params
609
- }).then(convertHttpResponse),
600
+ }).then(utils_1.convertHttpResponse),
610
601
  /**
611
602
  * No description
612
603
  *
@@ -621,7 +612,7 @@ class Api extends HttpClient {
621
612
  query: query,
622
613
  format: 'json',
623
614
  ...params
624
- }).then(convertHttpResponse)
615
+ }).then(utils_1.convertHttpResponse)
625
616
  };
626
617
  this.blockflow = {
627
618
  /**
@@ -638,7 +629,7 @@ class Api extends HttpClient {
638
629
  query: query,
639
630
  format: 'json',
640
631
  ...params
641
- }).then(convertHttpResponse),
632
+ }).then(utils_1.convertHttpResponse),
642
633
  /**
643
634
  * No description
644
635
  *
@@ -652,7 +643,7 @@ class Api extends HttpClient {
652
643
  method: 'GET',
653
644
  format: 'json',
654
645
  ...params
655
- }).then(convertHttpResponse),
646
+ }).then(utils_1.convertHttpResponse),
656
647
  /**
657
648
  * No description
658
649
  *
@@ -667,7 +658,7 @@ class Api extends HttpClient {
667
658
  query: query,
668
659
  format: 'json',
669
660
  ...params
670
- }).then(convertHttpResponse),
661
+ }).then(utils_1.convertHttpResponse),
671
662
  /**
672
663
  * No description
673
664
  *
@@ -682,7 +673,7 @@ class Api extends HttpClient {
682
673
  query: query,
683
674
  format: 'json',
684
675
  ...params
685
- }).then(convertHttpResponse),
676
+ }).then(utils_1.convertHttpResponse),
686
677
  /**
687
678
  * No description
688
679
  *
@@ -697,7 +688,7 @@ class Api extends HttpClient {
697
688
  query: query,
698
689
  format: 'json',
699
690
  ...params
700
- }).then(convertHttpResponse),
691
+ }).then(utils_1.convertHttpResponse),
701
692
  /**
702
693
  * No description
703
694
  *
@@ -711,7 +702,7 @@ class Api extends HttpClient {
711
702
  method: 'GET',
712
703
  format: 'json',
713
704
  ...params
714
- }).then(convertHttpResponse)
705
+ }).then(utils_1.convertHttpResponse)
715
706
  };
716
707
  this.addresses = {
717
708
  /**
@@ -727,7 +718,7 @@ class Api extends HttpClient {
727
718
  method: 'GET',
728
719
  format: 'json',
729
720
  ...params
730
- }).then(convertHttpResponse),
721
+ }).then(utils_1.convertHttpResponse),
731
722
  /**
732
723
  * No description
733
724
  *
@@ -741,7 +732,7 @@ class Api extends HttpClient {
741
732
  method: 'GET',
742
733
  format: 'json',
743
734
  ...params
744
- }).then(convertHttpResponse),
735
+ }).then(utils_1.convertHttpResponse),
745
736
  /**
746
737
  * No description
747
738
  *
@@ -755,7 +746,7 @@ class Api extends HttpClient {
755
746
  method: 'GET',
756
747
  format: 'json',
757
748
  ...params
758
- }).then(convertHttpResponse)
749
+ }).then(utils_1.convertHttpResponse)
759
750
  };
760
751
  this.transactions = {
761
752
  /**
@@ -771,7 +762,7 @@ class Api extends HttpClient {
771
762
  method: 'GET',
772
763
  format: 'json',
773
764
  ...params
774
- }).then(convertHttpResponse),
765
+ }).then(utils_1.convertHttpResponse),
775
766
  /**
776
767
  * No description
777
768
  *
@@ -787,7 +778,7 @@ class Api extends HttpClient {
787
778
  type: ContentType.Json,
788
779
  format: 'json',
789
780
  ...params
790
- }).then(convertHttpResponse),
781
+ }).then(utils_1.convertHttpResponse),
791
782
  /**
792
783
  * No description
793
784
  *
@@ -803,7 +794,7 @@ class Api extends HttpClient {
803
794
  type: ContentType.Json,
804
795
  format: 'json',
805
796
  ...params
806
- }).then(convertHttpResponse),
797
+ }).then(utils_1.convertHttpResponse),
807
798
  /**
808
799
  * No description
809
800
  *
@@ -819,7 +810,7 @@ class Api extends HttpClient {
819
810
  type: ContentType.Json,
820
811
  format: 'json',
821
812
  ...params
822
- }).then(convertHttpResponse),
813
+ }).then(utils_1.convertHttpResponse),
823
814
  /**
824
815
  * No description
825
816
  *
@@ -835,7 +826,7 @@ class Api extends HttpClient {
835
826
  type: ContentType.Json,
836
827
  format: 'json',
837
828
  ...params
838
- }).then(convertHttpResponse),
829
+ }).then(utils_1.convertHttpResponse),
839
830
  /**
840
831
  * No description
841
832
  *
@@ -850,7 +841,7 @@ class Api extends HttpClient {
850
841
  query: query,
851
842
  format: 'json',
852
843
  ...params
853
- }).then(convertHttpResponse)
844
+ }).then(utils_1.convertHttpResponse)
854
845
  };
855
846
  this.contracts = {
856
847
  /**
@@ -868,7 +859,7 @@ class Api extends HttpClient {
868
859
  type: ContentType.Json,
869
860
  format: 'json',
870
861
  ...params
871
- }).then(convertHttpResponse),
862
+ }).then(utils_1.convertHttpResponse),
872
863
  /**
873
864
  * No description
874
865
  *
@@ -884,7 +875,7 @@ class Api extends HttpClient {
884
875
  type: ContentType.Json,
885
876
  format: 'json',
886
877
  ...params
887
- }).then(convertHttpResponse),
878
+ }).then(utils_1.convertHttpResponse),
888
879
  /**
889
880
  * No description
890
881
  *
@@ -900,7 +891,7 @@ class Api extends HttpClient {
900
891
  type: ContentType.Json,
901
892
  format: 'json',
902
893
  ...params
903
- }).then(convertHttpResponse),
894
+ }).then(utils_1.convertHttpResponse),
904
895
  /**
905
896
  * No description
906
897
  *
@@ -916,7 +907,7 @@ class Api extends HttpClient {
916
907
  type: ContentType.Json,
917
908
  format: 'json',
918
909
  ...params
919
- }).then(convertHttpResponse),
910
+ }).then(utils_1.convertHttpResponse),
920
911
  /**
921
912
  * No description
922
913
  *
@@ -932,7 +923,7 @@ class Api extends HttpClient {
932
923
  type: ContentType.Json,
933
924
  format: 'json',
934
925
  ...params
935
- }).then(convertHttpResponse),
926
+ }).then(utils_1.convertHttpResponse),
936
927
  /**
937
928
  * No description
938
929
  *
@@ -947,7 +938,7 @@ class Api extends HttpClient {
947
938
  query: query,
948
939
  format: 'json',
949
940
  ...params
950
- }).then(convertHttpResponse),
941
+ }).then(utils_1.convertHttpResponse),
951
942
  /**
952
943
  * No description
953
944
  *
@@ -963,7 +954,7 @@ class Api extends HttpClient {
963
954
  type: ContentType.Json,
964
955
  format: 'json',
965
956
  ...params
966
- }).then(convertHttpResponse),
957
+ }).then(utils_1.convertHttpResponse),
967
958
  /**
968
959
  * No description
969
960
  *
@@ -979,7 +970,7 @@ class Api extends HttpClient {
979
970
  type: ContentType.Json,
980
971
  format: 'json',
981
972
  ...params
982
- }).then(convertHttpResponse)
973
+ }).then(utils_1.convertHttpResponse)
983
974
  };
984
975
  this.multisig = {
985
976
  /**
@@ -997,7 +988,7 @@ class Api extends HttpClient {
997
988
  type: ContentType.Json,
998
989
  format: 'json',
999
990
  ...params
1000
- }).then(convertHttpResponse),
991
+ }).then(utils_1.convertHttpResponse),
1001
992
  /**
1002
993
  * No description
1003
994
  *
@@ -1013,7 +1004,7 @@ class Api extends HttpClient {
1013
1004
  type: ContentType.Json,
1014
1005
  format: 'json',
1015
1006
  ...params
1016
- }).then(convertHttpResponse),
1007
+ }).then(utils_1.convertHttpResponse),
1017
1008
  /**
1018
1009
  * No description
1019
1010
  *
@@ -1029,7 +1020,7 @@ class Api extends HttpClient {
1029
1020
  type: ContentType.Json,
1030
1021
  format: 'json',
1031
1022
  ...params
1032
- }).then(convertHttpResponse)
1023
+ }).then(utils_1.convertHttpResponse)
1033
1024
  };
1034
1025
  this.utils = {
1035
1026
  /**
@@ -1047,7 +1038,7 @@ class Api extends HttpClient {
1047
1038
  type: ContentType.Json,
1048
1039
  format: 'json',
1049
1040
  ...params
1050
- }).then(convertHttpResponse),
1041
+ }).then(utils_1.convertHttpResponse),
1051
1042
  /**
1052
1043
  * No description
1053
1044
  *
@@ -1060,7 +1051,7 @@ class Api extends HttpClient {
1060
1051
  path: `/utils/check-hash-indexing`,
1061
1052
  method: 'PUT',
1062
1053
  ...params
1063
- }).then(convertHttpResponse)
1054
+ }).then(utils_1.convertHttpResponse)
1064
1055
  };
1065
1056
  this.miners = {
1066
1057
  /**
@@ -1077,7 +1068,7 @@ class Api extends HttpClient {
1077
1068
  query: query,
1078
1069
  format: 'json',
1079
1070
  ...params
1080
- }).then(convertHttpResponse),
1071
+ }).then(utils_1.convertHttpResponse),
1081
1072
  /**
1082
1073
  * No description
1083
1074
  *
@@ -1091,7 +1082,7 @@ class Api extends HttpClient {
1091
1082
  method: 'GET',
1092
1083
  format: 'json',
1093
1084
  ...params
1094
- }).then(convertHttpResponse),
1085
+ }).then(utils_1.convertHttpResponse),
1095
1086
  /**
1096
1087
  * No description
1097
1088
  *
@@ -1106,7 +1097,7 @@ class Api extends HttpClient {
1106
1097
  body: data,
1107
1098
  type: ContentType.Json,
1108
1099
  ...params
1109
- }).then(convertHttpResponse)
1100
+ }).then(utils_1.convertHttpResponse)
1110
1101
  };
1111
1102
  this.events = {
1112
1103
  /**
@@ -1123,7 +1114,7 @@ class Api extends HttpClient {
1123
1114
  query: query,
1124
1115
  format: 'json',
1125
1116
  ...params
1126
- }).then(convertHttpResponse),
1117
+ }).then(utils_1.convertHttpResponse),
1127
1118
  /**
1128
1119
  * No description
1129
1120
  *
@@ -1137,7 +1128,7 @@ class Api extends HttpClient {
1137
1128
  method: 'GET',
1138
1129
  format: 'json',
1139
1130
  ...params
1140
- }).then(convertHttpResponse),
1131
+ }).then(utils_1.convertHttpResponse),
1141
1132
  /**
1142
1133
  * No description
1143
1134
  *
@@ -1152,7 +1143,7 @@ class Api extends HttpClient {
1152
1143
  query: query,
1153
1144
  format: 'json',
1154
1145
  ...params
1155
- }).then(convertHttpResponse)
1146
+ }).then(utils_1.convertHttpResponse)
1156
1147
  };
1157
1148
  }
1158
1149
  }