@avalabs/glacier-sdk 2.8.0-canary.88a143f.0 → 2.8.0-canary.88be626.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/dist/index.d.ts +227 -55
- package/dist/index.js +140 -45
- package/esm/generated/Glacier.d.ts +2 -0
- package/esm/generated/Glacier.js +3 -0
- package/esm/generated/core/CancelablePromise.d.ts +2 -8
- package/esm/generated/core/CancelablePromise.js +38 -36
- package/esm/generated/core/request.js +3 -2
- package/esm/generated/models/ActiveValidatorDetails.d.ts +5 -0
- package/esm/generated/models/AddressActivityMetadata.d.ts +2 -2
- package/esm/generated/models/AddressesChangeRequest.d.ts +8 -0
- package/esm/generated/models/BlsCredentials.d.ts +6 -0
- package/esm/generated/models/ChainInfo.d.ts +1 -1
- package/esm/generated/models/CompletedValidatorDetails.d.ts +5 -0
- package/esm/generated/models/{RegisterWebhookRequest.d.ts → CreateWebhookRequest.d.ts} +5 -3
- package/esm/generated/models/DeliveredSourceNotIndexedTeleporterMessage.d.ts +2 -0
- package/esm/generated/models/DeliveredTeleporterMessage.d.ts +2 -0
- package/esm/generated/models/GetChainResponse.d.ts +1 -1
- package/esm/generated/models/GlacierApiFeature.d.ts +2 -1
- package/esm/generated/models/GlacierApiFeature.js +1 -0
- package/esm/generated/models/ListTeleporterMessagesResponse.d.ts +12 -0
- package/esm/generated/models/ListWebhookAddressesResponse.d.ts +10 -0
- package/esm/generated/models/PChainTransaction.d.ts +5 -0
- package/esm/generated/models/PendingTeleporterMessage.d.ts +2 -0
- package/esm/generated/models/PendingValidatorDetails.d.ts +6 -0
- package/esm/generated/models/PrimaryNetworkOptions.d.ts +1 -1
- package/esm/generated/models/RemovedValidatorDetails.d.ts +6 -0
- package/esm/generated/models/RpcErrorDto.d.ts +7 -0
- package/esm/generated/models/RpcErrorResponseDto.d.ts +9 -0
- package/esm/generated/models/RpcRequestBodyDto.d.ts +8 -0
- package/esm/generated/models/RpcSuccessResponseDto.d.ts +7 -0
- package/esm/generated/models/SortByOption.d.ts +9 -0
- package/esm/generated/models/SortByOption.js +10 -0
- package/esm/generated/models/UpdateWebhookRequest.d.ts +1 -1
- package/esm/generated/models/WebhookResponse.d.ts +1 -1
- package/esm/generated/services/EvmBalancesService.d.ts +5 -1
- package/esm/generated/services/EvmBalancesService.js +2 -0
- package/esm/generated/services/PrimaryNetworkService.d.ts +23 -8
- package/esm/generated/services/PrimaryNetworkService.js +10 -4
- package/esm/generated/services/RpcService.d.ts +25 -0
- package/esm/generated/services/RpcService.js +24 -0
- package/esm/generated/services/TeleporterService.d.ts +9 -4
- package/esm/generated/services/TeleporterService.js +4 -2
- package/esm/generated/services/WebhooksService.d.ts +53 -5
- package/esm/generated/services/WebhooksService.js +46 -1
- package/esm/index.d.ts +11 -1
- package/esm/index.js +2 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -33,71 +33,73 @@ class CancelError extends Error {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
class CancelablePromise {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
_reject;
|
|
36
|
+
#isResolved;
|
|
37
|
+
#isRejected;
|
|
38
|
+
#isCancelled;
|
|
39
|
+
#cancelHandlers;
|
|
40
|
+
#promise;
|
|
41
|
+
#resolve;
|
|
42
|
+
#reject;
|
|
44
43
|
constructor(executor) {
|
|
45
|
-
this
|
|
46
|
-
this
|
|
47
|
-
this
|
|
48
|
-
this
|
|
49
|
-
this
|
|
50
|
-
this
|
|
51
|
-
this
|
|
44
|
+
this.#isResolved = false;
|
|
45
|
+
this.#isRejected = false;
|
|
46
|
+
this.#isCancelled = false;
|
|
47
|
+
this.#cancelHandlers = [];
|
|
48
|
+
this.#promise = new Promise((resolve, reject) => {
|
|
49
|
+
this.#resolve = resolve;
|
|
50
|
+
this.#reject = reject;
|
|
52
51
|
const onResolve = (value) => {
|
|
53
|
-
if (this
|
|
52
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
54
53
|
return;
|
|
55
54
|
}
|
|
56
|
-
this
|
|
57
|
-
this
|
|
55
|
+
this.#isResolved = true;
|
|
56
|
+
this.#resolve?.(value);
|
|
58
57
|
};
|
|
59
58
|
const onReject = (reason) => {
|
|
60
|
-
if (this
|
|
59
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
61
60
|
return;
|
|
62
61
|
}
|
|
63
|
-
this
|
|
64
|
-
this
|
|
62
|
+
this.#isRejected = true;
|
|
63
|
+
this.#reject?.(reason);
|
|
65
64
|
};
|
|
66
65
|
const onCancel = (cancelHandler) => {
|
|
67
|
-
if (this
|
|
66
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
68
67
|
return;
|
|
69
68
|
}
|
|
70
|
-
this.
|
|
69
|
+
this.#cancelHandlers.push(cancelHandler);
|
|
71
70
|
};
|
|
72
71
|
Object.defineProperty(onCancel, "isResolved", {
|
|
73
|
-
get: () => this
|
|
72
|
+
get: () => this.#isResolved
|
|
74
73
|
});
|
|
75
74
|
Object.defineProperty(onCancel, "isRejected", {
|
|
76
|
-
get: () => this
|
|
75
|
+
get: () => this.#isRejected
|
|
77
76
|
});
|
|
78
77
|
Object.defineProperty(onCancel, "isCancelled", {
|
|
79
|
-
get: () => this
|
|
78
|
+
get: () => this.#isCancelled
|
|
80
79
|
});
|
|
81
80
|
return executor(onResolve, onReject, onCancel);
|
|
82
81
|
});
|
|
83
82
|
}
|
|
83
|
+
get [Symbol.toStringTag]() {
|
|
84
|
+
return "Cancellable Promise";
|
|
85
|
+
}
|
|
84
86
|
then(onFulfilled, onRejected) {
|
|
85
|
-
return this.
|
|
87
|
+
return this.#promise.then(onFulfilled, onRejected);
|
|
86
88
|
}
|
|
87
89
|
catch(onRejected) {
|
|
88
|
-
return this.
|
|
90
|
+
return this.#promise.catch(onRejected);
|
|
89
91
|
}
|
|
90
92
|
finally(onFinally) {
|
|
91
|
-
return this.
|
|
93
|
+
return this.#promise.finally(onFinally);
|
|
92
94
|
}
|
|
93
95
|
cancel() {
|
|
94
|
-
if (this
|
|
96
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
95
97
|
return;
|
|
96
98
|
}
|
|
97
|
-
this
|
|
98
|
-
if (this.
|
|
99
|
+
this.#isCancelled = true;
|
|
100
|
+
if (this.#cancelHandlers.length) {
|
|
99
101
|
try {
|
|
100
|
-
for (const cancelHandler of this
|
|
102
|
+
for (const cancelHandler of this.#cancelHandlers) {
|
|
101
103
|
cancelHandler();
|
|
102
104
|
}
|
|
103
105
|
} catch (error) {
|
|
@@ -105,11 +107,11 @@ class CancelablePromise {
|
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
|
-
this.
|
|
109
|
-
this
|
|
110
|
+
this.#cancelHandlers.length = 0;
|
|
111
|
+
this.#reject?.(new CancelError("Request aborted"));
|
|
110
112
|
}
|
|
111
113
|
get isCancelled() {
|
|
112
|
-
return this
|
|
114
|
+
return this.#isCancelled;
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
117
|
|
|
@@ -238,7 +240,7 @@ const getHeaders = async (config, options) => {
|
|
|
238
240
|
return new Headers(headers);
|
|
239
241
|
};
|
|
240
242
|
const getRequestBody = (options) => {
|
|
241
|
-
if (options.body) {
|
|
243
|
+
if (options.body !== void 0) {
|
|
242
244
|
if (options.mediaType?.includes("/json")) {
|
|
243
245
|
return JSON.stringify(options.body);
|
|
244
246
|
} else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
|
|
@@ -277,7 +279,8 @@ const getResponseBody = async (response) => {
|
|
|
277
279
|
try {
|
|
278
280
|
const contentType = response.headers.get("Content-Type");
|
|
279
281
|
if (contentType) {
|
|
280
|
-
const
|
|
282
|
+
const jsonTypes = ["application/json", "application/problem+json"];
|
|
283
|
+
const isJSON = jsonTypes.some((type) => contentType.toLowerCase().startsWith(type));
|
|
281
284
|
if (isJSON) {
|
|
282
285
|
return await response.json();
|
|
283
286
|
} else {
|
|
@@ -386,6 +389,7 @@ class EvmBalancesService {
|
|
|
386
389
|
blockNumber,
|
|
387
390
|
pageToken,
|
|
388
391
|
pageSize = 10,
|
|
392
|
+
filterSpamTokens = true,
|
|
389
393
|
contractAddresses,
|
|
390
394
|
currency
|
|
391
395
|
}) {
|
|
@@ -400,6 +404,7 @@ class EvmBalancesService {
|
|
|
400
404
|
"blockNumber": blockNumber,
|
|
401
405
|
"pageToken": pageToken,
|
|
402
406
|
"pageSize": pageSize,
|
|
407
|
+
"filterSpamTokens": filterSpamTokens,
|
|
403
408
|
"contractAddresses": contractAddresses,
|
|
404
409
|
"currency": currency
|
|
405
410
|
}
|
|
@@ -1008,6 +1013,7 @@ class PrimaryNetworkService {
|
|
|
1008
1013
|
pageToken,
|
|
1009
1014
|
pageSize = 10,
|
|
1010
1015
|
nodeIds,
|
|
1016
|
+
sortBy,
|
|
1011
1017
|
sortOrder,
|
|
1012
1018
|
validationStatus,
|
|
1013
1019
|
minDelegationCapacity,
|
|
@@ -1016,6 +1022,8 @@ class PrimaryNetworkService {
|
|
|
1016
1022
|
maxTimeRemaining,
|
|
1017
1023
|
minFeePercentage,
|
|
1018
1024
|
maxFeePercentage,
|
|
1025
|
+
minUptimePerformance,
|
|
1026
|
+
maxUptimePerformance,
|
|
1019
1027
|
subnetId
|
|
1020
1028
|
}) {
|
|
1021
1029
|
return this.httpRequest.request({
|
|
@@ -1028,6 +1036,7 @@ class PrimaryNetworkService {
|
|
|
1028
1036
|
"pageToken": pageToken,
|
|
1029
1037
|
"pageSize": pageSize,
|
|
1030
1038
|
"nodeIds": nodeIds,
|
|
1039
|
+
"sortBy": sortBy,
|
|
1031
1040
|
"sortOrder": sortOrder,
|
|
1032
1041
|
"validationStatus": validationStatus,
|
|
1033
1042
|
"minDelegationCapacity": minDelegationCapacity,
|
|
@@ -1036,6 +1045,8 @@ class PrimaryNetworkService {
|
|
|
1036
1045
|
"maxTimeRemaining": maxTimeRemaining,
|
|
1037
1046
|
"minFeePercentage": minFeePercentage,
|
|
1038
1047
|
"maxFeePercentage": maxFeePercentage,
|
|
1048
|
+
"minUptimePerformance": minUptimePerformance,
|
|
1049
|
+
"maxUptimePerformance": maxUptimePerformance,
|
|
1039
1050
|
"subnetId": subnetId
|
|
1040
1051
|
}
|
|
1041
1052
|
});
|
|
@@ -1045,8 +1056,8 @@ class PrimaryNetworkService {
|
|
|
1045
1056
|
nodeId,
|
|
1046
1057
|
pageToken,
|
|
1047
1058
|
pageSize = 10,
|
|
1048
|
-
|
|
1049
|
-
|
|
1059
|
+
validationStatus,
|
|
1060
|
+
sortOrder
|
|
1050
1061
|
}) {
|
|
1051
1062
|
return this.httpRequest.request({
|
|
1052
1063
|
method: "GET",
|
|
@@ -1058,8 +1069,8 @@ class PrimaryNetworkService {
|
|
|
1058
1069
|
query: {
|
|
1059
1070
|
"pageToken": pageToken,
|
|
1060
1071
|
"pageSize": pageSize,
|
|
1061
|
-
"
|
|
1062
|
-
"
|
|
1072
|
+
"validationStatus": validationStatus,
|
|
1073
|
+
"sortOrder": sortOrder
|
|
1063
1074
|
}
|
|
1064
1075
|
});
|
|
1065
1076
|
}
|
|
@@ -1432,6 +1443,29 @@ class PrimaryNetworkVerticesService {
|
|
|
1432
1443
|
}
|
|
1433
1444
|
}
|
|
1434
1445
|
|
|
1446
|
+
class RpcService {
|
|
1447
|
+
constructor(httpRequest) {
|
|
1448
|
+
this.httpRequest = httpRequest;
|
|
1449
|
+
}
|
|
1450
|
+
rpc({
|
|
1451
|
+
chainId,
|
|
1452
|
+
requestBody
|
|
1453
|
+
}) {
|
|
1454
|
+
return this.httpRequest.request({
|
|
1455
|
+
method: "POST",
|
|
1456
|
+
url: "/v1/ext/bc/{chainId}/rpc",
|
|
1457
|
+
path: {
|
|
1458
|
+
"chainId": chainId
|
|
1459
|
+
},
|
|
1460
|
+
body: requestBody,
|
|
1461
|
+
mediaType: "application/json",
|
|
1462
|
+
errors: {
|
|
1463
|
+
504: `Request timed out`
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1435
1469
|
class TeleporterService {
|
|
1436
1470
|
constructor(httpRequest) {
|
|
1437
1471
|
this.httpRequest = httpRequest;
|
|
@@ -1453,7 +1487,8 @@ class TeleporterService {
|
|
|
1453
1487
|
sourceBlockchainId,
|
|
1454
1488
|
destinationBlockchainId,
|
|
1455
1489
|
to,
|
|
1456
|
-
from
|
|
1490
|
+
from,
|
|
1491
|
+
network
|
|
1457
1492
|
}) {
|
|
1458
1493
|
return this.httpRequest.request({
|
|
1459
1494
|
method: "GET",
|
|
@@ -1464,7 +1499,8 @@ class TeleporterService {
|
|
|
1464
1499
|
"sourceBlockchainId": sourceBlockchainId,
|
|
1465
1500
|
"destinationBlockchainId": destinationBlockchainId,
|
|
1466
1501
|
"to": to,
|
|
1467
|
-
"from": from
|
|
1502
|
+
"from": from,
|
|
1503
|
+
"network": network
|
|
1468
1504
|
}
|
|
1469
1505
|
});
|
|
1470
1506
|
}
|
|
@@ -1474,7 +1510,7 @@ class WebhooksService {
|
|
|
1474
1510
|
constructor(httpRequest) {
|
|
1475
1511
|
this.httpRequest = httpRequest;
|
|
1476
1512
|
}
|
|
1477
|
-
|
|
1513
|
+
createWebhook({
|
|
1478
1514
|
requestBody
|
|
1479
1515
|
}) {
|
|
1480
1516
|
return this.httpRequest.request({
|
|
@@ -1547,6 +1583,51 @@ class WebhooksService {
|
|
|
1547
1583
|
url: "/v1/webhooks:getSharedSecret"
|
|
1548
1584
|
});
|
|
1549
1585
|
}
|
|
1586
|
+
addAddressesToWebhook({
|
|
1587
|
+
id,
|
|
1588
|
+
requestBody
|
|
1589
|
+
}) {
|
|
1590
|
+
return this.httpRequest.request({
|
|
1591
|
+
method: "PATCH",
|
|
1592
|
+
url: "/v1/webhooks/{id}/addresses",
|
|
1593
|
+
path: {
|
|
1594
|
+
"id": id
|
|
1595
|
+
},
|
|
1596
|
+
body: requestBody,
|
|
1597
|
+
mediaType: "application/json"
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
removeAddressesFromWebhook({
|
|
1601
|
+
id,
|
|
1602
|
+
requestBody
|
|
1603
|
+
}) {
|
|
1604
|
+
return this.httpRequest.request({
|
|
1605
|
+
method: "DELETE",
|
|
1606
|
+
url: "/v1/webhooks/{id}/addresses",
|
|
1607
|
+
path: {
|
|
1608
|
+
"id": id
|
|
1609
|
+
},
|
|
1610
|
+
body: requestBody,
|
|
1611
|
+
mediaType: "application/json"
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
getAddressesFromWebhook({
|
|
1615
|
+
id,
|
|
1616
|
+
pageToken,
|
|
1617
|
+
pageSize = 10
|
|
1618
|
+
}) {
|
|
1619
|
+
return this.httpRequest.request({
|
|
1620
|
+
method: "GET",
|
|
1621
|
+
url: "/v1/webhooks/{id}/addresses",
|
|
1622
|
+
path: {
|
|
1623
|
+
"id": id
|
|
1624
|
+
},
|
|
1625
|
+
query: {
|
|
1626
|
+
"pageToken": pageToken,
|
|
1627
|
+
"pageSize": pageSize
|
|
1628
|
+
}
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1550
1631
|
}
|
|
1551
1632
|
|
|
1552
1633
|
class Glacier {
|
|
@@ -1566,6 +1647,7 @@ class Glacier {
|
|
|
1566
1647
|
primaryNetworkTransactions;
|
|
1567
1648
|
primaryNetworkUtxOs;
|
|
1568
1649
|
primaryNetworkVertices;
|
|
1650
|
+
rpc;
|
|
1569
1651
|
teleporter;
|
|
1570
1652
|
webhooks;
|
|
1571
1653
|
request;
|
|
@@ -1597,6 +1679,7 @@ class Glacier {
|
|
|
1597
1679
|
this.primaryNetworkTransactions = new PrimaryNetworkTransactionsService(this.request);
|
|
1598
1680
|
this.primaryNetworkUtxOs = new PrimaryNetworkUtxOsService(this.request);
|
|
1599
1681
|
this.primaryNetworkVertices = new PrimaryNetworkVerticesService(this.request);
|
|
1682
|
+
this.rpc = new RpcService(this.request);
|
|
1600
1683
|
this.teleporter = new TeleporterService(this.request);
|
|
1601
1684
|
this.webhooks = new WebhooksService(this.request);
|
|
1602
1685
|
}
|
|
@@ -1825,6 +1908,7 @@ var EVMOperationType = /* @__PURE__ */ ((EVMOperationType2) => {
|
|
|
1825
1908
|
|
|
1826
1909
|
var GlacierApiFeature = /* @__PURE__ */ ((GlacierApiFeature2) => {
|
|
1827
1910
|
GlacierApiFeature2["NFT_INDEXING"] = "nftIndexing";
|
|
1911
|
+
GlacierApiFeature2["WEBHOOKS"] = "webhooks";
|
|
1828
1912
|
return GlacierApiFeature2;
|
|
1829
1913
|
})(GlacierApiFeature || {});
|
|
1830
1914
|
|
|
@@ -2026,6 +2110,15 @@ var RewardType = /* @__PURE__ */ ((RewardType2) => {
|
|
|
2026
2110
|
return RewardType2;
|
|
2027
2111
|
})(RewardType || {});
|
|
2028
2112
|
|
|
2113
|
+
var SortByOption = /* @__PURE__ */ ((SortByOption2) => {
|
|
2114
|
+
SortByOption2["BLOCK_INDEX"] = "blockIndex";
|
|
2115
|
+
SortByOption2["DELEGATION_CAPACITY"] = "delegationCapacity";
|
|
2116
|
+
SortByOption2["TIME_REMAINING"] = "timeRemaining";
|
|
2117
|
+
SortByOption2["DELEGATION_FEE"] = "delegationFee";
|
|
2118
|
+
SortByOption2["UPTIME_PERFORMANCE"] = "uptimePerformance";
|
|
2119
|
+
return SortByOption2;
|
|
2120
|
+
})(SortByOption || {});
|
|
2121
|
+
|
|
2029
2122
|
var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
|
|
2030
2123
|
SortOrder2["ASC"] = "asc";
|
|
2031
2124
|
SortOrder2["DESC"] = "desc";
|
|
@@ -2172,6 +2265,8 @@ exports.PrimaryNetworkUtxOsService = PrimaryNetworkUtxOsService;
|
|
|
2172
2265
|
exports.PrimaryNetworkVerticesService = PrimaryNetworkVerticesService;
|
|
2173
2266
|
exports.ResourceLinkType = ResourceLinkType;
|
|
2174
2267
|
exports.RewardType = RewardType;
|
|
2268
|
+
exports.RpcService = RpcService;
|
|
2269
|
+
exports.SortByOption = SortByOption;
|
|
2175
2270
|
exports.SortOrder = SortOrder;
|
|
2176
2271
|
exports.TeleporterService = TeleporterService;
|
|
2177
2272
|
exports.TransactionMethodType = TransactionMethodType;
|
|
@@ -16,6 +16,7 @@ import { PrimaryNetworkRewardsService } from './services/PrimaryNetworkRewardsSe
|
|
|
16
16
|
import { PrimaryNetworkTransactionsService } from './services/PrimaryNetworkTransactionsService.js';
|
|
17
17
|
import { PrimaryNetworkUtxOsService } from './services/PrimaryNetworkUtxOsService.js';
|
|
18
18
|
import { PrimaryNetworkVerticesService } from './services/PrimaryNetworkVerticesService.js';
|
|
19
|
+
import { RpcService } from './services/RpcService.js';
|
|
19
20
|
import { TeleporterService } from './services/TeleporterService.js';
|
|
20
21
|
import { WebhooksService } from './services/WebhooksService.js';
|
|
21
22
|
|
|
@@ -37,6 +38,7 @@ declare class Glacier {
|
|
|
37
38
|
readonly primaryNetworkTransactions: PrimaryNetworkTransactionsService;
|
|
38
39
|
readonly primaryNetworkUtxOs: PrimaryNetworkUtxOsService;
|
|
39
40
|
readonly primaryNetworkVertices: PrimaryNetworkVerticesService;
|
|
41
|
+
readonly rpc: RpcService;
|
|
40
42
|
readonly teleporter: TeleporterService;
|
|
41
43
|
readonly webhooks: WebhooksService;
|
|
42
44
|
readonly request: BaseHttpRequest;
|
package/esm/generated/Glacier.js
CHANGED
|
@@ -15,6 +15,7 @@ import { PrimaryNetworkRewardsService } from './services/PrimaryNetworkRewardsSe
|
|
|
15
15
|
import { PrimaryNetworkTransactionsService } from './services/PrimaryNetworkTransactionsService.js';
|
|
16
16
|
import { PrimaryNetworkUtxOsService } from './services/PrimaryNetworkUtxOsService.js';
|
|
17
17
|
import { PrimaryNetworkVerticesService } from './services/PrimaryNetworkVerticesService.js';
|
|
18
|
+
import { RpcService } from './services/RpcService.js';
|
|
18
19
|
import { TeleporterService } from './services/TeleporterService.js';
|
|
19
20
|
import { WebhooksService } from './services/WebhooksService.js';
|
|
20
21
|
|
|
@@ -35,6 +36,7 @@ class Glacier {
|
|
|
35
36
|
primaryNetworkTransactions;
|
|
36
37
|
primaryNetworkUtxOs;
|
|
37
38
|
primaryNetworkVertices;
|
|
39
|
+
rpc;
|
|
38
40
|
teleporter;
|
|
39
41
|
webhooks;
|
|
40
42
|
request;
|
|
@@ -66,6 +68,7 @@ class Glacier {
|
|
|
66
68
|
this.primaryNetworkTransactions = new PrimaryNetworkTransactionsService(this.request);
|
|
67
69
|
this.primaryNetworkUtxOs = new PrimaryNetworkUtxOsService(this.request);
|
|
68
70
|
this.primaryNetworkVertices = new PrimaryNetworkVerticesService(this.request);
|
|
71
|
+
this.rpc = new RpcService(this.request);
|
|
69
72
|
this.teleporter = new TeleporterService(this.request);
|
|
70
73
|
this.webhooks = new WebhooksService(this.request);
|
|
71
74
|
}
|
|
@@ -9,15 +9,9 @@ interface OnCancel {
|
|
|
9
9
|
(cancelHandler: () => void): void;
|
|
10
10
|
}
|
|
11
11
|
declare class CancelablePromise<T> implements Promise<T> {
|
|
12
|
-
|
|
13
|
-
private _isResolved;
|
|
14
|
-
private _isRejected;
|
|
15
|
-
private _isCancelled;
|
|
16
|
-
private readonly _cancelHandlers;
|
|
17
|
-
private readonly _promise;
|
|
18
|
-
private _resolve?;
|
|
19
|
-
private _reject?;
|
|
12
|
+
#private;
|
|
20
13
|
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
|
|
14
|
+
get [Symbol.toStringTag](): string;
|
|
21
15
|
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
22
16
|
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
23
17
|
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
@@ -8,71 +8,73 @@ class CancelError extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
class CancelablePromise {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
_reject;
|
|
11
|
+
#isResolved;
|
|
12
|
+
#isRejected;
|
|
13
|
+
#isCancelled;
|
|
14
|
+
#cancelHandlers;
|
|
15
|
+
#promise;
|
|
16
|
+
#resolve;
|
|
17
|
+
#reject;
|
|
19
18
|
constructor(executor) {
|
|
20
|
-
this
|
|
21
|
-
this
|
|
22
|
-
this
|
|
23
|
-
this
|
|
24
|
-
this
|
|
25
|
-
this
|
|
26
|
-
this
|
|
19
|
+
this.#isResolved = false;
|
|
20
|
+
this.#isRejected = false;
|
|
21
|
+
this.#isCancelled = false;
|
|
22
|
+
this.#cancelHandlers = [];
|
|
23
|
+
this.#promise = new Promise((resolve, reject) => {
|
|
24
|
+
this.#resolve = resolve;
|
|
25
|
+
this.#reject = reject;
|
|
27
26
|
const onResolve = (value) => {
|
|
28
|
-
if (this
|
|
27
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
29
28
|
return;
|
|
30
29
|
}
|
|
31
|
-
this
|
|
32
|
-
this
|
|
30
|
+
this.#isResolved = true;
|
|
31
|
+
this.#resolve?.(value);
|
|
33
32
|
};
|
|
34
33
|
const onReject = (reason) => {
|
|
35
|
-
if (this
|
|
34
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
36
35
|
return;
|
|
37
36
|
}
|
|
38
|
-
this
|
|
39
|
-
this
|
|
37
|
+
this.#isRejected = true;
|
|
38
|
+
this.#reject?.(reason);
|
|
40
39
|
};
|
|
41
40
|
const onCancel = (cancelHandler) => {
|
|
42
|
-
if (this
|
|
41
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
|
-
this.
|
|
44
|
+
this.#cancelHandlers.push(cancelHandler);
|
|
46
45
|
};
|
|
47
46
|
Object.defineProperty(onCancel, "isResolved", {
|
|
48
|
-
get: () => this
|
|
47
|
+
get: () => this.#isResolved
|
|
49
48
|
});
|
|
50
49
|
Object.defineProperty(onCancel, "isRejected", {
|
|
51
|
-
get: () => this
|
|
50
|
+
get: () => this.#isRejected
|
|
52
51
|
});
|
|
53
52
|
Object.defineProperty(onCancel, "isCancelled", {
|
|
54
|
-
get: () => this
|
|
53
|
+
get: () => this.#isCancelled
|
|
55
54
|
});
|
|
56
55
|
return executor(onResolve, onReject, onCancel);
|
|
57
56
|
});
|
|
58
57
|
}
|
|
58
|
+
get [Symbol.toStringTag]() {
|
|
59
|
+
return "Cancellable Promise";
|
|
60
|
+
}
|
|
59
61
|
then(onFulfilled, onRejected) {
|
|
60
|
-
return this.
|
|
62
|
+
return this.#promise.then(onFulfilled, onRejected);
|
|
61
63
|
}
|
|
62
64
|
catch(onRejected) {
|
|
63
|
-
return this.
|
|
65
|
+
return this.#promise.catch(onRejected);
|
|
64
66
|
}
|
|
65
67
|
finally(onFinally) {
|
|
66
|
-
return this.
|
|
68
|
+
return this.#promise.finally(onFinally);
|
|
67
69
|
}
|
|
68
70
|
cancel() {
|
|
69
|
-
if (this
|
|
71
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
70
72
|
return;
|
|
71
73
|
}
|
|
72
|
-
this
|
|
73
|
-
if (this.
|
|
74
|
+
this.#isCancelled = true;
|
|
75
|
+
if (this.#cancelHandlers.length) {
|
|
74
76
|
try {
|
|
75
|
-
for (const cancelHandler of this
|
|
77
|
+
for (const cancelHandler of this.#cancelHandlers) {
|
|
76
78
|
cancelHandler();
|
|
77
79
|
}
|
|
78
80
|
} catch (error) {
|
|
@@ -80,11 +82,11 @@ class CancelablePromise {
|
|
|
80
82
|
return;
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
|
-
this.
|
|
84
|
-
this
|
|
85
|
+
this.#cancelHandlers.length = 0;
|
|
86
|
+
this.#reject?.(new CancelError("Request aborted"));
|
|
85
87
|
}
|
|
86
88
|
get isCancelled() {
|
|
87
|
-
return this
|
|
89
|
+
return this.#isCancelled;
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
|
|
@@ -126,7 +126,7 @@ const getHeaders = async (config, options) => {
|
|
|
126
126
|
return new Headers(headers);
|
|
127
127
|
};
|
|
128
128
|
const getRequestBody = (options) => {
|
|
129
|
-
if (options.body) {
|
|
129
|
+
if (options.body !== void 0) {
|
|
130
130
|
if (options.mediaType?.includes("/json")) {
|
|
131
131
|
return JSON.stringify(options.body);
|
|
132
132
|
} else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
|
|
@@ -165,7 +165,8 @@ const getResponseBody = async (response) => {
|
|
|
165
165
|
try {
|
|
166
166
|
const contentType = response.headers.get("Content-Type");
|
|
167
167
|
if (contentType) {
|
|
168
|
-
const
|
|
168
|
+
const jsonTypes = ["application/json", "application/problem+json"];
|
|
169
|
+
const isJSON = jsonTypes.some((type) => contentType.toLowerCase().startsWith(type));
|
|
169
170
|
if (isJSON) {
|
|
170
171
|
return await response.json();
|
|
171
172
|
} else {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlsCredentials } from './BlsCredentials.js';
|
|
1
2
|
import { Rewards } from './Rewards.js';
|
|
2
3
|
import { ValidatorHealthDetails } from './ValidatorHealthDetails.js';
|
|
3
4
|
|
|
@@ -9,6 +10,10 @@ type ActiveValidatorDetails = {
|
|
|
9
10
|
delegationFee?: string;
|
|
10
11
|
startTimestamp: number;
|
|
11
12
|
endTimestamp: number;
|
|
13
|
+
/**
|
|
14
|
+
* Present for AddPermissionlessValidatorTx
|
|
15
|
+
*/
|
|
16
|
+
blsCredentials?: BlsCredentials;
|
|
12
17
|
stakePercentage: number;
|
|
13
18
|
delegatorCount: number;
|
|
14
19
|
amountDelegated?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
type AddressActivityMetadata = {
|
|
2
2
|
/**
|
|
3
|
-
* Ethereum address for the address_activity event type
|
|
3
|
+
* Ethereum address(es) for the address_activity event type
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
addresses: Array<string>;
|
|
6
6
|
/**
|
|
7
7
|
* Array of hexadecimal strings of the event signatures.
|
|
8
8
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BlsCredentials } from './BlsCredentials.js';
|
|
1
2
|
import { Rewards } from './Rewards.js';
|
|
2
3
|
|
|
3
4
|
type CompletedValidatorDetails = {
|
|
@@ -8,6 +9,10 @@ type CompletedValidatorDetails = {
|
|
|
8
9
|
delegationFee?: string;
|
|
9
10
|
startTimestamp: number;
|
|
10
11
|
endTimestamp: number;
|
|
12
|
+
/**
|
|
13
|
+
* Present for AddPermissionlessValidatorTx
|
|
14
|
+
*/
|
|
15
|
+
blsCredentials?: BlsCredentials;
|
|
11
16
|
delegatorCount: number;
|
|
12
17
|
rewards: Rewards;
|
|
13
18
|
validationStatus: CompletedValidatorDetails.validationStatus;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { AddressActivityMetadata } from './AddressActivityMetadata.js';
|
|
2
2
|
import { EventType } from './EventType.js';
|
|
3
3
|
|
|
4
|
-
type
|
|
4
|
+
type CreateWebhookRequest = {
|
|
5
5
|
url: string;
|
|
6
6
|
chainId: string;
|
|
7
7
|
eventType: EventType;
|
|
8
8
|
metadata: AddressActivityMetadata;
|
|
9
|
+
name?: string;
|
|
10
|
+
description?: string;
|
|
9
11
|
/**
|
|
10
12
|
* Whether to include traces in the webhook payload.
|
|
11
13
|
*/
|
|
12
|
-
|
|
14
|
+
includeInternalTxs?: boolean;
|
|
13
15
|
/**
|
|
14
16
|
* Whether to include logs in the webhook payload.
|
|
15
17
|
*/
|
|
16
18
|
includeLogs?: boolean;
|
|
17
19
|
};
|
|
18
20
|
|
|
19
|
-
export {
|
|
21
|
+
export { CreateWebhookRequest };
|
|
@@ -7,6 +7,8 @@ type DeliveredSourceNotIndexedTeleporterMessage = {
|
|
|
7
7
|
teleporterContractAddress: string;
|
|
8
8
|
sourceBlockchainId: string;
|
|
9
9
|
destinationBlockchainId: string;
|
|
10
|
+
sourceEvmChainId: string;
|
|
11
|
+
destinationEvmChainId: string;
|
|
10
12
|
messageNonce: string;
|
|
11
13
|
from: string;
|
|
12
14
|
to: string;
|