@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,350 @@
1
+ export interface AddressInfo {
2
+ /** @format uint256 */
3
+ balance: string;
4
+ /** @format uint256 */
5
+ lockedBalance: string;
6
+ txNumber: number;
7
+ }
8
+ export interface BadRequest {
9
+ detail: string;
10
+ }
11
+ export interface BlockEntryLite {
12
+ hash: string;
13
+ /** @format int64 */
14
+ timestamp: number;
15
+ chainFrom: number;
16
+ chainTo: number;
17
+ height: number;
18
+ txNumber: number;
19
+ mainChain: boolean;
20
+ /** @format bigint */
21
+ hashRate: string;
22
+ }
23
+ export interface ConfirmedTransaction {
24
+ hash: string;
25
+ blockHash: string;
26
+ /** @format int64 */
27
+ timestamp: number;
28
+ inputs?: Input[];
29
+ outputs?: Output[];
30
+ gasAmount: number;
31
+ /** @format uint256 */
32
+ gasPrice: string;
33
+ type: string;
34
+ }
35
+ export interface ExplorerInfo {
36
+ releaseVersion: string;
37
+ commit: string;
38
+ }
39
+ export interface Hashrate {
40
+ /** @format int64 */
41
+ timestamp: number;
42
+ value: string;
43
+ }
44
+ export interface Input {
45
+ outputRef: OutputRef;
46
+ unlockScript?: string;
47
+ txHashRef: string;
48
+ address: string;
49
+ /** @format uint256 */
50
+ amount: string;
51
+ }
52
+ export interface InternalServerError {
53
+ detail: string;
54
+ }
55
+ export interface ListBlocks {
56
+ total: number;
57
+ blocks?: BlockEntryLite[];
58
+ }
59
+ export interface NotFound {
60
+ detail: string;
61
+ resource: string;
62
+ }
63
+ export interface Output {
64
+ hint: number;
65
+ key: string;
66
+ /** @format uint256 */
67
+ amount: string;
68
+ address: string;
69
+ /** @format int64 */
70
+ lockTime?: number;
71
+ spent?: string;
72
+ }
73
+ export interface OutputRef {
74
+ hint: number;
75
+ key: string;
76
+ }
77
+ export interface PerChainValue {
78
+ chainFrom: number;
79
+ chainTo: number;
80
+ /** @format int64 */
81
+ value: number;
82
+ }
83
+ export interface ServiceUnavailable {
84
+ detail: string;
85
+ }
86
+ export interface TokenSupply {
87
+ /** @format int64 */
88
+ timestamp: number;
89
+ /** @format uint256 */
90
+ total: string;
91
+ /** @format uint256 */
92
+ circulating: string;
93
+ /** @format uint256 */
94
+ maximum: string;
95
+ }
96
+ export interface Transaction {
97
+ hash: string;
98
+ blockHash: string;
99
+ /** @format int64 */
100
+ timestamp: number;
101
+ inputs?: Input[];
102
+ outputs?: Output[];
103
+ gasAmount: number;
104
+ /** @format uint256 */
105
+ gasPrice: string;
106
+ }
107
+ export declare type TransactionLike = ConfirmedTransaction | UnconfirmedTransaction;
108
+ export interface UInput {
109
+ outputRef: OutputRef;
110
+ unlockScript?: string;
111
+ }
112
+ export interface UOutput {
113
+ /** @format uint256 */
114
+ amount: string;
115
+ address: string;
116
+ /** @format int64 */
117
+ lockTime?: number;
118
+ }
119
+ export interface Unauthorized {
120
+ detail: string;
121
+ }
122
+ export interface UnconfirmedTransaction {
123
+ hash: string;
124
+ chainFrom: number;
125
+ chainTo: number;
126
+ inputs?: UInput[];
127
+ outputs?: UOutput[];
128
+ gasAmount: number;
129
+ /** @format uint256 */
130
+ gasPrice: string;
131
+ type: string;
132
+ }
133
+ import 'cross-fetch/polyfill';
134
+ export declare type QueryParamsType = Record<string | number, any>;
135
+ export declare type ResponseFormat = keyof Omit<Body, 'body' | 'bodyUsed'>;
136
+ export interface FullRequestParams extends Omit<RequestInit, 'body'> {
137
+ /** set parameter to `true` for call `securityWorker` for this request */
138
+ secure?: boolean;
139
+ /** request path */
140
+ path: string;
141
+ /** content type of request body */
142
+ type?: ContentType;
143
+ /** query params */
144
+ query?: QueryParamsType;
145
+ /** format of response (i.e. response.json() -> format: "json") */
146
+ format?: ResponseFormat;
147
+ /** request body */
148
+ body?: unknown;
149
+ /** base url */
150
+ baseUrl?: string;
151
+ /** request cancellation token */
152
+ cancelToken?: CancelToken;
153
+ }
154
+ export declare type RequestParams = Omit<FullRequestParams, 'body' | 'method' | 'query' | 'path'>;
155
+ export interface ApiConfig<SecurityDataType = unknown> {
156
+ baseUrl?: string;
157
+ baseApiParams?: Omit<RequestParams, 'baseUrl' | 'cancelToken' | 'signal'>;
158
+ securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
159
+ customFetch?: typeof fetch;
160
+ }
161
+ export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
162
+ data: D;
163
+ error: E;
164
+ }
165
+ declare type CancelToken = Symbol | string | number;
166
+ export declare enum ContentType {
167
+ Json = "application/json",
168
+ FormData = "multipart/form-data",
169
+ UrlEncoded = "application/x-www-form-urlencoded"
170
+ }
171
+ export declare class HttpClient<SecurityDataType = unknown> {
172
+ baseUrl: string;
173
+ private securityData;
174
+ private securityWorker?;
175
+ private abortControllers;
176
+ private customFetch;
177
+ private baseApiParams;
178
+ constructor(apiConfig?: ApiConfig<SecurityDataType>);
179
+ setSecurityData: (data: SecurityDataType | null) => void;
180
+ private encodeQueryParam;
181
+ private addQueryParam;
182
+ private addArrayQueryParam;
183
+ protected toQueryString(rawQuery?: QueryParamsType): string;
184
+ protected addQueryParams(rawQuery?: QueryParamsType): string;
185
+ private contentFormatters;
186
+ private mergeRequestParams;
187
+ private createAbortSignal;
188
+ abortRequest: (cancelToken: CancelToken) => void;
189
+ request: <T = any, E = any>({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams) => Promise<HttpResponse<T, E>>;
190
+ }
191
+ /**
192
+ * @title Alephium Explorer API
193
+ * @version 1.0
194
+ */
195
+ export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
196
+ blocks: {
197
+ /**
198
+ * @description List blocks within time interval
199
+ *
200
+ * @tags Blocks
201
+ * @name GetBlocks
202
+ * @request GET:/blocks
203
+ */
204
+ getBlocks: (query?: {
205
+ page?: number | undefined;
206
+ limit?: number | undefined;
207
+ reverse?: boolean | undefined;
208
+ } | undefined, params?: RequestParams) => Promise<HttpResponse<ListBlocks, BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
209
+ /**
210
+ * @description Get a block with hash
211
+ *
212
+ * @tags Blocks
213
+ * @name GetBlocksBlockHash
214
+ * @request GET:/blocks/{block-hash}
215
+ */
216
+ getBlocksBlockHash: (blockHash: string, params?: RequestParams) => Promise<HttpResponse<BlockEntryLite, BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
217
+ /**
218
+ * @description Get block's transactions
219
+ *
220
+ * @tags Blocks
221
+ * @name GetBlocksBlockHashTransactions
222
+ * @request GET:/blocks/{block-hash}/transactions
223
+ */
224
+ getBlocksBlockHashTransactions: (blockHash: string, query?: {
225
+ page?: number | undefined;
226
+ limit?: number | undefined;
227
+ reverse?: boolean | undefined;
228
+ } | undefined, params?: RequestParams) => Promise<HttpResponse<Transaction[], BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
229
+ };
230
+ transactions: {
231
+ /**
232
+ * @description Get a transaction with hash
233
+ *
234
+ * @tags Transactions
235
+ * @name GetTransactionsTransactionHash
236
+ * @request GET:/transactions/{transaction-hash}
237
+ */
238
+ getTransactionsTransactionHash: (transactionHash: string, params?: RequestParams) => Promise<HttpResponse<TransactionLike, BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
239
+ };
240
+ addresses: {
241
+ /**
242
+ * @description Get address information
243
+ *
244
+ * @tags Addressess
245
+ * @name GetAddressesAddress
246
+ * @request GET:/addresses/{address}
247
+ */
248
+ getAddressesAddress: (address: string, params?: RequestParams) => Promise<HttpResponse<AddressInfo, BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
249
+ /**
250
+ * @description List transactions of a given address
251
+ *
252
+ * @tags Addressess
253
+ * @name GetAddressesAddressTransactions
254
+ * @request GET:/addresses/{address}/transactions
255
+ */
256
+ getAddressesAddressTransactions: (address: string, query?: {
257
+ page?: number | undefined;
258
+ limit?: number | undefined;
259
+ reverse?: boolean | undefined;
260
+ } | undefined, params?: RequestParams) => Promise<HttpResponse<Transaction[], BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
261
+ };
262
+ infos: {
263
+ /**
264
+ * @description Get explorer informations
265
+ *
266
+ * @tags Infos
267
+ * @name GetInfos
268
+ * @request GET:/infos
269
+ */
270
+ getInfos: (params?: RequestParams) => Promise<HttpResponse<ExplorerInfo, BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
271
+ /**
272
+ * @description List latest height for each chain
273
+ *
274
+ * @tags Infos
275
+ * @name GetInfosHeights
276
+ * @request GET:/infos/heights
277
+ */
278
+ getInfosHeights: (params?: RequestParams) => Promise<HttpResponse<PerChainValue[], BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
279
+ /**
280
+ * @description Get token supply list
281
+ *
282
+ * @tags Infos
283
+ * @name GetInfosSupply
284
+ * @request GET:/infos/supply
285
+ */
286
+ getInfosSupply: (query?: {
287
+ page?: number | undefined;
288
+ limit?: number | undefined;
289
+ reverse?: boolean | undefined;
290
+ } | undefined, params?: RequestParams) => Promise<HttpResponse<TokenSupply[], BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
291
+ /**
292
+ * @description Get the ALPH total supply
293
+ *
294
+ * @tags Infos
295
+ * @name GetInfosSupplyTotalAlph
296
+ * @request GET:/infos/supply/total-alph
297
+ */
298
+ getInfosSupplyTotalAlph: (params?: RequestParams) => Promise<HttpResponse<string, BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
299
+ /**
300
+ * @description Get the ALPH circulating supply
301
+ *
302
+ * @tags Infos
303
+ * @name GetInfosSupplyCirculatingAlph
304
+ * @request GET:/infos/supply/circulating-alph
305
+ */
306
+ getInfosSupplyCirculatingAlph: (params?: RequestParams) => Promise<HttpResponse<string, BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
307
+ /**
308
+ * @description Get the total number of transactions
309
+ *
310
+ * @tags Infos
311
+ * @name GetInfosTotalTransactions
312
+ * @request GET:/infos/total-transactions
313
+ */
314
+ getInfosTotalTransactions: (params?: RequestParams) => Promise<HttpResponse<number, BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
315
+ /**
316
+ * @description Get the average block time for each chain
317
+ *
318
+ * @tags Infos
319
+ * @name GetInfosAverageBlockTimes
320
+ * @request GET:/infos/average-block-times
321
+ */
322
+ getInfosAverageBlockTimes: (params?: RequestParams) => Promise<HttpResponse<PerChainValue[], BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
323
+ };
324
+ charts: {
325
+ /**
326
+ * @description `interval-type` query param: hourly, daily
327
+ *
328
+ * @tags Charts
329
+ * @name GetChartsHashrates
330
+ * @summary Get explorer informations.
331
+ * @request GET:/charts/hashrates
332
+ */
333
+ getChartsHashrates: (query: {
334
+ fromTs: number;
335
+ toTs: number;
336
+ 'interval-type': string;
337
+ }, params?: RequestParams) => Promise<HttpResponse<Hashrate[], BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
338
+ };
339
+ utils: {
340
+ /**
341
+ * @description Perform a sanity check
342
+ *
343
+ * @tags Utils
344
+ * @name PutUtilsSanityCheck
345
+ * @request PUT:/utils/sanity-check
346
+ */
347
+ putUtilsSanityCheck: (params?: RequestParams) => Promise<HttpResponse<void, BadRequest | InternalServerError | NotFound | ServiceUnavailable | Unauthorized>>;
348
+ };
349
+ }
350
+ export {};
@@ -0,0 +1,297 @@
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 = '';
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 Explorer API
157
+ * @version 1.0
158
+ */
159
+ class Api extends HttpClient {
160
+ constructor() {
161
+ super(...arguments);
162
+ this.blocks = {
163
+ /**
164
+ * @description List blocks within time interval
165
+ *
166
+ * @tags Blocks
167
+ * @name GetBlocks
168
+ * @request GET:/blocks
169
+ */
170
+ getBlocks: (query, params = {}) => this.request(Object.assign({ path: `/blocks`, method: 'GET', query: query, format: 'json' }, params)),
171
+ /**
172
+ * @description Get a block with hash
173
+ *
174
+ * @tags Blocks
175
+ * @name GetBlocksBlockHash
176
+ * @request GET:/blocks/{block-hash}
177
+ */
178
+ getBlocksBlockHash: (blockHash, params = {}) => this.request(Object.assign({ path: `/blocks/${blockHash}`, method: 'GET', format: 'json' }, params)),
179
+ /**
180
+ * @description Get block's transactions
181
+ *
182
+ * @tags Blocks
183
+ * @name GetBlocksBlockHashTransactions
184
+ * @request GET:/blocks/{block-hash}/transactions
185
+ */
186
+ getBlocksBlockHashTransactions: (blockHash, query, params = {}) => this.request(Object.assign({ path: `/blocks/${blockHash}/transactions`, method: 'GET', query: query, format: 'json' }, params))
187
+ };
188
+ this.transactions = {
189
+ /**
190
+ * @description Get a transaction with hash
191
+ *
192
+ * @tags Transactions
193
+ * @name GetTransactionsTransactionHash
194
+ * @request GET:/transactions/{transaction-hash}
195
+ */
196
+ getTransactionsTransactionHash: (transactionHash, params = {}) => this.request(Object.assign({ path: `/transactions/${transactionHash}`, method: 'GET', format: 'json' }, params))
197
+ };
198
+ this.addresses = {
199
+ /**
200
+ * @description Get address information
201
+ *
202
+ * @tags Addressess
203
+ * @name GetAddressesAddress
204
+ * @request GET:/addresses/{address}
205
+ */
206
+ getAddressesAddress: (address, params = {}) => this.request(Object.assign({ path: `/addresses/${address}`, method: 'GET', format: 'json' }, params)),
207
+ /**
208
+ * @description List transactions of a given address
209
+ *
210
+ * @tags Addressess
211
+ * @name GetAddressesAddressTransactions
212
+ * @request GET:/addresses/{address}/transactions
213
+ */
214
+ getAddressesAddressTransactions: (address, query, params = {}) => this.request(Object.assign({ path: `/addresses/${address}/transactions`, method: 'GET', query: query, format: 'json' }, params))
215
+ };
216
+ this.infos = {
217
+ /**
218
+ * @description Get explorer informations
219
+ *
220
+ * @tags Infos
221
+ * @name GetInfos
222
+ * @request GET:/infos
223
+ */
224
+ getInfos: (params = {}) => this.request(Object.assign({ path: `/infos`, method: 'GET', format: 'json' }, params)),
225
+ /**
226
+ * @description List latest height for each chain
227
+ *
228
+ * @tags Infos
229
+ * @name GetInfosHeights
230
+ * @request GET:/infos/heights
231
+ */
232
+ getInfosHeights: (params = {}) => this.request(Object.assign({ path: `/infos/heights`, method: 'GET', format: 'json' }, params)),
233
+ /**
234
+ * @description Get token supply list
235
+ *
236
+ * @tags Infos
237
+ * @name GetInfosSupply
238
+ * @request GET:/infos/supply
239
+ */
240
+ getInfosSupply: (query, params = {}) => this.request(Object.assign({ path: `/infos/supply`, method: 'GET', query: query, format: 'json' }, params)),
241
+ /**
242
+ * @description Get the ALPH total supply
243
+ *
244
+ * @tags Infos
245
+ * @name GetInfosSupplyTotalAlph
246
+ * @request GET:/infos/supply/total-alph
247
+ */
248
+ getInfosSupplyTotalAlph: (params = {}) => this.request(Object.assign({ path: `/infos/supply/total-alph`, method: 'GET' }, params)),
249
+ /**
250
+ * @description Get the ALPH circulating supply
251
+ *
252
+ * @tags Infos
253
+ * @name GetInfosSupplyCirculatingAlph
254
+ * @request GET:/infos/supply/circulating-alph
255
+ */
256
+ getInfosSupplyCirculatingAlph: (params = {}) => this.request(Object.assign({ path: `/infos/supply/circulating-alph`, method: 'GET' }, params)),
257
+ /**
258
+ * @description Get the total number of transactions
259
+ *
260
+ * @tags Infos
261
+ * @name GetInfosTotalTransactions
262
+ * @request GET:/infos/total-transactions
263
+ */
264
+ getInfosTotalTransactions: (params = {}) => this.request(Object.assign({ path: `/infos/total-transactions`, method: 'GET' }, params)),
265
+ /**
266
+ * @description Get the average block time for each chain
267
+ *
268
+ * @tags Infos
269
+ * @name GetInfosAverageBlockTimes
270
+ * @request GET:/infos/average-block-times
271
+ */
272
+ getInfosAverageBlockTimes: (params = {}) => this.request(Object.assign({ path: `/infos/average-block-times`, method: 'GET', format: 'json' }, params))
273
+ };
274
+ this.charts = {
275
+ /**
276
+ * @description `interval-type` query param: hourly, daily
277
+ *
278
+ * @tags Charts
279
+ * @name GetChartsHashrates
280
+ * @summary Get explorer informations.
281
+ * @request GET:/charts/hashrates
282
+ */
283
+ getChartsHashrates: (query, params = {}) => this.request(Object.assign({ path: `/charts/hashrates`, method: 'GET', query: query, format: 'json' }, params))
284
+ };
285
+ this.utils = {
286
+ /**
287
+ * @description Perform a sanity check
288
+ *
289
+ * @tags Utils
290
+ * @name PutUtilsSanityCheck
291
+ * @request PUT:/utils/sanity-check
292
+ */
293
+ putUtilsSanityCheck: (params = {}) => this.request(Object.assign({ path: `/utils/sanity-check`, method: 'PUT' }, params))
294
+ };
295
+ }
296
+ }
297
+ exports.Api = Api;
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};