@alephium/web3 0.0.1-test.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/.editorconfig +13 -0
  2. package/.eslintignore +2 -0
  3. package/.eslintrc.json +21 -0
  4. package/.gitattributes +1 -0
  5. package/LICENSE +165 -0
  6. package/README.md +136 -0
  7. package/contracts/add.ral +16 -0
  8. package/contracts/greeter.ral +7 -0
  9. package/contracts/greeter_interface.ral +3 -0
  10. package/contracts/greeter_main.ral +9 -0
  11. package/contracts/main.ral +6 -0
  12. package/contracts/sub.ral +9 -0
  13. package/dev/user.conf +29 -0
  14. package/dist/alephium-web3.min.js +3 -0
  15. package/dist/alephium-web3.min.js.LICENSE.txt +27 -0
  16. package/dist/alephium-web3.min.js.map +1 -0
  17. package/dist/scripts/check-versions.d.ts +1 -0
  18. package/dist/scripts/check-versions.js +39 -0
  19. package/dist/scripts/create-project.d.ts +2 -0
  20. package/dist/scripts/create-project.js +124 -0
  21. package/dist/scripts/header.d.ts +0 -0
  22. package/dist/scripts/header.js +18 -0
  23. package/dist/scripts/rename-gitignore.d.ts +1 -0
  24. package/dist/scripts/rename-gitignore.js +24 -0
  25. package/dist/scripts/start-devnet.d.ts +1 -0
  26. package/dist/scripts/start-devnet.js +131 -0
  27. package/dist/scripts/stop-devnet.d.ts +1 -0
  28. package/dist/scripts/stop-devnet.js +32 -0
  29. package/dist/src/api/api-alephium.d.ts +1473 -0
  30. package/dist/src/api/api-alephium.js +1143 -0
  31. package/dist/src/api/api-explorer.d.ts +475 -0
  32. package/dist/src/api/api-explorer.js +457 -0
  33. package/dist/src/api/index.d.ts +10 -0
  34. package/dist/src/api/index.js +55 -0
  35. package/dist/src/constants.d.ts +2 -0
  36. package/dist/src/constants.js +22 -0
  37. package/dist/src/contract/contract.d.ts +182 -0
  38. package/dist/src/contract/contract.js +760 -0
  39. package/dist/src/contract/events.d.ts +11 -0
  40. package/dist/src/contract/events.js +64 -0
  41. package/dist/src/contract/index.d.ts +3 -0
  42. package/dist/src/contract/index.js +32 -0
  43. package/dist/src/contract/ralph.d.ts +12 -0
  44. package/dist/src/contract/ralph.js +362 -0
  45. package/dist/src/index.d.ts +6 -0
  46. package/dist/src/index.js +35 -0
  47. package/dist/src/signer/index.d.ts +2 -0
  48. package/dist/src/signer/index.js +31 -0
  49. package/dist/src/signer/node-wallet.d.ts +13 -0
  50. package/dist/src/signer/node-wallet.js +60 -0
  51. package/dist/src/signer/signer.d.ts +143 -0
  52. package/dist/src/signer/signer.js +184 -0
  53. package/dist/src/test/index.d.ts +7 -0
  54. package/dist/src/test/index.js +41 -0
  55. package/dist/src/test/privatekey-wallet.d.ts +12 -0
  56. package/dist/src/test/privatekey-wallet.js +68 -0
  57. package/dist/src/transaction/index.d.ts +2 -0
  58. package/dist/src/transaction/index.js +31 -0
  59. package/dist/src/transaction/sign-verify.d.ts +2 -0
  60. package/dist/src/transaction/sign-verify.js +58 -0
  61. package/dist/src/transaction/status.d.ts +10 -0
  62. package/dist/src/transaction/status.js +48 -0
  63. package/dist/src/utils/address.d.ts +1 -0
  64. package/dist/src/utils/address.js +42 -0
  65. package/dist/src/utils/bs58.d.ts +4 -0
  66. package/dist/src/utils/bs58.js +28 -0
  67. package/dist/src/utils/djb2.d.ts +1 -0
  68. package/dist/src/utils/djb2.js +27 -0
  69. package/dist/src/utils/index.d.ts +6 -0
  70. package/dist/src/utils/index.js +35 -0
  71. package/dist/src/utils/password-crypto.d.ts +2 -0
  72. package/dist/src/utils/password-crypto.js +69 -0
  73. package/dist/src/utils/subscription.d.ts +24 -0
  74. package/dist/src/utils/subscription.js +52 -0
  75. package/dist/src/utils/utils.d.ts +30 -0
  76. package/dist/src/utils/utils.js +199 -0
  77. package/gitignore +10 -0
  78. package/package.json +127 -0
  79. package/scripts/check-versions.js +45 -0
  80. package/scripts/create-project.ts +136 -0
  81. package/scripts/header.js +17 -0
  82. package/scripts/rename-gitignore.js +24 -0
  83. package/scripts/start-devnet.js +141 -0
  84. package/scripts/stop-devnet.js +32 -0
  85. package/src/api/api-alephium.ts +2430 -0
  86. package/src/api/api-explorer.ts +852 -0
  87. package/src/api/index.ts +35 -0
  88. package/src/constants.ts +20 -0
  89. package/src/contract/contract.ts +1014 -0
  90. package/src/contract/events.ts +75 -0
  91. package/src/contract/index.ts +21 -0
  92. package/src/contract/ralph.test.ts +178 -0
  93. package/src/contract/ralph.ts +362 -0
  94. package/src/fixtures/address.json +36 -0
  95. package/src/fixtures/balance.json +9 -0
  96. package/src/fixtures/self-clique.json +19 -0
  97. package/src/fixtures/transaction.json +13 -0
  98. package/src/fixtures/transactions.json +179 -0
  99. package/src/index.ts +25 -0
  100. package/src/signer/fixtures/genesis.json +26 -0
  101. package/src/signer/fixtures/wallets.json +26 -0
  102. package/src/signer/index.ts +20 -0
  103. package/src/signer/node-wallet.ts +74 -0
  104. package/src/signer/signer.ts +313 -0
  105. package/src/test/index.ts +32 -0
  106. package/src/test/privatekey-wallet.ts +58 -0
  107. package/src/transaction/index.ts +20 -0
  108. package/src/transaction/sign-verify.test.ts +50 -0
  109. package/src/transaction/sign-verify.ts +39 -0
  110. package/src/transaction/status.ts +58 -0
  111. package/src/utils/address.test.ts +47 -0
  112. package/src/utils/address.ts +39 -0
  113. package/src/utils/bs58.ts +26 -0
  114. package/src/utils/djb2.test.ts +35 -0
  115. package/src/utils/djb2.ts +25 -0
  116. package/src/utils/index.ts +24 -0
  117. package/src/utils/password-crypto.test.ts +27 -0
  118. package/src/utils/password-crypto.ts +77 -0
  119. package/src/utils/subscription.ts +72 -0
  120. package/src/utils/utils.test.ts +160 -0
  121. package/src/utils/utils.ts +209 -0
  122. package/templates/base/README.md +34 -0
  123. package/templates/base/package.json +35 -0
  124. package/templates/base/src/greeter.ts +41 -0
  125. package/templates/base/tsconfig.json +19 -0
  126. package/templates/react/README.md +34 -0
  127. package/templates/react/config-overrides.js +18 -0
  128. package/templates/react/package.json +66 -0
  129. package/templates/react/src/App.tsx +42 -0
  130. package/templates/react/src/artifacts/greeter.ral.json +26 -0
  131. package/templates/react/src/artifacts/greeter_main.ral.json +22 -0
  132. package/templates/shared/.eslintrc.json +12 -0
  133. package/templates/shared/scripts/header.js +0 -0
  134. package/test/contract.test.ts +161 -0
  135. package/test/events.test.ts +138 -0
  136. package/test/transaction.test.ts +72 -0
  137. package/webpack.config.js +57 -0
