@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,1143 @@
1
+ "use strict";
2
+ /* eslint-disable */
3
+ /* tslint:disable */
4
+ /*
5
+ * ---------------------------------------------------------------
6
+ * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
7
+ * ## ##
8
+ * ## AUTHOR: acacode ##
9
+ * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
10
+ * ---------------------------------------------------------------
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.Api = exports.HttpClient = exports.ContentType = void 0;
14
+ require("cross-fetch/polyfill");
15
+ function convertHttpResponse(response) {
16
+ if (response.error) {
17
+ throw new Error(response.error.detail);
18
+ }
19
+ else {
20
+ return response.data;
21
+ }
22
+ }
23
+ var ContentType;
24
+ (function (ContentType) {
25
+ ContentType["Json"] = "application/json";
26
+ ContentType["FormData"] = "multipart/form-data";
27
+ ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
28
+ })(ContentType = exports.ContentType || (exports.ContentType = {}));
29
+ class HttpClient {
30
+ constructor(apiConfig = {}) {
31
+ this.baseUrl = '{protocol}://{host}:{port}';
32
+ this.securityData = null;
33
+ this.abortControllers = new Map();
34
+ this.customFetch = (...fetchParams) => fetch(...fetchParams);
35
+ this.baseApiParams = {
36
+ credentials: 'same-origin',
37
+ headers: {},
38
+ redirect: 'follow',
39
+ referrerPolicy: 'no-referrer'
40
+ };
41
+ this.setSecurityData = (data) => {
42
+ this.securityData = data;
43
+ };
44
+ this.contentFormatters = {
45
+ [ContentType.Json]: (input) => input !== null && (typeof input === 'object' || typeof input === 'string') ? JSON.stringify(input) : input,
46
+ [ContentType.FormData]: (input) => Object.keys(input || {}).reduce((formData, key) => {
47
+ const property = input[key];
48
+ formData.append(key, property instanceof Blob
49
+ ? property
50
+ : typeof property === 'object' && property !== null
51
+ ? JSON.stringify(property)
52
+ : `${property}`);
53
+ return formData;
54
+ }, new FormData()),
55
+ [ContentType.UrlEncoded]: (input) => this.toQueryString(input)
56
+ };
57
+ this.createAbortSignal = (cancelToken) => {
58
+ if (this.abortControllers.has(cancelToken)) {
59
+ const abortController = this.abortControllers.get(cancelToken);
60
+ if (abortController) {
61
+ return abortController.signal;
62
+ }
63
+ return void 0;
64
+ }
65
+ const abortController = new AbortController();
66
+ this.abortControllers.set(cancelToken, abortController);
67
+ return abortController.signal;
68
+ };
69
+ this.abortRequest = (cancelToken) => {
70
+ const abortController = this.abortControllers.get(cancelToken);
71
+ if (abortController) {
72
+ abortController.abort();
73
+ this.abortControllers.delete(cancelToken);
74
+ }
75
+ };
76
+ this.request = async ({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }) => {
77
+ const secureParams = ((typeof secure === 'boolean' ? secure : this.baseApiParams.secure) &&
78
+ this.securityWorker &&
79
+ (await this.securityWorker(this.securityData))) ||
80
+ {};
81
+ const requestParams = this.mergeRequestParams(params, secureParams);
82
+ const queryString = query && this.toQueryString(query);
83
+ const payloadFormatter = this.contentFormatters[type || ContentType.Json];
84
+ const responseFormat = format || requestParams.format;
85
+ return this.customFetch(`${baseUrl || this.baseUrl || ''}${path}${queryString ? `?${queryString}` : ''}`, {
86
+ ...requestParams,
87
+ headers: {
88
+ ...(type && type !== ContentType.FormData ? { 'Content-Type': type } : {}),
89
+ ...(requestParams.headers || {})
90
+ },
91
+ signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
92
+ body: typeof body === 'undefined' || body === null ? null : payloadFormatter(body)
93
+ }).then(async (response) => {
94
+ const r = response;
95
+ r.data = null;
96
+ r.error = null;
97
+ const data = !responseFormat
98
+ ? r
99
+ : await response[responseFormat]()
100
+ .then((data) => {
101
+ if (r.ok) {
102
+ r.data = data;
103
+ }
104
+ else {
105
+ r.error = data;
106
+ }
107
+ return r;
108
+ })
109
+ .catch((e) => {
110
+ r.error = e;
111
+ return r;
112
+ });
113
+ if (cancelToken) {
114
+ this.abortControllers.delete(cancelToken);
115
+ }
116
+ if (!response.ok)
117
+ throw data;
118
+ return data;
119
+ });
120
+ };
121
+ Object.assign(this, apiConfig);
122
+ }
123
+ encodeQueryParam(key, value) {
124
+ const encodedKey = encodeURIComponent(key);
125
+ return `${encodedKey}=${encodeURIComponent(typeof value === 'number' ? value : `${value}`)}`;
126
+ }
127
+ addQueryParam(query, key) {
128
+ return this.encodeQueryParam(key, query[key]);
129
+ }
130
+ addArrayQueryParam(query, key) {
131
+ const value = query[key];
132
+ return value.map((v) => this.encodeQueryParam(key, v)).join('&');
133
+ }
134
+ toQueryString(rawQuery) {
135
+ const query = rawQuery || {};
136
+ const keys = Object.keys(query).filter((key) => 'undefined' !== typeof query[key]);
137
+ return keys
138
+ .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)))
139
+ .join('&');
140
+ }
141
+ addQueryParams(rawQuery) {
142
+ const queryString = this.toQueryString(rawQuery);
143
+ return queryString ? `?${queryString}` : '';
144
+ }
145
+ mergeRequestParams(params1, params2) {
146
+ return {
147
+ ...this.baseApiParams,
148
+ ...params1,
149
+ ...(params2 || {}),
150
+ headers: {
151
+ ...(this.baseApiParams.headers || {}),
152
+ ...(params1.headers || {}),
153
+ ...((params2 && params2.headers) || {})
154
+ }
155
+ };
156
+ }
157
+ }
158
+ exports.HttpClient = HttpClient;
159
+ /**
160
+ * @title Alephium API
161
+ * @version 1.4.1
162
+ * @baseUrl {protocol}://{host}:{port}
163
+ */
164
+ class Api extends HttpClient {
165
+ constructor() {
166
+ super(...arguments);
167
+ this.wallets = {
168
+ /**
169
+ * No description
170
+ *
171
+ * @tags Wallets
172
+ * @name GetWallets
173
+ * @summary List available wallets
174
+ * @request GET:/wallets
175
+ */
176
+ getWallets: (params = {}) => this.request({
177
+ path: `/wallets`,
178
+ method: 'GET',
179
+ format: 'json',
180
+ ...params
181
+ }).then(convertHttpResponse),
182
+ /**
183
+ * No description
184
+ *
185
+ * @tags Wallets
186
+ * @name PutWallets
187
+ * @summary Restore a wallet from your mnemonic
188
+ * @request PUT:/wallets
189
+ */
190
+ putWallets: (data, params = {}) => this.request({
191
+ path: `/wallets`,
192
+ method: 'PUT',
193
+ body: data,
194
+ type: ContentType.Json,
195
+ format: 'json',
196
+ ...params
197
+ }).then(convertHttpResponse),
198
+ /**
199
+ * @description A new wallet will be created and respond with a mnemonic. Make sure to keep that mnemonic safely as it will allows you to recover your wallet. Default mnemonic size is 24, (options: 12, 15, 18, 21, 24).
200
+ *
201
+ * @tags Wallets
202
+ * @name PostWallets
203
+ * @summary Create a new wallet
204
+ * @request POST:/wallets
205
+ */
206
+ postWallets: (data, params = {}) => this.request({
207
+ path: `/wallets`,
208
+ method: 'POST',
209
+ body: data,
210
+ type: ContentType.Json,
211
+ format: 'json',
212
+ ...params
213
+ }).then(convertHttpResponse),
214
+ /**
215
+ * No description
216
+ *
217
+ * @tags Wallets
218
+ * @name GetWalletsWalletName
219
+ * @summary Get wallet's status
220
+ * @request GET:/wallets/{wallet_name}
221
+ */
222
+ getWalletsWalletName: (walletName, params = {}) => this.request({
223
+ path: `/wallets/${walletName}`,
224
+ method: 'GET',
225
+ format: 'json',
226
+ ...params
227
+ }).then(convertHttpResponse),
228
+ /**
229
+ * No description
230
+ *
231
+ * @tags Wallets
232
+ * @name DeleteWalletsWalletName
233
+ * @summary Delete your wallet file (can be recovered with your mnemonic)
234
+ * @request DELETE:/wallets/{wallet_name}
235
+ */
236
+ deleteWalletsWalletName: (walletName, data, params = {}) => this.request({
237
+ path: `/wallets/${walletName}`,
238
+ method: 'DELETE',
239
+ body: data,
240
+ type: ContentType.Json,
241
+ ...params
242
+ }).then(convertHttpResponse),
243
+ /**
244
+ * No description
245
+ *
246
+ * @tags Wallets
247
+ * @name PostWalletsWalletNameLock
248
+ * @summary Lock your wallet
249
+ * @request POST:/wallets/{wallet_name}/lock
250
+ */
251
+ postWalletsWalletNameLock: (walletName, params = {}) => this.request({
252
+ path: `/wallets/${walletName}/lock`,
253
+ method: 'POST',
254
+ ...params
255
+ }).then(convertHttpResponse),
256
+ /**
257
+ * No description
258
+ *
259
+ * @tags Wallets
260
+ * @name PostWalletsWalletNameUnlock
261
+ * @summary Unlock your wallet
262
+ * @request POST:/wallets/{wallet_name}/unlock
263
+ */
264
+ postWalletsWalletNameUnlock: (walletName, data, params = {}) => this.request({
265
+ path: `/wallets/${walletName}/unlock`,
266
+ method: 'POST',
267
+ body: data,
268
+ type: ContentType.Json,
269
+ ...params
270
+ }).then(convertHttpResponse),
271
+ /**
272
+ * No description
273
+ *
274
+ * @tags Wallets
275
+ * @name GetWalletsWalletNameBalances
276
+ * @summary Get your total balance
277
+ * @request GET:/wallets/{wallet_name}/balances
278
+ */
279
+ getWalletsWalletNameBalances: (walletName, params = {}) => this.request({
280
+ path: `/wallets/${walletName}/balances`,
281
+ method: 'GET',
282
+ format: 'json',
283
+ ...params
284
+ }).then(convertHttpResponse),
285
+ /**
286
+ * No description
287
+ *
288
+ * @tags Wallets
289
+ * @name PostWalletsWalletNameRevealMnemonic
290
+ * @summary Reveal your mnemonic. !!! use it with caution !!!
291
+ * @request POST:/wallets/{wallet_name}/reveal-mnemonic
292
+ */
293
+ postWalletsWalletNameRevealMnemonic: (walletName, data, params = {}) => this.request({
294
+ path: `/wallets/${walletName}/reveal-mnemonic`,
295
+ method: 'POST',
296
+ body: data,
297
+ type: ContentType.Json,
298
+ format: 'json',
299
+ ...params
300
+ }).then(convertHttpResponse),
301
+ /**
302
+ * No description
303
+ *
304
+ * @tags Wallets
305
+ * @name PostWalletsWalletNameTransfer
306
+ * @summary Transfer ALPH from the active address
307
+ * @request POST:/wallets/{wallet_name}/transfer
308
+ */
309
+ postWalletsWalletNameTransfer: (walletName, data, params = {}) => this.request({
310
+ path: `/wallets/${walletName}/transfer`,
311
+ method: 'POST',
312
+ body: data,
313
+ type: ContentType.Json,
314
+ format: 'json',
315
+ ...params
316
+ }).then(convertHttpResponse),
317
+ /**
318
+ * No description
319
+ *
320
+ * @tags Wallets
321
+ * @name PostWalletsWalletNameSweepActiveAddress
322
+ * @summary Transfer all unlocked ALPH from the active address to another address
323
+ * @request POST:/wallets/{wallet_name}/sweep-active-address
324
+ */
325
+ postWalletsWalletNameSweepActiveAddress: (walletName, data, params = {}) => this.request({
326
+ path: `/wallets/${walletName}/sweep-active-address`,
327
+ method: 'POST',
328
+ body: data,
329
+ type: ContentType.Json,
330
+ format: 'json',
331
+ ...params
332
+ }).then(convertHttpResponse),
333
+ /**
334
+ * No description
335
+ *
336
+ * @tags Wallets
337
+ * @name PostWalletsWalletNameSweepAllAddresses
338
+ * @summary Transfer unlocked ALPH from all addresses (including all mining addresses if applicable) to another address
339
+ * @request POST:/wallets/{wallet_name}/sweep-all-addresses
340
+ */
341
+ postWalletsWalletNameSweepAllAddresses: (walletName, data, params = {}) => this.request({
342
+ path: `/wallets/${walletName}/sweep-all-addresses`,
343
+ method: 'POST',
344
+ body: data,
345
+ type: ContentType.Json,
346
+ format: 'json',
347
+ ...params
348
+ }).then(convertHttpResponse),
349
+ /**
350
+ * No description
351
+ *
352
+ * @tags Wallets
353
+ * @name PostWalletsWalletNameSign
354
+ * @summary Sign the given data and return back the signature
355
+ * @request POST:/wallets/{wallet_name}/sign
356
+ */
357
+ postWalletsWalletNameSign: (walletName, data, params = {}) => this.request({
358
+ path: `/wallets/${walletName}/sign`,
359
+ method: 'POST',
360
+ body: data,
361
+ type: ContentType.Json,
362
+ format: 'json',
363
+ ...params
364
+ }).then(convertHttpResponse),
365
+ /**
366
+ * No description
367
+ *
368
+ * @tags Wallets
369
+ * @name GetWalletsWalletNameAddresses
370
+ * @summary List all your wallet's addresses
371
+ * @request GET:/wallets/{wallet_name}/addresses
372
+ */
373
+ getWalletsWalletNameAddresses: (walletName, params = {}) => this.request({
374
+ path: `/wallets/${walletName}/addresses`,
375
+ method: 'GET',
376
+ format: 'json',
377
+ ...params
378
+ }).then(convertHttpResponse),
379
+ /**
380
+ * No description
381
+ *
382
+ * @tags Wallets
383
+ * @name GetWalletsWalletNameAddressesAddress
384
+ * @summary Get address' info
385
+ * @request GET:/wallets/{wallet_name}/addresses/{address}
386
+ */
387
+ getWalletsWalletNameAddressesAddress: (walletName, address, params = {}) => this.request({
388
+ path: `/wallets/${walletName}/addresses/${address}`,
389
+ method: 'GET',
390
+ format: 'json',
391
+ ...params
392
+ }).then(convertHttpResponse),
393
+ /**
394
+ * @description This endpoint can only be called if the wallet was created with the `isMiner = true` flag
395
+ *
396
+ * @tags Miners
397
+ * @name GetWalletsWalletNameMinerAddresses
398
+ * @summary List all miner addresses per group
399
+ * @request GET:/wallets/{wallet_name}/miner-addresses
400
+ */
401
+ getWalletsWalletNameMinerAddresses: (walletName, params = {}) => this.request({
402
+ path: `/wallets/${walletName}/miner-addresses`,
403
+ method: 'GET',
404
+ format: 'json',
405
+ ...params
406
+ }).then(convertHttpResponse),
407
+ /**
408
+ * @description Cannot be called from a miner wallet
409
+ *
410
+ * @tags Wallets
411
+ * @name PostWalletsWalletNameDeriveNextAddress
412
+ * @summary Derive your next address
413
+ * @request POST:/wallets/{wallet_name}/derive-next-address
414
+ */
415
+ postWalletsWalletNameDeriveNextAddress: (walletName, query, params = {}) => this.request({
416
+ path: `/wallets/${walletName}/derive-next-address`,
417
+ method: 'POST',
418
+ query: query,
419
+ format: 'json',
420
+ ...params
421
+ }).then(convertHttpResponse),
422
+ /**
423
+ * @description Your wallet need to have been created with the miner flag set to true
424
+ *
425
+ * @tags Miners
426
+ * @name PostWalletsWalletNameDeriveNextMinerAddresses
427
+ * @summary Derive your next miner addresses for each group
428
+ * @request POST:/wallets/{wallet_name}/derive-next-miner-addresses
429
+ */
430
+ postWalletsWalletNameDeriveNextMinerAddresses: (walletName, params = {}) => this.request({
431
+ path: `/wallets/${walletName}/derive-next-miner-addresses`,
432
+ method: 'POST',
433
+ format: 'json',
434
+ ...params
435
+ }).then(convertHttpResponse),
436
+ /**
437
+ * No description
438
+ *
439
+ * @tags Wallets
440
+ * @name PostWalletsWalletNameChangeActiveAddress
441
+ * @summary Choose the active address
442
+ * @request POST:/wallets/{wallet_name}/change-active-address
443
+ */
444
+ postWalletsWalletNameChangeActiveAddress: (walletName, data, params = {}) => this.request({
445
+ path: `/wallets/${walletName}/change-active-address`,
446
+ method: 'POST',
447
+ body: data,
448
+ type: ContentType.Json,
449
+ ...params
450
+ }).then(convertHttpResponse)
451
+ };
452
+ this.infos = {
453
+ /**
454
+ * No description
455
+ *
456
+ * @tags Infos
457
+ * @name GetInfosNode
458
+ * @summary Get info about that node
459
+ * @request GET:/infos/node
460
+ */
461
+ getInfosNode: (params = {}) => this.request({
462
+ path: `/infos/node`,
463
+ method: 'GET',
464
+ format: 'json',
465
+ ...params
466
+ }).then(convertHttpResponse),
467
+ /**
468
+ * No description
469
+ *
470
+ * @tags Infos
471
+ * @name GetInfosVersion
472
+ * @summary Get version about that node
473
+ * @request GET:/infos/version
474
+ */
475
+ getInfosVersion: (params = {}) => this.request({
476
+ path: `/infos/version`,
477
+ method: 'GET',
478
+ format: 'json',
479
+ ...params
480
+ }).then(convertHttpResponse),
481
+ /**
482
+ * No description
483
+ *
484
+ * @tags Infos
485
+ * @name GetInfosChainParams
486
+ * @summary Get key params about your blockchain
487
+ * @request GET:/infos/chain-params
488
+ */
489
+ getInfosChainParams: (params = {}) => this.request({
490
+ path: `/infos/chain-params`,
491
+ method: 'GET',
492
+ format: 'json',
493
+ ...params
494
+ }).then(convertHttpResponse),
495
+ /**
496
+ * No description
497
+ *
498
+ * @tags Infos
499
+ * @name GetInfosSelfClique
500
+ * @summary Get info about your own clique
501
+ * @request GET:/infos/self-clique
502
+ */
503
+ getInfosSelfClique: (params = {}) => this.request({
504
+ path: `/infos/self-clique`,
505
+ method: 'GET',
506
+ format: 'json',
507
+ ...params
508
+ }).then(convertHttpResponse),
509
+ /**
510
+ * No description
511
+ *
512
+ * @tags Infos
513
+ * @name GetInfosInterCliquePeerInfo
514
+ * @summary Get infos about the inter cliques
515
+ * @request GET:/infos/inter-clique-peer-info
516
+ */
517
+ getInfosInterCliquePeerInfo: (params = {}) => this.request({
518
+ path: `/infos/inter-clique-peer-info`,
519
+ method: 'GET',
520
+ format: 'json',
521
+ ...params
522
+ }).then(convertHttpResponse),
523
+ /**
524
+ * No description
525
+ *
526
+ * @tags Infos
527
+ * @name GetInfosDiscoveredNeighbors
528
+ * @summary Get discovered neighbors
529
+ * @request GET:/infos/discovered-neighbors
530
+ */
531
+ getInfosDiscoveredNeighbors: (params = {}) => this.request({
532
+ path: `/infos/discovered-neighbors`,
533
+ method: 'GET',
534
+ format: 'json',
535
+ ...params
536
+ }).then(convertHttpResponse),
537
+ /**
538
+ * No description
539
+ *
540
+ * @tags Infos
541
+ * @name GetInfosMisbehaviors
542
+ * @summary Get the misbehaviors of peers
543
+ * @request GET:/infos/misbehaviors
544
+ */
545
+ getInfosMisbehaviors: (params = {}) => this.request({
546
+ path: `/infos/misbehaviors`,
547
+ method: 'GET',
548
+ format: 'json',
549
+ ...params
550
+ }).then(convertHttpResponse),
551
+ /**
552
+ * No description
553
+ *
554
+ * @tags Infos
555
+ * @name PostInfosMisbehaviors
556
+ * @summary Ban/Unban given peers
557
+ * @request POST:/infos/misbehaviors
558
+ */
559
+ postInfosMisbehaviors: (data, params = {}) => this.request({
560
+ path: `/infos/misbehaviors`,
561
+ method: 'POST',
562
+ body: data,
563
+ type: ContentType.Json,
564
+ ...params
565
+ }).then(convertHttpResponse),
566
+ /**
567
+ * No description
568
+ *
569
+ * @tags Infos
570
+ * @name GetInfosUnreachable
571
+ * @summary Get the unreachable brokers
572
+ * @request GET:/infos/unreachable
573
+ */
574
+ getInfosUnreachable: (params = {}) => this.request({
575
+ path: `/infos/unreachable`,
576
+ method: 'GET',
577
+ format: 'json',
578
+ ...params
579
+ }).then(convertHttpResponse),
580
+ /**
581
+ * No description
582
+ *
583
+ * @tags Infos
584
+ * @name PostInfosDiscovery
585
+ * @summary Set brokers to be unreachable/reachable
586
+ * @request POST:/infos/discovery
587
+ */
588
+ postInfosDiscovery: (data, params = {}) => this.request({
589
+ path: `/infos/discovery`,
590
+ method: 'POST',
591
+ body: data,
592
+ type: ContentType.Json,
593
+ ...params
594
+ }).then(convertHttpResponse),
595
+ /**
596
+ * No description
597
+ *
598
+ * @tags Infos
599
+ * @name GetInfosHistoryHashrate
600
+ * @summary Get history average hashrate on the given time interval
601
+ * @request GET:/infos/history-hashrate
602
+ */
603
+ getInfosHistoryHashrate: (query, params = {}) => this.request({
604
+ path: `/infos/history-hashrate`,
605
+ method: 'GET',
606
+ query: query,
607
+ format: 'json',
608
+ ...params
609
+ }).then(convertHttpResponse),
610
+ /**
611
+ * No description
612
+ *
613
+ * @tags Infos
614
+ * @name GetInfosCurrentHashrate
615
+ * @summary Get average hashrate from `now - timespan(millis)` to `now`
616
+ * @request GET:/infos/current-hashrate
617
+ */
618
+ getInfosCurrentHashrate: (query, params = {}) => this.request({
619
+ path: `/infos/current-hashrate`,
620
+ method: 'GET',
621
+ query: query,
622
+ format: 'json',
623
+ ...params
624
+ }).then(convertHttpResponse)
625
+ };
626
+ this.blockflow = {
627
+ /**
628
+ * No description
629
+ *
630
+ * @tags Blockflow
631
+ * @name GetBlockflow
632
+ * @summary List blocks on the given time interval
633
+ * @request GET:/blockflow
634
+ */
635
+ getBlockflow: (query, params = {}) => this.request({
636
+ path: `/blockflow`,
637
+ method: 'GET',
638
+ query: query,
639
+ format: 'json',
640
+ ...params
641
+ }).then(convertHttpResponse),
642
+ /**
643
+ * No description
644
+ *
645
+ * @tags Blockflow
646
+ * @name GetBlockflowBlocksBlockHash
647
+ * @summary Get a block with hash
648
+ * @request GET:/blockflow/blocks/{block_hash}
649
+ */
650
+ getBlockflowBlocksBlockHash: (blockHash, params = {}) => this.request({
651
+ path: `/blockflow/blocks/${blockHash}`,
652
+ method: 'GET',
653
+ format: 'json',
654
+ ...params
655
+ }).then(convertHttpResponse),
656
+ /**
657
+ * No description
658
+ *
659
+ * @tags Blockflow
660
+ * @name GetBlockflowIsBlockInMainChain
661
+ * @summary Check if the block is in main chain
662
+ * @request GET:/blockflow/is-block-in-main-chain
663
+ */
664
+ getBlockflowIsBlockInMainChain: (query, params = {}) => this.request({
665
+ path: `/blockflow/is-block-in-main-chain`,
666
+ method: 'GET',
667
+ query: query,
668
+ format: 'json',
669
+ ...params
670
+ }).then(convertHttpResponse),
671
+ /**
672
+ * No description
673
+ *
674
+ * @tags Blockflow
675
+ * @name GetBlockflowHashes
676
+ * @summary Get all block's hashes at given height for given groups
677
+ * @request GET:/blockflow/hashes
678
+ */
679
+ getBlockflowHashes: (query, params = {}) => this.request({
680
+ path: `/blockflow/hashes`,
681
+ method: 'GET',
682
+ query: query,
683
+ format: 'json',
684
+ ...params
685
+ }).then(convertHttpResponse),
686
+ /**
687
+ * No description
688
+ *
689
+ * @tags Blockflow
690
+ * @name GetBlockflowChainInfo
691
+ * @summary Get infos about the chain from the given groups
692
+ * @request GET:/blockflow/chain-info
693
+ */
694
+ getBlockflowChainInfo: (query, params = {}) => this.request({
695
+ path: `/blockflow/chain-info`,
696
+ method: 'GET',
697
+ query: query,
698
+ format: 'json',
699
+ ...params
700
+ }).then(convertHttpResponse),
701
+ /**
702
+ * No description
703
+ *
704
+ * @tags Blockflow
705
+ * @name GetBlockflowHeadersBlockHash
706
+ * @summary Get block header
707
+ * @request GET:/blockflow/headers/{block_hash}
708
+ */
709
+ getBlockflowHeadersBlockHash: (blockHash, params = {}) => this.request({
710
+ path: `/blockflow/headers/${blockHash}`,
711
+ method: 'GET',
712
+ format: 'json',
713
+ ...params
714
+ }).then(convertHttpResponse)
715
+ };
716
+ this.addresses = {
717
+ /**
718
+ * No description
719
+ *
720
+ * @tags Addresses
721
+ * @name GetAddressesAddressBalance
722
+ * @summary Get the balance of an address
723
+ * @request GET:/addresses/{address}/balance
724
+ */
725
+ getAddressesAddressBalance: (address, params = {}) => this.request({
726
+ path: `/addresses/${address}/balance`,
727
+ method: 'GET',
728
+ format: 'json',
729
+ ...params
730
+ }).then(convertHttpResponse),
731
+ /**
732
+ * No description
733
+ *
734
+ * @tags Addresses
735
+ * @name GetAddressesAddressUtxos
736
+ * @summary Get the UTXOs of an address
737
+ * @request GET:/addresses/{address}/utxos
738
+ */
739
+ getAddressesAddressUtxos: (address, params = {}) => this.request({
740
+ path: `/addresses/${address}/utxos`,
741
+ method: 'GET',
742
+ format: 'json',
743
+ ...params
744
+ }).then(convertHttpResponse),
745
+ /**
746
+ * No description
747
+ *
748
+ * @tags Addresses
749
+ * @name GetAddressesAddressGroup
750
+ * @summary Get the group of an address
751
+ * @request GET:/addresses/{address}/group
752
+ */
753
+ getAddressesAddressGroup: (address, params = {}) => this.request({
754
+ path: `/addresses/${address}/group`,
755
+ method: 'GET',
756
+ format: 'json',
757
+ ...params
758
+ }).then(convertHttpResponse)
759
+ };
760
+ this.transactions = {
761
+ /**
762
+ * No description
763
+ *
764
+ * @tags Transactions
765
+ * @name GetTransactionsUnconfirmed
766
+ * @summary List unconfirmed transactions
767
+ * @request GET:/transactions/unconfirmed
768
+ */
769
+ getTransactionsUnconfirmed: (params = {}) => this.request({
770
+ path: `/transactions/unconfirmed`,
771
+ method: 'GET',
772
+ format: 'json',
773
+ ...params
774
+ }).then(convertHttpResponse),
775
+ /**
776
+ * No description
777
+ *
778
+ * @tags Transactions
779
+ * @name PostTransactionsBuild
780
+ * @summary Build an unsigned transaction to a number of recipients
781
+ * @request POST:/transactions/build
782
+ */
783
+ postTransactionsBuild: (data, params = {}) => this.request({
784
+ path: `/transactions/build`,
785
+ method: 'POST',
786
+ body: data,
787
+ type: ContentType.Json,
788
+ format: 'json',
789
+ ...params
790
+ }).then(convertHttpResponse),
791
+ /**
792
+ * No description
793
+ *
794
+ * @tags Transactions
795
+ * @name PostTransactionsSweepAddressBuild
796
+ * @summary Build unsigned transactions to send all unlocked balanced of one address to another address
797
+ * @request POST:/transactions/sweep-address/build
798
+ */
799
+ postTransactionsSweepAddressBuild: (data, params = {}) => this.request({
800
+ path: `/transactions/sweep-address/build`,
801
+ method: 'POST',
802
+ body: data,
803
+ type: ContentType.Json,
804
+ format: 'json',
805
+ ...params
806
+ }).then(convertHttpResponse),
807
+ /**
808
+ * No description
809
+ *
810
+ * @tags Transactions
811
+ * @name PostTransactionsSubmit
812
+ * @summary Submit a signed transaction
813
+ * @request POST:/transactions/submit
814
+ */
815
+ postTransactionsSubmit: (data, params = {}) => this.request({
816
+ path: `/transactions/submit`,
817
+ method: 'POST',
818
+ body: data,
819
+ type: ContentType.Json,
820
+ format: 'json',
821
+ ...params
822
+ }).then(convertHttpResponse),
823
+ /**
824
+ * No description
825
+ *
826
+ * @tags Transactions
827
+ * @name PostTransactionsDecodeUnsignedTx
828
+ * @summary Decode an unsigned transaction
829
+ * @request POST:/transactions/decode-unsigned-tx
830
+ */
831
+ postTransactionsDecodeUnsignedTx: (data, params = {}) => this.request({
832
+ path: `/transactions/decode-unsigned-tx`,
833
+ method: 'POST',
834
+ body: data,
835
+ type: ContentType.Json,
836
+ format: 'json',
837
+ ...params
838
+ }).then(convertHttpResponse),
839
+ /**
840
+ * No description
841
+ *
842
+ * @tags Transactions
843
+ * @name GetTransactionsStatus
844
+ * @summary Get tx status
845
+ * @request GET:/transactions/status
846
+ */
847
+ getTransactionsStatus: (query, params = {}) => this.request({
848
+ path: `/transactions/status`,
849
+ method: 'GET',
850
+ query: query,
851
+ format: 'json',
852
+ ...params
853
+ }).then(convertHttpResponse)
854
+ };
855
+ this.contracts = {
856
+ /**
857
+ * No description
858
+ *
859
+ * @tags Contracts
860
+ * @name PostContractsCompileScript
861
+ * @summary Compile a script
862
+ * @request POST:/contracts/compile-script
863
+ */
864
+ postContractsCompileScript: (data, params = {}) => this.request({
865
+ path: `/contracts/compile-script`,
866
+ method: 'POST',
867
+ body: data,
868
+ type: ContentType.Json,
869
+ format: 'json',
870
+ ...params
871
+ }).then(convertHttpResponse),
872
+ /**
873
+ * No description
874
+ *
875
+ * @tags Contracts
876
+ * @name PostContractsUnsignedTxExecuteScript
877
+ * @summary Build an unsigned script
878
+ * @request POST:/contracts/unsigned-tx/execute-script
879
+ */
880
+ postContractsUnsignedTxExecuteScript: (data, params = {}) => this.request({
881
+ path: `/contracts/unsigned-tx/execute-script`,
882
+ method: 'POST',
883
+ body: data,
884
+ type: ContentType.Json,
885
+ format: 'json',
886
+ ...params
887
+ }).then(convertHttpResponse),
888
+ /**
889
+ * No description
890
+ *
891
+ * @tags Contracts
892
+ * @name PostContractsCompileContract
893
+ * @summary Compile a smart contract
894
+ * @request POST:/contracts/compile-contract
895
+ */
896
+ postContractsCompileContract: (data, params = {}) => this.request({
897
+ path: `/contracts/compile-contract`,
898
+ method: 'POST',
899
+ body: data,
900
+ type: ContentType.Json,
901
+ format: 'json',
902
+ ...params
903
+ }).then(convertHttpResponse),
904
+ /**
905
+ * No description
906
+ *
907
+ * @tags Contracts
908
+ * @name PostContractsUnsignedTxDeployContract
909
+ * @summary Build an unsigned contract
910
+ * @request POST:/contracts/unsigned-tx/deploy-contract
911
+ */
912
+ postContractsUnsignedTxDeployContract: (data, params = {}) => this.request({
913
+ path: `/contracts/unsigned-tx/deploy-contract`,
914
+ method: 'POST',
915
+ body: data,
916
+ type: ContentType.Json,
917
+ format: 'json',
918
+ ...params
919
+ }).then(convertHttpResponse),
920
+ /**
921
+ * No description
922
+ *
923
+ * @tags Contracts
924
+ * @name GetContractsAddressState
925
+ * @summary Get contract state
926
+ * @request GET:/contracts/{address}/state
927
+ */
928
+ getContractsAddressState: (address, query, params = {}) => this.request({
929
+ path: `/contracts/${address}/state`,
930
+ method: 'GET',
931
+ query: query,
932
+ format: 'json',
933
+ ...params
934
+ }).then(convertHttpResponse),
935
+ /**
936
+ * No description
937
+ *
938
+ * @tags Contracts
939
+ * @name PostContractsTestContract
940
+ * @summary Test contract
941
+ * @request POST:/contracts/test-contract
942
+ */
943
+ postContractsTestContract: (data, params = {}) => this.request({
944
+ path: `/contracts/test-contract`,
945
+ method: 'POST',
946
+ body: data,
947
+ type: ContentType.Json,
948
+ format: 'json',
949
+ ...params
950
+ }).then(convertHttpResponse),
951
+ /**
952
+ * No description
953
+ *
954
+ * @tags Contracts
955
+ * @name PostContractsCallContract
956
+ * @summary Call contract
957
+ * @request POST:/contracts/call-contract
958
+ */
959
+ postContractsCallContract: (data, params = {}) => this.request({
960
+ path: `/contracts/call-contract`,
961
+ method: 'POST',
962
+ body: data,
963
+ type: ContentType.Json,
964
+ format: 'json',
965
+ ...params
966
+ }).then(convertHttpResponse)
967
+ };
968
+ this.multisig = {
969
+ /**
970
+ * No description
971
+ *
972
+ * @tags Multi-signature
973
+ * @name PostMultisigAddress
974
+ * @summary Create the multisig address and unlock script
975
+ * @request POST:/multisig/address
976
+ */
977
+ postMultisigAddress: (data, params = {}) => this.request({
978
+ path: `/multisig/address`,
979
+ method: 'POST',
980
+ body: data,
981
+ type: ContentType.Json,
982
+ format: 'json',
983
+ ...params
984
+ }).then(convertHttpResponse),
985
+ /**
986
+ * No description
987
+ *
988
+ * @tags Multi-signature
989
+ * @name PostMultisigBuild
990
+ * @summary Build a multisig unsigned transaction
991
+ * @request POST:/multisig/build
992
+ */
993
+ postMultisigBuild: (data, params = {}) => this.request({
994
+ path: `/multisig/build`,
995
+ method: 'POST',
996
+ body: data,
997
+ type: ContentType.Json,
998
+ format: 'json',
999
+ ...params
1000
+ }).then(convertHttpResponse),
1001
+ /**
1002
+ * No description
1003
+ *
1004
+ * @tags Multi-signature
1005
+ * @name PostMultisigSubmit
1006
+ * @summary Submit a multi-signed transaction
1007
+ * @request POST:/multisig/submit
1008
+ */
1009
+ postMultisigSubmit: (data, params = {}) => this.request({
1010
+ path: `/multisig/submit`,
1011
+ method: 'POST',
1012
+ body: data,
1013
+ type: ContentType.Json,
1014
+ format: 'json',
1015
+ ...params
1016
+ }).then(convertHttpResponse)
1017
+ };
1018
+ this.utils = {
1019
+ /**
1020
+ * No description
1021
+ *
1022
+ * @tags Utils
1023
+ * @name PostUtilsVerifySignature
1024
+ * @summary Verify the SecP256K1 signature of some data
1025
+ * @request POST:/utils/verify-signature
1026
+ */
1027
+ postUtilsVerifySignature: (data, params = {}) => this.request({
1028
+ path: `/utils/verify-signature`,
1029
+ method: 'POST',
1030
+ body: data,
1031
+ type: ContentType.Json,
1032
+ format: 'json',
1033
+ ...params
1034
+ }).then(convertHttpResponse),
1035
+ /**
1036
+ * No description
1037
+ *
1038
+ * @tags Utils
1039
+ * @name PutUtilsCheckHashIndexing
1040
+ * @summary Check and repair the indexing of block hashes
1041
+ * @request PUT:/utils/check-hash-indexing
1042
+ */
1043
+ putUtilsCheckHashIndexing: (params = {}) => this.request({
1044
+ path: `/utils/check-hash-indexing`,
1045
+ method: 'PUT',
1046
+ ...params
1047
+ }).then(convertHttpResponse)
1048
+ };
1049
+ this.miners = {
1050
+ /**
1051
+ * No description
1052
+ *
1053
+ * @tags Miners
1054
+ * @name PostMinersCpuMining
1055
+ * @summary Execute an action on CPU miner. !!! for test only !!!
1056
+ * @request POST:/miners/cpu-mining
1057
+ */
1058
+ postMinersCpuMining: (query, params = {}) => this.request({
1059
+ path: `/miners/cpu-mining`,
1060
+ method: 'POST',
1061
+ query: query,
1062
+ format: 'json',
1063
+ ...params
1064
+ }).then(convertHttpResponse),
1065
+ /**
1066
+ * No description
1067
+ *
1068
+ * @tags Miners
1069
+ * @name GetMinersAddresses
1070
+ * @summary List miner's addresses
1071
+ * @request GET:/miners/addresses
1072
+ */
1073
+ getMinersAddresses: (params = {}) => this.request({
1074
+ path: `/miners/addresses`,
1075
+ method: 'GET',
1076
+ format: 'json',
1077
+ ...params
1078
+ }).then(convertHttpResponse),
1079
+ /**
1080
+ * No description
1081
+ *
1082
+ * @tags Miners
1083
+ * @name PutMinersAddresses
1084
+ * @summary Update miner's addresses, but better to use user.conf instead
1085
+ * @request PUT:/miners/addresses
1086
+ */
1087
+ putMinersAddresses: (data, params = {}) => this.request({
1088
+ path: `/miners/addresses`,
1089
+ method: 'PUT',
1090
+ body: data,
1091
+ type: ContentType.Json,
1092
+ ...params
1093
+ }).then(convertHttpResponse)
1094
+ };
1095
+ this.events = {
1096
+ /**
1097
+ * No description
1098
+ *
1099
+ * @tags Events
1100
+ * @name GetEventsContractContractaddress
1101
+ * @summary Get events for a contract within a counter range
1102
+ * @request GET:/events/contract/{contractAddress}
1103
+ */
1104
+ getEventsContractContractaddress: (contractAddress, query, params = {}) => this.request({
1105
+ path: `/events/contract/${contractAddress}`,
1106
+ method: 'GET',
1107
+ query: query,
1108
+ format: 'json',
1109
+ ...params
1110
+ }).then(convertHttpResponse),
1111
+ /**
1112
+ * No description
1113
+ *
1114
+ * @tags Events
1115
+ * @name GetEventsContractContractaddressCurrentCount
1116
+ * @summary Get current value of the events counter for a contract
1117
+ * @request GET:/events/contract/{contractAddress}/current-count
1118
+ */
1119
+ getEventsContractContractaddressCurrentCount: (contractAddress, params = {}) => this.request({
1120
+ path: `/events/contract/${contractAddress}/current-count`,
1121
+ method: 'GET',
1122
+ format: 'json',
1123
+ ...params
1124
+ }).then(convertHttpResponse),
1125
+ /**
1126
+ * No description
1127
+ *
1128
+ * @tags Events
1129
+ * @name GetEventsTxIdTxid
1130
+ * @summary Get events for a TxScript
1131
+ * @request GET:/events/tx-id/{txId}
1132
+ */
1133
+ getEventsTxIdTxid: (txId, query, params = {}) => this.request({
1134
+ path: `/events/tx-id/${txId}`,
1135
+ method: 'GET',
1136
+ query: query,
1137
+ format: 'json',
1138
+ ...params
1139
+ }).then(convertHttpResponse)
1140
+ };
1141
+ }
1142
+ }
1143
+ exports.Api = Api;