@avalabs/glacier-sdk 2.8.0-canary.69c602c.0 → 2.8.0-canary.6a1af3d.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.
Files changed (36) hide show
  1. package/dist/index.d.ts +278 -169
  2. package/dist/index.js +189 -114
  3. package/esm/generated/Glacier.d.ts +4 -0
  4. package/esm/generated/Glacier.js +6 -0
  5. package/esm/generated/core/CancelablePromise.d.ts +2 -8
  6. package/esm/generated/core/CancelablePromise.js +38 -36
  7. package/esm/generated/core/request.js +3 -2
  8. package/esm/generated/models/AddressActivityMetadata.d.ts +2 -6
  9. package/esm/generated/models/AddressesChangeRequest.d.ts +8 -0
  10. package/esm/generated/models/ChainInfo.d.ts +1 -0
  11. package/esm/generated/models/GetChainResponse.d.ts +1 -0
  12. package/esm/generated/models/GlacierApiFeature.d.ts +6 -0
  13. package/esm/generated/models/GlacierApiFeature.js +7 -0
  14. package/esm/generated/models/ListTeleporterMessagesResponse.d.ts +12 -0
  15. package/esm/generated/models/PrimaryNetworkOptions.d.ts +1 -1
  16. package/esm/generated/models/RegisterWebhookRequest.d.ts +8 -0
  17. package/esm/generated/models/RpcErrorDto.d.ts +7 -0
  18. package/esm/generated/models/RpcErrorResponseDto.d.ts +9 -0
  19. package/esm/generated/models/RpcRequestBodyDto.d.ts +8 -0
  20. package/esm/generated/models/RpcSuccessResponseDto.d.ts +7 -0
  21. package/esm/generated/models/UpdateWebhookRequest.d.ts +2 -1
  22. package/esm/generated/models/WebhookResponse.d.ts +8 -0
  23. package/esm/generated/services/DefaultService.d.ts +0 -86
  24. package/esm/generated/services/DefaultService.js +0 -73
  25. package/esm/generated/services/EvmChainsService.d.ts +6 -1
  26. package/esm/generated/services/EvmChainsService.js +4 -2
  27. package/esm/generated/services/PrimaryNetworkService.d.ts +1 -1
  28. package/esm/generated/services/PrimaryNetworkService.js +1 -1
  29. package/esm/generated/services/RpcService.d.ts +25 -0
  30. package/esm/generated/services/RpcService.js +24 -0
  31. package/esm/generated/services/TeleporterService.d.ts +3 -3
  32. package/esm/generated/services/WebhooksService.d.ts +122 -0
  33. package/esm/generated/services/WebhooksService.js +108 -0
  34. package/esm/index.d.ts +9 -0
  35. package/esm/index.js +3 -0
  36. 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
