@alephium/web3 0.0.3

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 (59) hide show
  1. package/.gitattributes +1 -0
  2. package/LICENSE +165 -0
  3. package/README.md +136 -0
  4. package/contracts/add.ral +12 -0
  5. package/contracts/greeter-main.ral +8 -0
  6. package/contracts/greeter.ral +5 -0
  7. package/contracts/main.ral +8 -0
  8. package/contracts/sub.ral +9 -0
  9. package/dev/user.conf +24 -0
  10. package/dist/alephium-web3.min.js +3 -0
  11. package/dist/alephium-web3.min.js.LICENSE.txt +27 -0
  12. package/dist/alephium-web3.min.js.map +1 -0
  13. package/dist/api/api-alephium.d.ts +1292 -0
  14. package/dist/api/api-alephium.js +761 -0
  15. package/dist/api/api-explorer.d.ts +350 -0
  16. package/dist/api/api-explorer.js +297 -0
  17. package/dist/cli/create-project.d.ts +2 -0
  18. package/dist/cli/create-project.js +87 -0
  19. package/dist/lib/address.d.ts +1 -0
  20. package/dist/lib/address.js +42 -0
  21. package/dist/lib/bs58.d.ts +4 -0
  22. package/dist/lib/bs58.js +26 -0
  23. package/dist/lib/clique.d.ts +23 -0
  24. package/dist/lib/clique.js +149 -0
  25. package/dist/lib/constants.d.ts +2 -0
  26. package/dist/lib/constants.js +22 -0
  27. package/dist/lib/contract.d.ts +152 -0
  28. package/dist/lib/contract.js +711 -0
  29. package/dist/lib/djb2.d.ts +1 -0
  30. package/dist/lib/djb2.js +27 -0
  31. package/dist/lib/explorer.d.ts +8 -0
  32. package/dist/lib/explorer.js +46 -0
  33. package/dist/lib/index.d.ts +12 -0
  34. package/dist/lib/index.js +60 -0
  35. package/dist/lib/node.d.ts +10 -0
  36. package/dist/lib/node.js +64 -0
  37. package/dist/lib/numbers.d.ts +7 -0
  38. package/dist/lib/numbers.js +128 -0
  39. package/dist/lib/password-crypto.d.ts +2 -0
  40. package/dist/lib/password-crypto.js +68 -0
  41. package/dist/lib/signer.d.ts +17 -0
  42. package/dist/lib/signer.js +70 -0
  43. package/dist/lib/storage-browser.d.ts +9 -0
  44. package/dist/lib/storage-browser.js +52 -0
  45. package/dist/lib/storage-node.d.ts +9 -0
  46. package/dist/lib/storage-node.js +65 -0
  47. package/dist/lib/utils.d.ts +11 -0
  48. package/dist/lib/utils.js +135 -0
  49. package/dist/lib/wallet.d.ts +30 -0
  50. package/dist/lib/wallet.js +142 -0
  51. package/gitignore +9 -0
  52. package/package.json +113 -0
  53. package/scripts/check-versions.js +45 -0
  54. package/scripts/rename-gitignore.js +24 -0
  55. package/scripts/start-devnet.js +141 -0
  56. package/scripts/stop-devnet.js +32 -0
  57. package/templates/README.md +34 -0
  58. package/templates/package.json +29 -0
  59. package/webpack.config.js +57 -0