@@ -0,0 +1,2430 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+ /*
4
+ * ---------------------------------------------------------------
5
+ * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
6
+ * ## ##
7
+ * ## AUTHOR: acacode ##
8
+ * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
9
+ * ---------------------------------------------------------------
10
+ */
11
+
12
+ export interface AddressBalance {
13
+ /** @format address */
14
+ address: string
15
+
16
+ /** @format uint256 */
17
+ balance: string
18
+
19
+ /** @format x.x ALPH */
20
+ balanceHint: string
21
+
22
+ /** @format uint256 */
23
+ lockedBalance: string
24
+
25
+ /** @format x.x ALPH */
26
+ lockedBalanceHint: string
27
+ warning?: string
28
+ }
29
+
30
+ export interface AddressInfo {
31
+ /** @format address */
32
+ address: string
33
+
34
+ /** @format public-key */
35
+ publicKey: string
36
+
37
+ /** @format group-index */
38
+ group: number
39
+ path: string
40
+ }
41
+
42
+ export interface Addresses {
43
+ /** @format address */
44
+ activeAddress: string
45
+ addresses: AddressInfo[]
46
+ }
47
+
48
+ export interface AssetInput {
49
+ outputRef: OutputRef
50
+
51
+ /** @format hex-string */
52
+ unlockScript: string
53
+ }
54
+
55
+ export interface AssetOutput {
56
+ /** @format int32 */
57
+ hint: number
58
+
59
+ /** @format 32-byte-hash */
60
+ key: string
61
+
62
+ /** @format uint256 */
63
+ attoAlphAmount: string
64
+
65
+ /** @format address */
66
+ address: string
67
+ tokens: Token[]
68
+
69
+ /** @format int64 */
70
+ lockTime: number
71
+
72
+ /** @format hex-string */
73
+ message: string
74
+ type: string
75
+ }
76
+
77
+ export interface AssetState {
78
+ /** @format uint256 */
79
+ attoAlphAmount: string
80
+ tokens?: Token[]
81
+ }
82
+
83
+ export interface BadRequest {
84
+ detail: string
85
+ }
86
+
87
+ export interface Balance {
88
+ /** @format uint256 */
89
+ balance: string
90
+
91
+ /** @format x.x ALPH */
92
+ balanceHint: string
93
+
94
+ /** @format uint256 */
95
+ lockedBalance: string
96
+
97
+ /** @format x.x ALPH */
98
+ lockedBalanceHint: string
99
+ tokenBalances?: Token[]
100
+ lockedTokenBalances?: Token[]
101
+
102
+ /** @format int32 */
103
+ utxoNum: number
104
+ warning?: string
105
+ }
106
+
107
+ export interface Balances {
108
+ /** @format uint256 */
109
+ totalBalance: string
110
+
111
+ /** @format x.x ALPH */
112
+ totalBalanceHint: string
113
+ balances: AddressBalance[]
114
+ }
115
+
116
+ export interface Ban {
117
+ peers: string[]
118
+ type: string
119
+ }
120
+
121
+ export interface Banned {
122
+ /** @format int64 */
123
+ until: number
124
+ type: string
125
+ }
126
+
127
+ export interface BlockEntry {
128
+ /** @format block-hash */
129
+ hash: string
130
+
131
+ /** @format int64 */
132
+ timestamp: number
133
+
134
+ /** @format int32 */
135
+ chainFrom: number
136
+
137
+ /** @format int32 */
138
+ chainTo: number
139
+
140
+ /** @format int32 */
141
+ height: number
142
+ deps: string[]
143
+ transactions: Transaction[]
144
+
145
+ /** @format hex-string */
146
+ nonce: string
147
+ version: number
148
+
149
+ /** @format 32-byte-hash */
150
+ depStateHash: string
151
+
152
+ /** @format 32-byte-hash */
153
+ txsHash: string
154
+
155
+ /** @format hex-string */
156
+ target: string
157
+ }
158
+
159
+ export interface BlockHeaderEntry {
160
+ /** @format block-hash */
161
+ hash: string
162
+
163
+ /** @format int64 */
164
+ timestamp: number
165
+
166
+ /** @format int32 */
167
+ chainFrom: number
168
+
169
+ /** @format int32 */
170
+ chainTo: number
171
+
172
+ /** @format int32 */
173
+ height: number
174
+ deps: string[]
175
+ }
176
+
177
+ export interface BrokerInfo {
178
+ /** @format clique-id */
179
+ cliqueId: string
180
+
181
+ /** @format int32 */
182
+ brokerId: number
183
+
184
+ /** @format int32 */
185
+ brokerNum: number
186
+
187
+ /** @format inet-socket-address */
188
+ address: string
189
+ }
190
+
191
+ export interface BuildDeployContractTx {
192
+ /** @format public-key */
193
+ fromPublicKey: string
194
+
195
+ /** @format hex-string */
196
+ bytecode: string
197
+
198
+ /** @format uint256 */
199
+ initialAttoAlphAmount?: string
200
+ initialTokenAmounts?: Token[]
201
+
202
+ /** @format uint256 */
203
+ issueTokenAmount?: string
204
+
205
+ /** @format gas */
206
+ gasAmount?: number
207
+
208
+ /** @format uint256 */
209
+ gasPrice?: string
210
+ }
211
+
212
+ export interface BuildDeployContractTxResult {
213
+ /** @format int32 */
214
+ fromGroup: number
215
+
216
+ /** @format int32 */
217
+ toGroup: number
218
+ unsignedTx: string
219
+
220
+ /** @format gas */
221
+ gasAmount: number
222
+
223
+ /** @format uint256 */
224
+ gasPrice: string
225
+
226
+ /** @format 32-byte-hash */
227
+ txId: string
228
+
229
+ /** @format address */
230
+ contractAddress: string
231
+ }
232
+
233
+ export interface BuildExecuteScriptTx {
234
+ /** @format public-key */
235
+ fromPublicKey: string
236
+
237
+ /** @format hex-string */
238
+ bytecode: string
239
+
240
+ /** @format uint256 */
241
+ attoAlphAmount?: string
242
+ tokens?: Token[]
243
+
244
+ /** @format gas */
245
+ gasAmount?: number
246
+
247
+ /** @format uint256 */
248
+ gasPrice?: string
249
+ }
250
+
251
+ export interface BuildExecuteScriptTxResult {
252
+ /** @format int32 */
253
+ fromGroup: number
254
+
255
+ /** @format int32 */
256
+ toGroup: number
257
+ unsignedTx: string
258
+
259
+ /** @format gas */
260
+ gasAmount: number
261
+
262
+ /** @format uint256 */
263
+ gasPrice: string
264
+
265
+ /** @format 32-byte-hash */
266
+ txId: string
267
+ }
268
+
269
+ export interface BuildInfo {
270
+ releaseVersion: string
271
+ commit: string
272
+ }
273
+
274
+ export interface BuildMultisig {
275
+ /** @format address */
276
+ fromAddress: string
277
+ fromPublicKeys: string[]
278
+ destinations: Destination[]
279
+
280
+ /** @format gas */
281
+ gas?: number
282
+
283
+ /** @format uint256 */
284
+ gasPrice?: string
285
+ }
286
+
287
+ export interface BuildMultisigAddress {
288
+ keys: string[]
289
+
290
+ /** @format int32 */
291
+ mrequired: number
292
+ }
293
+
294
+ export interface BuildMultisigAddressResult {
295
+ /** @format address */
296
+ address: string
297
+ }
298
+
299
+ export interface BuildSweepAddressTransactions {
300
+ /** @format public-key */
301
+ fromPublicKey: string
302
+
303
+ /** @format address */
304
+ toAddress: string
305
+
306
+ /** @format int64 */
307
+ lockTime?: number
308
+
309
+ /** @format gas */
310
+ gasAmount?: number
311
+
312
+ /** @format uint256 */
313
+ gasPrice?: string
314
+ }
315
+
316
+ export interface BuildSweepAddressTransactionsResult {
317
+ unsignedTxs: SweepAddressTransaction[]
318
+
319
+ /** @format int32 */
320
+ fromGroup: number
321
+
322
+ /** @format int32 */
323
+ toGroup: number
324
+ }
325
+
326
+ export interface BuildTransaction {
327
+ /** @format public-key */
328
+ fromPublicKey: string
329
+ destinations: Destination[]
330
+ utxos?: OutputRef[]
331
+
332
+ /** @format gas */
333
+ gasAmount?: number
334
+
335
+ /** @format uint256 */
336
+ gasPrice?: string
337
+ }
338
+
339
+ export interface BuildTransactionResult {
340
+ unsignedTx: string
341
+
342
+ /** @format gas */
343
+ gasAmount: number
344
+
345
+ /** @format uint256 */
346
+ gasPrice: string
347
+
348
+ /** @format 32-byte-hash */
349
+ txId: string
350
+
351
+ /** @format int32 */
352
+ fromGroup: number
353
+
354
+ /** @format int32 */
355
+ toGroup: number
356
+ }
357
+
358
+ export interface CallContract {
359
+ /** @format int32 */
360
+ group: number
361
+
362
+ /** @format block-hash */
363
+ worldStateBlockHash?: string
364
+
365
+ /** @format 32-byte-hash */
366
+ txId?: string
367
+
368
+ /** @format address */
369
+ address: string
370
+
371
+ /** @format int32 */
372
+ methodIndex: number
373
+ args?: Val[]
374
+ existingContracts?: string[]
375
+ inputAssets?: TestInputAsset[]
376
+ }
377
+
378
+ export interface CallContractResult {
379
+ returns: Val[]
380
+
381
+ /** @format int32 */
382
+ gasUsed: number
383
+ contracts: ContractState[]
384
+ txInputs: string[]
385
+ txOutputs: Output[]
386
+ events: ContractEventByTxId[]
387
+ }
388
+
389
+ export interface ChainInfo {
390
+ /** @format int32 */
391
+ currentHeight: number
392
+ }
393
+
394
+ export interface ChainParams {
395
+ networkId: number
396
+
397
+ /** @format int32 */
398
+ numZerosAtLeastInHash: number
399
+
400
+ /** @format int32 */
401
+ groupNumPerBroker: number
402
+
403
+ /** @format int32 */
404
+ groups: number
405
+ }
406
+
407
+ export interface ChangeActiveAddress {
408
+ /** @format address */
409
+ address: string
410
+ }
411
+
412
+ export interface CompileContractResult {
413
+ bytecode: string
414
+
415
+ /** @format 32-byte-hash */
416
+ codeHash: string
417
+ fields: FieldsSig
418
+ functions: FunctionSig[]
419
+ events: EventSig[]
420
+ }
421
+
422
+ export interface CompileScriptResult {
423
+ bytecodeTemplate: string
424
+ fields: FieldsSig
425
+ functions: FunctionSig[]
426
+ }
427
+
428
+ export interface Confirmed {
429
+ /** @format block-hash */
430
+ blockHash: string
431
+
432
+ /** @format int32 */
433
+ txIndex: number
434
+
435
+ /** @format int32 */
436
+ chainConfirmations: number
437
+
438
+ /** @format int32 */
439
+ fromGroupConfirmations: number
440
+
441
+ /** @format int32 */
442
+ toGroupConfirmations: number
443
+ type: string
444
+ }
445
+
446
+ export interface Contract {
447
+ code: string
448
+ }
449
+
450
+ export interface ContractEvent {
451
+ /** @format block-hash */
452
+ blockHash: string
453
+
454
+ /** @format 32-byte-hash */
455
+ txId: string
456
+
457
+ /** @format int32 */
458
+ eventIndex: number
459
+ fields: Val[]
460
+ }
461
+
462
+ export interface ContractEventByTxId {
463
+ /** @format block-hash */
464
+ blockHash: string
465
+
466
+ /** @format address */
467
+ contractAddress: string
468
+
469
+ /** @format int32 */
470
+ eventIndex: number
471
+ fields: Val[]
472
+ }
473
+
474
+ export interface ContractEvents {
475
+ events: ContractEvent[]
476
+
477
+ /** @format int32 */
478
+ nextStart: number
479
+ }
480
+
481
+ export interface ContractEventsByTxId {
482
+ events: ContractEventByTxId[]
483
+
484
+ /** @format int32 */
485
+ nextStart: number
486
+ }
487
+
488
+ export interface ContractOutput {
489
+ /** @format int32 */
490
+ hint: number
491
+
492
+ /** @format 32-byte-hash */
493
+ key: string
494
+
495
+ /** @format uint256 */
496
+ attoAlphAmount: string
497
+
498
+ /** @format address */
499
+ address: string
500
+ tokens: Token[]
501
+ type: string
502
+ }
503
+
504
+ export interface ContractState {
505
+ /** @format address */
506
+ address: string
507
+
508
+ /** @format contract */
509
+ bytecode: string
510
+
511
+ /** @format 32-byte-hash */
512
+ codeHash: string
513
+
514
+ /** @format 32-byte-hash */
515
+ initialStateHash?: string
516
+ fields: Val[]
517
+ asset: AssetState
518
+ }
519
+
520
+ export interface DecodeUnsignedTx {
521
+ unsignedTx: string
522
+ }
523
+
524
+ export interface DecodeUnsignedTxResult {
525
+ /** @format int32 */
526
+ fromGroup: number
527
+
528
+ /** @format int32 */
529
+ toGroup: number
530
+ unsignedTx: UnsignedTx
531
+ }
532
+
533
+ export interface Destination {
534
+ /** @format address */
535
+ address: string
536
+
537
+ /** @format uint256 */
538
+ attoAlphAmount: string
539
+ tokens?: Token[]
540
+
541
+ /** @format int64 */
542
+ lockTime?: number
543
+
544
+ /** @format hex-string */
545
+ message?: string
546
+ }
547
+
548
+ export type DiscoveryAction = Reachable | Unreachable
549
+
550
+ export interface EventSig {
551
+ name: string
552
+ signature: string
553
+ fieldNames: string[]
554
+ fieldTypes: string[]
555
+ }
556
+
557
+ export interface FetchResponse {
558
+ blocks: BlockEntry[][]
559
+ }
560
+
561
+ export interface FieldsSig {
562
+ signature: string
563
+ names: string[]
564
+ types: string[]
565
+ }
566
+
567
+ export interface FixedAssetOutput {
568
+ /** @format int32 */
569
+ hint: number
570
+
571
+ /** @format 32-byte-hash */
572
+ key: string
573
+
574
+ /** @format uint256 */
575
+ attoAlphAmount: string
576
+
577
+ /** @format address */
578
+ address: string
579
+ tokens: Token[]
580
+
581
+ /** @format int64 */
582
+ lockTime: number
583
+
584
+ /** @format hex-string */
585
+ message: string
586
+ }
587
+
588
+ export interface FunctionSig {
589
+ name: string
590
+ signature: string
591
+ argNames: string[]
592
+ argTypes: string[]
593
+ returnTypes: string[]
594
+ }
595
+
596
+ export interface Group {
597
+ /** @format int32 */
598
+ group: number
599
+ }
600
+
601
+ export interface HashesAtHeight {
602
+ headers: string[]
603
+ }
604
+
605
+ export interface InterCliquePeerInfo {
606
+ /** @format clique-id */
607
+ cliqueId: string
608
+
609
+ /** @format int32 */
610
+ brokerId: number
611
+
612
+ /** @format int32 */
613
+ groupNumPerBroker: number
614
+
615
+ /** @format inet-socket-address */
616
+ address: string
617
+ isSynced: boolean
618
+ clientVersion: string
619
+ }
620
+
621
+ export interface InternalServerError {
622
+ detail: string
623
+ }
624
+
625
+ export interface MemPooled {
626
+ type: string
627
+ }
628
+
629
+ export interface MinerAddresses {
630
+ addresses: string[]
631
+ }
632
+
633
+ export interface MinerAddressesInfo {
634
+ addresses: AddressInfo[]
635
+ }
636
+
637
+ export type MisbehaviorAction = Ban | Unban
638
+
639
+ export interface NodeInfo {
640
+ buildInfo: BuildInfo
641
+ upnp: boolean
642
+
643
+ /** @format inet-socket-address */
644
+ externalAddress?: string
645
+ }
646
+
647
+ export interface NodeVersion {
648
+ version: ReleaseVersion
649
+ }
650
+
651
+ export interface NotFound {
652
+ detail: string
653
+ resource: string
654
+ }
655
+
656
+ export type Output = AssetOutput | ContractOutput
657
+
658
+ export interface OutputRef {
659
+ /** @format int32 */
660
+ hint: number
661
+
662
+ /** @format 32-byte-hash */
663
+ key: string
664
+ }
665
+
666
+ export interface PeerAddress {
667
+ /** @format inet-address */
668
+ address: string
669
+
670
+ /** @format int32 */
671
+ restPort: number
672
+
673
+ /** @format int32 */
674
+ wsPort: number
675
+
676
+ /** @format int32 */
677
+ minerApiPort: number
678
+ }
679
+
680
+ export interface PeerMisbehavior {
681
+ /** @format inet-address */
682
+ peer: string
683
+ status: PeerStatus
684
+ }
685
+
686
+ export type PeerStatus = Banned | Penalty
687
+
688
+ export interface Penalty {
689
+ /** @format int32 */
690
+ value: number
691
+ type: string
692
+ }
693
+
694
+ export interface Reachable {
695
+ peers: string[]
696
+ type: string
697
+ }
698
+
699
+ export interface ReleaseVersion {
700
+ /** @format int32 */
701
+ major: number
702
+
703
+ /** @format int32 */
704
+ minor: number
705
+
706
+ /** @format int32 */
707
+ patch: number
708
+ }
709
+
710
+ export interface RevealMnemonic {
711
+ password: string
712
+ }
713
+
714
+ export interface RevealMnemonicResult {
715
+ mnemonic: string
716
+ }
717
+
718
+ export interface Script {
719
+ code: string
720
+ }
721
+
722
+ export interface SelfClique {
723
+ /** @format clique-id */
724
+ cliqueId: string
725
+ nodes: PeerAddress[]
726
+ selfReady: boolean
727
+ synced: boolean
728
+ }
729
+
730
+ export interface ServiceUnavailable {
731
+ detail: string
732
+ }
733
+
734
+ export interface Sign {
735
+ data: string
736
+ }
737
+
738
+ export interface SignResult {
739
+ /** @format signature */
740
+ signature: string
741
+ }
742
+
743
+ export interface SubmitMultisig {
744
+ unsignedTx: string
745
+ signatures: string[]
746
+ }
747
+
748
+ export interface SubmitTransaction {
749
+ unsignedTx: string
750
+
751
+ /** @format signature */
752
+ signature: string
753
+ }
754
+
755
+ export interface SubmitTxResult {
756
+ /** @format 32-byte-hash */
757
+ txId: string
758
+
759
+ /** @format int32 */
760
+ fromGroup: number
761
+
762
+ /** @format int32 */
763
+ toGroup: number
764
+ }
765
+
766
+ export interface Sweep {
767
+ /** @format address */
768
+ toAddress: string
769
+
770
+ /** @format int64 */
771
+ lockTime?: number
772
+
773
+ /** @format gas */
774
+ gasAmount?: number
775
+
776
+ /** @format uint256 */
777
+ gasPrice?: string
778
+
779
+ /** @format int32 */
780
+ utxosLimit?: number
781
+ }
782
+
783
+ export interface SweepAddressTransaction {
784
+ /** @format 32-byte-hash */
785
+ txId: string
786
+ unsignedTx: string
787
+
788
+ /** @format gas */
789
+ gasAmount: number
790
+
791
+ /** @format uint256 */
792
+ gasPrice: string
793
+ }
794
+
795
+ export interface TestContract {
796
+ /** @format int32 */
797
+ group?: number
798
+
799
+ /** @format block-hash */
800
+ blockHash?: string
801
+
802
+ /** @format 32-byte-hash */
803
+ txId?: string
804
+
805
+ /** @format address */
806
+ address?: string
807
+
808
+ /** @format contract */
809
+ bytecode: string
810
+ initialFields?: Val[]
811
+ initialAsset?: AssetState
812
+
813
+ /** @format int32 */
814
+ methodIndex?: number
815
+ args?: Val[]
816
+ existingContracts?: ContractState[]
817
+ inputAssets?: TestInputAsset[]
818
+ }
819
+
820
+ export interface TestContractResult {
821
+ /** @format address */
822
+ address: string
823
+
824
+ /** @format 32-byte-hash */
825
+ codeHash: string
826
+ returns: Val[]
827
+
828
+ /** @format int32 */
829
+ gasUsed: number
830
+ contracts: ContractState[]
831
+ txInputs: string[]
832
+ txOutputs: Output[]
833
+ events: ContractEventByTxId[]
834
+ }
835
+
836
+ export interface TestInputAsset {
837
+ /** @format address */
838
+ address: string
839
+ asset: AssetState
840
+ }
841
+
842
+ export interface Token {
843
+ /** @format 32-byte-hash */
844
+ id: string
845
+
846
+ /** @format uint256 */
847
+ amount: string
848
+ }
849
+
850
+ export interface Transaction {
851
+ unsigned: UnsignedTx
852
+ scriptExecutionOk: boolean
853
+ contractInputs: OutputRef[]
854
+ generatedOutputs: Output[]
855
+ inputSignatures: string[]
856
+ scriptSignatures: string[]
857
+ }
858
+
859
+ export interface TransactionTemplate {
860
+ unsigned: UnsignedTx
861
+ inputSignatures: string[]
862
+ scriptSignatures: string[]
863
+ }
864
+
865
+ export interface Transfer {
866
+ destinations: Destination[]
867
+
868
+ /** @format gas */
869
+ gas?: number
870
+
871
+ /** @format uint256 */
872
+ gasPrice?: string
873
+
874
+ /** @format int32 */
875
+ utxosLimit?: number
876
+ }
877
+
878
+ export interface TransferResult {
879
+ /** @format 32-byte-hash */
880
+ txId: string
881
+
882
+ /** @format group-index */
883
+ fromGroup: number
884
+
885
+ /** @format group-index */
886
+ toGroup: number
887
+ }
888
+
889
+ export interface TransferResults {
890
+ results: TransferResult[]
891
+ }
892
+
893
+ export interface TxNotFound {
894
+ type: string
895
+ }
896
+
897
+ export type TxStatus = Confirmed | MemPooled | TxNotFound
898
+
899
+ export interface UTXO {
900
+ ref: OutputRef
901
+
902
+ /** @format uint256 */
903
+ amount: string
904
+ tokens: Token[]
905
+
906
+ /** @format int64 */
907
+ lockTime: number
908
+
909
+ /** @format hex-string */
910
+ additionalData: string
911
+ }
912
+
913
+ export interface UTXOs {
914
+ utxos: UTXO[]
915
+ warning?: string
916
+ }
917
+
918
+ export interface Unauthorized {
919
+ detail: string
920
+ }
921
+
922
+ export interface Unban {
923
+ peers: string[]
924
+ type: string
925
+ }
926
+
927
+ export interface UnconfirmedTransactions {
928
+ /** @format int32 */
929
+ fromGroup: number
930
+
931
+ /** @format int32 */
932
+ toGroup: number
933
+ unconfirmedTransactions: TransactionTemplate[]
934
+ }
935
+
936
+ export interface Unreachable {
937
+ peers: string[]
938
+ type: string
939
+ }
940
+
941
+ export interface UnsignedTx {
942
+ /** @format 32-byte-hash */
943
+ txId: string
944
+ version: number
945
+ networkId: number
946
+
947
+ /** @format script */
948
+ scriptOpt?: string
949
+
950
+ /** @format int32 */
951
+ gasAmount: number
952
+
953
+ /** @format uint256 */
954
+ gasPrice: string
955
+ inputs: AssetInput[]
956
+ fixedOutputs: FixedAssetOutput[]
957
+ }
958
+
959
+ export type Val = ValAddress | ValArray | ValBool | ValByteVec | ValI256 | ValU256
960
+
961
+ export interface ValAddress {
962
+ /** @format address */
963
+ value: string
964
+ type: string
965
+ }
966
+
967
+ export interface ValArray {
968
+ value: Val[]
969
+ type: string
970
+ }
971
+
972
+ export interface ValBool {
973
+ value: boolean
974
+ type: string
975
+ }
976
+
977
+ export interface ValByteVec {
978
+ /** @format hex-string */
979
+ value: string
980
+ type: string
981
+ }
982
+
983
+ export interface ValI256 {
984
+ /** @format bigint */
985
+ value: string
986
+ type: string
987
+ }
988
+
989
+ export interface ValU256 {
990
+ /** @format uint256 */
991
+ value: string
992
+ type: string
993
+ }
994
+
995
+ export interface VerifySignature {
996
+ /** @format hex-string */
997
+ data: string
998
+
999
+ /** @format signature */
1000
+ signature: string
1001
+
1002
+ /** @format public-key */
1003
+ publicKey: string
1004
+ }
1005
+
1006
+ export interface WalletCreation {
1007
+ password: string
1008
+ walletName: string
1009
+ isMiner?: boolean
1010
+ mnemonicPassphrase?: string
1011
+ mnemonicSize?: number
1012
+ }
1013
+
1014
+ export interface WalletCreationResult {
1015
+ walletName: string
1016
+ mnemonic: string
1017
+ }
1018
+
1019
+ export interface WalletDeletion {
1020
+ password: string
1021
+ }
1022
+
1023
+ export interface WalletRestore {
1024
+ password: string
1025
+ mnemonic: string
1026
+ walletName: string
1027
+ isMiner?: boolean
1028
+ mnemonicPassphrase?: string
1029
+ }
1030
+
1031
+ export interface WalletRestoreResult {
1032
+ walletName: string
1033
+ }
1034
+
1035
+ export interface WalletStatus {
1036
+ walletName: string
1037
+ locked: boolean
1038
+ }
1039
+
1040
+ export interface WalletUnlock {
1041
+ password: string
1042
+ mnemonicPassphrase?: string
1043
+ }
1044
+
1045
+ import 'cross-fetch/polyfill'
1046
+
1047
+ function convertHttpResponse<T>(
1048
+ response: HttpResponse<T, { detail: string }> | HttpResponse<T, { detail: string }>
1049
+ ): T {
1050
+ if (response.error) {
1051
+ throw new Error(response.error.detail)
1052
+ } else {
1053
+ return response.data
1054
+ }
1055
+ }
1056
+
1057
+ export type QueryParamsType = Record<string | number, any>
1058
+ export type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>
1059
+
1060
+ export interface FullRequestParams extends Omit<RequestInit, 'body'> {
1061
+ /** set parameter to `true` for call `securityWorker` for this request */
1062
+ secure?: boolean
1063
+ /** request path */
1064
+ path: string
1065
+ /** content type of request body */
1066
+ type?: ContentType
1067
+ /** query params */
1068
+ query?: QueryParamsType
1069
+ /** format of response (i.e. response.json() -> format: "json") */
1070
+ format?: ResponseFormat
1071
+ /** request body */
1072
+ body?: unknown
1073
+ /** base url */
1074
+ baseUrl?: string
1075
+ /** request cancellation token */
1076
+ cancelToken?: CancelToken
1077
+ }
1078
+
1079
+ export type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>
1080
+
1081
+ export interface ApiConfig<SecurityDataType = unknown> {
1082
+ baseUrl?: string
1083
+ baseApiParams?: Omit<RequestParams, 'baseUrl' | 'cancelToken' | 'signal'>
1084
+ securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void
1085
+ customFetch?: typeof fetch
1086
+ }
1087
+
1088
+ export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
1089
+ data: D
1090
+ error: E
1091
+ }
1092
+
1093
+ type CancelToken = Symbol | string | number
1094
+
1095
+ export enum ContentType {
1096
+ Json = 'application/json',
1097
+ FormData = 'multipart/form-data',
1098
+ UrlEncoded = 'application/x-www-form-urlencoded'
1099
+ }
1100
+
1101
+ export class HttpClient<SecurityDataType = unknown> {
1102
+ public baseUrl: string = '{protocol}://{host}:{port}'
1103
+ private securityData: SecurityDataType | null = null
1104
+ private securityWorker?: ApiConfig<SecurityDataType>['securityWorker']
1105
+ private abortControllers = new Map<CancelToken, AbortController>()
1106
+ private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams)
1107
+
1108
+ private baseApiParams: RequestParams = {
1109
+ credentials: 'same-origin',
1110
+ headers: {},
1111
+ redirect: 'follow',
1112
+ referrerPolicy: 'no-referrer'
1113
+ }
1114
+
1115
+ constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
1116
+ Object.assign(this, apiConfig)
1117
+ }
1118
+
1119
+ public setSecurityData = (data: SecurityDataType | null) => {
1120
+ this.securityData = data
1121
+ }
1122
+
1123
+ private encodeQueryParam(key: string, value: any) {
1124
+ const encodedKey = encodeURIComponent(key)
1125
+ return `${encodedKey}=${encodeURIComponent(typeof value === 'number' ? value : `${value}`)}`
1126
+ }
1127
+
1128
+ private addQueryParam(query: QueryParamsType, key: string) {
1129
+ return this.encodeQueryParam(key, query[key])
1130
+ }
1131
+
1132
+ private addArrayQueryParam(query: QueryParamsType, key: string) {
1133
+ const value = query[key]
1134
+ return value.map((v: any) => this.encodeQueryParam(key, v)).join('&')
1135
+ }
1136
+
1137
+ protected toQueryString(rawQuery?: QueryParamsType): string {
1138
+ const query = rawQuery || {}
1139
+ const keys = Object.keys(query).filter((key) => 'undefined' !== typeof query[key])
1140
+ return keys
1141
+ .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)))
1142
+ .join('&')
1143
+ }
1144
+
1145
+ protected addQueryParams(rawQuery?: QueryParamsType): string {
1146
+ const queryString = this.toQueryString(rawQuery)
1147
+ return queryString ? `?${queryString}` : ''
1148
+ }
1149
+
1150
+ private contentFormatters: Record<ContentType, (input: any) => any> = {
1151
+ [ContentType.Json]: (input: any) =>
1152
+ input !== null && (typeof input === 'object' || typeof input === 'string') ? JSON.stringify(input) : input,
1153
+ [ContentType.FormData]: (input: any) =>
1154
+ Object.keys(input || {}).reduce((formData, key) => {
1155
+ const property = input[key]
1156
+ formData.append(
1157
+ key,
1158
+ property instanceof Blob
1159
+ ? property
1160
+ : typeof property === 'object' && property !== null
1161
+ ? JSON.stringify(property)
1162
+ : `${property}`
1163
+ )
1164
+ return formData
1165
+ }, new FormData()),
1166
+ [ContentType.UrlEncoded]: (input: any) => this.toQueryString(input)
1167
+ }
1168
+
1169
+ private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
1170
+ return {
1171
+ ...this.baseApiParams,
1172
+ ...params1,
1173
+ ...(params2 || {}),
1174
+ headers: {
1175
+ ...(this.baseApiParams.headers || {}),
1176
+ ...(params1.headers || {}),
1177
+ ...((params2 && params2.headers) || {})
1178
+ }
1179
+ }
1180
+ }
1181
+
1182
+ private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
1183
+ if (this.abortControllers.has(cancelToken)) {
1184
+ const abortController = this.abortControllers.get(cancelToken)
1185
+ if (abortController) {
1186
+ return abortController.signal
1187
+ }
1188
+ return void 0
1189
+ }
1190
+
1191
+ const abortController = new AbortController()
1192
+ this.abortControllers.set(cancelToken, abortController)
1193
+ return abortController.signal
1194
+ }
1195
+
1196
+ public abortRequest = (cancelToken: CancelToken) => {
1197
+ const abortController = this.abortControllers.get(cancelToken)
1198
+
1199
+ if (abortController) {
1200
+ abortController.abort()
1201
+ this.abortControllers.delete(cancelToken)
1202
+ }
1203
+ }
1204
+
1205
+ public request = async <T = any, E = any>({
1206
+ body,
1207
+ secure,
1208
+ path,
1209
+ type,
1210
+ query,
1211
+ format,
1212
+ baseUrl,
1213
+ cancelToken,
1214
+ ...params
1215
+ }: FullRequestParams): Promise<HttpResponse<T, E>> => {
1216
+ const secureParams =
1217
+ ((typeof secure === 'boolean' ? secure : this.baseApiParams.secure) &&
1218
+ this.securityWorker &&
1219
+ (await this.securityWorker(this.securityData))) ||
1220
+ {}
1221
+ const requestParams = this.mergeRequestParams(params, secureParams)
1222
+ const queryString = query && this.toQueryString(query)
1223
+ const payloadFormatter = this.contentFormatters[type || ContentType.Json]
1224
+ const responseFormat = format || requestParams.format
1225
+
1226
+ return this.customFetch(`${baseUrl || this.baseUrl || ''}${path}${queryString ? `?${queryString}` : ''}`, {
1227
+ ...requestParams,
1228
+ headers: {
1229
+ ...(type && type !== ContentType.FormData ? { 'Content-Type': type } : {}),
1230
+ ...(requestParams.headers || {})
1231
+ },
1232
+ signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
1233
+ body: typeof body === 'undefined' || body === null ? null : payloadFormatter(body)
1234
+ }).then(async (response) => {
1235
+ const r = response as HttpResponse<T, E>
1236
+ r.data = null as unknown as T
1237
+ r.error = null as unknown as E
1238
+
1239
+ const data = !responseFormat
1240
+ ? r
1241
+ : await response[responseFormat]()
1242
+ .then((data) => {
1243
+ if (r.ok) {
1244
+ r.data = data
1245
+ } else {
1246
+ r.error = data
1247
+ }
1248
+ return r
1249
+ })
1250
+ .catch((e) => {
1251
+ r.error = e
1252
+ return r
1253
+ })
1254
+
1255
+ if (cancelToken) {
1256
+ this.abortControllers.delete(cancelToken)
1257
+ }
1258
+
1259
+ if (!response.ok) throw data
1260
+ return data
1261
+ })
1262
+ }
1263
+ }
1264
+
1265
+ /**
1266
+ * @title Alephium API
1267
+ * @version 1.4.1
1268
+ * @baseUrl {protocol}://{host}:{port}
1269
+ */
1270
+ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
1271
+ wallets = {
1272
+ /**
1273
+ * No description
1274
+ *
1275
+ * @tags Wallets
1276
+ * @name GetWallets
1277
+ * @summary List available wallets
1278
+ * @request GET:/wallets
1279
+ */
1280
+ getWallets: (params: RequestParams = {}) =>
1281
+ this.request<WalletStatus[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1282
+ path: `/wallets`,
1283
+ method: 'GET',
1284
+ format: 'json',
1285
+ ...params
1286
+ }).then(convertHttpResponse),
1287
+
1288
+ /**
1289
+ * No description
1290
+ *
1291
+ * @tags Wallets
1292
+ * @name PutWallets
1293
+ * @summary Restore a wallet from your mnemonic
1294
+ * @request PUT:/wallets
1295
+ */
1296
+ putWallets: (data: WalletRestore, params: RequestParams = {}) =>
1297
+ this.request<
1298
+ WalletRestoreResult,
1299
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
1300
+ >({
1301
+ path: `/wallets`,
1302
+ method: 'PUT',
1303
+ body: data,
1304
+ type: ContentType.Json,
1305
+ format: 'json',
1306
+ ...params
1307
+ }).then(convertHttpResponse),
1308
+
1309
+ /**
1310
+ * @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).
1311
+ *
1312
+ * @tags Wallets
1313
+ * @name PostWallets
1314
+ * @summary Create a new wallet
1315
+ * @request POST:/wallets
1316
+ */
1317
+ postWallets: (data: WalletCreation, params: RequestParams = {}) =>
1318
+ this.request<
1319
+ WalletCreationResult,
1320
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
1321
+ >({
1322
+ path: `/wallets`,
1323
+ method: 'POST',
1324
+ body: data,
1325
+ type: ContentType.Json,
1326
+ format: 'json',
1327
+ ...params
1328
+ }).then(convertHttpResponse),
1329
+
1330
+ /**
1331
+ * No description
1332
+ *
1333
+ * @tags Wallets
1334
+ * @name GetWalletsWalletName
1335
+ * @summary Get wallet's status
1336
+ * @request GET:/wallets/{wallet_name}
1337
+ */
1338
+ getWalletsWalletName: (walletName: string, params: RequestParams = {}) =>
1339
+ this.request<WalletStatus, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1340
+ path: `/wallets/${walletName}`,
1341
+ method: 'GET',
1342
+ format: 'json',
1343
+ ...params
1344
+ }).then(convertHttpResponse),
1345
+
1346
+ /**
1347
+ * No description
1348
+ *
1349
+ * @tags Wallets
1350
+ * @name DeleteWalletsWalletName
1351
+ * @summary Delete your wallet file (can be recovered with your mnemonic)
1352
+ * @request DELETE:/wallets/{wallet_name}
1353
+ */
1354
+ deleteWalletsWalletName: (walletName: string, data: WalletDeletion, params: RequestParams = {}) =>
1355
+ this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1356
+ path: `/wallets/${walletName}`,
1357
+ method: 'DELETE',
1358
+ body: data,
1359
+ type: ContentType.Json,
1360
+ ...params
1361
+ }).then(convertHttpResponse),
1362
+
1363
+ /**
1364
+ * No description
1365
+ *
1366
+ * @tags Wallets
1367
+ * @name PostWalletsWalletNameLock
1368
+ * @summary Lock your wallet
1369
+ * @request POST:/wallets/{wallet_name}/lock
1370
+ */
1371
+ postWalletsWalletNameLock: (walletName: string, params: RequestParams = {}) =>
1372
+ this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1373
+ path: `/wallets/${walletName}/lock`,
1374
+ method: 'POST',
1375
+ ...params
1376
+ }).then(convertHttpResponse),
1377
+
1378
+ /**
1379
+ * No description
1380
+ *
1381
+ * @tags Wallets
1382
+ * @name PostWalletsWalletNameUnlock
1383
+ * @summary Unlock your wallet
1384
+ * @request POST:/wallets/{wallet_name}/unlock
1385
+ */
1386
+ postWalletsWalletNameUnlock: (walletName: string, data: WalletUnlock, params: RequestParams = {}) =>
1387
+ this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1388
+ path: `/wallets/${walletName}/unlock`,
1389
+ method: 'POST',
1390
+ body: data,
1391
+ type: ContentType.Json,
1392
+ ...params
1393
+ }).then(convertHttpResponse),
1394
+
1395
+ /**
1396
+ * No description
1397
+ *
1398
+ * @tags Wallets
1399
+ * @name GetWalletsWalletNameBalances
1400
+ * @summary Get your total balance
1401
+ * @request GET:/wallets/{wallet_name}/balances
1402
+ */
1403
+ getWalletsWalletNameBalances: (walletName: string, params: RequestParams = {}) =>
1404
+ this.request<Balances, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1405
+ path: `/wallets/${walletName}/balances`,
1406
+ method: 'GET',
1407
+ format: 'json',
1408
+ ...params
1409
+ }).then(convertHttpResponse),
1410
+
1411
+ /**
1412
+ * No description
1413
+ *
1414
+ * @tags Wallets
1415
+ * @name PostWalletsWalletNameRevealMnemonic
1416
+ * @summary Reveal your mnemonic. !!! use it with caution !!!
1417
+ * @request POST:/wallets/{wallet_name}/reveal-mnemonic
1418
+ */
1419
+ postWalletsWalletNameRevealMnemonic: (walletName: string, data: RevealMnemonic, params: RequestParams = {}) =>
1420
+ this.request<
1421
+ RevealMnemonicResult,
1422
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
1423
+ >({
1424
+ path: `/wallets/${walletName}/reveal-mnemonic`,
1425
+ method: 'POST',
1426
+ body: data,
1427
+ type: ContentType.Json,
1428
+ format: 'json',
1429
+ ...params
1430
+ }).then(convertHttpResponse),
1431
+
1432
+ /**
1433
+ * No description
1434
+ *
1435
+ * @tags Wallets
1436
+ * @name PostWalletsWalletNameTransfer
1437
+ * @summary Transfer ALPH from the active address
1438
+ * @request POST:/wallets/{wallet_name}/transfer
1439
+ */
1440
+ postWalletsWalletNameTransfer: (walletName: string, data: Transfer, params: RequestParams = {}) =>
1441
+ this.request<TransferResult, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1442
+ path: `/wallets/${walletName}/transfer`,
1443
+ method: 'POST',
1444
+ body: data,
1445
+ type: ContentType.Json,
1446
+ format: 'json',
1447
+ ...params
1448
+ }).then(convertHttpResponse),
1449
+
1450
+ /**
1451
+ * No description
1452
+ *
1453
+ * @tags Wallets
1454
+ * @name PostWalletsWalletNameSweepActiveAddress
1455
+ * @summary Transfer all unlocked ALPH from the active address to another address
1456
+ * @request POST:/wallets/{wallet_name}/sweep-active-address
1457
+ */
1458
+ postWalletsWalletNameSweepActiveAddress: (walletName: string, data: Sweep, params: RequestParams = {}) =>
1459
+ this.request<TransferResults, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1460
+ path: `/wallets/${walletName}/sweep-active-address`,
1461
+ method: 'POST',
1462
+ body: data,
1463
+ type: ContentType.Json,
1464
+ format: 'json',
1465
+ ...params
1466
+ }).then(convertHttpResponse),
1467
+
1468
+ /**
1469
+ * No description
1470
+ *
1471
+ * @tags Wallets
1472
+ * @name PostWalletsWalletNameSweepAllAddresses
1473
+ * @summary Transfer unlocked ALPH from all addresses (including all mining addresses if applicable) to another address
1474
+ * @request POST:/wallets/{wallet_name}/sweep-all-addresses
1475
+ */
1476
+ postWalletsWalletNameSweepAllAddresses: (walletName: string, data: Sweep, params: RequestParams = {}) =>
1477
+ this.request<TransferResults, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1478
+ path: `/wallets/${walletName}/sweep-all-addresses`,
1479
+ method: 'POST',
1480
+ body: data,
1481
+ type: ContentType.Json,
1482
+ format: 'json',
1483
+ ...params
1484
+ }).then(convertHttpResponse),
1485
+
1486
+ /**
1487
+ * No description
1488
+ *
1489
+ * @tags Wallets
1490
+ * @name PostWalletsWalletNameSign
1491
+ * @summary Sign the given data and return back the signature
1492
+ * @request POST:/wallets/{wallet_name}/sign
1493
+ */
1494
+ postWalletsWalletNameSign: (walletName: string, data: Sign, params: RequestParams = {}) =>
1495
+ this.request<SignResult, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1496
+ path: `/wallets/${walletName}/sign`,
1497
+ method: 'POST',
1498
+ body: data,
1499
+ type: ContentType.Json,
1500
+ format: 'json',
1501
+ ...params
1502
+ }).then(convertHttpResponse),
1503
+
1504
+ /**
1505
+ * No description
1506
+ *
1507
+ * @tags Wallets
1508
+ * @name GetWalletsWalletNameAddresses
1509
+ * @summary List all your wallet's addresses
1510
+ * @request GET:/wallets/{wallet_name}/addresses
1511
+ */
1512
+ getWalletsWalletNameAddresses: (walletName: string, params: RequestParams = {}) =>
1513
+ this.request<Addresses, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1514
+ path: `/wallets/${walletName}/addresses`,
1515
+ method: 'GET',
1516
+ format: 'json',
1517
+ ...params
1518
+ }).then(convertHttpResponse),
1519
+
1520
+ /**
1521
+ * No description
1522
+ *
1523
+ * @tags Wallets
1524
+ * @name GetWalletsWalletNameAddressesAddress
1525
+ * @summary Get address' info
1526
+ * @request GET:/wallets/{wallet_name}/addresses/{address}
1527
+ */
1528
+ getWalletsWalletNameAddressesAddress: (walletName: string, address: string, params: RequestParams = {}) =>
1529
+ this.request<AddressInfo, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1530
+ path: `/wallets/${walletName}/addresses/${address}`,
1531
+ method: 'GET',
1532
+ format: 'json',
1533
+ ...params
1534
+ }).then(convertHttpResponse),
1535
+
1536
+ /**
1537
+ * @description This endpoint can only be called if the wallet was created with the `isMiner = true` flag
1538
+ *
1539
+ * @tags Miners
1540
+ * @name GetWalletsWalletNameMinerAddresses
1541
+ * @summary List all miner addresses per group
1542
+ * @request GET:/wallets/{wallet_name}/miner-addresses
1543
+ */
1544
+ getWalletsWalletNameMinerAddresses: (walletName: string, params: RequestParams = {}) =>
1545
+ this.request<
1546
+ MinerAddressesInfo[],
1547
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
1548
+ >({
1549
+ path: `/wallets/${walletName}/miner-addresses`,
1550
+ method: 'GET',
1551
+ format: 'json',
1552
+ ...params
1553
+ }).then(convertHttpResponse),
1554
+
1555
+ /**
1556
+ * @description Cannot be called from a miner wallet
1557
+ *
1558
+ * @tags Wallets
1559
+ * @name PostWalletsWalletNameDeriveNextAddress
1560
+ * @summary Derive your next address
1561
+ * @request POST:/wallets/{wallet_name}/derive-next-address
1562
+ */
1563
+ postWalletsWalletNameDeriveNextAddress: (
1564
+ walletName: string,
1565
+ query?: { group?: number },
1566
+ params: RequestParams = {}
1567
+ ) =>
1568
+ this.request<AddressInfo, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1569
+ path: `/wallets/${walletName}/derive-next-address`,
1570
+ method: 'POST',
1571
+ query: query,
1572
+ format: 'json',
1573
+ ...params
1574
+ }).then(convertHttpResponse),
1575
+
1576
+ /**
1577
+ * @description Your wallet need to have been created with the miner flag set to true
1578
+ *
1579
+ * @tags Miners
1580
+ * @name PostWalletsWalletNameDeriveNextMinerAddresses
1581
+ * @summary Derive your next miner addresses for each group
1582
+ * @request POST:/wallets/{wallet_name}/derive-next-miner-addresses
1583
+ */
1584
+ postWalletsWalletNameDeriveNextMinerAddresses: (walletName: string, params: RequestParams = {}) =>
1585
+ this.request<AddressInfo[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1586
+ path: `/wallets/${walletName}/derive-next-miner-addresses`,
1587
+ method: 'POST',
1588
+ format: 'json',
1589
+ ...params
1590
+ }).then(convertHttpResponse),
1591
+
1592
+ /**
1593
+ * No description
1594
+ *
1595
+ * @tags Wallets
1596
+ * @name PostWalletsWalletNameChangeActiveAddress
1597
+ * @summary Choose the active address
1598
+ * @request POST:/wallets/{wallet_name}/change-active-address
1599
+ */
1600
+ postWalletsWalletNameChangeActiveAddress: (
1601
+ walletName: string,
1602
+ data: ChangeActiveAddress,
1603
+ params: RequestParams = {}
1604
+ ) =>
1605
+ this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1606
+ path: `/wallets/${walletName}/change-active-address`,
1607
+ method: 'POST',
1608
+ body: data,
1609
+ type: ContentType.Json,
1610
+ ...params
1611
+ }).then(convertHttpResponse)
1612
+ }
1613
+ infos = {
1614
+ /**
1615
+ * No description
1616
+ *
1617
+ * @tags Infos
1618
+ * @name GetInfosNode
1619
+ * @summary Get info about that node
1620
+ * @request GET:/infos/node
1621
+ */
1622
+ getInfosNode: (params: RequestParams = {}) =>
1623
+ this.request<NodeInfo, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1624
+ path: `/infos/node`,
1625
+ method: 'GET',
1626
+ format: 'json',
1627
+ ...params
1628
+ }).then(convertHttpResponse),
1629
+
1630
+ /**
1631
+ * No description
1632
+ *
1633
+ * @tags Infos
1634
+ * @name GetInfosVersion
1635
+ * @summary Get version about that node
1636
+ * @request GET:/infos/version
1637
+ */
1638
+ getInfosVersion: (params: RequestParams = {}) =>
1639
+ this.request<NodeVersion, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1640
+ path: `/infos/version`,
1641
+ method: 'GET',
1642
+ format: 'json',
1643
+ ...params
1644
+ }).then(convertHttpResponse),
1645
+
1646
+ /**
1647
+ * No description
1648
+ *
1649
+ * @tags Infos
1650
+ * @name GetInfosChainParams
1651
+ * @summary Get key params about your blockchain
1652
+ * @request GET:/infos/chain-params
1653
+ */
1654
+ getInfosChainParams: (params: RequestParams = {}) =>
1655
+ this.request<ChainParams, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1656
+ path: `/infos/chain-params`,
1657
+ method: 'GET',
1658
+ format: 'json',
1659
+ ...params
1660
+ }).then(convertHttpResponse),
1661
+
1662
+ /**
1663
+ * No description
1664
+ *
1665
+ * @tags Infos
1666
+ * @name GetInfosSelfClique
1667
+ * @summary Get info about your own clique
1668
+ * @request GET:/infos/self-clique
1669
+ */
1670
+ getInfosSelfClique: (params: RequestParams = {}) =>
1671
+ this.request<SelfClique, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1672
+ path: `/infos/self-clique`,
1673
+ method: 'GET',
1674
+ format: 'json',
1675
+ ...params
1676
+ }).then(convertHttpResponse),
1677
+
1678
+ /**
1679
+ * No description
1680
+ *
1681
+ * @tags Infos
1682
+ * @name GetInfosInterCliquePeerInfo
1683
+ * @summary Get infos about the inter cliques
1684
+ * @request GET:/infos/inter-clique-peer-info
1685
+ */
1686
+ getInfosInterCliquePeerInfo: (params: RequestParams = {}) =>
1687
+ this.request<
1688
+ InterCliquePeerInfo[],
1689
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
1690
+ >({
1691
+ path: `/infos/inter-clique-peer-info`,
1692
+ method: 'GET',
1693
+ format: 'json',
1694
+ ...params
1695
+ }).then(convertHttpResponse),
1696
+
1697
+ /**
1698
+ * No description
1699
+ *
1700
+ * @tags Infos
1701
+ * @name GetInfosDiscoveredNeighbors
1702
+ * @summary Get discovered neighbors
1703
+ * @request GET:/infos/discovered-neighbors
1704
+ */
1705
+ getInfosDiscoveredNeighbors: (params: RequestParams = {}) =>
1706
+ this.request<BrokerInfo[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1707
+ path: `/infos/discovered-neighbors`,
1708
+ method: 'GET',
1709
+ format: 'json',
1710
+ ...params
1711
+ }).then(convertHttpResponse),
1712
+
1713
+ /**
1714
+ * No description
1715
+ *
1716
+ * @tags Infos
1717
+ * @name GetInfosMisbehaviors
1718
+ * @summary Get the misbehaviors of peers
1719
+ * @request GET:/infos/misbehaviors
1720
+ */
1721
+ getInfosMisbehaviors: (params: RequestParams = {}) =>
1722
+ this.request<PeerMisbehavior[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1723
+ path: `/infos/misbehaviors`,
1724
+ method: 'GET',
1725
+ format: 'json',
1726
+ ...params
1727
+ }).then(convertHttpResponse),
1728
+
1729
+ /**
1730
+ * No description
1731
+ *
1732
+ * @tags Infos
1733
+ * @name PostInfosMisbehaviors
1734
+ * @summary Ban/Unban given peers
1735
+ * @request POST:/infos/misbehaviors
1736
+ */
1737
+ postInfosMisbehaviors: (data: MisbehaviorAction, params: RequestParams = {}) =>
1738
+ this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1739
+ path: `/infos/misbehaviors`,
1740
+ method: 'POST',
1741
+ body: data,
1742
+ type: ContentType.Json,
1743
+ ...params
1744
+ }).then(convertHttpResponse),
1745
+
1746
+ /**
1747
+ * No description
1748
+ *
1749
+ * @tags Infos
1750
+ * @name GetInfosUnreachable
1751
+ * @summary Get the unreachable brokers
1752
+ * @request GET:/infos/unreachable
1753
+ */
1754
+ getInfosUnreachable: (params: RequestParams = {}) =>
1755
+ this.request<string[], BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1756
+ path: `/infos/unreachable`,
1757
+ method: 'GET',
1758
+ format: 'json',
1759
+ ...params
1760
+ }).then(convertHttpResponse),
1761
+
1762
+ /**
1763
+ * No description
1764
+ *
1765
+ * @tags Infos
1766
+ * @name PostInfosDiscovery
1767
+ * @summary Set brokers to be unreachable/reachable
1768
+ * @request POST:/infos/discovery
1769
+ */
1770
+ postInfosDiscovery: (data: DiscoveryAction, params: RequestParams = {}) =>
1771
+ this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1772
+ path: `/infos/discovery`,
1773
+ method: 'POST',
1774
+ body: data,
1775
+ type: ContentType.Json,
1776
+ ...params
1777
+ }).then(convertHttpResponse),
1778
+
1779
+ /**
1780
+ * No description
1781
+ *
1782
+ * @tags Infos
1783
+ * @name GetInfosHistoryHashrate
1784
+ * @summary Get history average hashrate on the given time interval
1785
+ * @request GET:/infos/history-hashrate
1786
+ */
1787
+ getInfosHistoryHashrate: (query: { fromTs: number; toTs?: number }, params: RequestParams = {}) =>
1788
+ this.request<string, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1789
+ path: `/infos/history-hashrate`,
1790
+ method: 'GET',
1791
+ query: query,
1792
+ format: 'json',
1793
+ ...params
1794
+ }).then(convertHttpResponse),
1795
+
1796
+ /**
1797
+ * No description
1798
+ *
1799
+ * @tags Infos
1800
+ * @name GetInfosCurrentHashrate
1801
+ * @summary Get average hashrate from `now - timespan(millis)` to `now`
1802
+ * @request GET:/infos/current-hashrate
1803
+ */
1804
+ getInfosCurrentHashrate: (query?: { timespan?: number }, params: RequestParams = {}) =>
1805
+ this.request<string, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1806
+ path: `/infos/current-hashrate`,
1807
+ method: 'GET',
1808
+ query: query,
1809
+ format: 'json',
1810
+ ...params
1811
+ }).then(convertHttpResponse)
1812
+ }
1813
+ blockflow = {
1814
+ /**
1815
+ * No description
1816
+ *
1817
+ * @tags Blockflow
1818
+ * @name GetBlockflow
1819
+ * @summary List blocks on the given time interval
1820
+ * @request GET:/blockflow
1821
+ */
1822
+ getBlockflow: (query: { fromTs: number; toTs?: number }, params: RequestParams = {}) =>
1823
+ this.request<FetchResponse, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1824
+ path: `/blockflow`,
1825
+ method: 'GET',
1826
+ query: query,
1827
+ format: 'json',
1828
+ ...params
1829
+ }).then(convertHttpResponse),
1830
+
1831
+ /**
1832
+ * No description
1833
+ *
1834
+ * @tags Blockflow
1835
+ * @name GetBlockflowBlocksBlockHash
1836
+ * @summary Get a block with hash
1837
+ * @request GET:/blockflow/blocks/{block_hash}
1838
+ */
1839
+ getBlockflowBlocksBlockHash: (blockHash: string, params: RequestParams = {}) =>
1840
+ this.request<BlockEntry, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1841
+ path: `/blockflow/blocks/${blockHash}`,
1842
+ method: 'GET',
1843
+ format: 'json',
1844
+ ...params
1845
+ }).then(convertHttpResponse),
1846
+
1847
+ /**
1848
+ * No description
1849
+ *
1850
+ * @tags Blockflow
1851
+ * @name GetBlockflowIsBlockInMainChain
1852
+ * @summary Check if the block is in main chain
1853
+ * @request GET:/blockflow/is-block-in-main-chain
1854
+ */
1855
+ getBlockflowIsBlockInMainChain: (query: { blockHash: string }, params: RequestParams = {}) =>
1856
+ this.request<boolean, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1857
+ path: `/blockflow/is-block-in-main-chain`,
1858
+ method: 'GET',
1859
+ query: query,
1860
+ format: 'json',
1861
+ ...params
1862
+ }).then(convertHttpResponse),
1863
+
1864
+ /**
1865
+ * No description
1866
+ *
1867
+ * @tags Blockflow
1868
+ * @name GetBlockflowHashes
1869
+ * @summary Get all block's hashes at given height for given groups
1870
+ * @request GET:/blockflow/hashes
1871
+ */
1872
+ getBlockflowHashes: (query: { fromGroup: number; toGroup: number; height: number }, params: RequestParams = {}) =>
1873
+ this.request<HashesAtHeight, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1874
+ path: `/blockflow/hashes`,
1875
+ method: 'GET',
1876
+ query: query,
1877
+ format: 'json',
1878
+ ...params
1879
+ }).then(convertHttpResponse),
1880
+
1881
+ /**
1882
+ * No description
1883
+ *
1884
+ * @tags Blockflow
1885
+ * @name GetBlockflowChainInfo
1886
+ * @summary Get infos about the chain from the given groups
1887
+ * @request GET:/blockflow/chain-info
1888
+ */
1889
+ getBlockflowChainInfo: (query: { fromGroup: number; toGroup: number }, params: RequestParams = {}) =>
1890
+ this.request<ChainInfo, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1891
+ path: `/blockflow/chain-info`,
1892
+ method: 'GET',
1893
+ query: query,
1894
+ format: 'json',
1895
+ ...params
1896
+ }).then(convertHttpResponse),
1897
+
1898
+ /**
1899
+ * No description
1900
+ *
1901
+ * @tags Blockflow
1902
+ * @name GetBlockflowHeadersBlockHash
1903
+ * @summary Get block header
1904
+ * @request GET:/blockflow/headers/{block_hash}
1905
+ */
1906
+ getBlockflowHeadersBlockHash: (blockHash: string, params: RequestParams = {}) =>
1907
+ this.request<BlockHeaderEntry, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1908
+ path: `/blockflow/headers/${blockHash}`,
1909
+ method: 'GET',
1910
+ format: 'json',
1911
+ ...params
1912
+ }).then(convertHttpResponse)
1913
+ }
1914
+ addresses = {
1915
+ /**
1916
+ * No description
1917
+ *
1918
+ * @tags Addresses
1919
+ * @name GetAddressesAddressBalance
1920
+ * @summary Get the balance of an address
1921
+ * @request GET:/addresses/{address}/balance
1922
+ */
1923
+ getAddressesAddressBalance: (address: string, params: RequestParams = {}) =>
1924
+ this.request<Balance, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1925
+ path: `/addresses/${address}/balance`,
1926
+ method: 'GET',
1927
+ format: 'json',
1928
+ ...params
1929
+ }).then(convertHttpResponse),
1930
+
1931
+ /**
1932
+ * No description
1933
+ *
1934
+ * @tags Addresses
1935
+ * @name GetAddressesAddressUtxos
1936
+ * @summary Get the UTXOs of an address
1937
+ * @request GET:/addresses/{address}/utxos
1938
+ */
1939
+ getAddressesAddressUtxos: (address: string, params: RequestParams = {}) =>
1940
+ this.request<UTXOs, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1941
+ path: `/addresses/${address}/utxos`,
1942
+ method: 'GET',
1943
+ format: 'json',
1944
+ ...params
1945
+ }).then(convertHttpResponse),
1946
+
1947
+ /**
1948
+ * No description
1949
+ *
1950
+ * @tags Addresses
1951
+ * @name GetAddressesAddressGroup
1952
+ * @summary Get the group of an address
1953
+ * @request GET:/addresses/{address}/group
1954
+ */
1955
+ getAddressesAddressGroup: (address: string, params: RequestParams = {}) =>
1956
+ this.request<Group, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
1957
+ path: `/addresses/${address}/group`,
1958
+ method: 'GET',
1959
+ format: 'json',
1960
+ ...params
1961
+ }).then(convertHttpResponse)
1962
+ }
1963
+ transactions = {
1964
+ /**
1965
+ * No description
1966
+ *
1967
+ * @tags Transactions
1968
+ * @name GetTransactionsUnconfirmed
1969
+ * @summary List unconfirmed transactions
1970
+ * @request GET:/transactions/unconfirmed
1971
+ */
1972
+ getTransactionsUnconfirmed: (params: RequestParams = {}) =>
1973
+ this.request<
1974
+ UnconfirmedTransactions[],
1975
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
1976
+ >({
1977
+ path: `/transactions/unconfirmed`,
1978
+ method: 'GET',
1979
+ format: 'json',
1980
+ ...params
1981
+ }).then(convertHttpResponse),
1982
+
1983
+ /**
1984
+ * No description
1985
+ *
1986
+ * @tags Transactions
1987
+ * @name PostTransactionsBuild
1988
+ * @summary Build an unsigned transaction to a number of recipients
1989
+ * @request POST:/transactions/build
1990
+ */
1991
+ postTransactionsBuild: (data: BuildTransaction, params: RequestParams = {}) =>
1992
+ this.request<
1993
+ BuildTransactionResult,
1994
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
1995
+ >({
1996
+ path: `/transactions/build`,
1997
+ method: 'POST',
1998
+ body: data,
1999
+ type: ContentType.Json,
2000
+ format: 'json',
2001
+ ...params
2002
+ }).then(convertHttpResponse),
2003
+
2004
+ /**
2005
+ * No description
2006
+ *
2007
+ * @tags Transactions
2008
+ * @name PostTransactionsSweepAddressBuild
2009
+ * @summary Build unsigned transactions to send all unlocked balanced of one address to another address
2010
+ * @request POST:/transactions/sweep-address/build
2011
+ */
2012
+ postTransactionsSweepAddressBuild: (data: BuildSweepAddressTransactions, params: RequestParams = {}) =>
2013
+ this.request<
2014
+ BuildSweepAddressTransactionsResult,
2015
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
2016
+ >({
2017
+ path: `/transactions/sweep-address/build`,
2018
+ method: 'POST',
2019
+ body: data,
2020
+ type: ContentType.Json,
2021
+ format: 'json',
2022
+ ...params
2023
+ }).then(convertHttpResponse),
2024
+
2025
+ /**
2026
+ * No description
2027
+ *
2028
+ * @tags Transactions
2029
+ * @name PostTransactionsSubmit
2030
+ * @summary Submit a signed transaction
2031
+ * @request POST:/transactions/submit
2032
+ */
2033
+ postTransactionsSubmit: (data: SubmitTransaction, params: RequestParams = {}) =>
2034
+ this.request<SubmitTxResult, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2035
+ path: `/transactions/submit`,
2036
+ method: 'POST',
2037
+ body: data,
2038
+ type: ContentType.Json,
2039
+ format: 'json',
2040
+ ...params
2041
+ }).then(convertHttpResponse),
2042
+
2043
+ /**
2044
+ * No description
2045
+ *
2046
+ * @tags Transactions
2047
+ * @name PostTransactionsDecodeUnsignedTx
2048
+ * @summary Decode an unsigned transaction
2049
+ * @request POST:/transactions/decode-unsigned-tx
2050
+ */
2051
+ postTransactionsDecodeUnsignedTx: (data: DecodeUnsignedTx, params: RequestParams = {}) =>
2052
+ this.request<
2053
+ DecodeUnsignedTxResult,
2054
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
2055
+ >({
2056
+ path: `/transactions/decode-unsigned-tx`,
2057
+ method: 'POST',
2058
+ body: data,
2059
+ type: ContentType.Json,
2060
+ format: 'json',
2061
+ ...params
2062
+ }).then(convertHttpResponse),
2063
+
2064
+ /**
2065
+ * No description
2066
+ *
2067
+ * @tags Transactions
2068
+ * @name GetTransactionsStatus
2069
+ * @summary Get tx status
2070
+ * @request GET:/transactions/status
2071
+ */
2072
+ getTransactionsStatus: (
2073
+ query: { txId: string; fromGroup?: number; toGroup?: number },
2074
+ params: RequestParams = {}
2075
+ ) =>
2076
+ this.request<TxStatus, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2077
+ path: `/transactions/status`,
2078
+ method: 'GET',
2079
+ query: query,
2080
+ format: 'json',
2081
+ ...params
2082
+ }).then(convertHttpResponse)
2083
+ }
2084
+ contracts = {
2085
+ /**
2086
+ * No description
2087
+ *
2088
+ * @tags Contracts
2089
+ * @name PostContractsCompileScript
2090
+ * @summary Compile a script
2091
+ * @request POST:/contracts/compile-script
2092
+ */
2093
+ postContractsCompileScript: (data: Script, params: RequestParams = {}) =>
2094
+ this.request<
2095
+ CompileScriptResult,
2096
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
2097
+ >({
2098
+ path: `/contracts/compile-script`,
2099
+ method: 'POST',
2100
+ body: data,
2101
+ type: ContentType.Json,
2102
+ format: 'json',
2103
+ ...params
2104
+ }).then(convertHttpResponse),
2105
+
2106
+ /**
2107
+ * No description
2108
+ *
2109
+ * @tags Contracts
2110
+ * @name PostContractsUnsignedTxExecuteScript
2111
+ * @summary Build an unsigned script
2112
+ * @request POST:/contracts/unsigned-tx/execute-script
2113
+ */
2114
+ postContractsUnsignedTxExecuteScript: (data: BuildExecuteScriptTx, params: RequestParams = {}) =>
2115
+ this.request<
2116
+ BuildExecuteScriptTxResult,
2117
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
2118
+ >({
2119
+ path: `/contracts/unsigned-tx/execute-script`,
2120
+ method: 'POST',
2121
+ body: data,
2122
+ type: ContentType.Json,
2123
+ format: 'json',
2124
+ ...params
2125
+ }).then(convertHttpResponse),
2126
+
2127
+ /**
2128
+ * No description
2129
+ *
2130
+ * @tags Contracts
2131
+ * @name PostContractsCompileContract
2132
+ * @summary Compile a smart contract
2133
+ * @request POST:/contracts/compile-contract
2134
+ */
2135
+ postContractsCompileContract: (data: Contract, params: RequestParams = {}) =>
2136
+ this.request<
2137
+ CompileContractResult,
2138
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
2139
+ >({
2140
+ path: `/contracts/compile-contract`,
2141
+ method: 'POST',
2142
+ body: data,
2143
+ type: ContentType.Json,
2144
+ format: 'json',
2145
+ ...params
2146
+ }).then(convertHttpResponse),
2147
+
2148
+ /**
2149
+ * No description
2150
+ *
2151
+ * @tags Contracts
2152
+ * @name PostContractsUnsignedTxDeployContract
2153
+ * @summary Build an unsigned contract
2154
+ * @request POST:/contracts/unsigned-tx/deploy-contract
2155
+ */
2156
+ postContractsUnsignedTxDeployContract: (data: BuildDeployContractTx, params: RequestParams = {}) =>
2157
+ this.request<
2158
+ BuildDeployContractTxResult,
2159
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
2160
+ >({
2161
+ path: `/contracts/unsigned-tx/deploy-contract`,
2162
+ method: 'POST',
2163
+ body: data,
2164
+ type: ContentType.Json,
2165
+ format: 'json',
2166
+ ...params
2167
+ }).then(convertHttpResponse),
2168
+
2169
+ /**
2170
+ * No description
2171
+ *
2172
+ * @tags Contracts
2173
+ * @name GetContractsAddressState
2174
+ * @summary Get contract state
2175
+ * @request GET:/contracts/{address}/state
2176
+ */
2177
+ getContractsAddressState: (address: string, query: { group: number }, params: RequestParams = {}) =>
2178
+ this.request<ContractState, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2179
+ path: `/contracts/${address}/state`,
2180
+ method: 'GET',
2181
+ query: query,
2182
+ format: 'json',
2183
+ ...params
2184
+ }).then(convertHttpResponse),
2185
+
2186
+ /**
2187
+ * No description
2188
+ *
2189
+ * @tags Contracts
2190
+ * @name PostContractsTestContract
2191
+ * @summary Test contract
2192
+ * @request POST:/contracts/test-contract
2193
+ */
2194
+ postContractsTestContract: (data: TestContract, params: RequestParams = {}) =>
2195
+ this.request<TestContractResult, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>(
2196
+ {
2197
+ path: `/contracts/test-contract`,
2198
+ method: 'POST',
2199
+ body: data,
2200
+ type: ContentType.Json,
2201
+ format: 'json',
2202
+ ...params
2203
+ }
2204
+ ).then(convertHttpResponse),
2205
+
2206
+ /**
2207
+ * No description
2208
+ *
2209
+ * @tags Contracts
2210
+ * @name PostContractsCallContract
2211
+ * @summary Call contract
2212
+ * @request POST:/contracts/call-contract
2213
+ */
2214
+ postContractsCallContract: (data: CallContract, params: RequestParams = {}) =>
2215
+ this.request<CallContractResult, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>(
2216
+ {
2217
+ path: `/contracts/call-contract`,
2218
+ method: 'POST',
2219
+ body: data,
2220
+ type: ContentType.Json,
2221
+ format: 'json',
2222
+ ...params
2223
+ }
2224
+ ).then(convertHttpResponse)
2225
+ }
2226
+ multisig = {
2227
+ /**
2228
+ * No description
2229
+ *
2230
+ * @tags Multi-signature
2231
+ * @name PostMultisigAddress
2232
+ * @summary Create the multisig address and unlock script
2233
+ * @request POST:/multisig/address
2234
+ */
2235
+ postMultisigAddress: (data: BuildMultisigAddress, params: RequestParams = {}) =>
2236
+ this.request<
2237
+ BuildMultisigAddressResult,
2238
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
2239
+ >({
2240
+ path: `/multisig/address`,
2241
+ method: 'POST',
2242
+ body: data,
2243
+ type: ContentType.Json,
2244
+ format: 'json',
2245
+ ...params
2246
+ }).then(convertHttpResponse),
2247
+
2248
+ /**
2249
+ * No description
2250
+ *
2251
+ * @tags Multi-signature
2252
+ * @name PostMultisigBuild
2253
+ * @summary Build a multisig unsigned transaction
2254
+ * @request POST:/multisig/build
2255
+ */
2256
+ postMultisigBuild: (data: BuildMultisig, params: RequestParams = {}) =>
2257
+ this.request<
2258
+ BuildTransactionResult,
2259
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
2260
+ >({
2261
+ path: `/multisig/build`,
2262
+ method: 'POST',
2263
+ body: data,
2264
+ type: ContentType.Json,
2265
+ format: 'json',
2266
+ ...params
2267
+ }).then(convertHttpResponse),
2268
+
2269
+ /**
2270
+ * No description
2271
+ *
2272
+ * @tags Multi-signature
2273
+ * @name PostMultisigSubmit
2274
+ * @summary Submit a multi-signed transaction
2275
+ * @request POST:/multisig/submit
2276
+ */
2277
+ postMultisigSubmit: (data: SubmitMultisig, params: RequestParams = {}) =>
2278
+ this.request<SubmitTxResult, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2279
+ path: `/multisig/submit`,
2280
+ method: 'POST',
2281
+ body: data,
2282
+ type: ContentType.Json,
2283
+ format: 'json',
2284
+ ...params
2285
+ }).then(convertHttpResponse)
2286
+ }
2287
+ utils = {
2288
+ /**
2289
+ * No description
2290
+ *
2291
+ * @tags Utils
2292
+ * @name PostUtilsVerifySignature
2293
+ * @summary Verify the SecP256K1 signature of some data
2294
+ * @request POST:/utils/verify-signature
2295
+ */
2296
+ postUtilsVerifySignature: (data: VerifySignature, params: RequestParams = {}) =>
2297
+ this.request<boolean, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2298
+ path: `/utils/verify-signature`,
2299
+ method: 'POST',
2300
+ body: data,
2301
+ type: ContentType.Json,
2302
+ format: 'json',
2303
+ ...params
2304
+ }).then(convertHttpResponse),
2305
+
2306
+ /**
2307
+ * No description
2308
+ *
2309
+ * @tags Utils
2310
+ * @name PutUtilsCheckHashIndexing
2311
+ * @summary Check and repair the indexing of block hashes
2312
+ * @request PUT:/utils/check-hash-indexing
2313
+ */
2314
+ putUtilsCheckHashIndexing: (params: RequestParams = {}) =>
2315
+ this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2316
+ path: `/utils/check-hash-indexing`,
2317
+ method: 'PUT',
2318
+ ...params
2319
+ }).then(convertHttpResponse)
2320
+ }
2321
+ miners = {
2322
+ /**
2323
+ * No description
2324
+ *
2325
+ * @tags Miners
2326
+ * @name PostMinersCpuMining
2327
+ * @summary Execute an action on CPU miner. !!! for test only !!!
2328
+ * @request POST:/miners/cpu-mining
2329
+ */
2330
+ postMinersCpuMining: (query: { action: string }, params: RequestParams = {}) =>
2331
+ this.request<boolean, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2332
+ path: `/miners/cpu-mining`,
2333
+ method: 'POST',
2334
+ query: query,
2335
+ format: 'json',
2336
+ ...params
2337
+ }).then(convertHttpResponse),
2338
+
2339
+ /**
2340
+ * No description
2341
+ *
2342
+ * @tags Miners
2343
+ * @name GetMinersAddresses
2344
+ * @summary List miner's addresses
2345
+ * @request GET:/miners/addresses
2346
+ */
2347
+ getMinersAddresses: (params: RequestParams = {}) =>
2348
+ this.request<MinerAddresses, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2349
+ path: `/miners/addresses`,
2350
+ method: 'GET',
2351
+ format: 'json',
2352
+ ...params
2353
+ }).then(convertHttpResponse),
2354
+
2355
+ /**
2356
+ * No description
2357
+ *
2358
+ * @tags Miners
2359
+ * @name PutMinersAddresses
2360
+ * @summary Update miner's addresses, but better to use user.conf instead
2361
+ * @request PUT:/miners/addresses
2362
+ */
2363
+ putMinersAddresses: (data: MinerAddresses, params: RequestParams = {}) =>
2364
+ this.request<void, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2365
+ path: `/miners/addresses`,
2366
+ method: 'PUT',
2367
+ body: data,
2368
+ type: ContentType.Json,
2369
+ ...params
2370
+ }).then(convertHttpResponse)
2371
+ }
2372
+ events = {
2373
+ /**
2374
+ * No description
2375
+ *
2376
+ * @tags Events
2377
+ * @name GetEventsContractContractaddress
2378
+ * @summary Get events for a contract within a counter range
2379
+ * @request GET:/events/contract/{contractAddress}
2380
+ */
2381
+ getEventsContractContractaddress: (
2382
+ contractAddress: string,
2383
+ query: { start: number; end?: number; group?: number },
2384
+ params: RequestParams = {}
2385
+ ) =>
2386
+ this.request<ContractEvents, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2387
+ path: `/events/contract/${contractAddress}`,
2388
+ method: 'GET',
2389
+ query: query,
2390
+ format: 'json',
2391
+ ...params
2392
+ }).then(convertHttpResponse),
2393
+
2394
+ /**
2395
+ * No description
2396
+ *
2397
+ * @tags Events
2398
+ * @name GetEventsContractContractaddressCurrentCount
2399
+ * @summary Get current value of the events counter for a contract
2400
+ * @request GET:/events/contract/{contractAddress}/current-count
2401
+ */
2402
+ getEventsContractContractaddressCurrentCount: (contractAddress: string, params: RequestParams = {}) =>
2403
+ this.request<number, BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable>({
2404
+ path: `/events/contract/${contractAddress}/current-count`,
2405
+ method: 'GET',
2406
+ format: 'json',
2407
+ ...params
2408
+ }).then(convertHttpResponse),
2409
+
2410
+ /**
2411
+ * No description
2412
+ *
2413
+ * @tags Events
2414
+ * @name GetEventsTxIdTxid
2415
+ * @summary Get events for a TxScript
2416
+ * @request GET:/events/tx-id/{txId}
2417
+ */
2418
+ getEventsTxIdTxid: (txId: string, query?: { group?: number }, params: RequestParams = {}) =>
2419
+ this.request<
2420
+ ContractEventsByTxId,
2421
+ BadRequest | Unauthorized | NotFound | InternalServerError | ServiceUnavailable
2422
+ >({
2423
+ path: `/events/tx-id/${txId}`,
2424
+ method: 'GET',
2425
+ query: query,
2426
+ format: 'json',
2427
+ ...params
2428
+ }).then(convertHttpResponse)
2429
+ }
2430
+ }