@alephium/web3 0.5.0-rc.11 → 0.5.0-rc.12
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/dist/alephium-web3.min.js +1 -1
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/api/api-alephium.d.ts +56 -6
- package/dist/src/api/api-alephium.js +5 -3
- package/dist/src/api/api-explorer.d.ts +155 -6
- package/dist/src/api/api-explorer.js +5 -3
- package/package.json +4 -4
- package/src/api/api-alephium.ts +177 -180
- package/src/api/api-explorer.ts +249 -76
|
@@ -141,6 +141,7 @@ export interface BrokerInfo {
|
|
|
141
141
|
/** @format inet-socket-address */
|
|
142
142
|
address: {
|
|
143
143
|
addr: string;
|
|
144
|
+
/** @format int32 */
|
|
144
145
|
port: number;
|
|
145
146
|
};
|
|
146
147
|
}
|
|
@@ -514,6 +515,7 @@ export interface InterCliquePeerInfo {
|
|
|
514
515
|
/** @format inet-socket-address */
|
|
515
516
|
address: {
|
|
516
517
|
addr: string;
|
|
518
|
+
/** @format int32 */
|
|
517
519
|
port: number;
|
|
518
520
|
};
|
|
519
521
|
isSynced: boolean;
|
|
@@ -545,6 +547,7 @@ export interface NodeInfo {
|
|
|
545
547
|
/** @format inet-socket-address */
|
|
546
548
|
externalAddress?: {
|
|
547
549
|
addr: string;
|
|
550
|
+
/** @format int32 */
|
|
548
551
|
port: number;
|
|
549
552
|
};
|
|
550
553
|
}
|
|
@@ -892,7 +895,8 @@ declare type CancelToken = Symbol | string | number;
|
|
|
892
895
|
export declare enum ContentType {
|
|
893
896
|
Json = "application/json",
|
|
894
897
|
FormData = "multipart/form-data",
|
|
895
|
-
UrlEncoded = "application/x-www-form-urlencoded"
|
|
898
|
+
UrlEncoded = "application/x-www-form-urlencoded",
|
|
899
|
+
Text = "text/plain"
|
|
896
900
|
}
|
|
897
901
|
export declare class HttpClient<SecurityDataType = unknown> {
|
|
898
902
|
baseUrl: string;
|
|
@@ -903,14 +907,14 @@ export declare class HttpClient<SecurityDataType = unknown> {
|
|
|
903
907
|
private baseApiParams;
|
|
904
908
|
constructor(apiConfig?: ApiConfig<SecurityDataType>);
|
|
905
909
|
setSecurityData: (data: SecurityDataType | null) => void;
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
910
|
+
protected encodeQueryParam(key: string, value: any): string;
|
|
911
|
+
protected addQueryParam(query: QueryParamsType, key: string): string;
|
|
912
|
+
protected addArrayQueryParam(query: QueryParamsType, key: string): any;
|
|
909
913
|
protected toQueryString(rawQuery?: QueryParamsType): string;
|
|
910
914
|
protected addQueryParams(rawQuery?: QueryParamsType): string;
|
|
911
915
|
private contentFormatters;
|
|
912
|
-
|
|
913
|
-
|
|
916
|
+
protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams;
|
|
917
|
+
protected createAbortSignal: (cancelToken: CancelToken) => AbortSignal | undefined;
|
|
914
918
|
abortRequest: (cancelToken: CancelToken) => void;
|
|
915
919
|
request: <T = any, E = any>({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams) => Promise<HttpResponse<T, E>>;
|
|
916
920
|
}
|
|
@@ -1074,6 +1078,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1074
1078
|
* @request POST:/wallets/{wallet_name}/derive-next-address
|
|
1075
1079
|
*/
|
|
1076
1080
|
postWalletsWalletNameDeriveNextAddress: (walletName: string, query?: {
|
|
1081
|
+
/** @format int32 */
|
|
1077
1082
|
group?: number;
|
|
1078
1083
|
}, params?: RequestParams) => Promise<AddressInfo>;
|
|
1079
1084
|
/**
|
|
@@ -1195,7 +1200,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1195
1200
|
* @request GET:/infos/history-hashrate
|
|
1196
1201
|
*/
|
|
1197
1202
|
getInfosHistoryHashrate: (query: {
|
|
1203
|
+
/**
|
|
1204
|
+
* @format int64
|
|
1205
|
+
* @min 0
|
|
1206
|
+
*/
|
|
1198
1207
|
fromTs: number;
|
|
1208
|
+
/**
|
|
1209
|
+
* @format int64
|
|
1210
|
+
* @min 0
|
|
1211
|
+
*/
|
|
1199
1212
|
toTs?: number;
|
|
1200
1213
|
}, params?: RequestParams) => Promise<string>;
|
|
1201
1214
|
/**
|
|
@@ -1207,6 +1220,10 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1207
1220
|
* @request GET:/infos/current-hashrate
|
|
1208
1221
|
*/
|
|
1209
1222
|
getInfosCurrentHashrate: (query?: {
|
|
1223
|
+
/**
|
|
1224
|
+
* @format int64
|
|
1225
|
+
* @min 1
|
|
1226
|
+
*/
|
|
1210
1227
|
timespan?: number;
|
|
1211
1228
|
}, params?: RequestParams) => Promise<string>;
|
|
1212
1229
|
};
|
|
@@ -1220,7 +1237,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1220
1237
|
* @request GET:/blockflow/blocks
|
|
1221
1238
|
*/
|
|
1222
1239
|
getBlockflowBlocks: (query: {
|
|
1240
|
+
/**
|
|
1241
|
+
* @format int64
|
|
1242
|
+
* @min 0
|
|
1243
|
+
*/
|
|
1223
1244
|
fromTs: number;
|
|
1245
|
+
/**
|
|
1246
|
+
* @format int64
|
|
1247
|
+
* @min 0
|
|
1248
|
+
*/
|
|
1224
1249
|
toTs?: number;
|
|
1225
1250
|
}, params?: RequestParams) => Promise<BlocksPerTimeStampRange>;
|
|
1226
1251
|
/**
|
|
@@ -1232,7 +1257,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1232
1257
|
* @request GET:/blockflow/blocks-with-events
|
|
1233
1258
|
*/
|
|
1234
1259
|
getBlockflowBlocksWithEvents: (query: {
|
|
1260
|
+
/**
|
|
1261
|
+
* @format int64
|
|
1262
|
+
* @min 0
|
|
1263
|
+
*/
|
|
1235
1264
|
fromTs: number;
|
|
1265
|
+
/**
|
|
1266
|
+
* @format int64
|
|
1267
|
+
* @min 0
|
|
1268
|
+
*/
|
|
1236
1269
|
toTs?: number;
|
|
1237
1270
|
}, params?: RequestParams) => Promise<BlocksAndEventsPerTimeStampRange>;
|
|
1238
1271
|
/**
|
|
@@ -1273,8 +1306,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1273
1306
|
* @request GET:/blockflow/hashes
|
|
1274
1307
|
*/
|
|
1275
1308
|
getBlockflowHashes: (query: {
|
|
1309
|
+
/** @format int32 */
|
|
1276
1310
|
fromGroup: number;
|
|
1311
|
+
/** @format int32 */
|
|
1277
1312
|
toGroup: number;
|
|
1313
|
+
/** @format int32 */
|
|
1278
1314
|
height: number;
|
|
1279
1315
|
}, params?: RequestParams) => Promise<HashesAtHeight>;
|
|
1280
1316
|
/**
|
|
@@ -1286,7 +1322,9 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1286
1322
|
* @request GET:/blockflow/chain-info
|
|
1287
1323
|
*/
|
|
1288
1324
|
getBlockflowChainInfo: (query: {
|
|
1325
|
+
/** @format int32 */
|
|
1289
1326
|
fromGroup: number;
|
|
1327
|
+
/** @format int32 */
|
|
1290
1328
|
toGroup: number;
|
|
1291
1329
|
}, params?: RequestParams) => Promise<ChainInfo>;
|
|
1292
1330
|
/**
|
|
@@ -1374,7 +1412,9 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1374
1412
|
* @request GET:/transactions/details/{txId}
|
|
1375
1413
|
*/
|
|
1376
1414
|
getTransactionsDetailsTxid: (txId: string, query?: {
|
|
1415
|
+
/** @format int32 */
|
|
1377
1416
|
fromGroup?: number;
|
|
1417
|
+
/** @format int32 */
|
|
1378
1418
|
toGroup?: number;
|
|
1379
1419
|
}, params?: RequestParams) => Promise<Transaction>;
|
|
1380
1420
|
/**
|
|
@@ -1387,7 +1427,9 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1387
1427
|
*/
|
|
1388
1428
|
getTransactionsStatus: (query: {
|
|
1389
1429
|
txId: string;
|
|
1430
|
+
/** @format int32 */
|
|
1390
1431
|
fromGroup?: number;
|
|
1432
|
+
/** @format int32 */
|
|
1391
1433
|
toGroup?: number;
|
|
1392
1434
|
}, params?: RequestParams) => Promise<Confirmed | MemPooled | TxNotFound>;
|
|
1393
1435
|
};
|
|
@@ -1486,6 +1528,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1486
1528
|
* @request GET:/contracts/{address}/state
|
|
1487
1529
|
*/
|
|
1488
1530
|
getContractsAddressState: (address: string, query: {
|
|
1531
|
+
/** @format int32 */
|
|
1489
1532
|
group: number;
|
|
1490
1533
|
}, params?: RequestParams) => Promise<ContractState>;
|
|
1491
1534
|
/**
|
|
@@ -1577,7 +1620,9 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1577
1620
|
* @request POST:/miners/cpu-mining/mine-one-block
|
|
1578
1621
|
*/
|
|
1579
1622
|
postMinersCpuMiningMineOneBlock: (query: {
|
|
1623
|
+
/** @format int32 */
|
|
1580
1624
|
fromGroup: number;
|
|
1625
|
+
/** @format int32 */
|
|
1581
1626
|
toGroup: number;
|
|
1582
1627
|
}, params?: RequestParams) => Promise<boolean>;
|
|
1583
1628
|
/**
|
|
@@ -1609,8 +1654,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1609
1654
|
* @request GET:/events/contract/{contractAddress}
|
|
1610
1655
|
*/
|
|
1611
1656
|
getEventsContractContractaddress: (contractAddress: string, query: {
|
|
1657
|
+
/** @format int32 */
|
|
1612
1658
|
start: number;
|
|
1659
|
+
/** @format int32 */
|
|
1613
1660
|
limit?: number;
|
|
1661
|
+
/** @format int32 */
|
|
1614
1662
|
group?: number;
|
|
1615
1663
|
}, params?: RequestParams) => Promise<ContractEvents>;
|
|
1616
1664
|
/**
|
|
@@ -1631,6 +1679,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1631
1679
|
* @request GET:/events/tx-id/{txId}
|
|
1632
1680
|
*/
|
|
1633
1681
|
getEventsTxIdTxid: (txId: string, query?: {
|
|
1682
|
+
/** @format int32 */
|
|
1634
1683
|
group?: number;
|
|
1635
1684
|
}, params?: RequestParams) => Promise<ContractEventsByTxId>;
|
|
1636
1685
|
/**
|
|
@@ -1642,6 +1691,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1642
1691
|
* @request GET:/events/block-hash/{blockHash}
|
|
1643
1692
|
*/
|
|
1644
1693
|
getEventsBlockHashBlockhash: (blockHash: string, query?: {
|
|
1694
|
+
/** @format int32 */
|
|
1645
1695
|
group?: number;
|
|
1646
1696
|
}, params?: RequestParams) => Promise<ContractEventsByBlockHash>;
|
|
1647
1697
|
};
|
|
@@ -18,6 +18,7 @@ var ContentType;
|
|
|
18
18
|
ContentType["Json"] = "application/json";
|
|
19
19
|
ContentType["FormData"] = "multipart/form-data";
|
|
20
20
|
ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
|
|
21
|
+
ContentType["Text"] = "text/plain";
|
|
21
22
|
})(ContentType = exports.ContentType || (exports.ContentType = {}));
|
|
22
23
|
class HttpClient {
|
|
23
24
|
constructor(apiConfig = {}) {
|
|
@@ -36,6 +37,7 @@ class HttpClient {
|
|
|
36
37
|
};
|
|
37
38
|
this.contentFormatters = {
|
|
38
39
|
[ContentType.Json]: (input) => input !== null && (typeof input === 'object' || typeof input === 'string') ? JSON.stringify(input) : input,
|
|
40
|
+
[ContentType.Text]: (input) => (input !== null && typeof input !== 'string' ? JSON.stringify(input) : input),
|
|
39
41
|
[ContentType.FormData]: (input) => Object.keys(input || {}).reduce((formData, key) => {
|
|
40
42
|
const property = input[key];
|
|
41
43
|
formData.append(key, property instanceof Blob
|
|
@@ -78,10 +80,10 @@ class HttpClient {
|
|
|
78
80
|
return this.customFetch(`${baseUrl || this.baseUrl || ''}${path}${queryString ? `?${queryString}` : ''}`, {
|
|
79
81
|
...requestParams,
|
|
80
82
|
headers: {
|
|
81
|
-
...(
|
|
82
|
-
...(
|
|
83
|
+
...(requestParams.headers || {}),
|
|
84
|
+
...(type && type !== ContentType.FormData ? { 'Content-Type': type } : {})
|
|
83
85
|
},
|
|
84
|
-
signal: cancelToken ? this.createAbortSignal(cancelToken) :
|
|
86
|
+
signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal,
|
|
85
87
|
body: typeof body === 'undefined' || body === null ? null : payloadFormatter(body)
|
|
86
88
|
}).then(async (response) => {
|
|
87
89
|
const r = response;
|
|
@@ -300,7 +300,8 @@ declare type CancelToken = Symbol | string | number;
|
|
|
300
300
|
export declare enum ContentType {
|
|
301
301
|
Json = "application/json",
|
|
302
302
|
FormData = "multipart/form-data",
|
|
303
|
-
UrlEncoded = "application/x-www-form-urlencoded"
|
|
303
|
+
UrlEncoded = "application/x-www-form-urlencoded",
|
|
304
|
+
Text = "text/plain"
|
|
304
305
|
}
|
|
305
306
|
export declare class HttpClient<SecurityDataType = unknown> {
|
|
306
307
|
baseUrl: string;
|
|
@@ -311,14 +312,14 @@ export declare class HttpClient<SecurityDataType = unknown> {
|
|
|
311
312
|
private baseApiParams;
|
|
312
313
|
constructor(apiConfig?: ApiConfig<SecurityDataType>);
|
|
313
314
|
setSecurityData: (data: SecurityDataType | null) => void;
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
protected encodeQueryParam(key: string, value: any): string;
|
|
316
|
+
protected addQueryParam(query: QueryParamsType, key: string): string;
|
|
317
|
+
protected addArrayQueryParam(query: QueryParamsType, key: string): any;
|
|
317
318
|
protected toQueryString(rawQuery?: QueryParamsType): string;
|
|
318
319
|
protected addQueryParams(rawQuery?: QueryParamsType): string;
|
|
319
320
|
private contentFormatters;
|
|
320
|
-
|
|
321
|
-
|
|
321
|
+
protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams;
|
|
322
|
+
protected createAbortSignal: (cancelToken: CancelToken) => AbortSignal | undefined;
|
|
322
323
|
abortRequest: (cancelToken: CancelToken) => void;
|
|
323
324
|
request: <T = any, E = any>({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams) => Promise<HttpResponse<T, E>>;
|
|
324
325
|
}
|
|
@@ -336,8 +337,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
336
337
|
* @request GET:/blocks
|
|
337
338
|
*/
|
|
338
339
|
getBlocks: (query?: {
|
|
340
|
+
/**
|
|
341
|
+
* Page number
|
|
342
|
+
* @format int32
|
|
343
|
+
*/
|
|
339
344
|
page?: number;
|
|
345
|
+
/**
|
|
346
|
+
* Number of items per page
|
|
347
|
+
* @format int32
|
|
348
|
+
*/
|
|
340
349
|
limit?: number;
|
|
350
|
+
/** Reverse pagination */
|
|
341
351
|
reverse?: boolean;
|
|
342
352
|
}, params?: RequestParams) => Promise<ListBlocks>;
|
|
343
353
|
/**
|
|
@@ -356,8 +366,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
356
366
|
* @request GET:/blocks/{block_hash}/transactions
|
|
357
367
|
*/
|
|
358
368
|
getBlocksBlockHashTransactions: (blockHash: string, query?: {
|
|
369
|
+
/**
|
|
370
|
+
* Page number
|
|
371
|
+
* @format int32
|
|
372
|
+
*/
|
|
359
373
|
page?: number;
|
|
374
|
+
/**
|
|
375
|
+
* Number of items per page
|
|
376
|
+
* @format int32
|
|
377
|
+
*/
|
|
360
378
|
limit?: number;
|
|
379
|
+
/** Reverse pagination */
|
|
361
380
|
reverse?: boolean;
|
|
362
381
|
}, params?: RequestParams) => Promise<Transaction[]>;
|
|
363
382
|
};
|
|
@@ -388,8 +407,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
388
407
|
* @request GET:/addresses/{address}/transactions
|
|
389
408
|
*/
|
|
390
409
|
getAddressesAddressTransactions: (address: string, query?: {
|
|
410
|
+
/**
|
|
411
|
+
* Page number
|
|
412
|
+
* @format int32
|
|
413
|
+
*/
|
|
391
414
|
page?: number;
|
|
415
|
+
/**
|
|
416
|
+
* Number of items per page
|
|
417
|
+
* @format int32
|
|
418
|
+
*/
|
|
392
419
|
limit?: number;
|
|
420
|
+
/** Reverse pagination */
|
|
393
421
|
reverse?: boolean;
|
|
394
422
|
}, params?: RequestParams) => Promise<Transaction[]>;
|
|
395
423
|
/**
|
|
@@ -400,8 +428,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
400
428
|
* @request POST:/addresses/transactions
|
|
401
429
|
*/
|
|
402
430
|
postAddressesTransactions: (query?: {
|
|
431
|
+
/**
|
|
432
|
+
* Page number
|
|
433
|
+
* @format int32
|
|
434
|
+
*/
|
|
403
435
|
page?: number;
|
|
436
|
+
/**
|
|
437
|
+
* Number of items per page
|
|
438
|
+
* @format int32
|
|
439
|
+
*/
|
|
404
440
|
limit?: number;
|
|
441
|
+
/** Reverse pagination */
|
|
405
442
|
reverse?: boolean;
|
|
406
443
|
}, data?: string[], params?: RequestParams) => Promise<Transaction[]>;
|
|
407
444
|
/**
|
|
@@ -412,10 +449,27 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
412
449
|
* @request GET:/addresses/{address}/timeranged-transactions
|
|
413
450
|
*/
|
|
414
451
|
getAddressesAddressTimerangedTransactions: (address: string, query: {
|
|
452
|
+
/**
|
|
453
|
+
* @format int64
|
|
454
|
+
* @min 0
|
|
455
|
+
*/
|
|
415
456
|
fromTs: number;
|
|
457
|
+
/**
|
|
458
|
+
* @format int64
|
|
459
|
+
* @min 0
|
|
460
|
+
*/
|
|
416
461
|
toTs: number;
|
|
462
|
+
/**
|
|
463
|
+
* Page number
|
|
464
|
+
* @format int32
|
|
465
|
+
*/
|
|
417
466
|
page?: number;
|
|
467
|
+
/**
|
|
468
|
+
* Number of items per page
|
|
469
|
+
* @format int32
|
|
470
|
+
*/
|
|
418
471
|
limit?: number;
|
|
472
|
+
/** Reverse pagination */
|
|
419
473
|
reverse?: boolean;
|
|
420
474
|
}, params?: RequestParams) => Promise<Transaction[]>;
|
|
421
475
|
/**
|
|
@@ -458,8 +512,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
458
512
|
* @request GET:/addresses/{address}/tokens/{token_id}/transactions
|
|
459
513
|
*/
|
|
460
514
|
getAddressesAddressTokensTokenIdTransactions: (address: string, tokenId: string, query?: {
|
|
515
|
+
/**
|
|
516
|
+
* Page number
|
|
517
|
+
* @format int32
|
|
518
|
+
*/
|
|
461
519
|
page?: number;
|
|
520
|
+
/**
|
|
521
|
+
* Number of items per page
|
|
522
|
+
* @format int32
|
|
523
|
+
*/
|
|
462
524
|
limit?: number;
|
|
525
|
+
/** Reverse pagination */
|
|
463
526
|
reverse?: boolean;
|
|
464
527
|
}, params?: RequestParams) => Promise<Transaction[]>;
|
|
465
528
|
/**
|
|
@@ -486,7 +549,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
486
549
|
* @request GET:/addresses/{address}/export-transactions/csv
|
|
487
550
|
*/
|
|
488
551
|
getAddressesAddressExportTransactionsCsv: (address: string, query: {
|
|
552
|
+
/**
|
|
553
|
+
* @format int64
|
|
554
|
+
* @min 0
|
|
555
|
+
*/
|
|
489
556
|
fromTs: number;
|
|
557
|
+
/**
|
|
558
|
+
* @format int64
|
|
559
|
+
* @min 0
|
|
560
|
+
*/
|
|
490
561
|
toTs: number;
|
|
491
562
|
}, params?: RequestParams) => Promise<string>;
|
|
492
563
|
};
|
|
@@ -515,8 +586,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
515
586
|
* @request GET:/infos/supply
|
|
516
587
|
*/
|
|
517
588
|
getInfosSupply: (query?: {
|
|
589
|
+
/**
|
|
590
|
+
* Page number
|
|
591
|
+
* @format int32
|
|
592
|
+
*/
|
|
518
593
|
page?: number;
|
|
594
|
+
/**
|
|
595
|
+
* Number of items per page
|
|
596
|
+
* @format int32
|
|
597
|
+
*/
|
|
519
598
|
limit?: number;
|
|
599
|
+
/** Reverse pagination */
|
|
520
600
|
reverse?: boolean;
|
|
521
601
|
}, params?: RequestParams) => Promise<TokenSupply[]>;
|
|
522
602
|
/**
|
|
@@ -577,8 +657,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
577
657
|
* @request GET:/unconfirmed-transactions
|
|
578
658
|
*/
|
|
579
659
|
getUnconfirmedTransactions: (query?: {
|
|
660
|
+
/**
|
|
661
|
+
* Page number
|
|
662
|
+
* @format int32
|
|
663
|
+
*/
|
|
580
664
|
page?: number;
|
|
665
|
+
/**
|
|
666
|
+
* Number of items per page
|
|
667
|
+
* @format int32
|
|
668
|
+
*/
|
|
581
669
|
limit?: number;
|
|
670
|
+
/** Reverse pagination */
|
|
582
671
|
reverse?: boolean;
|
|
583
672
|
}, params?: RequestParams) => Promise<TransactionLike[]>;
|
|
584
673
|
};
|
|
@@ -591,8 +680,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
591
680
|
* @request GET:/tokens
|
|
592
681
|
*/
|
|
593
682
|
getTokens: (query?: {
|
|
683
|
+
/**
|
|
684
|
+
* Page number
|
|
685
|
+
* @format int32
|
|
686
|
+
*/
|
|
594
687
|
page?: number;
|
|
688
|
+
/**
|
|
689
|
+
* Number of items per page
|
|
690
|
+
* @format int32
|
|
691
|
+
*/
|
|
595
692
|
limit?: number;
|
|
693
|
+
/** Reverse pagination */
|
|
596
694
|
reverse?: boolean;
|
|
597
695
|
}, params?: RequestParams) => Promise<string[]>;
|
|
598
696
|
/**
|
|
@@ -603,8 +701,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
603
701
|
* @request GET:/tokens/{token_id}/transactions
|
|
604
702
|
*/
|
|
605
703
|
getTokensTokenIdTransactions: (tokenId: string, query?: {
|
|
704
|
+
/**
|
|
705
|
+
* Page number
|
|
706
|
+
* @format int32
|
|
707
|
+
*/
|
|
606
708
|
page?: number;
|
|
709
|
+
/**
|
|
710
|
+
* Number of items per page
|
|
711
|
+
* @format int32
|
|
712
|
+
*/
|
|
607
713
|
limit?: number;
|
|
714
|
+
/** Reverse pagination */
|
|
608
715
|
reverse?: boolean;
|
|
609
716
|
}, params?: RequestParams) => Promise<Transaction[]>;
|
|
610
717
|
};
|
|
@@ -618,7 +725,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
618
725
|
* @request GET:/charts/hashrates
|
|
619
726
|
*/
|
|
620
727
|
getChartsHashrates: (query: {
|
|
728
|
+
/**
|
|
729
|
+
* @format int64
|
|
730
|
+
* @min 0
|
|
731
|
+
*/
|
|
621
732
|
fromTs: number;
|
|
733
|
+
/**
|
|
734
|
+
* @format int64
|
|
735
|
+
* @min 0
|
|
736
|
+
*/
|
|
622
737
|
toTs: number;
|
|
623
738
|
'interval-type': IntervalType;
|
|
624
739
|
}, params?: RequestParams) => Promise<Hashrate[]>;
|
|
@@ -631,7 +746,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
631
746
|
* @request GET:/charts/transactions-count
|
|
632
747
|
*/
|
|
633
748
|
getChartsTransactionsCount: (query: {
|
|
749
|
+
/**
|
|
750
|
+
* @format int64
|
|
751
|
+
* @min 0
|
|
752
|
+
*/
|
|
634
753
|
fromTs: number;
|
|
754
|
+
/**
|
|
755
|
+
* @format int64
|
|
756
|
+
* @min 0
|
|
757
|
+
*/
|
|
635
758
|
toTs: number;
|
|
636
759
|
'interval-type': IntervalType;
|
|
637
760
|
}, params?: RequestParams) => Promise<TimedCount[]>;
|
|
@@ -644,7 +767,15 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
644
767
|
* @request GET:/charts/transactions-count-per-chain
|
|
645
768
|
*/
|
|
646
769
|
getChartsTransactionsCountPerChain: (query: {
|
|
770
|
+
/**
|
|
771
|
+
* @format int64
|
|
772
|
+
* @min 0
|
|
773
|
+
*/
|
|
647
774
|
fromTs: number;
|
|
775
|
+
/**
|
|
776
|
+
* @format int64
|
|
777
|
+
* @min 0
|
|
778
|
+
*/
|
|
648
779
|
toTs: number;
|
|
649
780
|
'interval-type': IntervalType;
|
|
650
781
|
}, params?: RequestParams) => Promise<PerChainTimedCount[]>;
|
|
@@ -666,8 +797,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
666
797
|
* @request GET:/contract-events/contract-address/{contract_address}
|
|
667
798
|
*/
|
|
668
799
|
getContractEventsContractAddressContractAddress: (contractAddress: string, query?: {
|
|
800
|
+
/**
|
|
801
|
+
* Page number
|
|
802
|
+
* @format int32
|
|
803
|
+
*/
|
|
669
804
|
page?: number;
|
|
805
|
+
/**
|
|
806
|
+
* Number of items per page
|
|
807
|
+
* @format int32
|
|
808
|
+
*/
|
|
670
809
|
limit?: number;
|
|
810
|
+
/** Reverse pagination */
|
|
671
811
|
reverse?: boolean;
|
|
672
812
|
}, params?: RequestParams) => Promise<Event[]>;
|
|
673
813
|
/**
|
|
@@ -678,8 +818,17 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
678
818
|
* @request GET:/contract-events/contract-address/{contract_address}/input-address/{input_address}
|
|
679
819
|
*/
|
|
680
820
|
getContractEventsContractAddressContractAddressInputAddressInputAddress: (contractAddress: string, inputAddress: string, query?: {
|
|
821
|
+
/**
|
|
822
|
+
* Page number
|
|
823
|
+
* @format int32
|
|
824
|
+
*/
|
|
681
825
|
page?: number;
|
|
826
|
+
/**
|
|
827
|
+
* Number of items per page
|
|
828
|
+
* @format int32
|
|
829
|
+
*/
|
|
682
830
|
limit?: number;
|
|
831
|
+
/** Reverse pagination */
|
|
683
832
|
reverse?: boolean;
|
|
684
833
|
}, params?: RequestParams) => Promise<Event[]>;
|
|
685
834
|
};
|
|
@@ -23,6 +23,7 @@ var ContentType;
|
|
|
23
23
|
ContentType["Json"] = "application/json";
|
|
24
24
|
ContentType["FormData"] = "multipart/form-data";
|
|
25
25
|
ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
|
|
26
|
+
ContentType["Text"] = "text/plain";
|
|
26
27
|
})(ContentType = exports.ContentType || (exports.ContentType = {}));
|
|
27
28
|
class HttpClient {
|
|
28
29
|
constructor(apiConfig = {}) {
|
|
@@ -41,6 +42,7 @@ class HttpClient {
|
|
|
41
42
|
};
|
|
42
43
|
this.contentFormatters = {
|
|
43
44
|
[ContentType.Json]: (input) => input !== null && (typeof input === 'object' || typeof input === 'string') ? JSON.stringify(input) : input,
|
|
45
|
+
[ContentType.Text]: (input) => (input !== null && typeof input !== 'string' ? JSON.stringify(input) : input),
|
|
44
46
|
[ContentType.FormData]: (input) => Object.keys(input || {}).reduce((formData, key) => {
|
|
45
47
|
const property = input[key];
|
|
46
48
|
formData.append(key, property instanceof Blob
|
|
@@ -83,10 +85,10 @@ class HttpClient {
|
|
|
83
85
|
return this.customFetch(`${baseUrl || this.baseUrl || ''}${path}${queryString ? `?${queryString}` : ''}`, {
|
|
84
86
|
...requestParams,
|
|
85
87
|
headers: {
|
|
86
|
-
...(
|
|
87
|
-
...(
|
|
88
|
+
...(requestParams.headers || {}),
|
|
89
|
+
...(type && type !== ContentType.FormData ? { 'Content-Type': type } : {})
|
|
88
90
|
},
|
|
89
|
-
signal: cancelToken ? this.createAbortSignal(cancelToken) :
|
|
91
|
+
signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal,
|
|
90
92
|
body: typeof body === 'undefined' || body === null ? null : payloadFormatter(body)
|
|
91
93
|
}).then(async (response) => {
|
|
92
94
|
const r = response;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alephium/web3",
|
|
3
|
-
"version": "0.5.0-rc.
|
|
3
|
+
"version": "0.5.0-rc.12",
|
|
4
4
|
"description": "A JS/TS library to interact with the Alephium platform",
|
|
5
5
|
"license": "GPL",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"author": "Alephium dev <dev@alephium.org>",
|
|
29
29
|
"config": {
|
|
30
|
-
"alephium_version": "1.7.
|
|
31
|
-
"explorer_backend_version": "1.
|
|
30
|
+
"alephium_version": "1.7.1-rc2",
|
|
31
|
+
"explorer_backend_version": "1.13.0-rc0"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "rm -rf dist/* && npx tsc --build . && webpack",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"rewire": "^6.0.0",
|
|
79
79
|
"shelljs": "^0.8.5",
|
|
80
80
|
"stream-browserify": "^3.0.0",
|
|
81
|
-
"swagger-typescript-api": "
|
|
81
|
+
"swagger-typescript-api": "12.0.3",
|
|
82
82
|
"terser-webpack-plugin": "^5.3.1",
|
|
83
83
|
"ts-jest": "^28.0.2",
|
|
84
84
|
"ts-node": "^10.7.0",
|