@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.
- package/.editorconfig +13 -0
- package/.eslintignore +2 -0
- package/.eslintrc.json +21 -0
- package/.gitattributes +1 -0
- package/LICENSE +165 -0
- package/README.md +136 -0
- package/contracts/add.ral +16 -0
- package/contracts/greeter.ral +7 -0
- package/contracts/greeter_interface.ral +3 -0
- package/contracts/greeter_main.ral +9 -0
- package/contracts/main.ral +6 -0
- package/contracts/sub.ral +9 -0
- package/dev/user.conf +29 -0
- package/dist/alephium-web3.min.js +3 -0
- package/dist/alephium-web3.min.js.LICENSE.txt +27 -0
- package/dist/alephium-web3.min.js.map +1 -0
- package/dist/scripts/check-versions.d.ts +1 -0
- package/dist/scripts/check-versions.js +39 -0
- package/dist/scripts/create-project.d.ts +2 -0
- package/dist/scripts/create-project.js +124 -0
- package/dist/scripts/header.d.ts +0 -0
- package/dist/scripts/header.js +18 -0
- package/dist/scripts/rename-gitignore.d.ts +1 -0
- package/dist/scripts/rename-gitignore.js +24 -0
- package/dist/scripts/start-devnet.d.ts +1 -0
- package/dist/scripts/start-devnet.js +131 -0
- package/dist/scripts/stop-devnet.d.ts +1 -0
- package/dist/scripts/stop-devnet.js +32 -0
- package/dist/src/api/api-alephium.d.ts +1473 -0
- package/dist/src/api/api-alephium.js +1143 -0
- package/dist/src/api/api-explorer.d.ts +475 -0
- package/dist/src/api/api-explorer.js +457 -0
- package/dist/src/api/index.d.ts +10 -0
- package/dist/src/api/index.js +55 -0
- package/dist/src/constants.d.ts +2 -0
- package/dist/src/constants.js +22 -0
- package/dist/src/contract/contract.d.ts +182 -0
- package/dist/src/contract/contract.js +760 -0
- package/dist/src/contract/events.d.ts +11 -0
- package/dist/src/contract/events.js +64 -0
- package/dist/src/contract/index.d.ts +3 -0
- package/dist/src/contract/index.js +32 -0
- package/dist/src/contract/ralph.d.ts +12 -0
- package/dist/src/contract/ralph.js +362 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.js +35 -0
- package/dist/src/signer/index.d.ts +2 -0
- package/dist/src/signer/index.js +31 -0
- package/dist/src/signer/node-wallet.d.ts +13 -0
- package/dist/src/signer/node-wallet.js +60 -0
- package/dist/src/signer/signer.d.ts +143 -0
- package/dist/src/signer/signer.js +184 -0
- package/dist/src/test/index.d.ts +7 -0
- package/dist/src/test/index.js +41 -0
- package/dist/src/test/privatekey-wallet.d.ts +12 -0
- package/dist/src/test/privatekey-wallet.js +68 -0
- package/dist/src/transaction/index.d.ts +2 -0
- package/dist/src/transaction/index.js +31 -0
- package/dist/src/transaction/sign-verify.d.ts +2 -0
- package/dist/src/transaction/sign-verify.js +58 -0
- package/dist/src/transaction/status.d.ts +10 -0
- package/dist/src/transaction/status.js +48 -0
- package/dist/src/utils/address.d.ts +1 -0
- package/dist/src/utils/address.js +42 -0
- package/dist/src/utils/bs58.d.ts +4 -0
- package/dist/src/utils/bs58.js +28 -0
- package/dist/src/utils/djb2.d.ts +1 -0
- package/dist/src/utils/djb2.js +27 -0
- package/dist/src/utils/index.d.ts +6 -0
- package/dist/src/utils/index.js +35 -0
- package/dist/src/utils/password-crypto.d.ts +2 -0
- package/dist/src/utils/password-crypto.js +69 -0
- package/dist/src/utils/subscription.d.ts +24 -0
- package/dist/src/utils/subscription.js +52 -0
- package/dist/src/utils/utils.d.ts +30 -0
- package/dist/src/utils/utils.js +199 -0
- package/gitignore +10 -0
- package/package.json +127 -0
- package/scripts/check-versions.js +45 -0
- package/scripts/create-project.ts +136 -0
- package/scripts/header.js +17 -0
- package/scripts/rename-gitignore.js +24 -0
- package/scripts/start-devnet.js +141 -0
- package/scripts/stop-devnet.js +32 -0
- package/src/api/api-alephium.ts +2430 -0
- package/src/api/api-explorer.ts +852 -0
- package/src/api/index.ts +35 -0
- package/src/constants.ts +20 -0
- package/src/contract/contract.ts +1014 -0
- package/src/contract/events.ts +75 -0
- package/src/contract/index.ts +21 -0
- package/src/contract/ralph.test.ts +178 -0
- package/src/contract/ralph.ts +362 -0
- package/src/fixtures/address.json +36 -0
- package/src/fixtures/balance.json +9 -0
- package/src/fixtures/self-clique.json +19 -0
- package/src/fixtures/transaction.json +13 -0
- package/src/fixtures/transactions.json +179 -0
- package/src/index.ts +25 -0
- package/src/signer/fixtures/genesis.json +26 -0
- package/src/signer/fixtures/wallets.json +26 -0
- package/src/signer/index.ts +20 -0
- package/src/signer/node-wallet.ts +74 -0
- package/src/signer/signer.ts +313 -0
- package/src/test/index.ts +32 -0
- package/src/test/privatekey-wallet.ts +58 -0
- package/src/transaction/index.ts +20 -0
- package/src/transaction/sign-verify.test.ts +50 -0
- package/src/transaction/sign-verify.ts +39 -0
- package/src/transaction/status.ts +58 -0
- package/src/utils/address.test.ts +47 -0
- package/src/utils/address.ts +39 -0
- package/src/utils/bs58.ts +26 -0
- package/src/utils/djb2.test.ts +35 -0
- package/src/utils/djb2.ts +25 -0
- package/src/utils/index.ts +24 -0
- package/src/utils/password-crypto.test.ts +27 -0
- package/src/utils/password-crypto.ts +77 -0
- package/src/utils/subscription.ts +72 -0
- package/src/utils/utils.test.ts +160 -0
- package/src/utils/utils.ts +209 -0
- package/templates/base/README.md +34 -0
- package/templates/base/package.json +35 -0
- package/templates/base/src/greeter.ts +41 -0
- package/templates/base/tsconfig.json +19 -0
- package/templates/react/README.md +34 -0
- package/templates/react/config-overrides.js +18 -0
- package/templates/react/package.json +66 -0
- package/templates/react/src/App.tsx +42 -0
- package/templates/react/src/artifacts/greeter.ral.json +26 -0
- package/templates/react/src/artifacts/greeter_main.ral.json +22 -0
- package/templates/shared/.eslintrc.json +12 -0
- package/templates/shared/scripts/header.js +0 -0
- package/test/contract.test.ts +161 -0
- package/test/events.test.ts +138 -0
- package/test/transaction.test.ts +72 -0
- package/webpack.config.js +57 -0
|
@@ -0,0 +1,457 @@
|
|
|
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 = '';
|
|
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 Explorer API
|
|
161
|
+
* @version 1.0
|
|
162
|
+
*/
|
|
163
|
+
class Api extends HttpClient {
|
|
164
|
+
constructor() {
|
|
165
|
+
super(...arguments);
|
|
166
|
+
this.blocks = {
|
|
167
|
+
/**
|
|
168
|
+
* @description List blocks within time interval
|
|
169
|
+
*
|
|
170
|
+
* @tags Blocks
|
|
171
|
+
* @name GetBlocks
|
|
172
|
+
* @request GET:/blocks
|
|
173
|
+
*/
|
|
174
|
+
getBlocks: (query, params = {}) => this.request({
|
|
175
|
+
path: `/blocks`,
|
|
176
|
+
method: 'GET',
|
|
177
|
+
query: query,
|
|
178
|
+
format: 'json',
|
|
179
|
+
...params
|
|
180
|
+
}).then(convertHttpResponse),
|
|
181
|
+
/**
|
|
182
|
+
* @description Get a block with hash
|
|
183
|
+
*
|
|
184
|
+
* @tags Blocks
|
|
185
|
+
* @name GetBlocksBlockHash
|
|
186
|
+
* @request GET:/blocks/{block-hash}
|
|
187
|
+
*/
|
|
188
|
+
getBlocksBlockHash: (blockHash, params = {}) => this.request({
|
|
189
|
+
path: `/blocks/${blockHash}`,
|
|
190
|
+
method: 'GET',
|
|
191
|
+
format: 'json',
|
|
192
|
+
...params
|
|
193
|
+
}).then(convertHttpResponse),
|
|
194
|
+
/**
|
|
195
|
+
* @description Get block's transactions
|
|
196
|
+
*
|
|
197
|
+
* @tags Blocks
|
|
198
|
+
* @name GetBlocksBlockHashTransactions
|
|
199
|
+
* @request GET:/blocks/{block-hash}/transactions
|
|
200
|
+
*/
|
|
201
|
+
getBlocksBlockHashTransactions: (blockHash, query, params = {}) => this.request({
|
|
202
|
+
path: `/blocks/${blockHash}/transactions`,
|
|
203
|
+
method: 'GET',
|
|
204
|
+
query: query,
|
|
205
|
+
format: 'json',
|
|
206
|
+
...params
|
|
207
|
+
}).then(convertHttpResponse)
|
|
208
|
+
};
|
|
209
|
+
this.transactions = {
|
|
210
|
+
/**
|
|
211
|
+
* @description Get a transaction with hash
|
|
212
|
+
*
|
|
213
|
+
* @tags Transactions
|
|
214
|
+
* @name GetTransactionsTransactionHash
|
|
215
|
+
* @request GET:/transactions/{transaction-hash}
|
|
216
|
+
*/
|
|
217
|
+
getTransactionsTransactionHash: (transactionHash, params = {}) => this.request({
|
|
218
|
+
path: `/transactions/${transactionHash}`,
|
|
219
|
+
method: 'GET',
|
|
220
|
+
format: 'json',
|
|
221
|
+
...params
|
|
222
|
+
}).then(convertHttpResponse)
|
|
223
|
+
};
|
|
224
|
+
this.addresses = {
|
|
225
|
+
/**
|
|
226
|
+
* @description Get address information
|
|
227
|
+
*
|
|
228
|
+
* @tags Addresses
|
|
229
|
+
* @name GetAddressesAddress
|
|
230
|
+
* @request GET:/addresses/{address}
|
|
231
|
+
*/
|
|
232
|
+
getAddressesAddress: (address, params = {}) => this.request({
|
|
233
|
+
path: `/addresses/${address}`,
|
|
234
|
+
method: 'GET',
|
|
235
|
+
format: 'json',
|
|
236
|
+
...params
|
|
237
|
+
}).then(convertHttpResponse),
|
|
238
|
+
/**
|
|
239
|
+
* @description List transactions of a given address
|
|
240
|
+
*
|
|
241
|
+
* @tags Addresses
|
|
242
|
+
* @name GetAddressesAddressTransactions
|
|
243
|
+
* @request GET:/addresses/{address}/transactions
|
|
244
|
+
*/
|
|
245
|
+
getAddressesAddressTransactions: (address, query, params = {}) => this.request({
|
|
246
|
+
path: `/addresses/${address}/transactions`,
|
|
247
|
+
method: 'GET',
|
|
248
|
+
query: query,
|
|
249
|
+
format: 'json',
|
|
250
|
+
...params
|
|
251
|
+
}).then(convertHttpResponse),
|
|
252
|
+
/**
|
|
253
|
+
* @description Get total transactions of a given address
|
|
254
|
+
*
|
|
255
|
+
* @tags Addresses
|
|
256
|
+
* @name GetAddressesAddressTotalTransactions
|
|
257
|
+
* @request GET:/addresses/{address}/total-transactions
|
|
258
|
+
*/
|
|
259
|
+
getAddressesAddressTotalTransactions: (address, params = {}) => this.request({
|
|
260
|
+
path: `/addresses/${address}/total-transactions`,
|
|
261
|
+
method: 'GET',
|
|
262
|
+
format: 'json',
|
|
263
|
+
...params
|
|
264
|
+
}).then(convertHttpResponse),
|
|
265
|
+
/**
|
|
266
|
+
* @description Get address balance
|
|
267
|
+
*
|
|
268
|
+
* @tags Addresses
|
|
269
|
+
* @name GetAddressesAddressBalance
|
|
270
|
+
* @request GET:/addresses/{address}/balance
|
|
271
|
+
*/
|
|
272
|
+
getAddressesAddressBalance: (address, params = {}) => this.request({
|
|
273
|
+
path: `/addresses/${address}/balance`,
|
|
274
|
+
method: 'GET',
|
|
275
|
+
format: 'json',
|
|
276
|
+
...params
|
|
277
|
+
}).then(convertHttpResponse)
|
|
278
|
+
};
|
|
279
|
+
this.infos = {
|
|
280
|
+
/**
|
|
281
|
+
* @description Get explorer informations
|
|
282
|
+
*
|
|
283
|
+
* @tags Infos
|
|
284
|
+
* @name GetInfos
|
|
285
|
+
* @request GET:/infos
|
|
286
|
+
*/
|
|
287
|
+
getInfos: (params = {}) => this.request({
|
|
288
|
+
path: `/infos`,
|
|
289
|
+
method: 'GET',
|
|
290
|
+
format: 'json',
|
|
291
|
+
...params
|
|
292
|
+
}).then(convertHttpResponse),
|
|
293
|
+
/**
|
|
294
|
+
* @description List latest height for each chain
|
|
295
|
+
*
|
|
296
|
+
* @tags Infos
|
|
297
|
+
* @name GetInfosHeights
|
|
298
|
+
* @request GET:/infos/heights
|
|
299
|
+
*/
|
|
300
|
+
getInfosHeights: (params = {}) => this.request({
|
|
301
|
+
path: `/infos/heights`,
|
|
302
|
+
method: 'GET',
|
|
303
|
+
format: 'json',
|
|
304
|
+
...params
|
|
305
|
+
}).then(convertHttpResponse),
|
|
306
|
+
/**
|
|
307
|
+
* @description Get token supply list
|
|
308
|
+
*
|
|
309
|
+
* @tags Infos
|
|
310
|
+
* @name GetInfosSupply
|
|
311
|
+
* @request GET:/infos/supply
|
|
312
|
+
*/
|
|
313
|
+
getInfosSupply: (query, params = {}) => this.request({
|
|
314
|
+
path: `/infos/supply`,
|
|
315
|
+
method: 'GET',
|
|
316
|
+
query: query,
|
|
317
|
+
format: 'json',
|
|
318
|
+
...params
|
|
319
|
+
}).then(convertHttpResponse),
|
|
320
|
+
/**
|
|
321
|
+
* @description Get the ALPH total supply
|
|
322
|
+
*
|
|
323
|
+
* @tags Infos
|
|
324
|
+
* @name GetInfosSupplyTotalAlph
|
|
325
|
+
* @request GET:/infos/supply/total-alph
|
|
326
|
+
*/
|
|
327
|
+
getInfosSupplyTotalAlph: (params = {}) => this.request({
|
|
328
|
+
path: `/infos/supply/total-alph`,
|
|
329
|
+
method: 'GET',
|
|
330
|
+
...params
|
|
331
|
+
}).then(convertHttpResponse),
|
|
332
|
+
/**
|
|
333
|
+
* @description Get the ALPH circulating supply
|
|
334
|
+
*
|
|
335
|
+
* @tags Infos
|
|
336
|
+
* @name GetInfosSupplyCirculatingAlph
|
|
337
|
+
* @request GET:/infos/supply/circulating-alph
|
|
338
|
+
*/
|
|
339
|
+
getInfosSupplyCirculatingAlph: (params = {}) => this.request({
|
|
340
|
+
path: `/infos/supply/circulating-alph`,
|
|
341
|
+
method: 'GET',
|
|
342
|
+
...params
|
|
343
|
+
}).then(convertHttpResponse),
|
|
344
|
+
/**
|
|
345
|
+
* @description Get the ALPH reserved supply
|
|
346
|
+
*
|
|
347
|
+
* @tags Infos
|
|
348
|
+
* @name GetInfosSupplyReservedAlph
|
|
349
|
+
* @request GET:/infos/supply/reserved-alph
|
|
350
|
+
*/
|
|
351
|
+
getInfosSupplyReservedAlph: (params = {}) => this.request({
|
|
352
|
+
path: `/infos/supply/reserved-alph`,
|
|
353
|
+
method: 'GET',
|
|
354
|
+
...params
|
|
355
|
+
}).then(convertHttpResponse),
|
|
356
|
+
/**
|
|
357
|
+
* @description Get the ALPH locked supply
|
|
358
|
+
*
|
|
359
|
+
* @tags Infos
|
|
360
|
+
* @name GetInfosSupplyLockedAlph
|
|
361
|
+
* @request GET:/infos/supply/locked-alph
|
|
362
|
+
*/
|
|
363
|
+
getInfosSupplyLockedAlph: (params = {}) => this.request({
|
|
364
|
+
path: `/infos/supply/locked-alph`,
|
|
365
|
+
method: 'GET',
|
|
366
|
+
...params
|
|
367
|
+
}).then(convertHttpResponse),
|
|
368
|
+
/**
|
|
369
|
+
* @description Get the total number of transactions
|
|
370
|
+
*
|
|
371
|
+
* @tags Infos
|
|
372
|
+
* @name GetInfosTotalTransactions
|
|
373
|
+
* @request GET:/infos/total-transactions
|
|
374
|
+
*/
|
|
375
|
+
getInfosTotalTransactions: (params = {}) => this.request({
|
|
376
|
+
path: `/infos/total-transactions`,
|
|
377
|
+
method: 'GET',
|
|
378
|
+
...params
|
|
379
|
+
}).then(convertHttpResponse),
|
|
380
|
+
/**
|
|
381
|
+
* @description Get the average block time for each chain
|
|
382
|
+
*
|
|
383
|
+
* @tags Infos
|
|
384
|
+
* @name GetInfosAverageBlockTimes
|
|
385
|
+
* @request GET:/infos/average-block-times
|
|
386
|
+
*/
|
|
387
|
+
getInfosAverageBlockTimes: (params = {}) => this.request({
|
|
388
|
+
path: `/infos/average-block-times`,
|
|
389
|
+
method: 'GET',
|
|
390
|
+
format: 'json',
|
|
391
|
+
...params
|
|
392
|
+
}).then(convertHttpResponse)
|
|
393
|
+
};
|
|
394
|
+
this.charts = {
|
|
395
|
+
/**
|
|
396
|
+
* @description `interval-type` query param: hourly, daily
|
|
397
|
+
*
|
|
398
|
+
* @tags Charts
|
|
399
|
+
* @name GetChartsHashrates
|
|
400
|
+
* @summary Get hashrate chart in H/s
|
|
401
|
+
* @request GET:/charts/hashrates
|
|
402
|
+
*/
|
|
403
|
+
getChartsHashrates: (query, params = {}) => this.request({
|
|
404
|
+
path: `/charts/hashrates`,
|
|
405
|
+
method: 'GET',
|
|
406
|
+
query: query,
|
|
407
|
+
format: 'json',
|
|
408
|
+
...params
|
|
409
|
+
}).then(convertHttpResponse),
|
|
410
|
+
/**
|
|
411
|
+
* @description `interval-type` query param: hourly, daily
|
|
412
|
+
*
|
|
413
|
+
* @tags Charts
|
|
414
|
+
* @name GetChartsTransactionsCount
|
|
415
|
+
* @summary Get transaction count history
|
|
416
|
+
* @request GET:/charts/transactions-count
|
|
417
|
+
*/
|
|
418
|
+
getChartsTransactionsCount: (query, params = {}) => this.request({
|
|
419
|
+
path: `/charts/transactions-count`,
|
|
420
|
+
method: 'GET',
|
|
421
|
+
query: query,
|
|
422
|
+
format: 'json',
|
|
423
|
+
...params
|
|
424
|
+
}).then(convertHttpResponse),
|
|
425
|
+
/**
|
|
426
|
+
* @description `interval-type` query param: hourly, daily
|
|
427
|
+
*
|
|
428
|
+
* @tags Charts
|
|
429
|
+
* @name GetChartsTransactionsCountPerChain
|
|
430
|
+
* @summary Get transaction count history per chain
|
|
431
|
+
* @request GET:/charts/transactions-count-per-chain
|
|
432
|
+
*/
|
|
433
|
+
getChartsTransactionsCountPerChain: (query, params = {}) => this.request({
|
|
434
|
+
path: `/charts/transactions-count-per-chain`,
|
|
435
|
+
method: 'GET',
|
|
436
|
+
query: query,
|
|
437
|
+
format: 'json',
|
|
438
|
+
...params
|
|
439
|
+
}).then(convertHttpResponse)
|
|
440
|
+
};
|
|
441
|
+
this.utils = {
|
|
442
|
+
/**
|
|
443
|
+
* @description Perform a sanity check
|
|
444
|
+
*
|
|
445
|
+
* @tags Utils
|
|
446
|
+
* @name PutUtilsSanityCheck
|
|
447
|
+
* @request PUT:/utils/sanity-check
|
|
448
|
+
*/
|
|
449
|
+
putUtilsSanityCheck: (params = {}) => this.request({
|
|
450
|
+
path: `/utils/sanity-check`,
|
|
451
|
+
method: 'PUT',
|
|
452
|
+
...params
|
|
453
|
+
}).then(convertHttpResponse)
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
exports.Api = Api;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Api as NodeApi } from './api-alephium';
|
|
2
|
+
import { Api as ExplorerApi } from './api-explorer';
|
|
3
|
+
export declare class NodeProvider extends NodeApi<null> {
|
|
4
|
+
constructor(baseUrl: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class ExplorerProvider extends ExplorerApi<null> {
|
|
7
|
+
constructor(baseUrl: string);
|
|
8
|
+
}
|
|
9
|
+
export * as node from './api-alephium';
|
|
10
|
+
export * as explorer from './api-explorer';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2018 - 2022 The Alephium Authors
|
|
4
|
+
This file is part of the alephium project.
|
|
5
|
+
|
|
6
|
+
The library is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
The library is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Lesser General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
along with the library. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
+
}) : function(o, v) {
|
|
29
|
+
o["default"] = v;
|
|
30
|
+
});
|
|
31
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.explorer = exports.node = exports.ExplorerProvider = exports.NodeProvider = void 0;
|
|
40
|
+
const api_alephium_1 = require("./api-alephium");
|
|
41
|
+
const api_explorer_1 = require("./api-explorer");
|
|
42
|
+
class NodeProvider extends api_alephium_1.Api {
|
|
43
|
+
constructor(baseUrl) {
|
|
44
|
+
super({ baseUrl: baseUrl });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.NodeProvider = NodeProvider;
|
|
48
|
+
class ExplorerProvider extends api_explorer_1.Api {
|
|
49
|
+
constructor(baseUrl) {
|
|
50
|
+
super({ baseUrl: baseUrl });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ExplorerProvider = ExplorerProvider;
|
|
54
|
+
exports.node = __importStar(require("./api-alephium"));
|
|
55
|
+
exports.explorer = __importStar(require("./api-explorer"));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2018 - 2022 The Alephium Authors
|
|
4
|
+
This file is part of the alephium project.
|
|
5
|
+
|
|
6
|
+
The library is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
The library is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Lesser General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
along with the library. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.MIN_UTXO_SET_AMOUNT = exports.TOTAL_NUMBER_OF_GROUPS = void 0;
|
|
21
|
+
exports.TOTAL_NUMBER_OF_GROUPS = 4;
|
|
22
|
+
exports.MIN_UTXO_SET_AMOUNT = BigInt(1000000000000);
|