@avalabs/glacier-sdk 2.8.0-canary.a18b4e4.0 → 2.8.0-canary.aeb3588.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 (31) hide show
  1. package/dist/index.d.ts +240 -202
  2. package/dist/index.js +119 -61
  3. package/esm/generated/Glacier.d.ts +2 -0
  4. package/esm/generated/Glacier.js +27 -10
  5. package/esm/generated/core/ApiError.js +5 -0
  6. package/esm/generated/core/CancelablePromise.js +11 -6
  7. package/esm/generated/core/request.js +14 -31
  8. package/esm/generated/models/ActiveDelegatorDetails.d.ts +6 -3
  9. package/esm/generated/models/ActiveDelegatorDetails.js +8 -0
  10. package/esm/generated/models/ActiveValidatorDetails.d.ts +6 -2
  11. package/esm/generated/models/ActiveValidatorDetails.js +8 -0
  12. package/esm/generated/models/ChainInfo.d.ts +1 -0
  13. package/esm/generated/models/CompletedDelegatorDetails.d.ts +6 -3
  14. package/esm/generated/models/CompletedDelegatorDetails.js +8 -0
  15. package/esm/generated/models/CompletedValidatorDetails.d.ts +6 -2
  16. package/esm/generated/models/CompletedValidatorDetails.js +8 -0
  17. package/esm/generated/models/Erc20Contract.d.ts +1 -1
  18. package/esm/generated/models/GetChainResponse.d.ts +1 -0
  19. package/esm/generated/models/ListContractsResponse.d.ts +1 -1
  20. package/esm/generated/models/PendingDelegatorDetails.d.ts +6 -3
  21. package/esm/generated/models/PendingDelegatorDetails.js +8 -0
  22. package/esm/generated/models/PendingValidatorDetails.d.ts +6 -3
  23. package/esm/generated/models/PendingValidatorDetails.js +8 -0
  24. package/esm/generated/services/EvmContractsService.d.ts +29 -0
  25. package/esm/generated/services/EvmContractsService.js +20 -0
  26. package/esm/generated/services/EvmTransactionsService.js +1 -1
  27. package/esm/generated/services/NfTsService.d.ts +0 -18
  28. package/esm/generated/services/NfTsService.js +0 -13
  29. package/esm/index.d.ts +1 -0
  30. package/esm/index.js +7 -0
  31. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -7,6 +7,11 @@ class BaseHttpRequest {
7
7
  }
8
8
 