@@ -0,0 +1,761 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __rest = (this && this.__rest) || function (s, e) {
22
+ var t = {};
23
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24
+ t[p] = s[p];
25
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
26
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
27
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
28
+ t[p[i]] = s[p[i]];
29
+ }
30
+ return t;
31
+ };
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.Api = exports.HttpClient = exports.ContentType = void 0;
34
+ require("cross-fetch/polyfill");
35
+ var ContentType;
36
+ (function (ContentType) {
37
+ ContentType["Json"] = "application/json";
38
+ ContentType["FormData"] = "multipart/form-data";
39
+ ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
40
+ })(ContentType = exports.ContentType || (exports.ContentType = {}));
41
+ class HttpClient {
42
+ constructor(apiConfig = {}) {
43
+ this.baseUrl = '{protocol}://{host}:{port}';
44
+ this.securityData = null;
45
+ this.abortControllers = new Map();
46
+ this.customFetch = (...fetchParams) => fetch(...fetchParams);
47
+ this.baseApiParams = {
48
+ credentials: 'same-origin',
49
+ headers: {},
50
+ redirect: 'follow',
51
+ referrerPolicy: 'no-referrer'
52
+ };
53
+ this.setSecurityData = (data) => {
54
+ this.securityData = data;
55
+ };
56
+ this.contentFormatters = {
57
+ [ContentType.Json]: (input) => input !== null && (typeof input === 'object' || typeof input === 'string') ? JSON.stringify(input) : input,
58
+ [ContentType.FormData]: (input) => Object.keys(input || {}).reduce((formData, key) => {
59
+ const property = input[key];
60
+ formData.append(key, property instanceof Blob
61
+ ? property
62
+ : typeof property === 'object' && property !== null
63
+ ? JSON.stringify(property)
64
+ : `${property}`);
65
+ return formData;
66
+ }, new FormData()),
67
+ [ContentType.UrlEncoded]: (input) => this.toQueryString(input)
68
+ };
69
+ this.createAbortSignal = (cancelToken) => {
70
+ if (this.abortControllers.has(cancelToken)) {
71
+ const abortController = this.abortControllers.get(cancelToken);
72
+ if (abortController) {
73
+ return abortController.signal;
74
+ }
75
+ return void 0;
76
+ }
77
+ const abortController = new AbortController();
78
+ this.abortControllers.set(cancelToken, abortController);
79
+ return abortController.signal;
80
+ };
81
+ this.abortRequest = (cancelToken) => {
82
+ const abortController = this.abortControllers.get(cancelToken);
83
+ if (abortController) {
84
+ abortController.abort();
85
+ this.abortControllers.delete(cancelToken);
86
+ }
87
+ };
88
+ this.request = (_a) => __awaiter(this, void 0, void 0, function* () {
89
+ var { body, secure, path, type, query, format, baseUrl, cancelToken } = _a, params = __rest(_a, ["body", "secure", "path", "type", "query", "format", "baseUrl", "cancelToken"]);
90
+ const secureParams = ((typeof secure === 'boolean' ? secure : this.baseApiParams.secure) &&
91
+ this.securityWorker &&
92
+ (yield this.securityWorker(this.securityData))) ||
93
+ {};
94
+ const requestParams = this.mergeRequestParams(params, secureParams);
95
+ const queryString = query && this.toQueryString(query);
96
+ const payloadFormatter = this.contentFormatters[type || ContentType.Json];
97
+ const responseFormat = format || requestParams.format;
98
+ return this.customFetch(`${baseUrl || this.baseUrl || ''}${path}${queryString ? `?${queryString}` : ''}`, Object.assign(Object.assign({}, requestParams), { headers: Object.assign(Object.assign({}, (type && type !== ContentType.FormData ? { 'Content-Type': type } : {})), (requestParams.headers || {})), signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0, body: typeof body === 'undefined' || body === null ? null : payloadFormatter(body) })).then((response) => __awaiter(this, void 0, void 0, function* () {
99
+ const r = response;
100
+ r.data = null;
101
+ r.error = null;
102
+ const data = !responseFormat
103
+ ? r
104
+ : yield response[responseFormat]()
105
+ .then((data) => {
106
+ if (r.ok) {
107
+ r.data = data;
108
+ }
109
+ else {
110
+ r.error = data;
111
+ }
112
+ return r;
113
+ })
114
+ .catch((e) => {
115
+ r.error = e;
116
+ return r;
117
+ });
118
+ if (cancelToken) {
119
+ this.abortControllers.delete(cancelToken);
120
+ }
121
+ if (!response.ok)
122
+ throw data;
123
+ return data;
124
+ }));
125
+ });
126
+ Object.assign(this, apiConfig);
127
+ }
128
+ encodeQueryParam(key, value) {
129
+ const encodedKey = encodeURIComponent(key);
130
+ return `${encodedKey}=${encodeURIComponent(typeof value === 'number' ? value : `${value}`)}`;
131
+ }
132
+ addQueryParam(query, key) {
133
+ return this.encodeQueryParam(key, query[key]);
134
+ }
135
+ addArrayQueryParam(query, key) {
136
+ const value = query[key];
137
+ return value.map((v) => this.encodeQueryParam(key, v)).join('&');
138
+ }
139
+ toQueryString(rawQuery) {
140
+ const query = rawQuery || {};
141
+ const keys = Object.keys(query).filter((key) => 'undefined' !== typeof query[key]);
142
+ return keys
143
+ .map((key) => (Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)))
144
+ .join('&');
145
+ }
146
+ addQueryParams(rawQuery) {
147
+ const queryString = this.toQueryString(rawQuery);
148
+ return queryString ? `?${queryString}` : '';
149
+ }
150
+ mergeRequestParams(params1, params2) {
151
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, this.baseApiParams), params1), (params2 || {})), { headers: Object.assign(Object.assign(Object.assign({}, (this.baseApiParams.headers || {})), (params1.headers || {})), ((params2 && params2.headers) || {})) });
152
+ }
153
+ }
154
+ exports.HttpClient = HttpClient;
155
+ /**
156
+ * @title Alephium API
157
+ * @version 1.3.0
158
+ * @baseUrl {protocol}://{host}:{port}
159
+ */
160
+ class Api extends HttpClient {
161
+ constructor() {
162
+ super(...arguments);
163
+ this.wallets = {
164
+ /**
165
+ * No description
166
+ *
167
+ * @tags Wallets
168
+ * @name GetWallets
169
+ * @summary List available wallets
170
+ * @request GET:/wallets
171
+ */
172
+ getWallets: (params = {}) => this.request(Object.assign({ path: `/wallets`, method: 'GET', format: 'json' }, params)),
173
+ /**
174
+ * No description
175
+ *
176
+ * @tags Wallets
177
+ * @name PutWallets
178
+ * @summary Restore a wallet from your mnemonic
179
+ * @request PUT:/wallets
180
+ */
181
+ putWallets: (data, params = {}) => this.request(Object.assign({ path: `/wallets`, method: 'PUT', body: data, type: ContentType.Json, format: 'json' }, params)),
182
+ /**
183
+ * @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).
184
+ *
185
+ * @tags Wallets
186
+ * @name PostWallets
187
+ * @summary Create a new wallet
188
+ * @request POST:/wallets
189
+ */
190
+ postWallets: (data, params = {}) => this.request(Object.assign({ path: `/wallets`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
191
+ /**
192
+ * No description
193
+ *
194
+ * @tags Wallets
195
+ * @name GetWalletsWalletName
196
+ * @summary Get wallet's status
197
+ * @request GET:/wallets/{wallet_name}
198
+ */
199
+ getWalletsWalletName: (walletName, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}`, method: 'GET', format: 'json' }, params)),
200
+ /**
201
+ * No description
202
+ *
203
+ * @tags Wallets
204
+ * @name DeleteWalletsWalletName
205
+ * @summary Delete your wallet file (can be recovered with your mnemonic)
206
+ * @request DELETE:/wallets/{wallet_name}
207
+ */
208
+ deleteWalletsWalletName: (walletName, data, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}`, method: 'DELETE', body: data, type: ContentType.Json }, params)),
209
+ /**
210
+ * No description
211
+ *
212
+ * @tags Wallets
213
+ * @name PostWalletsWalletNameLock
214
+ * @summary Lock your wallet
215
+ * @request POST:/wallets/{wallet_name}/lock
216
+ */
217
+ postWalletsWalletNameLock: (walletName, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/lock`, method: 'POST' }, params)),
218
+ /**
219
+ * No description
220
+ *
221
+ * @tags Wallets
222
+ * @name PostWalletsWalletNameUnlock
223
+ * @summary Unlock your wallet
224
+ * @request POST:/wallets/{wallet_name}/unlock
225
+ */
226
+ postWalletsWalletNameUnlock: (walletName, data, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/unlock`, method: 'POST', body: data, type: ContentType.Json }, params)),
227
+ /**
228
+ * No description
229
+ *
230
+ * @tags Wallets
231
+ * @name GetWalletsWalletNameBalances
232
+ * @summary Get your total balance
233
+ * @request GET:/wallets/{wallet_name}/balances
234
+ */
235
+ getWalletsWalletNameBalances: (walletName, query, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/balances`, method: 'GET', query: query, format: 'json' }, params)),
236
+ /**
237
+ * No description
238
+ *
239
+ * @tags Wallets
240
+ * @name PostWalletsWalletNameRevealMnemonic
241
+ * @summary Reveal your mnemonic. !!! use it with caution !!!
242
+ * @request POST:/wallets/{wallet_name}/reveal-mnemonic
243
+ */
244
+ postWalletsWalletNameRevealMnemonic: (walletName, data, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/reveal-mnemonic`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
245
+ /**
246
+ * No description
247
+ *
248
+ * @tags Wallets
249
+ * @name PostWalletsWalletNameTransfer
250
+ * @summary Transfer ALPH from the active address
251
+ * @request POST:/wallets/{wallet_name}/transfer
252
+ */
253
+ postWalletsWalletNameTransfer: (walletName, data, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/transfer`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
254
+ /**
255
+ * No description
256
+ *
257
+ * @tags Wallets
258
+ * @name PostWalletsWalletNameSweepActiveAddress
259
+ * @summary Transfer all unlocked ALPH from the active address to another address
260
+ * @request POST:/wallets/{wallet_name}/sweep-active-address
261
+ */
262
+ postWalletsWalletNameSweepActiveAddress: (walletName, data, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/sweep-active-address`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
263
+ /**
264
+ * No description
265
+ *
266
+ * @tags Wallets
267
+ * @name PostWalletsWalletNameSweepAllAddresses
268
+ * @summary Transfer unlocked ALPH from all addresses (including all mining addresses if applicable) to another address
269
+ * @request POST:/wallets/{wallet_name}/sweep-all-addresses
270
+ */
271
+ postWalletsWalletNameSweepAllAddresses: (walletName, data, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/sweep-all-addresses`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
272
+ /**
273
+ * No description
274
+ *
275
+ * @tags Wallets
276
+ * @name PostWalletsWalletNameSign
277
+ * @summary Sign the given data and return back the signature
278
+ * @request POST:/wallets/{wallet_name}/sign
279
+ */
280
+ postWalletsWalletNameSign: (walletName, data, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/sign`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
281
+ /**
282
+ * No description
283
+ *
284
+ * @tags Wallets
285
+ * @name GetWalletsWalletNameAddresses
286
+ * @summary List all your wallet's addresses
287
+ * @request GET:/wallets/{wallet_name}/addresses
288
+ */
289
+ getWalletsWalletNameAddresses: (walletName, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/addresses`, method: 'GET', format: 'json' }, params)),
290
+ /**
291
+ * No description
292
+ *
293
+ * @tags Wallets
294
+ * @name GetWalletsWalletNameAddressesAddress
295
+ * @summary Get address' info
296
+ * @request GET:/wallets/{wallet_name}/addresses/{address}
297
+ */
298
+ getWalletsWalletNameAddressesAddress: (walletName, address, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/addresses/${address}`, method: 'GET', format: 'json' }, params)),
299
+ /**
300
+ * @description This endpoint can only be called if the wallet was created with the `isMiner = true` flag
301
+ *
302
+ * @tags Miners
303
+ * @name GetWalletsWalletNameMinerAddresses
304
+ * @summary List all miner addresses per group
305
+ * @request GET:/wallets/{wallet_name}/miner-addresses
306
+ */
307
+ getWalletsWalletNameMinerAddresses: (walletName, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/miner-addresses`, method: 'GET', format: 'json' }, params)),
308
+ /**
309
+ * @description Cannot be called from a miner wallet
310
+ *
311
+ * @tags Wallets
312
+ * @name PostWalletsWalletNameDeriveNextAddress
313
+ * @summary Derive your next address
314
+ * @request POST:/wallets/{wallet_name}/derive-next-address
315
+ */
316
+ postWalletsWalletNameDeriveNextAddress: (walletName, query, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/derive-next-address`, method: 'POST', query: query, format: 'json' }, params)),
317
+ /**
318
+ * @description Your wallet need to have been created with the miner flag set to true
319
+ *
320
+ * @tags Miners
321
+ * @name PostWalletsWalletNameDeriveNextMinerAddresses
322
+ * @summary Derive your next miner addresses for each group
323
+ * @request POST:/wallets/{wallet_name}/derive-next-miner-addresses
324
+ */
325
+ postWalletsWalletNameDeriveNextMinerAddresses: (walletName, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/derive-next-miner-addresses`, method: 'POST', format: 'json' }, params)),
326
+ /**
327
+ * No description
328
+ *
329
+ * @tags Wallets
330
+ * @name PostWalletsWalletNameChangeActiveAddress
331
+ * @summary Choose the active address
332
+ * @request POST:/wallets/{wallet_name}/change-active-address
333
+ */
334
+ postWalletsWalletNameChangeActiveAddress: (walletName, data, params = {}) => this.request(Object.assign({ path: `/wallets/${walletName}/change-active-address`, method: 'POST', body: data, type: ContentType.Json }, params))
335
+ };
336
+ this.infos = {
337
+ /**
338
+ * No description
339
+ *
340
+ * @tags Infos
341
+ * @name GetInfosNode
342
+ * @summary Get info about that node
343
+ * @request GET:/infos/node
344
+ */
345
+ getInfosNode: (params = {}) => this.request(Object.assign({ path: `/infos/node`, method: 'GET', format: 'json' }, params)),
346
+ /**
347
+ * No description
348
+ *
349
+ * @tags Infos
350
+ * @name GetInfosVersion
351
+ * @summary Get version about that node
352
+ * @request GET:/infos/version
353
+ */
354
+ getInfosVersion: (params = {}) => this.request(Object.assign({ path: `/infos/version`, method: 'GET', format: 'json' }, params)),
355
+ /**
356
+ * No description
357
+ *
358
+ * @tags Infos
359
+ * @name GetInfosChainParams
360
+ * @summary Get key params about your blockchain
361
+ * @request GET:/infos/chain-params
362
+ */
363
+ getInfosChainParams: (params = {}) => this.request(Object.assign({ path: `/infos/chain-params`, method: 'GET', format: 'json' }, params)),
364
+ /**
365
+ * No description
366
+ *
367
+ * @tags Infos
368
+ * @name GetInfosSelfClique
369
+ * @summary Get info about your own clique
370
+ * @request GET:/infos/self-clique
371
+ */
372
+ getInfosSelfClique: (params = {}) => this.request(Object.assign({ path: `/infos/self-clique`, method: 'GET', format: 'json' }, params)),
373
+ /**
374
+ * No description
375
+ *
376
+ * @tags Infos
377
+ * @name GetInfosInterCliquePeerInfo
378
+ * @summary Get infos about the inter cliques
379
+ * @request GET:/infos/inter-clique-peer-info
380
+ */
381
+ getInfosInterCliquePeerInfo: (params = {}) => this.request(Object.assign({ path: `/infos/inter-clique-peer-info`, method: 'GET', format: 'json' }, params)),
382
+ /**
383
+ * No description
384
+ *
385
+ * @tags Infos
386
+ * @name GetInfosDiscoveredNeighbors
387
+ * @summary Get discovered neighbors
388
+ * @request GET:/infos/discovered-neighbors
389
+ */
390
+ getInfosDiscoveredNeighbors: (params = {}) => this.request(Object.assign({ path: `/infos/discovered-neighbors`, method: 'GET', format: 'json' }, params)),
391
+ /**
392
+ * No description
393
+ *
394
+ * @tags Infos
395
+ * @name GetInfosMisbehaviors
396
+ * @summary Get the misbehaviors of peers
397
+ * @request GET:/infos/misbehaviors
398
+ */
399
+ getInfosMisbehaviors: (params = {}) => this.request(Object.assign({ path: `/infos/misbehaviors`, method: 'GET', format: 'json' }, params)),
400
+ /**
401
+ * No description
402
+ *
403
+ * @tags Infos
404
+ * @name PostInfosMisbehaviors
405
+ * @summary Ban/Unban given peers
406
+ * @request POST:/infos/misbehaviors
407
+ */
408
+ postInfosMisbehaviors: (data, params = {}) => this.request(Object.assign({ path: `/infos/misbehaviors`, method: 'POST', body: data, type: ContentType.Json }, params)),
409
+ /**
410
+ * No description
411
+ *
412
+ * @tags Infos
413
+ * @name GetInfosUnreachable
414
+ * @summary Get the unreachable brokers
415
+ * @request GET:/infos/unreachable
416
+ */
417
+ getInfosUnreachable: (params = {}) => this.request(Object.assign({ path: `/infos/unreachable`, method: 'GET', format: 'json' }, params)),
418
+ /**
419
+ * No description
420
+ *
421
+ * @tags Infos
422
+ * @name PostInfosDiscovery
423
+ * @summary Set brokers to be unreachable/reachable
424
+ * @request POST:/infos/discovery
425
+ */
426
+ postInfosDiscovery: (data, params = {}) => this.request(Object.assign({ path: `/infos/discovery`, method: 'POST', body: data, type: ContentType.Json }, params)),
427
+ /**
428
+ * No description
429
+ *
430
+ * @tags Infos
431
+ * @name GetInfosHistoryHashrate
432
+ * @summary Get history average hashrate on the given time interval
433
+ * @request GET:/infos/history-hashrate
434
+ */
435
+ getInfosHistoryHashrate: (query, params = {}) => this.request(Object.assign({ path: `/infos/history-hashrate`, method: 'GET', query: query, format: 'json' }, params)),
436
+ /**
437
+ * No description
438
+ *
439
+ * @tags Infos
440
+ * @name GetInfosCurrentHashrate
441
+ * @summary Get average hashrate from `now - timespan(millis)` to `now`
442
+ * @request GET:/infos/current-hashrate
443
+ */
444
+ getInfosCurrentHashrate: (query, params = {}) => this.request(Object.assign({ path: `/infos/current-hashrate`, method: 'GET', query: query, format: 'json' }, params))
445
+ };
446
+ this.blockflow = {
447
+ /**
448
+ * No description
449
+ *
450
+ * @tags Blockflow
451
+ * @name GetBlockflow
452
+ * @summary List blocks on the given time interval
453
+ * @request GET:/blockflow
454
+ */
455
+ getBlockflow: (query, params = {}) => this.request(Object.assign({ path: `/blockflow`, method: 'GET', query: query, format: 'json' }, params)),
456
+ /**
457
+ * No description
458
+ *
459
+ * @tags Blockflow
460
+ * @name GetBlockflowBlocksBlockHash
461
+ * @summary Get a block with hash
462
+ * @request GET:/blockflow/blocks/{block_hash}
463
+ */
464
+ getBlockflowBlocksBlockHash: (blockHash, params = {}) => this.request(Object.assign({ path: `/blockflow/blocks/${blockHash}`, method: 'GET', format: 'json' }, params)),
465
+ /**
466
+ * No description
467
+ *
468
+ * @tags Blockflow
469
+ * @name GetBlockflowIsBlockInMainChain
470
+ * @summary Check if the block is in main chain
471
+ * @request GET:/blockflow/is-block-in-main-chain
472
+ */
473
+ getBlockflowIsBlockInMainChain: (query, params = {}) => this.request(Object.assign({ path: `/blockflow/is-block-in-main-chain`, method: 'GET', query: query, format: 'json' }, params)),
474
+ /**
475
+ * No description
476
+ *
477
+ * @tags Blockflow
478
+ * @name GetBlockflowHashes
479
+ * @summary Get all block's hashes at given height for given groups
480
+ * @request GET:/blockflow/hashes
481
+ */
482
+ getBlockflowHashes: (query, params = {}) => this.request(Object.assign({ path: `/blockflow/hashes`, method: 'GET', query: query, format: 'json' }, params)),
483
+ /**
484
+ * No description
485
+ *
486
+ * @tags Blockflow
487
+ * @name GetBlockflowChainInfo
488
+ * @summary Get infos about the chain from the given groups
489
+ * @request GET:/blockflow/chain-info
490
+ */
491
+ getBlockflowChainInfo: (query, params = {}) => this.request(Object.assign({ path: `/blockflow/chain-info`, method: 'GET', query: query, format: 'json' }, params)),
492
+ /**
493
+ * No description
494
+ *
495
+ * @tags Blockflow
496
+ * @name GetBlockflowHeadersBlockHash
497
+ * @summary Get block header
498
+ * @request GET:/blockflow/headers/{block_hash}
499
+ */
500
+ getBlockflowHeadersBlockHash: (blockHash, params = {}) => this.request(Object.assign({ path: `/blockflow/headers/${blockHash}`, method: 'GET', format: 'json' }, params))
501
+ };
502
+ this.addresses = {
503
+ /**
504
+ * No description
505
+ *
506
+ * @tags Addresses
507
+ * @name GetAddressesAddressBalance
508
+ * @summary Get the balance of an address
509
+ * @request GET:/addresses/{address}/balance
510
+ */
511
+ getAddressesAddressBalance: (address, query, params = {}) => this.request(Object.assign({ path: `/addresses/${address}/balance`, method: 'GET', query: query, format: 'json' }, params)),
512
+ /**
513
+ * No description
514
+ *
515
+ * @tags Addresses
516
+ * @name GetAddressesAddressUtxos
517
+ * @summary Get the UTXOs of an address
518
+ * @request GET:/addresses/{address}/utxos
519
+ */
520
+ getAddressesAddressUtxos: (address, query, params = {}) => this.request(Object.assign({ path: `/addresses/${address}/utxos`, method: 'GET', query: query, format: 'json' }, params)),
521
+ /**
522
+ * No description
523
+ *
524
+ * @tags Addresses
525
+ * @name GetAddressesAddressGroup
526
+ * @summary Get the group of an address
527
+ * @request GET:/addresses/{address}/group
528
+ */
529
+ getAddressesAddressGroup: (address, params = {}) => this.request(Object.assign({ path: `/addresses/${address}/group`, method: 'GET', format: 'json' }, params))
530
+ };
531
+ this.transactions = {
532
+ /**
533
+ * No description
534
+ *
535
+ * @tags Transactions
536
+ * @name GetTransactionsUnconfirmed
537
+ * @summary List unconfirmed transactions
538
+ * @request GET:/transactions/unconfirmed
539
+ */
540
+ getTransactionsUnconfirmed: (params = {}) => this.request(Object.assign({ path: `/transactions/unconfirmed`, method: 'GET', format: 'json' }, params)),
541
+ /**
542
+ * No description
543
+ *
544
+ * @tags Transactions
545
+ * @name PostTransactionsBuild
546
+ * @summary Build an unsigned transaction to a number of recipients
547
+ * @request POST:/transactions/build
548
+ */
549
+ postTransactionsBuild: (data, params = {}) => this.request(Object.assign({ path: `/transactions/build`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
550
+ /**
551
+ * No description
552
+ *
553
+ * @tags Transactions
554
+ * @name PostTransactionsSweepAddressBuild
555
+ * @summary Build unsigned transactions to send all unlocked balanced of one address to another address
556
+ * @request POST:/transactions/sweep-address/build
557
+ */
558
+ postTransactionsSweepAddressBuild: (data, params = {}) => this.request(Object.assign({ path: `/transactions/sweep-address/build`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
559
+ /**
560
+ * No description
561
+ *
562
+ * @tags Transactions
563
+ * @name PostTransactionsSubmit
564
+ * @summary Submit a signed transaction
565
+ * @request POST:/transactions/submit
566
+ */
567
+ postTransactionsSubmit: (data, params = {}) => this.request(Object.assign({ path: `/transactions/submit`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
568
+ /**
569
+ * No description
570
+ *
571
+ * @tags Transactions
572
+ * @name PostTransactionsDecodeUnsignedTx
573
+ * @summary Decode an unsigned transaction
574
+ * @request POST:/transactions/decode-unsigned-tx
575
+ */
576
+ postTransactionsDecodeUnsignedTx: (data, params = {}) => this.request(Object.assign({ path: `/transactions/decode-unsigned-tx`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
577
+ /**
578
+ * No description
579
+ *
580
+ * @tags Transactions
581
+ * @name GetTransactionsStatus
582
+ * @summary Get tx status
583
+ * @request GET:/transactions/status
584
+ */
585
+ getTransactionsStatus: (query, params = {}) => this.request(Object.assign({ path: `/transactions/status`, method: 'GET', query: query, format: 'json' }, params))
586
+ };
587
+ this.contracts = {
588
+ /**
589
+ * No description
590
+ *
591
+ * @tags Contracts
592
+ * @name PostContractsCompileScript
593
+ * @summary Compile a script
594
+ * @request POST:/contracts/compile-script
595
+ */
596
+ postContractsCompileScript: (data, params = {}) => this.request(Object.assign({ path: `/contracts/compile-script`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
597
+ /**
598
+ * No description
599
+ *
600
+ * @tags Contracts
601
+ * @name PostContractsUnsignedTxBuildScript
602
+ * @summary Build an unsigned script
603
+ * @request POST:/contracts/unsigned-tx/build-script
604
+ */
605
+ postContractsUnsignedTxBuildScript: (data, params = {}) => this.request(Object.assign({ path: `/contracts/unsigned-tx/build-script`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
606
+ /**
607
+ * No description
608
+ *
609
+ * @tags Contracts
610
+ * @name PostContractsCompileContract
611
+ * @summary Compile a smart contract
612
+ * @request POST:/contracts/compile-contract
613
+ */
614
+ postContractsCompileContract: (data, params = {}) => this.request(Object.assign({ path: `/contracts/compile-contract`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
615
+ /**
616
+ * No description
617
+ *
618
+ * @tags Contracts
619
+ * @name PostContractsUnsignedTxBuildContract
620
+ * @summary Build an unsigned contract
621
+ * @request POST:/contracts/unsigned-tx/build-contract
622
+ */
623
+ postContractsUnsignedTxBuildContract: (data, params = {}) => this.request(Object.assign({ path: `/contracts/unsigned-tx/build-contract`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
624
+ /**
625
+ * No description
626
+ *
627
+ * @tags Contracts
628
+ * @name GetContractsAddressState
629
+ * @summary Get contract state
630
+ * @request GET:/contracts/{address}/state
631
+ */
632
+ getContractsAddressState: (address, query, params = {}) => this.request(Object.assign({ path: `/contracts/${address}/state`, method: 'GET', query: query, format: 'json' }, params)),
633
+ /**
634
+ * No description
635
+ *
636
+ * @tags Contracts
637
+ * @name PostContractsTestContract
638
+ * @summary Test contract
639
+ * @request POST:/contracts/test-contract
640
+ */
641
+ postContractsTestContract: (data, params = {}) => this.request(Object.assign({ path: `/contracts/test-contract`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params))
642
+ };
643
+ this.multisig = {
644
+ /**
645
+ * No description
646
+ *
647
+ * @tags Multi-signature
648
+ * @name PostMultisigAddress
649
+ * @summary Create the multisig address and unlock script
650
+ * @request POST:/multisig/address
651
+ */
652
+ postMultisigAddress: (data, params = {}) => this.request(Object.assign({ path: `/multisig/address`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
653
+ /**
654
+ * No description
655
+ *
656
+ * @tags Multi-signature
657
+ * @name PostMultisigBuild
658
+ * @summary Build a multisig unsigned transaction
659
+ * @request POST:/multisig/build
660
+ */
661
+ postMultisigBuild: (data, params = {}) => this.request(Object.assign({ path: `/multisig/build`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
662
+ /**
663
+ * No description
664
+ *
665
+ * @tags Multi-signature
666
+ * @name PostMultisigSubmit
667
+ * @summary Submit a multi-signed transaction
668
+ * @request POST:/multisig/submit
669
+ */
670
+ postMultisigSubmit: (data, params = {}) => this.request(Object.assign({ path: `/multisig/submit`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params))
671
+ };
672
+ this.utils = {
673
+ /**
674
+ * No description
675
+ *
676
+ * @tags Utils
677
+ * @name PostUtilsVerifySignature
678
+ * @summary Verify the SecP256K1 signature of some data
679
+ * @request POST:/utils/verify-signature
680
+ */
681
+ postUtilsVerifySignature: (data, params = {}) => this.request(Object.assign({ path: `/utils/verify-signature`, method: 'POST', body: data, type: ContentType.Json, format: 'json' }, params)),
682
+ /**
683
+ * No description
684
+ *
685
+ * @tags Utils
686
+ * @name PutUtilsCheckHashIndexing
687
+ * @summary Check and repair the indexing of block hashes
688
+ * @request PUT:/utils/check-hash-indexing
689
+ */
690
+ putUtilsCheckHashIndexing: (params = {}) => this.request(Object.assign({ path: `/utils/check-hash-indexing`, method: 'PUT' }, params))
691
+ };
692
+ this.miners = {
693
+ /**
694
+ * No description
695
+ *
696
+ * @tags Miners
697
+ * @name PostMinersCpuMining
698
+ * @summary Execute an action on CPU miner. !!! for test only !!!
699
+ * @request POST:/miners/cpu-mining
700
+ */
701
+ postMinersCpuMining: (query, params = {}) => this.request(Object.assign({ path: `/miners/cpu-mining`, method: 'POST', query: query, format: 'json' }, params)),
702
+ /**
703
+ * No description
704
+ *
705
+ * @tags Miners
706
+ * @name GetMinersAddresses
707
+ * @summary List miner's addresses
708
+ * @request GET:/miners/addresses
709
+ */
710
+ getMinersAddresses: (params = {}) => this.request(Object.assign({ path: `/miners/addresses`, method: 'GET', format: 'json' }, params)),
711
+ /**
712
+ * No description
713
+ *
714
+ * @tags Miners
715
+ * @name PutMinersAddresses
716
+ * @summary Update miner's addresses, but better to use user.conf instead
717
+ * @request PUT:/miners/addresses
718
+ */
719
+ putMinersAddresses: (data, params = {}) => this.request(Object.assign({ path: `/miners/addresses`, method: 'PUT', body: data, type: ContentType.Json }, params))
720
+ };
721
+ this.events = {
722
+ /**
723
+ * No description
724
+ *
725
+ * @tags Events
726
+ * @name GetEventsContractInBlock
727
+ * @summary Get events for a contract within a block
728
+ * @request GET:/events/contract/in-block
729
+ */
730
+ getEventsContractInBlock: (query, params = {}) => this.request(Object.assign({ path: `/events/contract/in-block`, method: 'GET', query: query, format: 'json' }, params)),
731
+ /**
732
+ * No description
733
+ *
734
+ * @tags Events
735
+ * @name GetEventsContractWithinBlocks
736
+ * @summary Get events for a contract within a range of blocks
737
+ * @request GET:/events/contract/within-blocks
738
+ */
739
+ getEventsContractWithinBlocks: (query, params = {}) => this.request(Object.assign({ path: `/events/contract/within-blocks`, method: 'GET', query: query, format: 'json' }, params)),
740
+ /**
741
+ * No description
742
+ *
743
+ * @tags Events
744
+ * @name GetEventsContractWithinTimeInterval
745
+ * @summary Get events for a contract within a time interval
746
+ * @request GET:/events/contract/within-time-interval
747
+ */
748
+ getEventsContractWithinTimeInterval: (query, params = {}) => this.request(Object.assign({ path: `/events/contract/within-time-interval`, method: 'GET', query: query, format: 'json' }, params)),
749
+ /**
750
+ * No description
751
+ *
752
+ * @tags Events
753
+ * @name GetEventsTxScript
754
+ * @summary Get events for a TxScript
755
+ * @request GET:/events/tx-script
756
+ */
757
+ getEventsTxScript: (query, params = {}) => this.request(Object.assign({ path: `/events/tx-script`, method: 'GET', query: query, format: 'json' }, params))
758
+ };
759
+ }
760
+ }
761
+ exports.Api = Api;