@avalabs/glacier-sdk 2.8.0-canary.5b6e5aa.0 → 2.8.0-canary.5b79e81.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 +228 -165
- package/dist/index.js +160 -113
- package/esm/generated/Glacier.d.ts +4 -0
- package/esm/generated/Glacier.js +6 -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/AddressActivityMetadata.d.ts +2 -10
- package/esm/generated/models/ChainInfo.d.ts +1 -0
- package/esm/generated/models/GetChainResponse.d.ts +1 -0
- package/esm/generated/models/GlacierApiFeature.d.ts +6 -0
- package/esm/generated/models/GlacierApiFeature.js +7 -0
- package/esm/generated/models/PrimaryNetworkOptions.d.ts +1 -1
- package/esm/generated/models/RegisterWebhookRequest.d.ts +8 -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/UpdateWebhookRequest.d.ts +1 -1
- package/esm/generated/models/WebhookResponse.d.ts +8 -0
- package/esm/generated/services/DefaultService.d.ts +0 -86
- package/esm/generated/services/DefaultService.js +0 -73
- package/esm/generated/services/EvmChainsService.d.ts +6 -1
- package/esm/generated/services/EvmChainsService.js +4 -2
- package/esm/generated/services/PrimaryNetworkService.d.ts +1 -1
- package/esm/generated/services/RpcService.d.ts +25 -0
- package/esm/generated/services/RpcService.js +24 -0
- package/esm/generated/services/WebhooksService.d.ts +95 -0
- package/esm/generated/services/WebhooksService.js +80 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.js +3 -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 {
|
|
@@ -355,79 +358,6 @@ class DefaultService {
|
|
|
355
358
|
url: "/v1/media/uploadImage"
|
|
356
359
|
});
|
|
357
360
|
}
|
|
358
|
-
registerWebhook({
|
|
359
|
-
requestBody
|
|
360
|
-
}) {
|
|
361
|
-
return this.httpRequest.request({
|
|
362
|
-
method: "POST",
|
|
363
|
-
url: "/v1/webhooks",
|
|
364
|
-
body: requestBody,
|
|
365
|
-
mediaType: "application/json"
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
listWebhooks({
|
|
369
|
-
pageToken,
|
|
370
|
-
pageSize = 10,
|
|
371
|
-
status
|
|
372
|
-
}) {
|
|
373
|
-
return this.httpRequest.request({
|
|
374
|
-
method: "GET",
|
|
375
|
-
url: "/v1/webhooks",
|
|
376
|
-
query: {
|
|
377
|
-
"pageToken": pageToken,
|
|
378
|
-
"pageSize": pageSize,
|
|
379
|
-
"status": status
|
|
380
|
-
}
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
getWebhook({
|
|
384
|
-
id
|
|
385
|
-
}) {
|
|
386
|
-
return this.httpRequest.request({
|
|
387
|
-
method: "GET",
|
|
388
|
-
url: "/v1/webhooks/{id}",
|
|
389
|
-
path: {
|
|
390
|
-
"id": id
|
|
391
|
-
}
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
deactivateWebhook({
|
|
395
|
-
id
|
|
396
|
-
}) {
|
|
397
|
-
return this.httpRequest.request({
|
|
398
|
-
method: "DELETE",
|
|
399
|
-
url: "/v1/webhooks/{id}",
|
|
400
|
-
path: {
|
|
401
|
-
"id": id
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
updateWebhook({
|
|
406
|
-
id,
|
|
407
|
-
requestBody
|
|
408
|
-
}) {
|
|
409
|
-
return this.httpRequest.request({
|
|
410
|
-
method: "PATCH",
|
|
411
|
-
url: "/v1/webhooks/{id}",
|
|
412
|
-
path: {
|
|
413
|
-
"id": id
|
|
414
|
-
},
|
|
415
|
-
body: requestBody,
|
|
416
|
-
mediaType: "application/json"
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
generateSharedSecret() {
|
|
420
|
-
return this.httpRequest.request({
|
|
421
|
-
method: "POST",
|
|
422
|
-
url: "/v1/webhooks:generateOrRotateSharedSecret"
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
getSharedSecret() {
|
|
426
|
-
return this.httpRequest.request({
|
|
427
|
-
method: "GET",
|
|
428
|
-
url: "/v1/webhooks:getSharedSecret"
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
361
|
}
|
|
432
362
|
|
|
433
363
|
class EvmBalancesService {
|
|
@@ -586,13 +516,15 @@ class EvmChainsService {
|
|
|
586
516
|
this.httpRequest = httpRequest;
|
|
587
517
|
}
|
|
588
518
|
supportedChains({
|
|
589
|
-
network
|
|
519
|
+
network,
|
|
520
|
+
feature
|
|
590
521
|
}) {
|
|
591
522
|
return this.httpRequest.request({
|
|
592
523
|
method: "GET",
|
|
593
524
|
url: "/v1/chains",
|
|
594
525
|
query: {
|
|
595
|
-
"network": network
|
|
526
|
+
"network": network,
|
|
527
|
+
"feature": feature
|
|
596
528
|
}
|
|
597
529
|
});
|
|
598
530
|
}
|
|
@@ -1503,6 +1435,29 @@ class PrimaryNetworkVerticesService {
|
|
|
1503
1435
|
}
|
|
1504
1436
|
}
|
|
1505
1437
|
|
|
1438
|
+
class RpcService {
|
|
1439
|
+
constructor(httpRequest) {
|
|
1440
|
+
this.httpRequest = httpRequest;
|
|
1441
|
+
}
|
|
1442
|
+
rpc({
|
|
1443
|
+
chainId,
|
|
1444
|
+
requestBody
|
|
1445
|
+
}) {
|
|
1446
|
+
return this.httpRequest.request({
|
|
1447
|
+
method: "POST",
|
|
1448
|
+
url: "/v1/ext/bc/{chainId}/rpc",
|
|
1449
|
+
path: {
|
|
1450
|
+
"chainId": chainId
|
|
1451
|
+
},
|
|
1452
|
+
body: requestBody,
|
|
1453
|
+
mediaType: "application/json",
|
|
1454
|
+
errors: {
|
|
1455
|
+
504: `Request timed out`
|
|
1456
|
+
}
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1506
1461
|
class TeleporterService {
|
|
1507
1462
|
constructor(httpRequest) {
|
|
1508
1463
|
this.httpRequest = httpRequest;
|
|
@@ -1541,6 +1496,85 @@ class TeleporterService {
|
|
|
1541
1496
|
}
|
|
1542
1497
|
}
|
|
1543
1498
|
|
|
1499
|
+
class WebhooksService {
|
|
1500
|
+
constructor(httpRequest) {
|
|
1501
|
+
this.httpRequest = httpRequest;
|
|
1502
|
+
}
|
|
1503
|
+
registerWebhook({
|
|
1504
|
+
requestBody
|
|
1505
|
+
}) {
|
|
1506
|
+
return this.httpRequest.request({
|
|
1507
|
+
method: "POST",
|
|
1508
|
+
url: "/v1/webhooks",
|
|
1509
|
+
body: requestBody,
|
|
1510
|
+
mediaType: "application/json"
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
listWebhooks({
|
|
1514
|
+
pageToken,
|
|
1515
|
+
pageSize = 10,
|
|
1516
|
+
status
|
|
1517
|
+
}) {
|
|
1518
|
+
return this.httpRequest.request({
|
|
1519
|
+
method: "GET",
|
|
1520
|
+
url: "/v1/webhooks",
|
|
1521
|
+
query: {
|
|
1522
|
+
"pageToken": pageToken,
|
|
1523
|
+
"pageSize": pageSize,
|
|
1524
|
+
"status": status
|
|
1525
|
+
}
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
getWebhook({
|
|
1529
|
+
id
|
|
1530
|
+
}) {
|
|
1531
|
+
return this.httpRequest.request({
|
|
1532
|
+
method: "GET",
|
|
1533
|
+
url: "/v1/webhooks/{id}",
|
|
1534
|
+
path: {
|
|
1535
|
+
"id": id
|
|
1536
|
+
}
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
deactivateWebhook({
|
|
1540
|
+
id
|
|
1541
|
+
}) {
|
|
1542
|
+
return this.httpRequest.request({
|
|
1543
|
+
method: "DELETE",
|
|
1544
|
+
url: "/v1/webhooks/{id}",
|
|
1545
|
+
path: {
|
|
1546
|
+
"id": id
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
updateWebhook({
|
|
1551
|
+
id,
|
|
1552
|
+
requestBody
|
|
1553
|
+
}) {
|
|
1554
|
+
return this.httpRequest.request({
|
|
1555
|
+
method: "PATCH",
|
|
1556
|
+
url: "/v1/webhooks/{id}",
|
|
1557
|
+
path: {
|
|
1558
|
+
"id": id
|
|
1559
|
+
},
|
|
1560
|
+
body: requestBody,
|
|
1561
|
+
mediaType: "application/json"
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1564
|
+
generateSharedSecret() {
|
|
1565
|
+
return this.httpRequest.request({
|
|
1566
|
+
method: "POST",
|
|
1567
|
+
url: "/v1/webhooks:generateOrRotateSharedSecret"
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
getSharedSecret() {
|
|
1571
|
+
return this.httpRequest.request({
|
|
1572
|
+
method: "GET",
|
|
1573
|
+
url: "/v1/webhooks:getSharedSecret"
|
|
1574
|
+
});
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1544
1578
|
class Glacier {
|
|
1545
1579
|
default;
|
|
1546
1580
|
evmBalances;
|
|
@@ -1558,7 +1592,9 @@ class Glacier {
|
|
|
1558
1592
|
primaryNetworkTransactions;
|
|
1559
1593
|
primaryNetworkUtxOs;
|
|
1560
1594
|
primaryNetworkVertices;
|
|
1595
|
+
rpc;
|
|
1561
1596
|
teleporter;
|
|
1597
|
+
webhooks;
|
|
1562
1598
|
request;
|
|
1563
1599
|
constructor(config, HttpRequest = FetchHttpRequest) {
|
|
1564
1600
|
this.request = new HttpRequest({
|
|
@@ -1588,7 +1624,9 @@ class Glacier {
|
|
|
1588
1624
|
this.primaryNetworkTransactions = new PrimaryNetworkTransactionsService(this.request);
|
|
1589
1625
|
this.primaryNetworkUtxOs = new PrimaryNetworkUtxOsService(this.request);
|
|
1590
1626
|
this.primaryNetworkVertices = new PrimaryNetworkVerticesService(this.request);
|
|
1627
|
+
this.rpc = new RpcService(this.request);
|
|
1591
1628
|
this.teleporter = new TeleporterService(this.request);
|
|
1629
|
+
this.webhooks = new WebhooksService(this.request);
|
|
1592
1630
|
}
|
|
1593
1631
|
}
|
|
1594
1632
|
|
|
@@ -1813,6 +1851,12 @@ var EVMOperationType = /* @__PURE__ */ ((EVMOperationType2) => {
|
|
|
1813
1851
|
return EVMOperationType2;
|
|
1814
1852
|
})(EVMOperationType || {});
|
|
1815
1853
|
|
|
1854
|
+
var GlacierApiFeature = /* @__PURE__ */ ((GlacierApiFeature2) => {
|
|
1855
|
+
GlacierApiFeature2["NFT_INDEXING"] = "nftIndexing";
|
|
1856
|
+
GlacierApiFeature2["WEBHOOKS"] = "webhooks";
|
|
1857
|
+
return GlacierApiFeature2;
|
|
1858
|
+
})(GlacierApiFeature || {});
|
|
1859
|
+
|
|
1816
1860
|
var InternalTransactionOpCall = /* @__PURE__ */ ((InternalTransactionOpCall2) => {
|
|
1817
1861
|
InternalTransactionOpCall2["UNKNOWN"] = "UNKNOWN";
|
|
1818
1862
|
InternalTransactionOpCall2["CALL"] = "CALL";
|
|
@@ -2128,6 +2172,7 @@ exports.EvmChainsService = EvmChainsService;
|
|
|
2128
2172
|
exports.EvmContractsService = EvmContractsService;
|
|
2129
2173
|
exports.EvmTransactionsService = EvmTransactionsService;
|
|
2130
2174
|
exports.Glacier = Glacier;
|
|
2175
|
+
exports.GlacierApiFeature = GlacierApiFeature;
|
|
2131
2176
|
exports.HealthCheckService = HealthCheckService;
|
|
2132
2177
|
exports.InternalTransactionOpCall = InternalTransactionOpCall;
|
|
2133
2178
|
exports.Network = Network;
|
|
@@ -2156,6 +2201,7 @@ exports.PrimaryNetworkUtxOsService = PrimaryNetworkUtxOsService;
|
|
|
2156
2201
|
exports.PrimaryNetworkVerticesService = PrimaryNetworkVerticesService;
|
|
2157
2202
|
exports.ResourceLinkType = ResourceLinkType;
|
|
2158
2203
|
exports.RewardType = RewardType;
|
|
2204
|
+
exports.RpcService = RpcService;
|
|
2159
2205
|
exports.SortOrder = SortOrder;
|
|
2160
2206
|
exports.TeleporterService = TeleporterService;
|
|
2161
2207
|
exports.TransactionMethodType = TransactionMethodType;
|
|
@@ -2165,5 +2211,6 @@ exports.ValidationStatusType = ValidationStatusType;
|
|
|
2165
2211
|
exports.VmName = VmName;
|
|
2166
2212
|
exports.WebhookStatus = WebhookStatus;
|
|
2167
2213
|
exports.WebhookStatusType = WebhookStatusType;
|
|
2214
|
+
exports.WebhooksService = WebhooksService;
|
|
2168
2215
|
exports.XChainId = XChainId;
|
|
2169
2216
|
exports.XChainTransactionType = XChainTransactionType;
|
|
@@ -16,7 +16,9 @@ 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';
|
|
21
|
+
import { WebhooksService } from './services/WebhooksService.js';
|
|
20
22
|
|
|
21
23
|
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
22
24
|
declare class Glacier {
|
|
@@ -36,7 +38,9 @@ declare class Glacier {
|
|
|
36
38
|
readonly primaryNetworkTransactions: PrimaryNetworkTransactionsService;
|
|
37
39
|
readonly primaryNetworkUtxOs: PrimaryNetworkUtxOsService;
|
|
38
40
|
readonly primaryNetworkVertices: PrimaryNetworkVerticesService;
|
|
41
|
+
readonly rpc: RpcService;
|
|
39
42
|
readonly teleporter: TeleporterService;
|
|
43
|
+
readonly webhooks: WebhooksService;
|
|
40
44
|
readonly request: BaseHttpRequest;
|
|
41
45
|
constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
|
|
42
46
|
}
|
package/esm/generated/Glacier.js
CHANGED
|
@@ -15,7 +15,9 @@ 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';
|
|
20
|
+
import { WebhooksService } from './services/WebhooksService.js';
|
|
19
21
|
|
|
20
22
|
class Glacier {
|
|
21
23
|
default;
|
|
@@ -34,7 +36,9 @@ class Glacier {
|
|
|
34
36
|
primaryNetworkTransactions;
|
|
35
37
|
primaryNetworkUtxOs;
|
|
36
38
|
primaryNetworkVertices;
|
|
39
|
+
rpc;
|
|
37
40
|
teleporter;
|
|
41
|
+
webhooks;
|
|
38
42
|
request;
|
|
39
43
|
constructor(config, HttpRequest = FetchHttpRequest) {
|
|
40
44
|
this.request = new HttpRequest({
|
|
@@ -64,7 +68,9 @@ class Glacier {
|
|
|
64
68
|
this.primaryNetworkTransactions = new PrimaryNetworkTransactionsService(this.request);
|
|
65
69
|
this.primaryNetworkUtxOs = new PrimaryNetworkUtxOsService(this.request);
|
|
66
70
|
this.primaryNetworkVertices = new PrimaryNetworkVerticesService(this.request);
|
|
71
|
+
this.rpc = new RpcService(this.request);
|
|
67
72
|
this.teleporter = new TeleporterService(this.request);
|
|
73
|
+
this.webhooks = new WebhooksService(this.request);
|
|
68
74
|
}
|
|
69
75
|
}
|
|
70
76
|
|
|
@@ -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,20 +1,12 @@
|
|
|
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<any[]>;
|
|
6
6
|
/**
|
|
7
7
|
* Array of hexadecimal strings of the event signatures.
|
|
8
8
|
*/
|
|
9
9
|
eventSignatures?: Array<string>;
|
|
10
|
-
/**
|
|
11
|
-
* Whether to include traces in the webhook payload.
|
|
12
|
-
*/
|
|
13
|
-
includeTraces?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Whether to include logs in the webhook payload.
|
|
16
|
-
*/
|
|
17
|
-
includeLogs?: boolean;
|
|
18
10
|
};
|
|
19
11
|
|
|
20
12
|
export { AddressActivityMetadata };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type PrimaryNetworkOptions = {
|
|
2
|
-
addresses
|
|
2
|
+
addresses?: Array<string>;
|
|
3
3
|
cChainEvmAddresses?: Array<string>;
|
|
4
4
|
includeChains: Array<'11111111111111111111111111111111LpoYY' | '2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM' | '2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm' | '2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5' | 'yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp' | 'p-chain' | 'x-chain' | 'c-chain'>;
|
|
5
5
|
};
|