9
9
  class ApiError extends Error {
10
+ url;
11
+ status;
12
+ statusText;
13
+ body;
14
+ request;
10
15
  constructor(request, response, message) {
11
16
  super(message);
12
17
  this.name = "ApiError";
@@ -28,6 +33,14 @@ class CancelError extends Error {
28
33
  }
29
34
  }
30
35
  class CancelablePromise {
36
+ [Symbol.toStringTag];
37
+ _isResolved;
38
+ _isRejected;
39
+ _isCancelled;
40
+ _cancelHandlers;
41
+ _promise;
42
+ _resolve;
43
+ _reject;
31
44
  constructor(executor) {
32
45
  this._isResolved = false;
33
46
  this._isRejected = false;
@@ -37,20 +50,18 @@ class CancelablePromise {
37
50
  this._resolve = resolve;
38
51
  this._reject = reject;
39
52
  const onResolve = (value) => {
40
- var _a;
41
53
  if (this._isResolved || this._isRejected || this._isCancelled) {
42
54
  return;
43
55
  }
44
56
  this._isResolved = true;
45
- (_a = this._resolve) == null ? void 0 : _a.call(this, value);
57
+ this._resolve?.(value);
46
58
  };
47
59
  const onReject = (reason) => {
48
- var _a;
49
60
  if (this._isResolved || this._isRejected || this._isCancelled) {
50
61
  return;
51
62
  }
52
63
  this._isRejected = true;
53
- (_a = this._reject) == null ? void 0 : _a.call(this, reason);
64
+ this._reject?.(reason);
54
65
  };
55
66
  const onCancel = (cancelHandler) => {
56
67
  if (this._isResolved || this._isRejected || this._isCancelled) {
@@ -80,7 +91,6 @@ class CancelablePromise {
80
91
  return this._promise.finally(onFinally);
81
92
  }
82
93
  cancel() {
83
- var _a;
84
94
  if (this._isResolved || this._isRejected || this._isCancelled) {
85
95
  return;
86
96
  }
@@ -96,32 +106,13 @@ class CancelablePromise {
96
106
  }
97
107
  }
98
108
  this._cancelHandlers.length = 0;
99
- (_a = this._reject) == null ? void 0 : _a.call(this, new CancelError("Request aborted"));
109
+ this._reject?.(new CancelError("Request aborted"));
100
110
  }
101
111
  get isCancelled() {
102
112
  return this._isCancelled;
103
113
  }
104
114
  }
105
115
 
106
- var __defProp = Object.defineProperty;
107
- var __defProps = Object.defineProperties;
108
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
109
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
110
- var __hasOwnProp = Object.prototype.hasOwnProperty;
111
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
112
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
113
- var __spreadValues = (a, b) => {
114
- for (var prop in b || (b = {}))
115
- if (__hasOwnProp.call(b, prop))
116
- __defNormalProp(a, prop, b[prop]);
117
- if (__getOwnPropSymbols)
118
- for (var prop of __getOwnPropSymbols(b)) {
119
- if (__propIsEnum.call(b, prop))
120
- __defNormalProp(a, prop, b[prop]);
121
- }
122
- return a;
123
- };
124
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
125
116
  const isDefined = (value) => {
126
117
  return value !== void 0 && value !== null;
127
118
  };
@@ -175,8 +166,7 @@ const getQueryString = (params) => {
175
166
  const getUrl = (config, options) => {
176
167
  const encoder = config.ENCODE_PATH || encodeURI;
177
168
  const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
178
- var _a;
179
- if ((_a = options.path) == null ? void 0 : _a.hasOwnProperty(group)) {
169
+ if (options.path?.hasOwnProperty(group)) {
180
170
  return encoder(String(options.path[group]));
181
171
  }
182
172
  return substring;
@@ -219,9 +209,12 @@ const getHeaders = async (config, options) => {
219
209
  const username = await resolve(options, config.USERNAME);
220
210
  const password = await resolve(options, config.PASSWORD);
221
211
  const additionalHeaders = await resolve(options, config.HEADERS);
222
- const headers = Object.entries(__spreadValues(__spreadValues({
223
- Accept: "application/json"
224
- }, additionalHeaders), options.headers)).filter(([_, value]) => isDefined(value)).reduce((headers2, [key, value]) => __spreadProps(__spreadValues({}, headers2), {
212
+ const headers = Object.entries({
213
+ Accept: "application/json",
214
+ ...additionalHeaders,
215
+ ...options.headers
216
+ }).filter(([_, value]) => isDefined(value)).reduce((headers2, [key, value]) => ({
217
+ ...headers2,
225
218
  [key]: String(value)
226
219
  }), {});
227
220
  if (isStringWithValue(token)) {
@@ -245,9 +238,8 @@ const getHeaders = async (config, options) => {
245
238
  return new Headers(headers);
246
239
  };
247
240
  const getRequestBody = (options) => {
248
- var _a;
249
241
  if (options.body) {
250
- if ((_a = options.mediaType) == null ? void 0 : _a.includes("/json")) {
242
+ if (options.mediaType?.includes("/json")) {
251
243
  return JSON.stringify(options.body);
252
244
  } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
253
245
  return options.body;
@@ -261,7 +253,7 @@ const sendRequest = async (config, options, url, body, formData, headers, onCanc
261
253
  const controller = new AbortController();
262
254
  const request2 = {
263
255
  headers,
264
- body: body != null ? body : formData,
256
+ body: body ?? formData,
265
257
  method: options.method,
266
258
  signal: controller.signal
267
259
  };
@@ -299,15 +291,16 @@ const getResponseBody = async (response) => {
299
291
  return void 0;
300
292
  };
301
293
  const catchErrorCodes = (options, result) => {
302
- const errors = __spreadValues({
294
+ const errors = {
303
295
  400: "Bad Request",
304
296
  401: "Unauthorized",
305
297
  403: "Forbidden",
306
298
  404: "Not Found",
307
299
  500: "Internal Server Error",
308
300
  502: "Bad Gateway",
309
- 503: "Service Unavailable"
310
- }, options.errors);
301
+ 503: "Service Unavailable",
302
+ ...options.errors
303
+ };
311
304
  const error = errors[result.status];
312
305
  if (error) {
313
306
  throw new ApiError(options, result, error);
@@ -332,7 +325,7 @@ const request = (config, options) => {
332
325
  ok: response.ok,
333
326
  status: response.status,
334
327
  statusText: response.statusText,
335
- body: responseHeader != null ? responseHeader : responseBody
328
+ body: responseHeader ?? responseBody
336
329
  };
337
330
  catchErrorCodes(options, result);
338
331
  resolve2(result.body);
@@ -531,6 +524,25 @@ class EvmChainsService {
531
524
  }
532
525
  }
533
526
 
527
+ class EvmContractsService {
528
+ constructor(httpRequest) {
529
+ this.httpRequest = httpRequest;
530
+ }
531
+ getContractMetadata({
532
+ chainId,
533
+ address
534
+ }) {
535
+ return this.httpRequest.request({
536
+ method: "GET",
537
+ url: "/v1/chains/{chainId}/addresses/{address}",
538
+ path: {
539
+ "chainId": chainId,
540
+ "address": address
541
+ }
542
+ });
543
+ }
544
+ }
545
+
534
546
  class EvmTransactionsService {
535
547
  constructor(httpRequest) {
536
548
  this.httpRequest = httpRequest;
@@ -560,7 +572,7 @@ class EvmTransactionsService {
560
572
  }) {
561
573
  return this.httpRequest.request({
562
574
  method: "GET",
563
- url: "/v1/chains/{chainId}/addresses/{address}/deployments",
575
+ url: "/v1/chains/{chainId}/contracts/{address}/deployments",
564
576
  path: {
565
577
  "chainId": chainId,
566
578
  "address": address
@@ -830,19 +842,6 @@ class NfTsService {
830
842
  }
831
843
  });
832
844
  }
833
- getCollection({
834
- chainId,
835
- address
836
- }) {
837
- return this.httpRequest.request({
838
- method: "GET",
839
- url: "/v1/chains/{chainId}/nfts/collections/{address}",
840
- path: {
841
- "chainId": chainId,
842
- "address": address
843
- }
844
- });
845
- }
846
845
  }
847
846
 
848
847
  class OperationsService {
@@ -1367,22 +1366,38 @@ class PrimaryNetworkVerticesService {
1367
1366
  }
1368
1367
 
1369
1368
  class Glacier {
1369
+ evmBalances;
1370
+ evmBlocks;
1371
+ evmChains;
1372
+ evmContracts;
1373
+ evmTransactions;
1374
+ healthCheck;
1375
+ nfTs;
1376
+ operations;
1377
+ primaryNetwork;
1378
+ primaryNetworkBalances;
1379
+ primaryNetworkBlocks;
1380
+ primaryNetworkRewards;
1381
+ primaryNetworkTransactions;
1382
+ primaryNetworkUtxOs;
1383
+ primaryNetworkVertices;
1384
+ request;
1370
1385
  constructor(config, HttpRequest = FetchHttpRequest) {
1371
- var _a, _b, _c, _d;
1372
1386
  this.request = new HttpRequest({
1373
- BASE: (_a = config == null ? void 0 : config.BASE) != null ? _a : "https://glacier-api-dev.avax.network",
1374
- VERSION: (_b = config == null ? void 0 : config.VERSION) != null ? _b : "Beta",
1375
- WITH_CREDENTIALS: (_c = config == null ? void 0 : config.WITH_CREDENTIALS) != null ? _c : false,
1376
- CREDENTIALS: (_d = config == null ? void 0 : config.CREDENTIALS) != null ? _d : "include",
1377
- TOKEN: config == null ? void 0 : config.TOKEN,
1378
- USERNAME: config == null ? void 0 : config.USERNAME,
1379
- PASSWORD: config == null ? void 0 : config.PASSWORD,
1380
- HEADERS: config == null ? void 0 : config.HEADERS,
1381
- ENCODE_PATH: config == null ? void 0 : config.ENCODE_PATH
1387
+ BASE: config?.BASE ?? "https://glacier-api-dev.avax.network",
1388
+ VERSION: config?.VERSION ?? "Beta",
1389
+ WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
1390
+ CREDENTIALS: config?.CREDENTIALS ?? "include",
1391
+ TOKEN: config?.TOKEN,
1392
+ USERNAME: config?.USERNAME,
1393
+ PASSWORD: config?.PASSWORD,
1394
+ HEADERS: config?.HEADERS,
1395
+ ENCODE_PATH: config?.ENCODE_PATH
1382
1396
  });
1383
1397
  this.evmBalances = new EvmBalancesService(this.request);
1384
1398
  this.evmBlocks = new EvmBlocksService(this.request);
1385
1399
  this.evmChains = new EvmChainsService(this.request);
1400
+ this.evmContracts = new EvmContractsService(this.request);
1386
1401
  this.evmTransactions = new EvmTransactionsService(this.request);
1387
1402
  this.healthCheck = new HealthCheckService(this.request);
1388
1403
  this.nfTs = new NfTsService(this.request);
@@ -1409,6 +1424,20 @@ const OpenAPI = {
1409
1424
  ENCODE_PATH: void 0
1410
1425
  };
1411
1426
 
1427
+ exports.ActiveDelegatorDetails = void 0;
1428
+ ((ActiveDelegatorDetails2) => {
1429
+ ((delegationStatus2) => {
1430
+ delegationStatus2["ACTIVE"] = "active";
1431
+ })(ActiveDelegatorDetails2.delegationStatus || (ActiveDelegatorDetails2.delegationStatus = {}));
1432
+ })(exports.ActiveDelegatorDetails || (exports.ActiveDelegatorDetails = {}));
1433
+
1434
+ exports.ActiveValidatorDetails = void 0;
1435
+ ((ActiveValidatorDetails2) => {
1436
+ ((validationStatus2) => {
1437
+ validationStatus2["ACTIVE"] = "active";
1438
+ })(ActiveValidatorDetails2.validationStatus || (ActiveValidatorDetails2.validationStatus = {}));
1439
+ })(exports.ActiveValidatorDetails || (exports.ActiveValidatorDetails = {}));
1440
+
1412
1441
  var BlockchainId = /* @__PURE__ */ ((BlockchainId2) => {
1413
1442
  BlockchainId2["_11111111111111111111111111111111LPO_YY"] = "11111111111111111111111111111111LpoYY";
1414
1443
  BlockchainId2["_2O_YMBNV4E_NHYQK2FJJ_V5N_VQLDBTM_NJZQ5S3QS3LO6FTN_C6FBY_M"] = "2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM";
@@ -1450,6 +1479,20 @@ var ChainStatus = /* @__PURE__ */ ((ChainStatus2) => {
1450
1479
  return ChainStatus2;
1451
1480
  })(ChainStatus || {});
1452
1481
 
1482
+ exports.CompletedDelegatorDetails = void 0;
1483
+ ((CompletedDelegatorDetails2) => {
1484
+ ((delegationStatus2) => {
1485
+ delegationStatus2["COMPLETED"] = "completed";
1486
+ })(CompletedDelegatorDetails2.delegationStatus || (CompletedDelegatorDetails2.delegationStatus = {}));
1487
+ })(exports.CompletedDelegatorDetails || (exports.CompletedDelegatorDetails = {}));
1488
+
1489
+ exports.CompletedValidatorDetails = void 0;
1490
+ ((CompletedValidatorDetails2) => {
1491
+ ((validationStatus2) => {
1492
+ validationStatus2["COMPLETED"] = "completed";
1493
+ })(CompletedValidatorDetails2.validationStatus || (CompletedValidatorDetails2.validationStatus = {}));
1494
+ })(exports.CompletedValidatorDetails || (exports.CompletedValidatorDetails = {}));
1495
+
1453
1496
  exports.CreateEvmTransactionExportRequest = void 0;
1454
1497
  ((CreateEvmTransactionExportRequest2) => {
1455
1498
  ((type2) => {
@@ -1633,6 +1676,20 @@ var PChainTransactionType = /* @__PURE__ */ ((PChainTransactionType2) => {
1633
1676
  return PChainTransactionType2;
1634
1677
  })(PChainTransactionType || {});
1635
1678
 
1679
+ exports.PendingDelegatorDetails = void 0;
1680
+ ((PendingDelegatorDetails2) => {
1681
+ ((delegationStatus2) => {
1682
+ delegationStatus2["PENDING"] = "pending";
1683
+ })(PendingDelegatorDetails2.delegationStatus || (PendingDelegatorDetails2.delegationStatus = {}));
1684
+ })(exports.PendingDelegatorDetails || (exports.PendingDelegatorDetails = {}));
1685
+
1686
+ exports.PendingValidatorDetails = void 0;
1687
+ ((PendingValidatorDetails2) => {
1688
+ ((validationStatus2) => {
1689
+ validationStatus2["PENDING"] = "pending";
1690
+ })(PendingValidatorDetails2.validationStatus || (PendingValidatorDetails2.validationStatus = {}));
1691
+ })(exports.PendingValidatorDetails || (exports.PendingValidatorDetails = {}));
1692
+
1636
1693
  var PrimaryNetwork = /* @__PURE__ */ ((PrimaryNetwork2) => {
1637
1694
  PrimaryNetwork2["MAINNET"] = "mainnet";
1638
1695
  PrimaryNetwork2["FUJI"] = "fuji";
@@ -1774,6 +1831,7 @@ exports.DelegationStatusType = DelegationStatusType;
1774
1831
  exports.EvmBalancesService = EvmBalancesService;
1775
1832
  exports.EvmBlocksService = EvmBlocksService;
1776
1833
  exports.EvmChainsService = EvmChainsService;
1834
+ exports.EvmContractsService = EvmContractsService;
1777
1835
  exports.EvmTransactionsService = EvmTransactionsService;
1778
1836
  exports.Glacier = Glacier;
1779
1837
  exports.HealthCheckService = HealthCheckService;
@@ -3,6 +3,7 @@ import { OpenAPIConfig } from './core/OpenAPI.js';
3
3
  import { EvmBalancesService } from './services/EvmBalancesService.js';
4
4
  import { EvmBlocksService } from './services/EvmBlocksService.js';
5
5
  import { EvmChainsService } from './services/EvmChainsService.js';
6
+ import { EvmContractsService } from './services/EvmContractsService.js';
6
7
  import { EvmTransactionsService } from './services/EvmTransactionsService.js';
7
8
  import { HealthCheckService } from './services/HealthCheckService.js';
8
9
  import { NfTsService } from './services/NfTsService.js';
@@ -20,6 +21,7 @@ declare class Glacier {
20
21
  readonly evmBalances: EvmBalancesService;
21
22
  readonly evmBlocks: EvmBlocksService;
22
23
  readonly evmChains: EvmChainsService;
24
+ readonly evmContracts: EvmContractsService;
23
25
  readonly evmTransactions: EvmTransactionsService;
24
26
  readonly healthCheck: HealthCheckService;
25
27
  readonly nfTs: NfTsService;
@@ -2,6 +2,7 @@ import { FetchHttpRequest } from './core/FetchHttpRequest.js';
2
2
  import { EvmBalancesService } from './services/EvmBalancesService.js';
3
3
  import { EvmBlocksService } from './services/EvmBlocksService.js';
4
4
  import { EvmChainsService } from './services/EvmChainsService.js';
5
+ import { EvmContractsService } from './services/EvmContractsService.js';
5
6
  import { EvmTransactionsService } from './services/EvmTransactionsService.js';
6
7
  import { HealthCheckService } from './services/HealthCheckService.js';
7
8
  import { NfTsService } from './services/NfTsService.js';
@@ -15,22 +16,38 @@ import { PrimaryNetworkUtxOsService } from './services/PrimaryNetworkUtxOsServic
15
16
  import { PrimaryNetworkVerticesService } from './services/PrimaryNetworkVerticesService.js';
16
17
 
17
18
  class Glacier {
19
+ evmBalances;
20
+ evmBlocks;
21
+ evmChains;
22
+ evmContracts;
23
+ evmTransactions;
24
+ healthCheck;
25
+ nfTs;
26
+ operations;
27
+ primaryNetwork;
28
+ primaryNetworkBalances;
29
+ primaryNetworkBlocks;
30
+ primaryNetworkRewards;
31
+ primaryNetworkTransactions;
32
+ primaryNetworkUtxOs;
33
+ primaryNetworkVertices;
34
+ request;
18
35
  constructor(config, HttpRequest = FetchHttpRequest) {
19
- var _a, _b, _c, _d;
20
36
  this.request = new HttpRequest({
21
- BASE: (_a = config == null ? void 0 : config.BASE) != null ? _a : "https://glacier-api-dev.avax.network",
22
- VERSION: (_b = config == null ? void 0 : config.VERSION) != null ? _b : "Beta",
23
- WITH_CREDENTIALS: (_c = config == null ? void 0 : config.WITH_CREDENTIALS) != null ? _c : false,
24
- CREDENTIALS: (_d = config == null ? void 0 : config.CREDENTIALS) != null ? _d : "include",
25
- TOKEN: config == null ? void 0 : config.TOKEN,
26
- USERNAME: config == null ? void 0 : config.USERNAME,
27
- PASSWORD: config == null ? void 0 : config.PASSWORD,
28
- HEADERS: config == null ? void 0 : config.HEADERS,
29
- ENCODE_PATH: config == null ? void 0 : config.ENCODE_PATH
37
+ BASE: config?.BASE ?? "https://glacier-api-dev.avax.network",
38
+ VERSION: config?.VERSION ?? "Beta",
39
+ WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
40
+ CREDENTIALS: config?.CREDENTIALS ?? "include",
41
+ TOKEN: config?.TOKEN,
42
+ USERNAME: config?.USERNAME,
43
+ PASSWORD: config?.PASSWORD,
44
+ HEADERS: config?.HEADERS,
45
+ ENCODE_PATH: config?.ENCODE_PATH
30
46
  });
31
47
  this.evmBalances = new EvmBalancesService(this.request);
32
48
  this.evmBlocks = new EvmBlocksService(this.request);
33
49
  this.evmChains = new EvmChainsService(this.request);
50
+ this.evmContracts = new EvmContractsService(this.request);
34
51
  this.evmTransactions = new EvmTransactionsService(this.request);
35
52
  this.healthCheck = new HealthCheckService(this.request);
36
53
  this.nfTs = new NfTsService(this.request);
@@ -1,4 +1,9 @@
1
1
  class ApiError extends Error {
2
+ url;
3
+ status;
4
+ statusText;
5
+ body;
6
+ request;
2
7
  constructor(request, response, message) {
3
8
  super(message);
4
9
  this.name = "ApiError";
@@ -8,6 +8,14 @@ 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
19
  constructor(executor) {
12
20
  this._isResolved = false;
13
21
  this._isRejected = false;
@@ -17,20 +25,18 @@ class CancelablePromise {
17
25
  this._resolve = resolve;
18
26
  this._reject = reject;
19
27
  const onResolve = (value) => {
20
- var _a;
21
28
  if (this._isResolved || this._isRejected || this._isCancelled) {
22
29
  return;
23
30
  }
24
31
  this._isResolved = true;
25
- (_a = this._resolve) == null ? void 0 : _a.call(this, value);
32
+ this._resolve?.(value);
26
33
  };
27
34
  const onReject = (reason) => {
28
- var _a;
29
35
  if (this._isResolved || this._isRejected || this._isCancelled) {
30
36
  return;
31
37
  }
32
38
  this._isRejected = true;
33
- (_a = this._reject) == null ? void 0 : _a.call(this, reason);
39
+ this._reject?.(reason);
34
40
  };
35
41
  const onCancel = (cancelHandler) => {
36
42
  if (this._isResolved || this._isRejected || this._isCancelled) {
@@ -60,7 +66,6 @@ class CancelablePromise {
60
66
  return this._promise.finally(onFinally);
61
67
  }
62
68
  cancel() {
63
- var _a;
64
69
  if (this._isResolved || this._isRejected || this._isCancelled) {
65
70
  return;
66
71
  }
@@ -76,7 +81,7 @@ class CancelablePromise {
76
81
  }
77
82
  }
78
83
  this._cancelHandlers.length = 0;
79
- (_a = this._reject) == null ? void 0 : _a.call(this, new CancelError("Request aborted"));
84
+ this._reject?.(new CancelError("Request aborted"));
80
85
  }
81
86
  get isCancelled() {
82
87
  return this._isCancelled;
@@ -1,25 +1,6 @@
1
1
  import { ApiError } from './ApiError.js';
2
2
  import { CancelablePromise } from './CancelablePromise.js';
3
3
 
4
- var __defProp = Object.defineProperty;
5
- var __defProps = Object.defineProperties;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
4
  const isDefined = (value) => {
24
5
  return value !== void 0 && value !== null;
25
6
  };
@@ -73,8 +54,7 @@ const getQueryString = (params) => {
73
54
  const getUrl = (config, options) => {
74
55
  const encoder = config.ENCODE_PATH || encodeURI;
75
56
  const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
76
- var _a;
77
- if ((_a = options.path) == null ? void 0 : _a.hasOwnProperty(group)) {
57
+ if (options.path?.hasOwnProperty(group)) {
78
58
  return encoder(String(options.path[group]));
79
59
  }
80
60
  return substring;
@@ -117,9 +97,12 @@ const getHeaders = async (config, options) => {
117
97
  const username = await resolve(options, config.USERNAME);
118
98
  const password = await resolve(options, config.PASSWORD);
119
99
  const additionalHeaders = await resolve(options, config.HEADERS);
120
- const headers = Object.entries(__spreadValues(__spreadValues({
121
- Accept: "application/json"
122
- }, additionalHeaders), options.headers)).filter(([_, value]) => isDefined(value)).reduce((headers2, [key, value]) => __spreadProps(__spreadValues({}, headers2), {
100
+ const headers = Object.entries({
101
+ Accept: "application/json",
102
+ ...additionalHeaders,
103
+ ...options.headers
104
+ }).filter(([_, value]) => isDefined(value)).reduce((headers2, [key, value]) => ({
105
+ ...headers2,
123
106
  [key]: String(value)
124
107
  }), {});
125
108
  if (isStringWithValue(token)) {
@@ -143,9 +126,8 @@ const getHeaders = async (config, options) => {
143
126
  return new Headers(headers);
144
127
  };
145
128
  const getRequestBody = (options) => {
146
- var _a;
147
129
  if (options.body) {
148
- if ((_a = options.mediaType) == null ? void 0 : _a.includes("/json")) {
130
+ if (options.mediaType?.includes("/json")) {
149
131
  return JSON.stringify(options.body);
150
132
  } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
151
133
  return options.body;
@@ -159,7 +141,7 @@ const sendRequest = async (config, options, url, body, formData, headers, onCanc
159
141
  const controller = new AbortController();
160
142
  const request2 = {
161
143
  headers,
162
- body: body != null ? body : formData,
144
+ body: body ?? formData,
163
145
  method: options.method,
164
146
  signal: controller.signal
165
147
  };
@@ -197,15 +179,16 @@ const getResponseBody = async (response) => {
197
179
  return void 0;
198
180
  };
199
181
  const catchErrorCodes = (options, result) => {
200
- const errors = __spreadValues({
182
+ const errors = {
201
183
  400: "Bad Request",
202
184
  401: "Unauthorized",
203
185
  403: "Forbidden",
204
186
  404: "Not Found",
205
187
  500: "Internal Server Error",
206
188
  502: "Bad Gateway",
207
- 503: "Service Unavailable"
208
- }, options.errors);
189
+ 503: "Service Unavailable",
190
+ ...options.errors
191
+ };
209
192
  const error = errors[result.status];
210
193
  if (error) {
211
194
  throw new ApiError(options, result, error);
@@ -230,7 +213,7 @@ const request = (config, options) => {
230
213
  ok: response.ok,
231
214
  status: response.status,
232
215
  statusText: response.statusText,
233
- body: responseHeader != null ? responseHeader : responseBody
216
+ body: responseHeader ?? responseBody
234
217
  };
235
218
  catchErrorCodes(options, result);
236
219
  resolve2(result.body);
@@ -1,5 +1,3 @@
1
- import { DelegationStatusType } from './DelegationStatusType.js';
2
-
3
1
  type ActiveDelegatorDetails = {
4
2
  txHash: string;
5
3
  rewardAddresses: Array<string>;
@@ -7,9 +5,14 @@ type ActiveDelegatorDetails = {
7
5
  delegationFee: string;
8
6
  startTimestamp: number;
9
7
  endTimestamp: number;
10
- delegationStatus: DelegationStatusType;
11
8
  estimatedGrossReward: string;
12
9
  estimatedNetReward: string;
10
+ delegationStatus: ActiveDelegatorDetails.delegationStatus;
13
11
  };
12
+ declare namespace ActiveDelegatorDetails {
13
+ enum delegationStatus {
14
+ ACTIVE = "active"
15
+ }
16
+ }
14
17
 
15
18
  export { ActiveDelegatorDetails };
@@ -0,0 +1,8 @@
1
+ var ActiveDelegatorDetails;
2
+ ((ActiveDelegatorDetails2) => {
3
+ ((delegationStatus2) => {
4
+ delegationStatus2["ACTIVE"] = "active";
5
+ })(ActiveDelegatorDetails2.delegationStatus || (ActiveDelegatorDetails2.delegationStatus = {}));
6
+ })(ActiveDelegatorDetails || (ActiveDelegatorDetails = {}));
7
+
8
+ export { ActiveDelegatorDetails };
@@ -1,5 +1,4 @@
1
1
  import { Rewards } from './Rewards.js';
2
- import { ValidationStatusType } from './ValidationStatusType.js';
3
2
 
4
3
  type ActiveValidatorDetails = {
5
4
  nodeId: string;
@@ -7,7 +6,6 @@ type ActiveValidatorDetails = {
7
6
  delegationFee: string;
8
7
  startTimestamp: number;
9
8
  endTimestamp: number;
10
- validationStatus: ValidationStatusType;
11
9
  stakePercentage: number;
12
10
  delegatorCount: number;
13
11
  amountDelegated: string;
@@ -15,6 +13,12 @@ type ActiveValidatorDetails = {
15
13
  avalancheGoVersion: string;
16
14
  delegationCapacity: string;
17
15
  potentialRewards: Rewards;
16
+ validationStatus: ActiveValidatorDetails.validationStatus;
18
17
  };
18
+ declare namespace ActiveValidatorDetails {
19
+ enum validationStatus {
20
+ ACTIVE = "active"
21
+ }
22
+ }
19
23
 
20
24
  export { ActiveValidatorDetails };
@@ -0,0 +1,8 @@
1
+ var ActiveValidatorDetails;
2
+ ((ActiveValidatorDetails2) => {
3
+ ((validationStatus2) => {
4
+ validationStatus2["ACTIVE"] = "active";
5
+ })(ActiveValidatorDetails2.validationStatus || (ActiveValidatorDetails2.validationStatus = {}));
6
+ })(ActiveValidatorDetails || (ActiveValidatorDetails = {}));
7
+
8
+ export { ActiveValidatorDetails };
@@ -22,6 +22,7 @@ type ChainInfo = {
22
22
  utilityAddresses?: UtilityAddresses;
23
23
  networkToken: NetworkToken;
24
24
  chainLogoUri?: string;
25
+ private?: boolean;
25
26
  };
26
27
 
27
28
  export { ChainInfo };
@@ -1,5 +1,3 @@
1
- import { DelegationStatusType } from './DelegationStatusType.js';
2
-
3
1
  type CompletedDelegatorDetails = {
4
2
  txHash: string;
5
3
  rewardAddresses: Array<string>;
@@ -7,9 +5,14 @@ type CompletedDelegatorDetails = {
7
5
  delegationFee: string;
8
6
  startTimestamp: number;
9
7
  endTimestamp: number;
10
- delegationStatus: DelegationStatusType;
11
8
  grossReward: string;
12
9
  netReward: string;
10
+ delegationStatus: CompletedDelegatorDetails.delegationStatus;
13
11
  };
12
+ declare namespace CompletedDelegatorDetails {
13
+ enum delegationStatus {
14
+ COMPLETED = "completed"
15
+ }
16
+ }
14
17
 
15
18
  export { CompletedDelegatorDetails };