@alephium/web3 0.0.3 → 0.1.0-rc.2
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/README.md +2 -2
- package/contracts/add.ral +7 -3
- package/contracts/greeter.ral +3 -1
- package/contracts/greeter_interface.ral +3 -0
- package/contracts/greeter_main.ral +9 -0
- package/contracts/main.ral +3 -5
- package/dev/user.conf +8 -4
- package/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/scripts/check-versions.d.ts +1 -0
- package/dist/scripts/check-versions.js +39 -0
- package/dist/{cli → scripts}/create-project.d.ts +0 -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/{api → src/api}/api-alephium.d.ts +287 -168
- package/dist/{api → src/api}/api-alephium.js +497 -115
- package/dist/{api → src/api}/api-explorer.d.ts +117 -19
- package/dist/{api → src/api}/api-explorer.js +206 -46
- package/dist/src/api/index.d.ts +10 -0
- package/dist/src/api/index.js +55 -0
- package/dist/{lib → src}/constants.d.ts +0 -0
- package/dist/{lib → src}/constants.js +0 -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 +29 -0
- package/dist/src/contract/events.js +77 -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 +5 -0
- package/dist/src/index.js +34 -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/{lib → src/utils}/address.d.ts +0 -0
- package/dist/{lib → src/utils}/address.js +1 -1
- package/dist/{lib → src/utils}/bs58.d.ts +2 -2
- package/dist/{lib → src/utils}/bs58.js +3 -1
- package/dist/{lib → src/utils}/djb2.d.ts +0 -0
- package/dist/{lib → src/utils}/djb2.js +1 -1
- package/dist/src/utils/index.d.ts +6 -0
- package/dist/src/utils/index.js +35 -0
- package/dist/{lib → src/utils}/password-crypto.d.ts +0 -0
- package/dist/{lib → src/utils}/password-crypto.js +8 -7
- package/dist/src/utils/transaction.d.ts +2 -0
- package/dist/src/utils/transaction.js +58 -0
- package/dist/src/utils/utils.d.ts +30 -0
- package/dist/{lib → src/utils}/utils.js +83 -19
- package/gitignore +5 -4
- package/package.json +55 -41
- package/scripts/create-project.ts +136 -0
- package/scripts/header.js +17 -0
- package/scripts/start-devnet.js +3 -3
- package/src/api/api-alephium.ts +2323 -0
- package/src/api/api-explorer.ts +808 -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 +102 -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 +24 -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/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/transaction.test.ts +50 -0
- package/src/utils/transaction.ts +39 -0
- package/src/utils/utils.test.ts +160 -0
- package/src/utils/utils.ts +209 -0
- package/templates/{README.md → base/README.md} +4 -4
- 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 +139 -0
- package/webpack.config.js +1 -1
- package/contracts/greeter-main.ral +0 -8
- package/dist/cli/create-project.js +0 -87
- package/dist/lib/clique.d.ts +0 -23
- package/dist/lib/clique.js +0 -149
- package/dist/lib/contract.d.ts +0 -152
- package/dist/lib/contract.js +0 -711
- package/dist/lib/explorer.d.ts +0 -8
- package/dist/lib/explorer.js +0 -46
- package/dist/lib/index.d.ts +0 -12
- package/dist/lib/index.js +0 -60
- package/dist/lib/node.d.ts +0 -10
- package/dist/lib/node.js +0 -64
- package/dist/lib/numbers.d.ts +0 -7
- package/dist/lib/numbers.js +0 -128
- package/dist/lib/signer.d.ts +0 -17
- package/dist/lib/signer.js +0 -70
- package/dist/lib/storage-browser.d.ts +0 -9
- package/dist/lib/storage-browser.js +0 -52
- package/dist/lib/storage-node.d.ts +0 -9
- package/dist/lib/storage-node.js +0 -65
- package/dist/lib/utils.d.ts +0 -11
- package/dist/lib/wallet.d.ts +0 -30
- package/dist/lib/wallet.js +0 -142
- package/templates/package.json +0 -29
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export interface AddressBalance {
|
|
2
|
+
/** @format uint256 */
|
|
3
|
+
balance: string;
|
|
4
|
+
/** @format uint256 */
|
|
5
|
+
lockedBalance: string;
|
|
6
|
+
}
|
|
1
7
|
export interface AddressInfo {
|
|
2
8
|
/** @format uint256 */
|
|
3
9
|
balance: string;
|
|
@@ -39,6 +45,7 @@ export interface ExplorerInfo {
|
|
|
39
45
|
export interface Hashrate {
|
|
40
46
|
/** @format int64 */
|
|
41
47
|
timestamp: number;
|
|
48
|
+
hashrate: string;
|
|
42
49
|
value: string;
|
|
43
50
|
}
|
|
44
51
|
export interface Input {
|
|
@@ -62,6 +69,7 @@ export interface NotFound {
|
|
|
62
69
|
}
|
|
63
70
|
export interface Output {
|
|
64
71
|
hint: number;
|
|
72
|
+
/** @format 32-byte-hash */
|
|
65
73
|
key: string;
|
|
66
74
|
/** @format uint256 */
|
|
67
75
|
amount: string;
|
|
@@ -72,17 +80,45 @@ export interface Output {
|
|
|
72
80
|
}
|
|
73
81
|
export interface OutputRef {
|
|
74
82
|
hint: number;
|
|
83
|
+
/** @format 32-byte-hash */
|
|
75
84
|
key: string;
|
|
76
85
|
}
|
|
77
|
-
export interface
|
|
86
|
+
export interface PerChainCount {
|
|
87
|
+
chainFrom: number;
|
|
88
|
+
chainTo: number;
|
|
89
|
+
/** @format int64 */
|
|
90
|
+
count: number;
|
|
91
|
+
}
|
|
92
|
+
export interface PerChainDuration {
|
|
93
|
+
chainFrom: number;
|
|
94
|
+
chainTo: number;
|
|
95
|
+
/** @format int64 */
|
|
96
|
+
duration: number;
|
|
97
|
+
/** @format int64 */
|
|
98
|
+
value: number;
|
|
99
|
+
}
|
|
100
|
+
export interface PerChainHeight {
|
|
78
101
|
chainFrom: number;
|
|
79
102
|
chainTo: number;
|
|
80
103
|
/** @format int64 */
|
|
104
|
+
height: number;
|
|
105
|
+
/** @format int64 */
|
|
81
106
|
value: number;
|
|
82
107
|
}
|
|
108
|
+
export interface PerChainTimedCount {
|
|
109
|
+
/** @format int64 */
|
|
110
|
+
timestamp: number;
|
|
111
|
+
totalCountPerChain?: PerChainCount[];
|
|
112
|
+
}
|
|
83
113
|
export interface ServiceUnavailable {
|
|
84
114
|
detail: string;
|
|
85
115
|
}
|
|
116
|
+
export interface TimedCount {
|
|
117
|
+
/** @format int64 */
|
|
118
|
+
timestamp: number;
|
|
119
|
+
/** @format int64 */
|
|
120
|
+
totalCountAllChains: number;
|
|
121
|
+
}
|
|
86
122
|
export interface TokenSupply {
|
|
87
123
|
/** @format int64 */
|
|
88
124
|
timestamp: number;
|
|
@@ -91,6 +127,10 @@ export interface TokenSupply {
|
|
|
91
127
|
/** @format uint256 */
|
|
92
128
|
circulating: string;
|
|
93
129
|
/** @format uint256 */
|
|
130
|
+
reserved: string;
|
|
131
|
+
/** @format uint256 */
|
|
132
|
+
locked: string;
|
|
133
|
+
/** @format uint256 */
|
|
94
134
|
maximum: string;
|
|
95
135
|
}
|
|
96
136
|
export interface Transaction {
|
|
@@ -205,7 +245,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
205
245
|
page?: number | undefined;
|
|
206
246
|
limit?: number | undefined;
|
|
207
247
|
reverse?: boolean | undefined;
|
|
208
|
-
} | undefined, params?: RequestParams) => Promise<
|
|
248
|
+
} | undefined, params?: RequestParams) => Promise<ListBlocks>;
|
|
209
249
|
/**
|
|
210
250
|
* @description Get a block with hash
|
|
211
251
|
*
|
|
@@ -213,7 +253,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
213
253
|
* @name GetBlocksBlockHash
|
|
214
254
|
* @request GET:/blocks/{block-hash}
|
|
215
255
|
*/
|
|
216
|
-
getBlocksBlockHash: (blockHash: string, params?: RequestParams) => Promise<
|
|
256
|
+
getBlocksBlockHash: (blockHash: string, params?: RequestParams) => Promise<BlockEntryLite>;
|
|
217
257
|
/**
|
|
218
258
|
* @description Get block's transactions
|
|
219
259
|
*
|
|
@@ -225,7 +265,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
225
265
|
page?: number | undefined;
|
|
226
266
|
limit?: number | undefined;
|
|
227
267
|
reverse?: boolean | undefined;
|
|
228
|
-
} | undefined, params?: RequestParams) => Promise<
|
|
268
|
+
} | undefined, params?: RequestParams) => Promise<Transaction[]>;
|
|
229
269
|
};
|
|
230
270
|
transactions: {
|
|
231
271
|
/**
|
|
@@ -235,21 +275,21 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
235
275
|
* @name GetTransactionsTransactionHash
|
|
236
276
|
* @request GET:/transactions/{transaction-hash}
|
|
237
277
|
*/
|
|
238
|
-
getTransactionsTransactionHash: (transactionHash: string, params?: RequestParams) => Promise<
|
|
278
|
+
getTransactionsTransactionHash: (transactionHash: string, params?: RequestParams) => Promise<ConfirmedTransaction | UnconfirmedTransaction>;
|
|
239
279
|
};
|
|
240
280
|
addresses: {
|
|
241
281
|
/**
|
|
242
282
|
* @description Get address information
|
|
243
283
|
*
|
|
244
|
-
* @tags
|
|
284
|
+
* @tags Addresses
|
|
245
285
|
* @name GetAddressesAddress
|
|
246
286
|
* @request GET:/addresses/{address}
|
|
247
287
|
*/
|
|
248
|
-
getAddressesAddress: (address: string, params?: RequestParams) => Promise<
|
|
288
|
+
getAddressesAddress: (address: string, params?: RequestParams) => Promise<AddressInfo>;
|
|
249
289
|
/**
|
|
250
290
|
* @description List transactions of a given address
|
|
251
291
|
*
|
|
252
|
-
* @tags
|
|
292
|
+
* @tags Addresses
|
|
253
293
|
* @name GetAddressesAddressTransactions
|
|
254
294
|
* @request GET:/addresses/{address}/transactions
|
|
255
295
|
*/
|
|
@@ -257,7 +297,23 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
257
297
|
page?: number | undefined;
|
|
258
298
|
limit?: number | undefined;
|
|
259
299
|
reverse?: boolean | undefined;
|
|
260
|
-
} | undefined, params?: RequestParams) => Promise<
|
|
300
|
+
} | undefined, params?: RequestParams) => Promise<Transaction[]>;
|
|
301
|
+
/**
|
|
302
|
+
* @description Get total transactions of a given address
|
|
303
|
+
*
|
|
304
|
+
* @tags Addresses
|
|
305
|
+
* @name GetAddressesAddressTotalTransactions
|
|
306
|
+
* @request GET:/addresses/{address}/total-transactions
|
|
307
|
+
*/
|
|
308
|
+
getAddressesAddressTotalTransactions: (address: string, params?: RequestParams) => Promise<number>;
|
|
309
|
+
/**
|
|
310
|
+
* @description Get address balance
|
|
311
|
+
*
|
|
312
|
+
* @tags Addresses
|
|
313
|
+
* @name GetAddressesAddressBalance
|
|
314
|
+
* @request GET:/addresses/{address}/balance
|
|
315
|
+
*/
|
|
316
|
+
getAddressesAddressBalance: (address: string, params?: RequestParams) => Promise<AddressBalance>;
|
|
261
317
|
};
|
|
262
318
|
infos: {
|
|
263
319
|
/**
|
|
@@ -267,7 +323,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
267
323
|
* @name GetInfos
|
|
268
324
|
* @request GET:/infos
|
|
269
325
|
*/
|
|
270
|
-
getInfos: (params?: RequestParams) => Promise<
|
|
326
|
+
getInfos: (params?: RequestParams) => Promise<ExplorerInfo>;
|
|
271
327
|
/**
|
|
272
328
|
* @description List latest height for each chain
|
|
273
329
|
*
|
|
@@ -275,7 +331,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
275
331
|
* @name GetInfosHeights
|
|
276
332
|
* @request GET:/infos/heights
|
|
277
333
|
*/
|
|
278
|
-
getInfosHeights: (params?: RequestParams) => Promise<
|
|
334
|
+
getInfosHeights: (params?: RequestParams) => Promise<PerChainHeight[]>;
|
|
279
335
|
/**
|
|
280
336
|
* @description Get token supply list
|
|
281
337
|
*
|
|
@@ -287,7 +343,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
287
343
|
page?: number | undefined;
|
|
288
344
|
limit?: number | undefined;
|
|
289
345
|
reverse?: boolean | undefined;
|
|
290
|
-
} | undefined, params?: RequestParams) => Promise<
|
|
346
|
+
} | undefined, params?: RequestParams) => Promise<TokenSupply[]>;
|
|
291
347
|
/**
|
|
292
348
|
* @description Get the ALPH total supply
|
|
293
349
|
*
|
|
@@ -295,7 +351,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
295
351
|
* @name GetInfosSupplyTotalAlph
|
|
296
352
|
* @request GET:/infos/supply/total-alph
|
|
297
353
|
*/
|
|
298
|
-
getInfosSupplyTotalAlph: (params?: RequestParams) => Promise<
|
|
354
|
+
getInfosSupplyTotalAlph: (params?: RequestParams) => Promise<string>;
|
|
299
355
|
/**
|
|
300
356
|
* @description Get the ALPH circulating supply
|
|
301
357
|
*
|
|
@@ -303,7 +359,23 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
303
359
|
* @name GetInfosSupplyCirculatingAlph
|
|
304
360
|
* @request GET:/infos/supply/circulating-alph
|
|
305
361
|
*/
|
|
306
|
-
getInfosSupplyCirculatingAlph: (params?: RequestParams) => Promise<
|
|
362
|
+
getInfosSupplyCirculatingAlph: (params?: RequestParams) => Promise<string>;
|
|
363
|
+
/**
|
|
364
|
+
* @description Get the ALPH reserved supply
|
|
365
|
+
*
|
|
366
|
+
* @tags Infos
|
|
367
|
+
* @name GetInfosSupplyReservedAlph
|
|
368
|
+
* @request GET:/infos/supply/reserved-alph
|
|
369
|
+
*/
|
|
370
|
+
getInfosSupplyReservedAlph: (params?: RequestParams) => Promise<string>;
|
|
371
|
+
/**
|
|
372
|
+
* @description Get the ALPH locked supply
|
|
373
|
+
*
|
|
374
|
+
* @tags Infos
|
|
375
|
+
* @name GetInfosSupplyLockedAlph
|
|
376
|
+
* @request GET:/infos/supply/locked-alph
|
|
377
|
+
*/
|
|
378
|
+
getInfosSupplyLockedAlph: (params?: RequestParams) => Promise<string>;
|
|
307
379
|
/**
|
|
308
380
|
* @description Get the total number of transactions
|
|
309
381
|
*
|
|
@@ -311,7 +383,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
311
383
|
* @name GetInfosTotalTransactions
|
|
312
384
|
* @request GET:/infos/total-transactions
|
|
313
385
|
*/
|
|
314
|
-
getInfosTotalTransactions: (params?: RequestParams) => Promise<
|
|
386
|
+
getInfosTotalTransactions: (params?: RequestParams) => Promise<number>;
|
|
315
387
|
/**
|
|
316
388
|
* @description Get the average block time for each chain
|
|
317
389
|
*
|
|
@@ -319,7 +391,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
319
391
|
* @name GetInfosAverageBlockTimes
|
|
320
392
|
* @request GET:/infos/average-block-times
|
|
321
393
|
*/
|
|
322
|
-
getInfosAverageBlockTimes: (params?: RequestParams) => Promise<
|
|
394
|
+
getInfosAverageBlockTimes: (params?: RequestParams) => Promise<PerChainDuration[]>;
|
|
323
395
|
};
|
|
324
396
|
charts: {
|
|
325
397
|
/**
|
|
@@ -327,14 +399,40 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
327
399
|
*
|
|
328
400
|
* @tags Charts
|
|
329
401
|
* @name GetChartsHashrates
|
|
330
|
-
* @summary Get
|
|
402
|
+
* @summary Get hashrate chart in H/s
|
|
331
403
|
* @request GET:/charts/hashrates
|
|
332
404
|
*/
|
|
333
405
|
getChartsHashrates: (query: {
|
|
334
406
|
fromTs: number;
|
|
335
407
|
toTs: number;
|
|
336
408
|
'interval-type': string;
|
|
337
|
-
}, params?: RequestParams) => Promise<
|
|
409
|
+
}, params?: RequestParams) => Promise<Hashrate[]>;
|
|
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: {
|
|
419
|
+
fromTs: number;
|
|
420
|
+
toTs: number;
|
|
421
|
+
'interval-type': string;
|
|
422
|
+
}, params?: RequestParams) => Promise<TimedCount[]>;
|
|
423
|
+
/**
|
|
424
|
+
* @description `interval-type` query param: hourly, daily
|
|
425
|
+
*
|
|
426
|
+
* @tags Charts
|
|
427
|
+
* @name GetChartsTransactionsCountPerChain
|
|
428
|
+
* @summary Get transaction count history per chain
|
|
429
|
+
* @request GET:/charts/transactions-count-per-chain
|
|
430
|
+
*/
|
|
431
|
+
getChartsTransactionsCountPerChain: (query: {
|
|
432
|
+
fromTs: number;
|
|
433
|
+
toTs: number;
|
|
434
|
+
'interval-type': string;
|
|
435
|
+
}, params?: RequestParams) => Promise<PerChainTimedCount[]>;
|
|
338
436
|
};
|
|
339
437
|
utils: {
|
|
340
438
|
/**
|
|
@@ -344,7 +442,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
344
442
|
* @name PutUtilsSanityCheck
|
|
345
443
|
* @request PUT:/utils/sanity-check
|
|
346
444
|
*/
|
|
347
|
-
putUtilsSanityCheck: (params?: RequestParams) => Promise<
|
|
445
|
+
putUtilsSanityCheck: (params?: RequestParams) => Promise<void>;
|
|
348
446
|
};
|
|
349
447
|
}
|
|
350
448
|
export {};
|