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