@alephium/web3 0.5.0-rc.2 → 0.5.0-rc.20

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.
Files changed (51) hide show
  1. package/dist/alephium-web3.min.js +1 -1
  2. package/dist/alephium-web3.min.js.LICENSE.txt +2 -0
  3. package/dist/alephium-web3.min.js.map +1 -1
  4. package/dist/src/api/api-alephium.d.ts +113 -26
  5. package/dist/src/api/api-alephium.js +62 -18
  6. package/dist/src/api/api-explorer.d.ts +222 -52
  7. package/dist/src/api/api-explorer.js +17 -15
  8. package/dist/src/api/explorer-provider.d.ts +18 -0
  9. package/dist/src/api/explorer-provider.js +65 -0
  10. package/dist/src/api/index.d.ts +2 -41
  11. package/dist/src/api/index.js +6 -116
  12. package/dist/src/api/node-provider.d.ts +21 -0
  13. package/dist/src/api/node-provider.js +68 -0
  14. package/dist/src/api/types.d.ts +10 -2
  15. package/dist/src/api/types.js +23 -3
  16. package/dist/src/contract/contract.d.ts +15 -7
  17. package/dist/src/contract/contract.js +62 -42
  18. package/dist/src/signer/signer.d.ts +25 -30
  19. package/dist/src/signer/signer.js +57 -30
  20. package/dist/src/signer/tx-builder.d.ts +2 -7
  21. package/dist/src/signer/tx-builder.js +10 -7
  22. package/dist/src/signer/types.d.ts +12 -16
  23. package/dist/src/transaction/sign-verify.d.ts +3 -2
  24. package/dist/src/transaction/sign-verify.js +4 -14
  25. package/dist/src/utils/index.d.ts +2 -0
  26. package/dist/src/utils/index.js +2 -0
  27. package/dist/src/utils/number.d.ts +17 -0
  28. package/dist/src/utils/number.fixture.d.ts +12 -0
  29. package/dist/src/utils/number.fixture.js +189 -0
  30. package/dist/src/utils/number.js +144 -0
  31. package/dist/src/utils/sign.d.ts +3 -0
  32. package/dist/src/utils/sign.js +89 -0
  33. package/dist/src/utils/utils.d.ts +4 -3
  34. package/dist/src/utils/utils.js +25 -10
  35. package/package.json +7 -5
  36. package/src/api/api-alephium.ts +260 -207
  37. package/src/api/api-explorer.ts +327 -126
  38. package/src/api/explorer-provider.ts +78 -0
  39. package/src/api/index.ts +2 -146
  40. package/src/api/node-provider.ts +84 -0
  41. package/src/api/types.ts +36 -3
  42. package/src/contract/contract.ts +80 -49
  43. package/src/signer/signer.ts +87 -66
  44. package/src/signer/tx-builder.ts +13 -7
  45. package/src/signer/types.ts +22 -11
  46. package/src/transaction/sign-verify.ts +10 -15
  47. package/src/utils/index.ts +2 -0
  48. package/src/utils/number.fixture.ts +187 -0
  49. package/src/utils/number.ts +158 -0
  50. package/src/utils/sign.ts +66 -0
  51. package/src/utils/utils.ts +26 -10