- [Symbol.toStringTag];
37
- _isResolved;
38
- _isRejected;
39
- _isCancelled;
40
- _cancelHandlers;
41
- _promise;
42
- _resolve;
43
- _reject;
36
+ #isResolved;
37
+ #isRejected;
38
+ #isCancelled;
39
+ #cancelHandlers;
40
+ #promise;
41
+ #resolve;
42
+ #reject;
44
43
  constructor(executor) {
45
- this._isResolved = false;
46
- this._isRejected = false;
47
- this._isCancelled = false;
48
- this._cancelHandlers = [];
49
- this._promise = new Promise((resolve, reject) => {
50
- this._resolve = resolve;
51
- this._reject = reject;
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._isResolved || this._isRejected || this._isCancelled) {
52
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
54
53
  return;
55
54
  }
56
- this._isResolved = true;
57
- this._resolve?.(value);
55
+ this.#isResolved = true;
56
+ this.#resolve?.(value);
58
57
  };
59
58
  const onReject = (reason) => {
60
- if (this._isResolved || this._isRejected || this._isCancelled) {
59
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
61
60
  return;
62
61
  }
63
- this._isRejected = true;
64
- this._reject?.(reason);
62
+ this.#isRejected = true;
63
+ this.#reject?.(reason);
65
64
  };
66
65
  const onCancel = (cancelHandler) => {
67
- if (this._isResolved || this._isRejected || this._isCancelled) {
66
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
68
67
  return;
69
68
  }
70
- this._cancelHandlers.push(cancelHandler);
69
+ this.#cancelHandlers.push(cancelHandler);
71
70
  };
72
71
  Object.defineProperty(onCancel, "isResolved", {
73
- get: () => this._isResolved
72
+ get: () => this.#isResolved
74
73
  });
75
74
  Object.defineProperty(onCancel, "isRejected", {
76
- get: () => this._isRejected
75
+ get: () => this.#isRejected
77
76
  });
78
77
  Object.defineProperty(onCancel, "isCancelled", {
79
- get: () => this._isCancelled
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._promise.then(onFulfilled, onRejected);
87
+ return this.#promise.then(onFulfilled, onRejected);
86
88
  }
87
89
  catch(onRejected) {
88
- return this._promise.catch(onRejected);
90
+ return this.#promise.catch(onRejected);
89
91
  }
90
92
  finally(onFinally) {
91
- return this._promise.finally(onFinally);
93
+ return this.#promise.finally(onFinally);
92
94
  }
93
95
  cancel() {
94
- if (this._isResolved || this._isRejected || this._isCancelled) {
96
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
95
97
  return;
96
98
  }
97
- this._isCancelled = true;
98
- if (this._cancelHandlers.length) {
99
+ this.#isCancelled = true;
100
+ if (this.#cancelHandlers.length) {
99
101
  try {
100
- for (const cancelHandler of this._cancelHandlers) {
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._cancelHandlers.length = 0;
109
- this._reject?.(new CancelError("Request aborted"));
110
+ this.#cancelHandlers.length = 0;
111
+ this.#reject?.(new CancelError("Request aborted"));
110
112
  }
111
113
  get isCancelled() {
112
- return this._isCancelled;
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 isJSON = contentType.toLowerCase().startsWith("application/json");
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
  }
@@ -1084,7 +1016,7 @@ class PrimaryNetworkService {
1084
1016
  minDelegationCapacity,
1085
1017
  maxDelegationCapacity,
1086
1018
  minTimeRemaining,
1087
- maxTimeRemaining = 2147483647,
1019
+ maxTimeRemaining,
1088
1020
  minFeePercentage,
1089
1021
  maxFeePercentage,
1090
1022
  subnetId
@@ -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,113 @@ 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
+ addAddressesToWebhook({
1577
+ id,
1578
+ requestBody
1579
+ }) {
1580
+ return this.httpRequest.request({
1581
+ method: "PATCH",
1582
+ url: "/v1/webhooks/{id}/addresses",
1583
+ path: {
1584
+ "id": id
1585
+ },
1586
+ body: requestBody,
1587
+ mediaType: "application/json"
1588
+ });
1589
+ }
1590
+ removeAddressesFromWebhook({
1591
+ id,
1592
+ requestBody
1593
+ }) {
1594
+ return this.httpRequest.request({
1595
+ method: "DELETE",
1596
+ url: "/v1/webhooks/{id}/addresses",
1597
+ path: {
1598
+ "id": id
1599
+ },
1600
+ body: requestBody,
1601
+ mediaType: "application/json"
1602
+ });
1603
+ }
1604
+ }
1605
+
1544
1606
  class Glacier {
1545
1607
  default;
1546
1608
  evmBalances;
@@ -1558,7 +1620,9 @@ class Glacier {
1558
1620
  primaryNetworkTransactions;
1559
1621
  primaryNetworkUtxOs;
1560
1622
  primaryNetworkVertices;
1623
+ rpc;
1561
1624
  teleporter;
1625
+ webhooks;
1562
1626
  request;
1563
1627
  constructor(config, HttpRequest = FetchHttpRequest) {
1564
1628
  this.request = new HttpRequest({
@@ -1588,7 +1652,9 @@ class Glacier {
1588
1652
  this.primaryNetworkTransactions = new PrimaryNetworkTransactionsService(this.request);
1589
1653
  this.primaryNetworkUtxOs = new PrimaryNetworkUtxOsService(this.request);
1590
1654
  this.primaryNetworkVertices = new PrimaryNetworkVerticesService(this.request);
1655
+ this.rpc = new RpcService(this.request);
1591
1656
  this.teleporter = new TeleporterService(this.request);
1657
+ this.webhooks = new WebhooksService(this.request);
1592
1658
  }
1593
1659
  }
1594
1660
 
@@ -1813,6 +1879,12 @@ var EVMOperationType = /* @__PURE__ */ ((EVMOperationType2) => {
1813
1879
  return EVMOperationType2;
1814
1880
  })(EVMOperationType || {});
1815
1881
 
1882
+ var GlacierApiFeature = /* @__PURE__ */ ((GlacierApiFeature2) => {
1883
+ GlacierApiFeature2["NFT_INDEXING"] = "nftIndexing";
1884
+ GlacierApiFeature2["WEBHOOKS"] = "webhooks";
1885
+ return GlacierApiFeature2;
1886
+ })(GlacierApiFeature || {});
1887
+
1816
1888
  var InternalTransactionOpCall = /* @__PURE__ */ ((InternalTransactionOpCall2) => {
1817
1889
  InternalTransactionOpCall2["UNKNOWN"] = "UNKNOWN";
1818
1890
  InternalTransactionOpCall2["CALL"] = "CALL";
@@ -2128,6 +2200,7 @@ exports.EvmChainsService = EvmChainsService;
2128
2200
  exports.EvmContractsService = EvmContractsService;
2129
2201
  exports.EvmTransactionsService = EvmTransactionsService;
2130
2202
  exports.Glacier = Glacier;
2203
+ exports.GlacierApiFeature = GlacierApiFeature;
2131
2204
  exports.HealthCheckService = HealthCheckService;
2132
2205
  exports.InternalTransactionOpCall = InternalTransactionOpCall;
2133
2206
  exports.Network = Network;
@@ -2156,6 +2229,7 @@ exports.PrimaryNetworkUtxOsService = PrimaryNetworkUtxOsService;
2156
2229
  exports.PrimaryNetworkVerticesService = PrimaryNetworkVerticesService;
2157
2230
  exports.ResourceLinkType = ResourceLinkType;
2158
2231
  exports.RewardType = RewardType;
2232
+ exports.RpcService = RpcService;
2159
2233
  exports.SortOrder = SortOrder;
2160
2234
  exports.TeleporterService = TeleporterService;
2161
2235
  exports.TransactionMethodType = TransactionMethodType;
@@ -2165,5 +2239,6 @@ exports.ValidationStatusType = ValidationStatusType;
2165
2239
  exports.VmName = VmName;
2166
2240
  exports.WebhookStatus = WebhookStatus;
2167
2241
  exports.WebhookStatusType = WebhookStatusType;
2242
+ exports.WebhooksService = WebhooksService;
2168
2243
  exports.XChainId = XChainId;
2169
2244
  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
  }
@@ -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
- readonly [Symbol.toStringTag]: string;
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
- [Symbol.toStringTag];
12
- _isResolved;
13
- _isRejected;
14
- _isCancelled;
15
- _cancelHandlers;
16
- _promise;
17
- _resolve;
18
- _reject;
11
+ #isResolved;
12
+ #isRejected;
13
+ #isCancelled;
14
+ #cancelHandlers;
15
+ #promise;
16
+ #resolve;
17
+ #reject;
19
18
  constructor(executor) {
20
- this._isResolved = false;
21
- this._isRejected = false;
22
- this._isCancelled = false;
23
- this._cancelHandlers = [];
24
- this._promise = new Promise((resolve, reject) => {
25
- this._resolve = resolve;
26
- this._reject = reject;
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._isResolved || this._isRejected || this._isCancelled) {
27
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
29
28
  return;
30
29
  }
31
- this._isResolved = true;
32
- this._resolve?.(value);
30
+ this.#isResolved = true;
31
+ this.#resolve?.(value);
33
32
  };
34
33
  const onReject = (reason) => {
35
- if (this._isResolved || this._isRejected || this._isCancelled) {
34
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
36
35
  return;
37
36
  }
38
- this._isRejected = true;
39
- this._reject?.(reason);
37
+ this.#isRejected = true;
38
+ this.#reject?.(reason);
40
39
  };
41
40
  const onCancel = (cancelHandler) => {
42
- if (this._isResolved || this._isRejected || this._isCancelled) {
41
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
43
42
  return;
44
43
  }
45
- this._cancelHandlers.push(cancelHandler);
44
+ this.#cancelHandlers.push(cancelHandler);
46
45
  };
47
46
  Object.defineProperty(onCancel, "isResolved", {
48
- get: () => this._isResolved
47
+ get: () => this.#isResolved
49
48
  });
50
49
  Object.defineProperty(onCancel, "isRejected", {
51
- get: () => this._isRejected
50
+ get: () => this.#isRejected
52
51
  });
53
52
  Object.defineProperty(onCancel, "isCancelled", {
54
- get: () => this._isCancelled
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._promise.then(onFulfilled, onRejected);
62
+ return this.#promise.then(onFulfilled, onRejected);
61
63
  }
62
64
  catch(onRejected) {
63
- return this._promise.catch(onRejected);
65
+ return this.#promise.catch(onRejected);
64
66
  }
65
67
  finally(onFinally) {
66
- return this._promise.finally(onFinally);
68
+ return this.#promise.finally(onFinally);
67
69
  }
68
70
  cancel() {
69
- if (this._isResolved || this._isRejected || this._isCancelled) {
71
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
70
72
  return;
71
73
  }
72
- this._isCancelled = true;
73
- if (this._cancelHandlers.length) {
74
+ this.#isCancelled = true;
75
+ if (this.#cancelHandlers.length) {
74
76
  try {
75
- for (const cancelHandler of this._cancelHandlers) {
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._cancelHandlers.length = 0;
84
- this._reject?.(new CancelError("Request aborted"));
85
+ this.#cancelHandlers.length = 0;
86
+ this.#reject?.(new CancelError("Request aborted"));
85
87
  }
86
88
  get isCancelled() {
87
- return this._isCancelled;
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 isJSON = contentType.toLowerCase().startsWith("application/json");
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,16 +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
- address: string;
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
10
  };
15
11
 
16
12
  export { AddressActivityMetadata };
@@ -0,0 +1,8 @@
1
+ type AddressesChangeRequest = {
2
+ /**
3
+ * Ethereum address(es) for the address_activity event type
4
+ */
5
+ addresses: Array<any[]>;
6
+ };
7
+
8
+ export { AddressesChangeRequest };
@@ -20,6 +20,7 @@ type ChainInfo = {
20
20
  networkToken: NetworkToken;
21
21
  chainLogoUri?: string;
22
22
  private?: boolean;
23
+ enabledFeatures?: Array<'nftIndexing' | 'webhooks'>;
23
24
  };
24
25
 
25
26
  export { ChainInfo };