@@ -12,16 +12,12 @@
12
12
  export interface AddressBalance {
13
13
  /** @format address */
14
14
  address: string
15
-
16
15
  /** @format uint256 */
17
16
  balance: string
18
-
19
17
  /** @format x.x ALPH */
20
18
  balanceHint: string
21
-
22
19
  /** @format uint256 */
23
20
  lockedBalance: string
24
-
25
21
  /** @format x.x ALPH */
26
22
  lockedBalanceHint: string
27
23
  warning?: string
@@ -30,10 +26,8 @@ export interface AddressBalance {
30
26
  export interface AddressInfo {
31
27
  /** @format address */
32
28
  address: string
33
-
34
29
  /** @format public-key */
35
30
  publicKey: string
36
-
37
31
  /** @format group-index */
38
32
  group: number
39
33
  path: string
@@ -47,7 +41,6 @@ export interface Addresses {
47
41
 
48
42
  export interface AssetInput {
49
43
  outputRef: OutputRef
50
-
51
44
  /** @format hex-string */
52
45
  unlockScript: string
53
46
  }
@@ -55,20 +48,15 @@ export interface AssetInput {
55
48
  export interface AssetOutput {
56
49
  /** @format int32 */
57
50
  hint: number
58
-
59
51
  /** @format 32-byte-hash */
60
52
  key: string
61
-
62
53
  /** @format uint256 */
63
54
  attoAlphAmount: string
64
-
65
55
  /** @format address */
66
56
  address: string
67
57
  tokens: Token[]
68
-
69
58
  /** @format int64 */
70
59
  lockTime: number
71
-
72
60
  /** @format hex-string */
73
61
  message: string
74
62
  type: string
@@ -87,18 +75,14 @@ export interface BadRequest {
87
75
  export interface Balance {
88
76
  /** @format uint256 */
89
77
  balance: string
90
-
91
78
  /** @format x.x ALPH */
92
79
  balanceHint: string
93
-
94
80
  /** @format uint256 */
95
81
  lockedBalance: string
96
-
97
82
  /** @format x.x ALPH */
98
83
  lockedBalanceHint: string
99
84
  tokenBalances?: Token[]
100
85
  lockedTokenBalances?: Token[]
101
-
102
86
  /** @format int32 */
103
87
  utxoNum: number
104
88
  warning?: string
@@ -107,7 +91,6 @@ export interface Balance {
107
91
  export interface Balances {
108
92
  /** @format uint256 */
109
93
  totalBalance: string
110
-
111
94
  /** @format x.x ALPH */
112
95
  totalBalanceHint: string
113
96
  balances: AddressBalance[]
@@ -132,31 +115,23 @@ export interface BlockAndEvents {
132
115
  export interface BlockEntry {
133
116
  /** @format block-hash */
134
117
  hash: string
135
-
136
118
  /** @format int64 */
137
119
  timestamp: number
138
-
139
120
  /** @format int32 */
140
121
  chainFrom: number
141
-
142
122
  /** @format int32 */
143
123
  chainTo: number
144
-
145
124
  /** @format int32 */
146
125
  height: number
147
126
  deps: string[]
148
127
  transactions: Transaction[]
149
-
150
128
  /** @format hex-string */
151
129
  nonce: string
152
130
  version: number
153
-
154
131
  /** @format 32-byte-hash */
155
132
  depStateHash: string
156
-
157
133
  /** @format 32-byte-hash */
158
134
  txsHash: string
159
-
160
135
  /** @format hex-string */
161
136
  target: string
162
137
  }
@@ -164,16 +139,12 @@ export interface BlockEntry {
164
139
  export interface BlockHeaderEntry {
165
140
  /** @format block-hash */
166
141
  hash: string
167
-
168
142
  /** @format int64 */
169
143
  timestamp: number
170
-
171
144
  /** @format int32 */
172
145
  chainFrom: number
173
-
174
146
  /** @format int32 */
175
147
  chainTo: number
176
-
177
148
  /** @format int32 */
178
149
  height: number
179
150
  deps: string[]
@@ -190,37 +161,34 @@ export interface BlocksPerTimeStampRange {
190
161
  export interface BrokerInfo {
191
162
  /** @format clique-id */
192
163
  cliqueId: string
193
-
194
164
  /** @format int32 */
195
165
  brokerId: number
196
-
197
166
  /** @format int32 */
198
167
  brokerNum: number
199
-
200
168
  /** @format inet-socket-address */
201
- address: { addr: string; port: number }
169
+ address: {
170
+ addr: string
171
+ /** @format int32 */
172
+ port: number
173
+ }
202
174
  }
203
175
 
204
176
  export interface BuildDeployContractTx {
205
- /** @format public-key */
177
+ /** @format hex-string */
206
178
  fromPublicKey: string
207
-
179
+ /** @format hex-string */
180
+ fromPublicKeyType?: string
208
181
  /** @format hex-string */
209
182
  bytecode: string
210
-
211
183
  /** @format uint256 */
212
184
  initialAttoAlphAmount?: string
213
185
  initialTokenAmounts?: Token[]
214
-
215
186
  /** @format uint256 */
216
187
  issueTokenAmount?: string
217
-
218
188
  /** @format gas */
219
189
  gasAmount?: number
220
-
221
190
  /** @format uint256 */
222
191
  gasPrice?: string
223
-
224
192
  /** @format block-hash */
225
193
  targetBlockHash?: string
226
194
  }
@@ -228,41 +196,33 @@ export interface BuildDeployContractTx {
228
196
  export interface BuildDeployContractTxResult {
229
197
  /** @format int32 */
230
198
  fromGroup: number
231
-
232
199
  /** @format int32 */
233
200
  toGroup: number
234
201
  unsignedTx: string
235
-
236
202
  /** @format gas */
237
203
  gasAmount: number
238
-
239
204
  /** @format uint256 */
240
205
  gasPrice: string
241
-
242
206
  /** @format 32-byte-hash */
243
207
  txId: string
244
-
245
208
  /** @format address */
246
209
  contractAddress: string
247
210
  }
248
211
 
249
212
  export interface BuildExecuteScriptTx {
250
- /** @format public-key */
213
+ /** @format hex-string */
251
214
  fromPublicKey: string
252
-
215
+ /** @format hex-string */
216
+ fromPublicKeyType?: string
253
217
  /** @format hex-string */
254
218
  bytecode: string
255
-
256
219
  /** @format uint256 */
257
220
  attoAlphAmount?: string
258
221
  tokens?: Token[]
259
-
260
222
  /** @format gas */
261
223
  gasAmount?: number
262
-
263
224
  /** @format uint256 */
264
225
  gasPrice?: string
265
-
266
226
  /** @format block-hash */
267
227
  targetBlockHash?: string
268
228
  }
@@ -270,17 +230,13 @@ export interface BuildExecuteScriptTx {
270
230
  export interface BuildExecuteScriptTxResult {
271
231
  /** @format int32 */
272
232
  fromGroup: number
273
-
274
233
  /** @format int32 */
275
234
  toGroup: number
276
235
  unsignedTx: string
277
-
278
236
  /** @format gas */
279
237
  gasAmount: number
280
-
281
238
  /** @format uint256 */
282
239
  gasPrice: string
283
-
284
240
  /** @format 32-byte-hash */
285
241
  txId: string
286
242
  }
@@ -295,17 +251,14 @@ export interface BuildMultisig {
295
251
  fromAddress: string
296
252
  fromPublicKeys: string[]
297
253
  destinations: Destination[]
298
-
299
254
  /** @format gas */
300
255
  gas?: number
301
-
302
256
  /** @format uint256 */
303
257
  gasPrice?: string
304
258
  }
305
259
 
306
260
  export interface BuildMultisigAddress {
307
261
  keys: string[]
308
-
309
262
  /** @format int32 */
310
263
  mrequired: number
311
264
  }
@@ -318,64 +271,51 @@ export interface BuildMultisigAddressResult {
318
271
  export interface BuildSweepAddressTransactions {
319
272
  /** @format public-key */
320
273
  fromPublicKey: string
321
-
322
274
  /** @format address */
323
275
  toAddress: string
324
-
325
276
  /** @format int64 */
326
277
  lockTime?: number
327
-
328
278
  /** @format gas */
329
279
  gasAmount?: number
330
-
331
280
  /** @format uint256 */
332
281
  gasPrice?: string
333
-
334
282
  /** @format block-hash */
335
283
  targetBlockHash?: string
336
284
  }
337
285
 
338
286
  export interface BuildSweepAddressTransactionsResult {
339
287
  unsignedTxs: SweepAddressTransaction[]
340
-
341
288
  /** @format int32 */
342
289
  fromGroup: number
343
-
344
290
  /** @format int32 */
345
291
  toGroup: number
346
292
  }
347
293
 
348
294
  export interface BuildTransaction {
349
- /** @format public-key */
295
+ /** @format hex-string */
350
296
  fromPublicKey: string
297
+ /** @format hex-string */
298
+ fromPublicKeyType?: string
351
299
  destinations: Destination[]
352
300
  utxos?: OutputRef[]
353
-
354
301
  /** @format gas */
355
302
  gasAmount?: number
356
-
357
303
  /** @format uint256 */
358
304
  gasPrice?: string
359
-
360
305
  /** @format block-hash */
361
306
  targetBlockHash?: string
362
307
  }
363
308
 
364
309
  export interface BuildTransactionResult {
365
310
  unsignedTx: string
366
-
367
311
  /** @format gas */
368
312
  gasAmount: number
369
-
370
313
  /** @format uint256 */
371
314
  gasPrice: string
372
-
373
315
  /** @format 32-byte-hash */
374
316
  txId: string
375
-
376
317
  /** @format int32 */
377
318
  fromGroup: number
378
-
379
319
  /** @format int32 */
380
320
  toGroup: number
381
321
  }
@@ -383,16 +323,12 @@ export interface BuildTransactionResult {
383
323
  export interface CallContract {
384
324
  /** @format int32 */
385
325
  group: number
386
-
387
326
  /** @format block-hash */
388
327
  worldStateBlockHash?: string
389
-
390
328
  /** @format 32-byte-hash */
391
329
  txId?: string
392
-
393
330
  /** @format address */
394
331
  address: string
395
-
396
332
  /** @format int32 */
397
333
  methodIndex: number
398
334
  args?: Val[]
@@ -402,7 +338,6 @@ export interface CallContract {
402
338
 
403
339
  export interface CallContractResult {
404
340
  returns: Val[]
405
-
406
341
  /** @format int32 */
407
342
  gasUsed: number
408
343
  contracts: ContractState[]
@@ -418,13 +353,10 @@ export interface ChainInfo {
418
353
 
419
354
  export interface ChainParams {
420
355
  networkId: number
421
-
422
356
  /** @format int32 */
423
357
  numZerosAtLeastInHash: number
424
-
425
358
  /** @format int32 */
426
359
  groupNumPerBroker: number
427
-
428
360
  /** @format int32 */
429
361
  groups: number
430
362
  }
@@ -439,10 +371,8 @@ export interface CompileContractResult {
439
371
  name: string
440
372
  bytecode: string
441
373
  bytecodeDebugPatch: string
442
-
443
374
  /** @format 32-byte-hash */
444
375
  codeHash: string
445
-
446
376
  /** @format 32-byte-hash */
447
377
  codeHashDebug: string
448
378
  fields: FieldsSig
@@ -478,16 +408,12 @@ export interface CompilerOptions {
478
408
  export interface Confirmed {
479
409
  /** @format block-hash */
480
410
  blockHash: string
481
-
482
411
  /** @format int32 */
483
412
  txIndex: number
484
-
485
413
  /** @format int32 */
486
414
  chainConfirmations: number
487
-
488
415
  /** @format int32 */
489
416
  fromGroupConfirmations: number
490
-
491
417
  /** @format int32 */
492
418
  toGroupConfirmations: number
493
419
  type: string
@@ -501,10 +427,8 @@ export interface Contract {
501
427
  export interface ContractEvent {
502
428
  /** @format block-hash */
503
429
  blockHash: string
504
-
505
430
  /** @format 32-byte-hash */
506
431
  txId: string
507
-
508
432
  /** @format int32 */
509
433
  eventIndex: number
510
434
  fields: Val[]
@@ -513,10 +437,8 @@ export interface ContractEvent {
513
437
  export interface ContractEventByBlockHash {
514
438
  /** @format 32-byte-hash */
515
439
  txId: string
516
-
517
440
  /** @format address */
518
441
  contractAddress: string
519
-
520
442
  /** @format int32 */
521
443
  eventIndex: number
522
444
  fields: Val[]
@@ -525,10 +447,8 @@ export interface ContractEventByBlockHash {
525
447
  export interface ContractEventByTxId {
526
448
  /** @format block-hash */
527
449
  blockHash: string
528
-
529
450
  /** @format address */
530
451
  contractAddress: string
531
-
532
452
  /** @format int32 */
533
453
  eventIndex: number
534
454
  fields: Val[]
@@ -536,7 +456,6 @@ export interface ContractEventByTxId {
536
456
 
537
457
  export interface ContractEvents {
538
458
  events: ContractEvent[]
539
-
540
459
  /** @format int32 */
541
460
  nextStart: number
542
461
  }
@@ -552,13 +471,10 @@ export interface ContractEventsByTxId {
552
471
  export interface ContractOutput {
553
472
  /** @format int32 */
554
473
  hint: number
555
-
556
474
  /** @format 32-byte-hash */
557
475
  key: string
558
-
559
476
  /** @format uint256 */
560
477
  attoAlphAmount: string
561
-
562
478
  /** @format address */
563
479
  address: string
564
480
  tokens: Token[]
@@ -568,13 +484,10 @@ export interface ContractOutput {
568
484
  export interface ContractState {
569
485
  /** @format address */
570
486
  address: string
571
-
572
487
  /** @format contract */
573
488
  bytecode: string
574
-
575
489
  /** @format 32-byte-hash */
576
490
  codeHash: string
577
-
578
491
  /** @format 32-byte-hash */
579
492
  initialStateHash?: string
580
493
  immFields: Val[]
@@ -595,7 +508,6 @@ export interface DecodeUnsignedTx {
595
508
  export interface DecodeUnsignedTxResult {
596
509
  /** @format int32 */
597
510
  fromGroup: number
598
-
599
511
  /** @format int32 */
600
512
  toGroup: number
601
513
  unsignedTx: UnsignedTx
@@ -604,14 +516,11 @@ export interface DecodeUnsignedTxResult {
604
516
  export interface Destination {
605
517
  /** @format address */
606
518
  address: string
607
-
608
519
  /** @format uint256 */
609
520
  attoAlphAmount: string
610
521
  tokens?: Token[]
611
-
612
522
  /** @format int64 */
613
523
  lockTime?: number
614
-
615
524
  /** @format hex-string */
616
525
  message?: string
617
526
  }
@@ -633,20 +542,15 @@ export interface FieldsSig {
633
542
  export interface FixedAssetOutput {
634
543
  /** @format int32 */
635
544
  hint: number
636
-
637
545
  /** @format 32-byte-hash */
638
546
  key: string
639
-
640
547
  /** @format uint256 */
641
548
  attoAlphAmount: string
642
-
643
549
  /** @format address */
644
550
  address: string
645
551
  tokens: Token[]
646
-
647
552
  /** @format int64 */
648
553
  lockTime: number
649
-
650
554
  /** @format hex-string */
651
555
  message: string
652
556
  }
@@ -674,15 +578,16 @@ export interface HashesAtHeight {
674
578
  export interface InterCliquePeerInfo {
675
579
  /** @format clique-id */
676
580
  cliqueId: string
677
-
678
581
  /** @format int32 */
679
582
  brokerId: number
680
-
681
583
  /** @format int32 */
682
584
  groupNumPerBroker: number
683
-
684
585
  /** @format inet-socket-address */
685
- address: { addr: string; port: number }
586
+ address: {
587
+ addr: string
588
+ /** @format int32 */
589
+ port: number
590
+ }
686
591
  isSynced: boolean
687
592
  clientVersion: string
688
593
  }
@@ -695,6 +600,14 @@ export interface MemPooled {
695
600
  type: string
696
601
  }
697
602
 
603
+ export interface MempoolTransactions {
604
+ /** @format int32 */
605
+ fromGroup: number
606
+ /** @format int32 */
607
+ toGroup: number
608
+ transactions: TransactionTemplate[]
609
+ }
610
+
698
611
  export interface MinerAddresses {
699
612
  addresses: string[]
700
613
  }
@@ -708,9 +621,12 @@ export type MisbehaviorAction = Ban | Unban
708
621
  export interface NodeInfo {
709
622
  buildInfo: BuildInfo
710
623
  upnp: boolean
711
-
712
624
  /** @format inet-socket-address */
713
- externalAddress?: { addr: string; port: number }
625
+ externalAddress?: {
626
+ addr: string
627
+ /** @format int32 */
628
+ port: number
629
+ }
714
630
  }
715
631
 
716
632
  export interface NodeVersion {
@@ -727,7 +643,6 @@ export type Output = AssetOutput | ContractOutput
727
643
  export interface OutputRef {
728
644
  /** @format int32 */
729
645
  hint: number
730
-
731
646
  /** @format 32-byte-hash */
732
647
  key: string
733
648
  }
@@ -735,13 +650,10 @@ export interface OutputRef {
735
650
  export interface PeerAddress {
736
651
  /** @format inet-address */
737
652
  address: string
738
-
739
653
  /** @format int32 */
740
654
  restPort: number
741
-
742
655
  /** @format int32 */
743
656
  wsPort: number
744
-
745
657
  /** @format int32 */
746
658
  minerApiPort: number
747
659
  }
@@ -773,10 +685,8 @@ export interface Reachable {
773
685
  export interface ReleaseVersion {
774
686
  /** @format int32 */
775
687
  major: number
776
-
777
688
  /** @format int32 */
778
689
  minor: number
779
-
780
690
  /** @format int32 */
781
691
  patch: number
782
692
  }
@@ -822,7 +732,6 @@ export interface SubmitMultisig {
822
732
 
823
733
  export interface SubmitTransaction {
824
734
  unsignedTx: string
825
-
826
735
  /** @format signature */
827
736
  signature: string
828
737
  }
@@ -830,10 +739,8 @@ export interface SubmitTransaction {
830
739
  export interface SubmitTxResult {
831
740
  /** @format 32-byte-hash */
832
741
  txId: string
833
-
834
742
  /** @format int32 */
835
743
  fromGroup: number
836
-
837
744
  /** @format int32 */
838
745
  toGroup: number
839
746
  }
@@ -841,19 +748,14 @@ export interface SubmitTxResult {
841
748
  export interface Sweep {
842
749
  /** @format address */
843
750
  toAddress: string
844
-
845
751
  /** @format int64 */
846
752
  lockTime?: number
847
-
848
753
  /** @format gas */
849
754
  gasAmount?: number
850
-
851
755
  /** @format uint256 */
852
756
  gasPrice?: string
853
-
854
757
  /** @format int32 */
855
758
  utxosLimit?: number
856
-
857
759
  /** @format block-hash */
858
760
  targetBlockHash?: string
859
761
  }
@@ -862,10 +764,8 @@ export interface SweepAddressTransaction {
862
764
  /** @format 32-byte-hash */
863
765
  txId: string
864
766
  unsignedTx: string
865
-
866
767
  /** @format gas */
867
768
  gasAmount: number
868
-
869
769
  /** @format uint256 */
870
770
  gasPrice: string
871
771
  }
@@ -873,22 +773,17 @@ export interface SweepAddressTransaction {
873
773
  export interface TestContract {
874
774
  /** @format int32 */
875
775
  group?: number
876
-
877
776
  /** @format block-hash */
878
777
  blockHash?: string
879
-
880
778
  /** @format 32-byte-hash */
881
779
  txId?: string
882
-
883
780
  /** @format address */
884
781
  address?: string
885
-
886
782
  /** @format contract */
887
783
  bytecode: string
888
784
  initialImmFields?: Val[]
889
785
  initialMutFields?: Val[]
890
786
  initialAsset?: AssetState
891
-
892
787
  /** @format int32 */
893
788
  methodIndex?: number
894
789
  args?: Val[]
@@ -899,11 +794,9 @@ export interface TestContract {
899
794
  export interface TestContractResult {
900
795
  /** @format address */
901
796
  address: string
902
-
903
797
  /** @format 32-byte-hash */
904
798
  codeHash: string
905
799
  returns: Val[]
906
-
907
800
  /** @format int32 */
908
801
  gasUsed: number
909
802
  contracts: ContractState[]
@@ -922,7 +815,6 @@ export interface TestInputAsset {
922
815
  export interface Token {
923
816
  /** @format 32-byte-hash */
924
817
  id: string
925
-
926
818
  /** @format uint256 */
927
819
  amount: string
928
820
  }
@@ -944,13 +836,10 @@ export interface TransactionTemplate {
944
836
 
945
837
  export interface Transfer {
946
838
  destinations: Destination[]
947
-
948
839
  /** @format gas */
949
840
  gas?: number
950
-
951
841
  /** @format uint256 */
952
842
  gasPrice?: string
953
-
954
843
  /** @format int32 */
955
844
  utxosLimit?: number
956
845
  }
@@ -958,10 +847,8 @@ export interface Transfer {
958
847
  export interface TransferResult {
959
848
  /** @format 32-byte-hash */
960
849
  txId: string
961
-
962
850
  /** @format group-index */
963
851
  fromGroup: number
964
-
965
852
  /** @format group-index */
966
853
  toGroup: number
967
854
  }
@@ -978,14 +865,11 @@ export type TxStatus = Confirmed | MemPooled | TxNotFound
978
865
 
979
866
  export interface UTXO {
980
867
  ref: OutputRef
981
-
982
868
  /** @format uint256 */
983
869
  amount: string
984
870
  tokens?: Token[]
985
-
986
871
  /** @format int64 */
987
872
  lockTime?: number
988
-
989
873
  /** @format hex-string */
990
874
  additionalData?: string
991
875
  }
@@ -1004,15 +888,6 @@ export interface Unban {
1004
888
  type: string
1005
889
  }
1006
890
 
1007
- export interface UnconfirmedTransactions {
1008
- /** @format int32 */
1009
- fromGroup: number
1010
-
1011
- /** @format int32 */
1012
- toGroup: number
1013
- unconfirmedTransactions: TransactionTemplate[]
1014
- }
1015
-
1016
891
  export interface Unreachable {
1017
892
  peers: string[]
1018
893
  type: string
@@ -1023,13 +898,10 @@ export interface UnsignedTx {
1023
898
  txId: string
1024
899
  version: number
1025
900
  networkId: number
1026
-
1027
901
  /** @format script */
1028
902
  scriptOpt?: string
1029
-
1030
903
  /** @format int32 */
1031
904
  gasAmount: number
1032
-
1033
905
  /** @format uint256 */
1034
906
  gasPrice: string
1035
907
  inputs: AssetInput[]
@@ -1075,10 +947,8 @@ export interface ValU256 {
1075
947
  export interface VerifySignature {
1076
948
  /** @format hex-string */
1077
949
  data: string
1078
-
1079
950
  /** @format signature */
1080
951
  signature: string
1081
-
1082
952
  /** @format public-key */
1083
953
  publicKey: string
1084
954
  }
@@ -1166,7 +1036,8 @@ type CancelToken = Symbol | string | number
1166
1036
  export enum ContentType {
1167
1037
  Json = 'application/json',
1168
1038
  FormData = 'multipart/form-data',
1169
- UrlEncoded = 'application/x-www-form-urlencoded'
1039
+ UrlEncoded = 'application/x-www-form-urlencoded',
1040
+ Text = 'text/plain'
1170
1041
  }
1171
1042
 
1172
1043
  export class HttpClient<SecurityDataType = unknown> {
@@ -1191,16 +1062,16 @@ export class HttpClient<SecurityDataType = unknown> {
1191
1062
  this.securityData = data
1192
1063
  }
1193
1064
 
1194
- private encodeQueryParam(key: string, value: any) {
1065
+ protected encodeQueryParam(key: string, value: any) {
1195
1066
  const encodedKey = encodeURIComponent(key)
1196
1067
  return `${encodedKey}=${encodeURIComponent(typeof value === 'number' ? value : `${value}`)}`
1197
1068
  }
1198
1069
 
1199
- private addQueryParam(query: QueryParamsType, key: string) {
1070
+ protected addQueryParam(query: QueryParamsType, key: string) {
1200
1071
  return this.encodeQueryParam(key, query[key])
1201
1072
  }
1202
1073
 
1203
- private addArrayQueryParam(query: QueryParamsType, key: string) {
1074
+ protected addArrayQueryParam(query: QueryParamsType, key: string) {
1204
1075
  const value = query[key]
1205
1076
  return value.map((v: any) => this.encodeQueryParam(key, v)).join('&')
1206
1077
  }
@@ -1221,6 +1092,7 @@ export class HttpClient<SecurityDataType = unknown> {
1221
1092
  private contentFormatters: Record<ContentType, (input: any) => any> = {
1222
1093
  [ContentType.Json]: (input: any) =>
1223
1094
  input !== null && (typeof input === 'object' || typeof input === 'string') ? JSON.stringify(input) : input,
1095
+ [ContentType.Text]: (input: any) => (input !== null && typeof input !== 'string' ? JSON.stringify(input) : input),
1224
1096
  [ContentType.FormData]: (input: any) =>
1225
1097
  Object.keys(input || {}).reduce((formData, key) => {
1226
1098
  const property = input[key]
@@ -1237,7 +1109,7 @@ export class HttpClient<SecurityDataType = unknown> {
1237
1109
  [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input)
1238
1110
  }
1239
1111
 
1240
- private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
1112
+ protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
1241
1113
  return {
1242
1114
  ...this.baseApiParams,
1243
1115
  ...params1,
@@ -1250,7 +1122,7 @@ export class HttpClient<SecurityDataType = unknown> {
1250
1122
  }
1251
1123
  }
1252
1124
 
1253
- private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
1125
+ protected createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
1254
1126
  if (this.abortControllers.has(cancelToken)) {
1255
1127
  const abortController = this.abortControllers.get(cancelToken)
1256
1128
  if (abortController) {
@@ -1297,10 +1169,10 @@ export class HttpClient<SecurityDataType = unknown> {
1297
1169
  return this.customFetch(`${baseUrl || this.baseUrl || ''}${path}${queryString ? `?${queryString}` : ''}`, {
1298
1170
  ...requestParams,
1299
1171
  headers: {
1300
- ...(type && type !== ContentType.FormData ? { 'Content-Type': type } : {}),
1301
- ...(requestParams.headers || {})
1172
+ ...(requestParams.headers || {}),
1173
+ ...(type && type !== ContentType.FormData ? { 'Content-Type': type } : {})
1302
1174
  },
1303
- signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
1175
+ signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal,
1304
1176
  body: typeof body === 'undefined' || body === null ? null : payloadFormatter(body)
1305
1177
  }).then(async (response) => {
1306
1178
  const r = response as HttpResponse<T, E>
@@ -1334,7 +1206,7 @@ export class HttpClient<SecurityDataType = unknown> {
1334
1206
 
1335
1207
  /**
1336
1208
  * @title Alephium API
1337
- * @version 1.7.0
1209
+ * @version 1.7.1
1338
1210
  * @baseUrl ../
1339
1211
  */
1340
1212
  export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
@@ -1632,7 +1504,10 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1632
1504
  */
1633
1505
  postWalletsWalletNameDeriveNextAddress: (
1634
1506
  walletName: string,
1635
- query?: { group?: number },
1507
+ query?: {
1508
+ /** @format int32 */
1509
+ group?: number
1510
+ },
1636
1511
  params: RequestParams = {}
1637
1512
  ) =>
1638
1513
  this.request<AddressInfo, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
@@ -1854,7 +1729,21 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1854
1729
  * @summary Get history average hashrate on the given time interval
1855
1730
  * @request GET:/infos/history-hashrate
1856
1731
  */
1857
- getInfosHistoryHashrate: (query: { fromTs: number; toTs?: number }, params: RequestParams = {}) =>
1732
+ getInfosHistoryHashrate: (
1733
+ query: {
1734
+ /**
1735
+ * @format int64
1736
+ * @min 0
1737
+ */
1738
+ fromTs: number
1739
+ /**
1740
+ * @format int64
1741
+ * @min 0
1742
+ */
1743
+ toTs?: number
1744
+ },
1745
+ params: RequestParams = {}
1746
+ ) =>
1858
1747
  this.request<string, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1859
1748
  path: `/infos/history-hashrate`,
1860
1749
  method: 'GET',
@@ -1871,7 +1760,16 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1871
1760
  * @summary Get average hashrate from `now - timespan(millis)` to `now`
1872
1761
  * @request GET:/infos/current-hashrate
1873
1762
  */
1874
- getInfosCurrentHashrate: (query?: { timespan?: number }, params: RequestParams = {}) =>
1763
+ getInfosCurrentHashrate: (
1764
+ query?: {
1765
+ /**
1766
+ * @format int64
1767
+ * @min 1
1768
+ */
1769
+ timespan?: number
1770
+ },
1771
+ params: RequestParams = {}
1772
+ ) =>
1875
1773
  this.request<string, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1876
1774
  path: `/infos/current-hashrate`,
1877
1775
  method: 'GET',
@@ -1889,7 +1787,21 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1889
1787
  * @summary List blocks on the given time interval
1890
1788
  * @request GET:/blockflow/blocks
1891
1789
  */
1892
- getBlockflowBlocks: (query: { fromTs: number; toTs?: number }, params: RequestParams = {}) =>
1790
+ getBlockflowBlocks: (
1791
+ query: {
1792
+ /**
1793
+ * @format int64
1794
+ * @min 0
1795
+ */
1796
+ fromTs: number
1797
+ /**
1798
+ * @format int64
1799
+ * @min 0
1800
+ */
1801
+ toTs?: number
1802
+ },
1803
+ params: RequestParams = {}
1804
+ ) =>
1893
1805
  this.request<
1894
1806
  BlocksPerTimeStampRange,
1895
1807
  BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
@@ -1909,7 +1821,21 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1909
1821
  * @summary List blocks with events on the given time interval
1910
1822
  * @request GET:/blockflow/blocks-with-events
1911
1823
  */
1912
- getBlockflowBlocksWithEvents: (query: { fromTs: number; toTs?: number }, params: RequestParams = {}) =>
1824
+ getBlockflowBlocksWithEvents: (
1825
+ query: {
1826
+ /**
1827
+ * @format int64
1828
+ * @min 0
1829
+ */
1830
+ fromTs: number
1831
+ /**
1832
+ * @format int64
1833
+ * @min 0
1834
+ */
1835
+ toTs?: number
1836
+ },
1837
+ params: RequestParams = {}
1838
+ ) =>
1913
1839
  this.request<
1914
1840
  BlocksAndEventsPerTimeStampRange,
1915
1841
  BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
@@ -1961,7 +1887,12 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1961
1887
  * @summary Check if the block is in main chain
1962
1888
  * @request GET:/blockflow/is-block-in-main-chain
1963
1889
  */
1964
- getBlockflowIsBlockInMainChain: (query: { blockHash: string }, params: RequestParams = {}) =>
1890
+ getBlockflowIsBlockInMainChain: (
1891
+ query: {
1892
+ blockHash: string
1893
+ },
1894
+ params: RequestParams = {}
1895
+ ) =>
1965
1896
  this.request<boolean, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1966
1897
  path: `/blockflow/is-block-in-main-chain`,
1967
1898
  method: 'GET',
@@ -1978,7 +1909,17 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1978
1909
  * @summary Get all block's hashes at given height for given groups
1979
1910
  * @request GET:/blockflow/hashes
1980
1911
  */
1981
- getBlockflowHashes: (query: { fromGroup: number; toGroup: number; height: number }, params: RequestParams = {}) =>
1912
+ getBlockflowHashes: (
1913
+ query: {
1914
+ /** @format int32 */
1915
+ fromGroup: number
1916
+ /** @format int32 */
1917
+ toGroup: number
1918
+ /** @format int32 */
1919
+ height: number
1920
+ },
1921
+ params: RequestParams = {}
1922
+ ) =>
1982
1923
  this.request<HashesAtHeight, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1983
1924
  path: `/blockflow/hashes`,
1984
1925
  method: 'GET',
@@ -1995,7 +1936,15 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
1995
1936
  * @summary Get infos about the chain from the given groups
1996
1937
  * @request GET:/blockflow/chain-info
1997
1938
  */
1998
- getBlockflowChainInfo: (query: { fromGroup: number; toGroup: number }, params: RequestParams = {}) =>
1939
+ getBlockflowChainInfo: (
1940
+ query: {
1941
+ /** @format int32 */
1942
+ fromGroup: number
1943
+ /** @format int32 */
1944
+ toGroup: number
1945
+ },
1946
+ params: RequestParams = {}
1947
+ ) =>
1999
1948
  this.request<ChainInfo, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2000
1949
  path: `/blockflow/chain-info`,
2001
1950
  method: 'GET',
@@ -2070,25 +2019,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2070
2019
  }).then(convertHttpResponse)
2071
2020
  }
2072
2021
  transactions = {
2073
- /**
2074
- * No description
2075
- *
2076
- * @tags Transactions
2077
- * @name GetTransactionsUnconfirmed
2078
- * @summary List unconfirmed transactions
2079
- * @request GET:/transactions/unconfirmed
2080
- */
2081
- getTransactionsUnconfirmed: (params: RequestParams = {}) =>
2082
- this.request<
2083
- UnconfirmedTransactions[],
2084
- BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
2085
- >({
2086
- path: `/transactions/unconfirmed`,
2087
- method: 'GET',
2088
- format: 'json',
2089
- ...params
2090
- }).then(convertHttpResponse),
2091
-
2092
2022
  /**
2093
2023
  * No description
2094
2024
  *
@@ -2180,7 +2110,12 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2180
2110
  */
2181
2111
  getTransactionsDetailsTxid: (
2182
2112
  txId: string,
2183
- query?: { fromGroup?: number; toGroup?: number },
2113
+ query?: {
2114
+ /** @format int32 */
2115
+ fromGroup?: number
2116
+ /** @format int32 */
2117
+ toGroup?: number
2118
+ },
2184
2119
  params: RequestParams = {}
2185
2120
  ) =>
2186
2121
  this.request<Transaction, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
@@ -2200,7 +2135,13 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2200
2135
  * @request GET:/transactions/status
2201
2136
  */
2202
2137
  getTransactionsStatus: (
2203
- query: { txId: string; fromGroup?: number; toGroup?: number },
2138
+ query: {
2139
+ txId: string
2140
+ /** @format int32 */
2141
+ fromGroup?: number
2142
+ /** @format int32 */
2143
+ toGroup?: number
2144
+ },
2204
2145
  params: RequestParams = {}
2205
2146
  ) =>
2206
2147
  this.request<TxStatus, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
@@ -2211,6 +2152,77 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2211
2152
  ...params
2212
2153
  }).then(convertHttpResponse)
2213
2154
  }
2155
+ mempool = {
2156
+ /**
2157
+ * No description
2158
+ *
2159
+ * @tags Mempool
2160
+ * @name GetMempoolTransactions
2161
+ * @summary List mempool transactions
2162
+ * @request GET:/mempool/transactions
2163
+ */
2164
+ getMempoolTransactions: (params: RequestParams = {}) =>
2165
+ this.request<
2166
+ MempoolTransactions[],
2167
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
2168
+ >({
2169
+ path: `/mempool/transactions`,
2170
+ method: 'GET',
2171
+ format: 'json',
2172
+ ...params
2173
+ }).then(convertHttpResponse),
2174
+
2175
+ /**
2176
+ * No description
2177
+ *
2178
+ * @tags Mempool
2179
+ * @name DeleteMempoolTransactions
2180
+ * @summary Remove all transactions from mempool
2181
+ * @request DELETE:/mempool/transactions
2182
+ */
2183
+ deleteMempoolTransactions: (params: RequestParams = {}) =>
2184
+ this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2185
+ path: `/mempool/transactions`,
2186
+ method: 'DELETE',
2187
+ ...params
2188
+ }).then(convertHttpResponse),
2189
+
2190
+ /**
2191
+ * No description
2192
+ *
2193
+ * @tags Mempool
2194
+ * @name PutMempoolTransactionsRebroadcast
2195
+ * @summary Rebroadcase a mempool transaction to the network
2196
+ * @request PUT:/mempool/transactions/rebroadcast
2197
+ */
2198
+ putMempoolTransactionsRebroadcast: (
2199
+ query: {
2200
+ txId: string
2201
+ },
2202
+ params: RequestParams = {}
2203
+ ) =>
2204
+ this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2205
+ path: `/mempool/transactions/rebroadcast`,
2206
+ method: 'PUT',
2207
+ query: query,
2208
+ ...params
2209
+ }).then(convertHttpResponse),
2210
+
2211
+ /**
2212
+ * No description
2213
+ *
2214
+ * @tags Mempool
2215
+ * @name PutMempoolTransactionsValidate
2216
+ * @summary Validate all mempool transactions and remove invalid ones
2217
+ * @request PUT:/mempool/transactions/validate
2218
+ */
2219
+ putMempoolTransactionsValidate: (params: RequestParams = {}) =>
2220
+ this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2221
+ path: `/mempool/transactions/validate`,
2222
+ method: 'PUT',
2223
+ ...params
2224
+ }).then(convertHttpResponse)
2225
+ }
2214
2226
  contracts = {
2215
2227
  /**
2216
2228
  * No description
@@ -2325,7 +2337,14 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2325
2337
  * @summary Get contract state
2326
2338
  * @request GET:/contracts/{address}/state
2327
2339
  */
2328
- getContractsAddressState: (address: string, query: { group: number }, params: RequestParams = {}) =>
2340
+ getContractsAddressState: (
2341
+ address: string,
2342
+ query: {
2343
+ /** @format int32 */
2344
+ group: number
2345
+ },
2346
+ params: RequestParams = {}
2347
+ ) =>
2329
2348
  this.request<ContractState, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2330
2349
  path: `/contracts/${address}/state`,
2331
2350
  method: 'GET',
@@ -2478,7 +2497,12 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2478
2497
  * @summary Execute an action on CPU miner. !!! for test only !!!
2479
2498
  * @request POST:/miners/cpu-mining
2480
2499
  */
2481
- postMinersCpuMining: (query: { action: string }, params: RequestParams = {}) =>
2500
+ postMinersCpuMining: (
2501
+ query: {
2502
+ action: string
2503
+ },
2504
+ params: RequestParams = {}
2505
+ ) =>
2482
2506
  this.request<boolean, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2483
2507
  path: `/miners/cpu-mining`,
2484
2508
  method: 'POST',
@@ -2495,7 +2519,15 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2495
2519
  * @summary Mine a block on CPU miner. !!! for test only !!!
2496
2520
  * @request POST:/miners/cpu-mining/mine-one-block
2497
2521
  */
2498
- postMinersCpuMiningMineOneBlock: (query: { fromGroup: number; toGroup: number }, params: RequestParams = {}) =>
2522
+ postMinersCpuMiningMineOneBlock: (
2523
+ query: {
2524
+ /** @format int32 */
2525
+ fromGroup: number
2526
+ /** @format int32 */
2527
+ toGroup: number
2528
+ },
2529
+ params: RequestParams = {}
2530
+ ) =>
2499
2531
  this.request<boolean, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2500
2532
  path: `/miners/cpu-mining/mine-one-block`,
2501
2533
  method: 'POST',
@@ -2548,7 +2580,14 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2548
2580
  */
2549
2581
  getEventsContractContractaddress: (
2550
2582
  contractAddress: string,
2551
- query: { start: number; limit?: number; group?: number },
2583
+ query: {
2584
+ /** @format int32 */
2585
+ start: number
2586
+ /** @format int32 */
2587
+ limit?: number
2588
+ /** @format int32 */
2589
+ group?: number
2590
+ },
2552
2591
  params: RequestParams = {}
2553
2592
  ) =>
2554
2593
  this.request<ContractEvents, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
@@ -2583,7 +2622,14 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2583
2622
  * @summary Get contract events for a transaction
2584
2623
  * @request GET:/events/tx-id/{txId}
2585
2624
  */
2586
- getEventsTxIdTxid: (txId: string, query?: { group?: number }, params: RequestParams = {}) =>
2625
+ getEventsTxIdTxid: (
2626
+ txId: string,
2627
+ query?: {
2628
+ /** @format int32 */
2629
+ group?: number
2630
+ },
2631
+ params: RequestParams = {}
2632
+ ) =>
2587
2633
  this.request<
2588
2634
  ContractEventsByTxId,
2589
2635
  BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
@@ -2603,7 +2649,14 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
2603
2649
  * @summary Get contract events for a block
2604
2650
  * @request GET:/events/block-hash/{blockHash}
2605
2651
  */
2606
- getEventsBlockHashBlockhash: (blockHash: string, query?: { group?: number }, params: RequestParams = {}) =>
2652
+ getEventsBlockHashBlockhash: (
2653
+ blockHash: string,
2654
+ query?: {
2655
+ /** @format int32 */
2656
+ group?: number
2657
+ },
2658
+ params: RequestParams = {}
2659
+ ) =>
2607
2660
  this.request<
2608
2661
  ContractEventsByBlockHash,
2609
2662
  BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable