@avalabs/glacier-sdk 2.8.0-canary.6c3da76.0 → 2.8.0-canary.80115cd.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 CHANGED
@@ -1019,6 +1019,10 @@ type ImageAsset = {
1019
1019
  imageUri?: string;
1020
1020
  };
1021
1021
 
1022
+ type PricingProviders = {
1023
+ coingeckoCoinId?: string;
1024
+ };
1025
+
1022
1026
  declare enum ResourceLinkType {
1023
1027
  BLOG = "Blog",
1024
1028
  COIN_GECKO = "CoinGecko",
@@ -1056,7 +1060,6 @@ type Erc1155Contract = {
1056
1060
  logoAsset?: ImageAsset;
1057
1061
  bannerAsset?: ImageAsset;
1058
1062
  color?: string;
1059
- coingeckoCoinId?: string;
1060
1063
  resourceLinks?: Array<ResourceLink>;
1061
1064
  tags?: Array<string>;
1062
1065
  /**
@@ -1069,6 +1072,7 @@ type Erc1155Contract = {
1069
1072
  * The contract symbol.
1070
1073
  */
1071
1074
  symbol?: string;
1075
+ pricingProviders?: PricingProviders;
1072
1076
  };
1073
1077
  declare namespace Erc1155Contract {
1074
1078
  enum ercType {
@@ -1087,7 +1091,6 @@ type Erc20Contract = {
1087
1091
  logoAsset?: ImageAsset;
1088
1092
  bannerAsset?: ImageAsset;
1089
1093
  color?: string;
1090
- coingeckoCoinId?: string;
1091
1094
  resourceLinks?: Array<ResourceLink>;
1092
1095
  tags?: Array<string>;
1093
1096
  /**
@@ -1104,6 +1107,7 @@ type Erc20Contract = {
1104
1107
  * The number of decimals the token uses. For example `6`, means to divide the token amount by `1000000` to get its user representation.
1105
1108
  */
1106
1109
  decimals: number;
1110
+ pricingProviders: PricingProviders;
1107
1111
  };
1108
1112
  declare namespace Erc20Contract {
1109
1113
  enum ercType {
@@ -1122,7 +1126,6 @@ type Erc721Contract = {
1122
1126
  logoAsset?: ImageAsset;
1123
1127
  bannerAsset?: ImageAsset;
1124
1128
  color?: string;
1125
- coingeckoCoinId?: string;
1126
1129
  resourceLinks?: Array<ResourceLink>;
1127
1130
  tags?: Array<string>;
1128
1131
  /**
@@ -1153,7 +1156,6 @@ type UnknownContract = {
1153
1156
  logoAsset?: ImageAsset;
1154
1157
  bannerAsset?: ImageAsset;
1155
1158
  color?: string;
1156
- coingeckoCoinId?: string;
1157
1159
  resourceLinks?: Array<ResourceLink>;
1158
1160
  tags?: Array<string>;
1159
1161
  /**
@@ -1728,6 +1730,67 @@ declare class HealthCheckService {
1728
1730
  }>;
1729
1731
  }
1730
1732
 
1733
+ declare class NfTsService {
1734
+ readonly httpRequest: BaseHttpRequest;
1735
+ constructor(httpRequest: BaseHttpRequest);
1736
+ /**
1737
+ * Reindex NFT metadata
1738
+ * Triggers reindexing of token metadata for an NFT token. Reindexing can only be called once per hour for each NFT token.
1739
+ * @returns any
1740
+ * @throws ApiError
1741
+ */
1742
+ reindexNft({ chainId, address, tokenId, }: {
1743
+ /**
1744
+ * A supported evm chain id. Use the `/chains` endpoint to get a list of supported chain ids.
1745
+ */
1746
+ chainId: string;
1747
+ /**
1748
+ * Contract address on the relevant chain.
1749
+ */
1750
+ address: string;
1751
+ /**
1752
+ * TokenId on the contract
1753
+ */
1754
+ tokenId: string;
1755
+ }): CancelablePromise<any>;
1756
+ /**
1757
+ * Get token details
1758
+ * Gets token details for a specific token of an NFT contract.
1759
+ * @returns any
1760
+ * @throws ApiError
1761
+ */
1762
+ getTokenDetails({ chainId, address, tokenId, }: {
1763
+ /**
1764
+ * A supported evm chain id. Use the `/chains` endpoint to get a list of supported chain ids.
1765
+ */
1766
+ chainId: string;
1767
+ /**
1768
+ * Contract address on the relevant chain.
1769
+ */
1770
+ address: string;
1771
+ /**
1772
+ * TokenId on the contract
1773
+ */
1774
+ tokenId: string;
1775
+ }): CancelablePromise<(Erc721Token | Erc1155Token)>;
1776
+ /**
1777
+ * Get collection details
1778
+ * Gets collection details for a NFT contract.
1779
+ * @returns any
1780
+ * @throws ApiError
1781
+ */
1782
+ getCollection({ chainId, address, }: {
1783
+ /**
1784
+ * A supported evm chain id. Use the `/chains` endpoint to get a list of supported chain ids.
1785
+ */
1786
+ chainId: string;
1787
+ /**
1788
+ * Contract address on the relevant chain.
1789
+ */
1790
+ address: string;
1791
+ }): CancelablePromise<(Erc721Contract | Erc1155Contract)>;
1792
+ }
1793
+
1731
1794
  type EvmNetworkOptions = {
1732
1795
  addresses: Array<string>;
1733
1796
  includeChains: Array<string>;
@@ -3603,6 +3666,7 @@ declare class Glacier {
3603
3666
  readonly evmChains: EvmChainsService;
3604
3667
  readonly evmTransactions: EvmTransactionsService;
3605
3668
  readonly healthCheck: HealthCheckService;
3669
+ readonly nfTs: NfTsService;
3606
3670
  readonly operations: OperationsService;
3607
3671
  readonly primaryNetwork: PrimaryNetworkService;
3608
3672
  readonly primaryNetworkBalances: PrimaryNetworkBalancesService;
@@ -3632,4 +3696,4 @@ declare class ApiError extends Error {
3632
3696
  constructor(request: ApiRequestOptions, response: ApiResult, message: string);
3633
3697
  }
3634
3698
 
3635
- export { ActiveDelegatorDetails, ActiveValidatorDetails, ApiError, Asset, BaseHttpRequest, Blockchain, BlockchainId, BlockchainIds, BlockchainInfo, CChainAtomicBalances, CChainExportTransaction, CChainImportTransaction, CChainSharedAssetBalance, CancelError, CancelablePromise, ChainAddressChainIdMap, ChainAddressChainIdMapListResponse, ChainInfo, ChainStatus, CompletedDelegatorDetails, CompletedValidatorDetails, ContractDeploymentDetails, CreateEvmTransactionExportRequest, CreatePrimaryNetworkTransactionExportRequest, CurrencyCode, DelegationStatusType, DelegatorsDetails, EVMInput, EVMOutput, Erc1155Contract, Erc1155Token, Erc1155TokenBalance, Erc1155TokenMetadata, Erc1155Transfer, Erc1155TransferDetails, Erc20Contract, Erc20Token, Erc20TokenBalance, Erc20Transfer, Erc20TransferDetails, Erc721Contract, Erc721Token, Erc721TokenBalance, Erc721TokenMetadata, Erc721Transfer, Erc721TransferDetails, EvmBalancesService, EvmBlock, EvmBlocksService, EvmChainsService, EvmNetworkOptions, EvmTransactionsService, FullNativeTransactionDetails, GetChainResponse, GetEvmBlockResponse, GetNativeBalanceResponse, GetNetworkDetailsResponse, GetPrimaryNetworkBlockResponse, GetTransactionResponse, Glacier, HealthCheckService, HistoricalReward, ImageAsset, InternalTransaction, InternalTransactionDetails, InternalTransactionOpCall, ListBlockchainsResponse, ListCChainAtomicBalancesResponse, ListCChainAtomicTransactionsResponse, ListChainsResponse, ListCollectibleBalancesResponse, ListContractsResponse, ListDelegatorDetailsResponse, ListErc1155BalancesResponse, ListErc1155TransactionsResponse, ListErc20BalancesResponse, ListErc20TransactionsResponse, ListErc721BalancesResponse, ListErc721TransactionsResponse, ListEvmBlocksResponse, ListHistoricalRewardsResponse, ListInternalTransactionsResponse, ListNativeTransactionsResponse, ListPChainBalancesResponse, ListPChainTransactionsResponse, ListPChainUtxosResponse, ListPendingRewardsResponse, ListPrimaryNetworkBlocksResponse, ListSubnetsResponse, ListTransactionDetailsResponse, ListTransfersResponse, ListUtxosResponse, ListValidatorDetailsResponse, ListXChainBalancesResponse, ListXChainTransactionsResponse, ListXChainVerticesResponse, Method, Money, NativeTokenBalance, NativeTransaction, Network, NetworkToken, NetworkTokenDetails, NetworkType, NftTokenMetadataStatus, OpenAPI, OpenAPIConfig, OperationStatus, OperationStatusCode, OperationStatusResponse, OperationType, OperationsService, PChainAsset, PChainBalance, PChainId, PChainSharedAsset, PChainTransaction, PChainTransactionType, PChainUtxo, PendingDelegatorDetails, PendingReward, PendingValidatorDetails, PrimaryNetwork, PrimaryNetworkBalancesService, PrimaryNetworkBlock, PrimaryNetworkBlocksService, PrimaryNetworkChainInfo, PrimaryNetworkChainName, PrimaryNetworkOptions, PrimaryNetworkRewardsService, PrimaryNetworkService, PrimaryNetworkTransactionsService, PrimaryNetworkTxType, PrimaryNetworkUtxOsService, PrimaryNetworkVerticesService, ProposerDetails, ResourceLink, ResourceLinkType, RewardType, Rewards, RichAddress, SortOrder, StakingDistribution, Subnet, TransactionDetails, TransactionExportMetadata, TransactionMethodType, TransactionStatus, TransactionVertexDetail, UnknownContract, UtilityAddresses, Utxo, UtxoCredential, UtxoType, ValidationStatusType, ValidatorsDetails, VmName, XChainAssetBalance, XChainAssetDetails, XChainBalances, XChainId, XChainLinearTransaction, XChainNonLinearTransaction, XChainSharedAssetBalance, XChainVertex };
3699
+ export { ActiveDelegatorDetails, ActiveValidatorDetails, ApiError, Asset, BaseHttpRequest, Blockchain, BlockchainId, BlockchainIds, BlockchainInfo, CChainAtomicBalances, CChainExportTransaction, CChainImportTransaction, CChainSharedAssetBalance, CancelError, CancelablePromise, ChainAddressChainIdMap, ChainAddressChainIdMapListResponse, ChainInfo, ChainStatus, CompletedDelegatorDetails, CompletedValidatorDetails, ContractDeploymentDetails, CreateEvmTransactionExportRequest, CreatePrimaryNetworkTransactionExportRequest, CurrencyCode, DelegationStatusType, DelegatorsDetails, EVMInput, EVMOutput, Erc1155Contract, Erc1155Token, Erc1155TokenBalance, Erc1155TokenMetadata, Erc1155Transfer, Erc1155TransferDetails, Erc20Contract, Erc20Token, Erc20TokenBalance, Erc20Transfer, Erc20TransferDetails, Erc721Contract, Erc721Token, Erc721TokenBalance, Erc721TokenMetadata, Erc721Transfer, Erc721TransferDetails, EvmBalancesService, EvmBlock, EvmBlocksService, EvmChainsService, EvmNetworkOptions, EvmTransactionsService, FullNativeTransactionDetails, GetChainResponse, GetEvmBlockResponse, GetNativeBalanceResponse, GetNetworkDetailsResponse, GetPrimaryNetworkBlockResponse, GetTransactionResponse, Glacier, HealthCheckService, HistoricalReward, ImageAsset, InternalTransaction, InternalTransactionDetails, InternalTransactionOpCall, ListBlockchainsResponse, ListCChainAtomicBalancesResponse, ListCChainAtomicTransactionsResponse, ListChainsResponse, ListCollectibleBalancesResponse, ListContractsResponse, ListDelegatorDetailsResponse, ListErc1155BalancesResponse, ListErc1155TransactionsResponse, ListErc20BalancesResponse, ListErc20TransactionsResponse, ListErc721BalancesResponse, ListErc721TransactionsResponse, ListEvmBlocksResponse, ListHistoricalRewardsResponse, ListInternalTransactionsResponse, ListNativeTransactionsResponse, ListPChainBalancesResponse, ListPChainTransactionsResponse, ListPChainUtxosResponse, ListPendingRewardsResponse, ListPrimaryNetworkBlocksResponse, ListSubnetsResponse, ListTransactionDetailsResponse, ListTransfersResponse, ListUtxosResponse, ListValidatorDetailsResponse, ListXChainBalancesResponse, ListXChainTransactionsResponse, ListXChainVerticesResponse, Method, Money, NativeTokenBalance, NativeTransaction, Network, NetworkToken, NetworkTokenDetails, NetworkType, NfTsService, NftTokenMetadataStatus, OpenAPI, OpenAPIConfig, OperationStatus, OperationStatusCode, OperationStatusResponse, OperationType, OperationsService, PChainAsset, PChainBalance, PChainId, PChainSharedAsset, PChainTransaction, PChainTransactionType, PChainUtxo, PendingDelegatorDetails, PendingReward, PendingValidatorDetails, PricingProviders, PrimaryNetwork, PrimaryNetworkBalancesService, PrimaryNetworkBlock, PrimaryNetworkBlocksService, PrimaryNetworkChainInfo, PrimaryNetworkChainName, PrimaryNetworkOptions, PrimaryNetworkRewardsService, PrimaryNetworkService, PrimaryNetworkTransactionsService, PrimaryNetworkTxType, PrimaryNetworkUtxOsService, PrimaryNetworkVerticesService, ProposerDetails, ResourceLink, ResourceLinkType, RewardType, Rewards, RichAddress, SortOrder, StakingDistribution, Subnet, TransactionDetails, TransactionExportMetadata, TransactionMethodType, TransactionStatus, TransactionVertexDetail, UnknownContract, UtilityAddresses, Utxo, UtxoCredential, UtxoType, ValidationStatusType, ValidatorsDetails, VmName, XChainAssetBalance, XChainAssetDetails, XChainBalances, XChainId, XChainLinearTransaction, XChainNonLinearTransaction, XChainSharedAssetBalance, XChainVertex };
package/dist/index.js CHANGED
@@ -7,11 +7,6 @@ class BaseHttpRequest {
7
7
  }
8
8
 
9
9
  class ApiError extends Error {
10
- url;
11
- status;
12
- statusText;
13
- body;
14
- request;
15
10
  constructor(request, response, message) {
16
11
  super(message);
17
12
  this.name = "ApiError";
@@ -33,14 +28,6 @@ class CancelError extends Error {
33
28
  }
34
29
  }
35
30
  class CancelablePromise {
36
- [Symbol.toStringTag];
37
- _isResolved;
38
- _isRejected;
39
- _isCancelled;
40
- _cancelHandlers;
41
- _promise;
42
- _resolve;
43
- _reject;
44
31
  constructor(executor) {
45
32
  this._isResolved = false;
46
33
  this._isRejected = false;
@@ -50,18 +37,20 @@ class CancelablePromise {
50
37
  this._resolve = resolve;
51
38
  this._reject = reject;
52
39
  const onResolve = (value) => {
40
+ var _a;
53
41
  if (this._isResolved || this._isRejected || this._isCancelled) {
54
42
  return;
55
43
  }
56
44
  this._isResolved = true;
57
- this._resolve?.(value);
45
+ (_a = this._resolve) == null ? void 0 : _a.call(this, value);
58
46
  };
59
47
  const onReject = (reason) => {
48
+ var _a;
60
49
  if (this._isResolved || this._isRejected || this._isCancelled) {
61
50
  return;
62
51
  }
63
52
  this._isRejected = true;
64
- this._reject?.(reason);
53
+ (_a = this._reject) == null ? void 0 : _a.call(this, reason);
65
54
  };
66
55
  const onCancel = (cancelHandler) => {
67
56
  if (this._isResolved || this._isRejected || this._isCancelled) {
@@ -91,6 +80,7 @@ class CancelablePromise {
91
80
  return this._promise.finally(onFinally);
92
81
  }
93
82
  cancel() {
83
+ var _a;
94
84
  if (this._isResolved || this._isRejected || this._isCancelled) {
95
85
  return;
96
86
  }
@@ -106,13 +96,32 @@ class CancelablePromise {
106
96
  }
107
97
  }
108
98
  this._cancelHandlers.length = 0;
109
- this._reject?.(new CancelError("Request aborted"));
99
+ (_a = this._reject) == null ? void 0 : _a.call(this, new CancelError("Request aborted"));
110
100
  }
111
101
  get isCancelled() {
112
102
  return this._isCancelled;
113
103
  }
114
104
  }
115
105
 
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));
116
125
  const isDefined = (value) => {
117
126
  return value !== void 0 && value !== null;
118
127
  };
@@ -166,7 +175,8 @@ const getQueryString = (params) => {
166
175
  const getUrl = (config, options) => {
167
176
  const encoder = config.ENCODE_PATH || encodeURI;
168
177
  const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
169
- if (options.path?.hasOwnProperty(group)) {
178
+ var _a;
179
+ if ((_a = options.path) == null ? void 0 : _a.hasOwnProperty(group)) {
170
180
  return encoder(String(options.path[group]));
171
181
  }
172
182
  return substring;
@@ -209,12 +219,9 @@ const getHeaders = async (config, options) => {
209
219
  const username = await resolve(options, config.USERNAME);
210
220
  const password = await resolve(options, config.PASSWORD);
211
221
  const additionalHeaders = await resolve(options, config.HEADERS);
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,
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), {
218
225
  [key]: String(value)
219
226
  }), {});
220
227
  if (isStringWithValue(token)) {
@@ -238,8 +245,9 @@ const getHeaders = async (config, options) => {
238
245
  return new Headers(headers);
239
246
  };
240
247
  const getRequestBody = (options) => {
248
+ var _a;
241
249
  if (options.body) {
242
- if (options.mediaType?.includes("/json")) {
250
+ if ((_a = options.mediaType) == null ? void 0 : _a.includes("/json")) {
243
251
  return JSON.stringify(options.body);
244
252
  } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
245
253
  return options.body;
@@ -253,7 +261,7 @@ const sendRequest = async (config, options, url, body, formData, headers, onCanc
253
261
  const controller = new AbortController();
254
262
  const request2 = {
255
263
  headers,
256
- body: body ?? formData,
264
+ body: body != null ? body : formData,
257
265
  method: options.method,
258
266
  signal: controller.signal
259
267
  };
@@ -291,16 +299,15 @@ const getResponseBody = async (response) => {
291
299
  return void 0;
292
300
  };
293
301
  const catchErrorCodes = (options, result) => {
294
- const errors = {
302
+ const errors = __spreadValues({
295
303
  400: "Bad Request",
296
304
  401: "Unauthorized",
297
305
  403: "Forbidden",
298
306
  404: "Not Found",
299
307
  500: "Internal Server Error",
300
308
  502: "Bad Gateway",
301
- 503: "Service Unavailable",
302
- ...options.errors
303
- };
309
+ 503: "Service Unavailable"
310
+ }, options.errors);
304
311
  const error = errors[result.status];
305
312
  if (error) {
306
313
  throw new ApiError(options, result, error);
@@ -325,7 +332,7 @@ const request = (config, options) => {
325
332
  ok: response.ok,
326
333
  status: response.status,
327
334
  statusText: response.statusText,
328
- body: responseHeader ?? responseBody
335
+ body: responseHeader != null ? responseHeader : responseBody
329
336
  };
330
337
  catchErrorCodes(options, result);
331
338
  resolve2(result.body);
@@ -789,6 +796,55 @@ class HealthCheckService {
789
796
  }
790
797
  }
791
798
 
799
+ class NfTsService {
800
+ constructor(httpRequest) {
801
+ this.httpRequest = httpRequest;
802
+ }
803
+ reindexNft({
804
+ chainId,
805
+ address,
806
+ tokenId
807
+ }) {
808
+ return this.httpRequest.request({
809
+ method: "POST",
810
+ url: "/v1/chains/{chainId}/nfts/collections/{address}/tokens/{tokenId}:reindex",
811
+ path: {
812
+ "chainId": chainId,
813
+ "address": address,
814
+ "tokenId": tokenId
815
+ }
816
+ });
817
+ }
818
+ getTokenDetails({
819
+ chainId,
820
+ address,
821
+ tokenId
822
+ }) {
823
+ return this.httpRequest.request({
824
+ method: "GET",
825
+ url: "/v1/chains/{chainId}/nfts/collections/{address}/tokens/{tokenId}",
826
+ path: {
827
+ "chainId": chainId,
828
+ "address": address,
829
+ "tokenId": tokenId
830
+ }
831
+ });
832
+ }
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
+ }
847
+
792
848
  class OperationsService {
793
849
  constructor(httpRequest) {
794
850
  this.httpRequest = httpRequest;
@@ -1311,37 +1367,25 @@ class PrimaryNetworkVerticesService {
1311
1367
  }
1312
1368
 
1313
1369
  class Glacier {
1314
- evmBalances;
1315
- evmBlocks;
1316
- evmChains;
1317
- evmTransactions;
1318
- healthCheck;
1319
- operations;
1320
- primaryNetwork;
1321
- primaryNetworkBalances;
1322
- primaryNetworkBlocks;
1323
- primaryNetworkRewards;
1324
- primaryNetworkTransactions;
1325
- primaryNetworkUtxOs;
1326
- primaryNetworkVertices;
1327
- request;
1328
1370
  constructor(config, HttpRequest = FetchHttpRequest) {
1371
+ var _a, _b, _c, _d;
1329
1372
  this.request = new HttpRequest({
1330
- BASE: config?.BASE ?? "https://glacier-api-dev.avax.network",
1331
- VERSION: config?.VERSION ?? "Beta",
1332
- WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
1333
- CREDENTIALS: config?.CREDENTIALS ?? "include",
1334
- TOKEN: config?.TOKEN,
1335
- USERNAME: config?.USERNAME,
1336
- PASSWORD: config?.PASSWORD,
1337
- HEADERS: config?.HEADERS,
1338
- ENCODE_PATH: config?.ENCODE_PATH
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
1339
1382
  });
1340
1383
  this.evmBalances = new EvmBalancesService(this.request);
1341
1384
  this.evmBlocks = new EvmBlocksService(this.request);
1342
1385
  this.evmChains = new EvmChainsService(this.request);
1343
1386
  this.evmTransactions = new EvmTransactionsService(this.request);
1344
1387
  this.healthCheck = new HealthCheckService(this.request);
1388
+ this.nfTs = new NfTsService(this.request);
1345
1389
  this.operations = new OperationsService(this.request);
1346
1390
  this.primaryNetwork = new PrimaryNetworkService(this.request);
1347
1391
  this.primaryNetworkBalances = new PrimaryNetworkBalancesService(this.request);
@@ -1736,6 +1780,7 @@ exports.HealthCheckService = HealthCheckService;
1736
1780
  exports.InternalTransactionOpCall = InternalTransactionOpCall;
1737
1781
  exports.Network = Network;
1738
1782
  exports.NetworkType = NetworkType;
1783
+ exports.NfTsService = NfTsService;
1739
1784
  exports.NftTokenMetadataStatus = NftTokenMetadataStatus;
1740
1785
  exports.OpenAPI = OpenAPI;
1741
1786
  exports.OperationStatus = OperationStatus;
@@ -5,6 +5,7 @@ import { EvmBlocksService } from './services/EvmBlocksService.js';
5
5
  import { EvmChainsService } from './services/EvmChainsService.js';
6
6
  import { EvmTransactionsService } from './services/EvmTransactionsService.js';
7
7
  import { HealthCheckService } from './services/HealthCheckService.js';
8
+ import { NfTsService } from './services/NfTsService.js';
8
9
  import { OperationsService } from './services/OperationsService.js';
9
10
  import { PrimaryNetworkService } from './services/PrimaryNetworkService.js';
10
11
  import { PrimaryNetworkBalancesService } from './services/PrimaryNetworkBalancesService.js';
@@ -21,6 +22,7 @@ declare class Glacier {
21
22
  readonly evmChains: EvmChainsService;
22
23
  readonly evmTransactions: EvmTransactionsService;
23
24
  readonly healthCheck: HealthCheckService;
25
+ readonly nfTs: NfTsService;
24
26
  readonly operations: OperationsService;
25
27
  readonly primaryNetwork: PrimaryNetworkService;
26
28
  readonly primaryNetworkBalances: PrimaryNetworkBalancesService;
@@ -4,6 +4,7 @@ import { EvmBlocksService } from './services/EvmBlocksService.js';
4
4
  import { EvmChainsService } from './services/EvmChainsService.js';
5
5
  import { EvmTransactionsService } from './services/EvmTransactionsService.js';
6
6
  import { HealthCheckService } from './services/HealthCheckService.js';
7
+ import { NfTsService } from './services/NfTsService.js';
7
8
  import { OperationsService } from './services/OperationsService.js';
8
9
  import { PrimaryNetworkService } from './services/PrimaryNetworkService.js';
9
10
  import { PrimaryNetworkBalancesService } from './services/PrimaryNetworkBalancesService.js';
@@ -14,37 +15,25 @@ import { PrimaryNetworkUtxOsService } from './services/PrimaryNetworkUtxOsServic
14
15
  import { PrimaryNetworkVerticesService } from './services/PrimaryNetworkVerticesService.js';
15
16
 
16
17
  class Glacier {
17
- evmBalances;
18
- evmBlocks;
19
- evmChains;
20
- evmTransactions;
21
- healthCheck;
22
- operations;
23
- primaryNetwork;
24
- primaryNetworkBalances;
25
- primaryNetworkBlocks;
26
- primaryNetworkRewards;
27
- primaryNetworkTransactions;
28
- primaryNetworkUtxOs;
29
- primaryNetworkVertices;
30
- request;
31
18
  constructor(config, HttpRequest = FetchHttpRequest) {
19
+ var _a, _b, _c, _d;
32
20
  this.request = new HttpRequest({
33
- BASE: config?.BASE ?? "https://glacier-api-dev.avax.network",
34
- VERSION: config?.VERSION ?? "Beta",
35
- WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
36
- CREDENTIALS: config?.CREDENTIALS ?? "include",
37
- TOKEN: config?.TOKEN,
38
- USERNAME: config?.USERNAME,
39
- PASSWORD: config?.PASSWORD,
40
- HEADERS: config?.HEADERS,
41
- ENCODE_PATH: config?.ENCODE_PATH
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
42
30
  });
43
31
  this.evmBalances = new EvmBalancesService(this.request);
44
32
  this.evmBlocks = new EvmBlocksService(this.request);
45
33
  this.evmChains = new EvmChainsService(this.request);
46
34
  this.evmTransactions = new EvmTransactionsService(this.request);
47
35
  this.healthCheck = new HealthCheckService(this.request);
36
+ this.nfTs = new NfTsService(this.request);
48
37
  this.operations = new OperationsService(this.request);
49
38
  this.primaryNetwork = new PrimaryNetworkService(this.request);
50
39
  this.primaryNetworkBalances = new PrimaryNetworkBalancesService(this.request);
@@ -1,9 +1,4 @@
1
1
  class ApiError extends Error {
2
- url;
3
- status;
4
- statusText;
5
- body;
6
- request;
7
2
  constructor(request, response, message) {
8
3
  super(message);
9
4
  this.name = "ApiError";
@@ -8,14 +8,6 @@ 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;
19
11
  constructor(executor) {
20
12
  this._isResolved = false;
21
13
  this._isRejected = false;
@@ -25,18 +17,20 @@ class CancelablePromise {
25
17
  this._resolve = resolve;
26
18
  this._reject = reject;
27
19
  const onResolve = (value) => {
20
+ var _a;
28
21
  if (this._isResolved || this._isRejected || this._isCancelled) {
29
22
  return;
30
23
  }
31
24
  this._isResolved = true;
32
- this._resolve?.(value);
25
+ (_a = this._resolve) == null ? void 0 : _a.call(this, value);
33
26
  };
34
27
  const onReject = (reason) => {
28
+ var _a;
35
29
  if (this._isResolved || this._isRejected || this._isCancelled) {
36
30
  return;
37
31
  }
38
32
  this._isRejected = true;
39
- this._reject?.(reason);
33
+ (_a = this._reject) == null ? void 0 : _a.call(this, reason);
40
34
  };
41
35
  const onCancel = (cancelHandler) => {
42
36
  if (this._isResolved || this._isRejected || this._isCancelled) {
@@ -66,6 +60,7 @@ class CancelablePromise {
66
60
  return this._promise.finally(onFinally);
67
61
  }
68
62
  cancel() {
63
+ var _a;
69
64
  if (this._isResolved || this._isRejected || this._isCancelled) {
70
65
  return;
71
66
  }
@@ -81,7 +76,7 @@ class CancelablePromise {
81
76
  }
82
77
  }
83
78
  this._cancelHandlers.length = 0;
84
- this._reject?.(new CancelError("Request aborted"));
79
+ (_a = this._reject) == null ? void 0 : _a.call(this, new CancelError("Request aborted"));
85
80
  }
86
81
  get isCancelled() {
87
82
  return this._isCancelled;
@@ -1,6 +1,25 @@
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));
4
23
  const isDefined = (value) => {
5
24
  return value !== void 0 && value !== null;
6
25
  };
@@ -54,7 +73,8 @@ const getQueryString = (params) => {
54
73
  const getUrl = (config, options) => {
55
74
  const encoder = config.ENCODE_PATH || encodeURI;
56
75
  const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
57
- if (options.path?.hasOwnProperty(group)) {
76
+ var _a;
77
+ if ((_a = options.path) == null ? void 0 : _a.hasOwnProperty(group)) {
58
78
  return encoder(String(options.path[group]));
59
79
  }
60
80
  return substring;
@@ -97,12 +117,9 @@ const getHeaders = async (config, options) => {
97
117
  const username = await resolve(options, config.USERNAME);
98
118
  const password = await resolve(options, config.PASSWORD);
99
119
  const additionalHeaders = await resolve(options, config.HEADERS);
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,
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), {
106
123
  [key]: String(value)
107
124
  }), {});
108
125
  if (isStringWithValue(token)) {
@@ -126,8 +143,9 @@ const getHeaders = async (config, options) => {
126
143
  return new Headers(headers);
127
144
  };
128
145
  const getRequestBody = (options) => {
146
+ var _a;
129
147
  if (options.body) {
130
- if (options.mediaType?.includes("/json")) {
148
+ if ((_a = options.mediaType) == null ? void 0 : _a.includes("/json")) {
131
149
  return JSON.stringify(options.body);
132
150
  } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
133
151
  return options.body;
@@ -141,7 +159,7 @@ const sendRequest = async (config, options, url, body, formData, headers, onCanc
141
159
  const controller = new AbortController();
142
160
  const request2 = {
143
161
  headers,
144
- body: body ?? formData,
162
+ body: body != null ? body : formData,
145
163
  method: options.method,
146
164
  signal: controller.signal
147
165
  };
@@ -179,16 +197,15 @@ const getResponseBody = async (response) => {
179
197
  return void 0;
180
198
  };
181
199
  const catchErrorCodes = (options, result) => {
182
- const errors = {
200
+ const errors = __spreadValues({
183
201
  400: "Bad Request",
184
202
  401: "Unauthorized",
185
203
  403: "Forbidden",
186
204
  404: "Not Found",
187
205
  500: "Internal Server Error",
188
206
  502: "Bad Gateway",
189
- 503: "Service Unavailable",
190
- ...options.errors
191
- };
207
+ 503: "Service Unavailable"
208
+ }, options.errors);
192
209
  const error = errors[result.status];
193
210
  if (error) {
194
211
  throw new ApiError(options, result, error);
@@ -213,7 +230,7 @@ const request = (config, options) => {
213
230
  ok: response.ok,
214
231
  status: response.status,
215
232
  statusText: response.statusText,
216
- body: responseHeader ?? responseBody
233
+ body: responseHeader != null ? responseHeader : responseBody
217
234
  };
218
235
  catchErrorCodes(options, result);
219
236
  resolve2(result.body);
@@ -1,5 +1,6 @@
1
1
  import { ContractDeploymentDetails } from './ContractDeploymentDetails.js';
2
2
  import { ImageAsset } from './ImageAsset.js';
3
+ import { PricingProviders } from './PricingProviders.js';
3
4
  import { ResourceLink } from './ResourceLink.js';
4
5
 
5
6
  type Erc1155Contract = {
@@ -13,7 +14,6 @@ type Erc1155Contract = {
13
14
  logoAsset?: ImageAsset;
14
15
  bannerAsset?: ImageAsset;
15
16
  color?: string;
16
- coingeckoCoinId?: string;
17
17
  resourceLinks?: Array<ResourceLink>;
18
18
  tags?: Array<string>;
19
19
  /**
@@ -26,6 +26,7 @@ type Erc1155Contract = {
26
26
  * The contract symbol.
27
27
  */
28
28
  symbol?: string;
29
+ pricingProviders?: PricingProviders;
29
30
  };
30
31
  declare namespace Erc1155Contract {
31
32
  enum ercType {
@@ -1,5 +1,6 @@
1
1
  import { ContractDeploymentDetails } from './ContractDeploymentDetails.js';
2
2
  import { ImageAsset } from './ImageAsset.js';
3
+ import { PricingProviders } from './PricingProviders.js';
3
4
  import { ResourceLink } from './ResourceLink.js';
4
5
 
5
6
  type Erc20Contract = {
@@ -13,7 +14,6 @@ type Erc20Contract = {
13
14
  logoAsset?: ImageAsset;
14
15
  bannerAsset?: ImageAsset;
15
16
  color?: string;
16
- coingeckoCoinId?: string;
17
17
  resourceLinks?: Array<ResourceLink>;
18
18
  tags?: Array<string>;
19
19
  /**
@@ -30,6 +30,7 @@ type Erc20Contract = {
30
30
  * The number of decimals the token uses. For example `6`, means to divide the token amount by `1000000` to get its user representation.
31
31
  */
32
32
  decimals: number;
33
+ pricingProviders: PricingProviders;
33
34
  };
34
35
  declare namespace Erc20Contract {
35
36
  enum ercType {
@@ -13,7 +13,6 @@ type Erc721Contract = {
13
13
  logoAsset?: ImageAsset;
14
14
  bannerAsset?: ImageAsset;
15
15
  color?: string;
16
- coingeckoCoinId?: string;
17
16
  resourceLinks?: Array<ResourceLink>;
18
17
  tags?: Array<string>;
19
18
  /**
@@ -0,0 +1,5 @@
1
+ type PricingProviders = {
2
+ coingeckoCoinId?: string;
3
+ };
4
+
5
+ export { PricingProviders };
@@ -13,7 +13,6 @@ type UnknownContract = {
13
13
  logoAsset?: ImageAsset;
14
14
  bannerAsset?: ImageAsset;
15
15
  color?: string;
16
- coingeckoCoinId?: string;
17
16
  resourceLinks?: Array<ResourceLink>;
18
17
  tags?: Array<string>;
19
18
  /**
@@ -0,0 +1,69 @@
1
+ import { Erc1155Contract } from '../models/Erc1155Contract.js';
2
+ import { Erc1155Token } from '../models/Erc1155Token.js';
3
+ import { Erc721Contract } from '../models/Erc721Contract.js';
4
+ import { Erc721Token } from '../models/Erc721Token.js';
5
+ import { CancelablePromise } from '../core/CancelablePromise.js';
6
+ import { BaseHttpRequest } from '../core/BaseHttpRequest.js';
7
+
8
+ declare class NfTsService {
9
+ readonly httpRequest: BaseHttpRequest;
10
+ constructor(httpRequest: BaseHttpRequest);
11
+ /**
12
+ * Reindex NFT metadata
13
+ * Triggers reindexing of token metadata for an NFT token. Reindexing can only be called once per hour for each NFT token.
14
+ * @returns any
15
+ * @throws ApiError
16
+ */
17
+ reindexNft({ chainId, address, tokenId, }: {
18
+ /**
19
+ * A supported evm chain id. Use the `/chains` endpoint to get a list of supported chain ids.
20
+ */
21
+ chainId: string;
22
+ /**
23
+ * Contract address on the relevant chain.
24
+ */
25
+ address: string;
26
+ /**
27
+ * TokenId on the contract
28
+ */
29
+ tokenId: string;
30
+ }): CancelablePromise<any>;
31
+ /**
32
+ * Get token details
33
+ * Gets token details for a specific token of an NFT contract.
34
+ * @returns any
35
+ * @throws ApiError
36
+ */
37
+ getTokenDetails({ chainId, address, tokenId, }: {
38
+ /**
39
+ * A supported evm chain id. Use the `/chains` endpoint to get a list of supported chain ids.
40
+ */
41
+ chainId: string;
42
+ /**
43
+ * Contract address on the relevant chain.
44
+ */
45
+ address: string;
46
+ /**
47
+ * TokenId on the contract
48
+ */
49
+ tokenId: string;
50
+ }): CancelablePromise<(Erc721Token | Erc1155Token)>;
51
+ /**
52
+ * Get collection details
53
+ * Gets collection details for a NFT contract.
54
+ * @returns any
55
+ * @throws ApiError
56
+ */
57
+ getCollection({ chainId, address, }: {
58
+ /**
59
+ * A supported evm chain id. Use the `/chains` endpoint to get a list of supported chain ids.
60
+ */
61
+ chainId: string;
62
+ /**
63
+ * Contract address on the relevant chain.
64
+ */
65
+ address: string;
66
+ }): CancelablePromise<(Erc721Contract | Erc1155Contract)>;
67
+ }
68
+
69
+ export { NfTsService };
@@ -0,0 +1,50 @@
1
+ class NfTsService {
2
+ constructor(httpRequest) {
3
+ this.httpRequest = httpRequest;
4
+ }
5
+ reindexNft({
6
+ chainId,
7
+ address,
8
+ tokenId
9
+ }) {
10
+ return this.httpRequest.request({
11
+ method: "POST",
12
+ url: "/v1/chains/{chainId}/nfts/collections/{address}/tokens/{tokenId}:reindex",
13
+ path: {
14
+ "chainId": chainId,
15
+ "address": address,
16
+ "tokenId": tokenId
17
+ }
18
+ });
19
+ }
20
+ getTokenDetails({
21
+ chainId,
22
+ address,
23
+ tokenId
24
+ }) {
25
+ return this.httpRequest.request({
26
+ method: "GET",
27
+ url: "/v1/chains/{chainId}/nfts/collections/{address}/tokens/{tokenId}",
28
+ path: {
29
+ "chainId": chainId,
30
+ "address": address,
31
+ "tokenId": tokenId
32
+ }
33
+ });
34
+ }
35
+ getCollection({
36
+ chainId,
37
+ address
38
+ }) {
39
+ return this.httpRequest.request({
40
+ method: "GET",
41
+ url: "/v1/chains/{chainId}/nfts/collections/{address}",
42
+ path: {
43
+ "chainId": chainId,
44
+ "address": address
45
+ }
46
+ });
47
+ }
48
+ }
49
+
50
+ export { NfTsService };
package/esm/index.d.ts CHANGED
@@ -112,6 +112,7 @@ export { PChainUtxo } from './generated/models/PChainUtxo.js';
112
112
  export { PendingDelegatorDetails } from './generated/models/PendingDelegatorDetails.js';
113
113
  export { PendingReward } from './generated/models/PendingReward.js';
114
114
  export { PendingValidatorDetails } from './generated/models/PendingValidatorDetails.js';
115
+ export { PricingProviders } from './generated/models/PricingProviders.js';
115
116
  export { PrimaryNetwork } from './generated/models/PrimaryNetwork.js';
116
117
  export { PrimaryNetworkBlock } from './generated/models/PrimaryNetworkBlock.js';
117
118
  export { PrimaryNetworkChainInfo } from './generated/models/PrimaryNetworkChainInfo.js';
@@ -153,6 +154,7 @@ export { EvmBlocksService } from './generated/services/EvmBlocksService.js';
153
154
  export { EvmChainsService } from './generated/services/EvmChainsService.js';
154
155
  export { EvmTransactionsService } from './generated/services/EvmTransactionsService.js';
155
156
  export { HealthCheckService } from './generated/services/HealthCheckService.js';
157
+ export { NfTsService } from './generated/services/NfTsService.js';
156
158
  export { OperationsService } from './generated/services/OperationsService.js';
157
159
  export { PrimaryNetworkService } from './generated/services/PrimaryNetworkService.js';
158
160
  export { PrimaryNetworkBalancesService } from './generated/services/PrimaryNetworkBalancesService.js';
package/esm/index.js CHANGED
@@ -50,6 +50,7 @@ export { EvmBlocksService } from './generated/services/EvmBlocksService.js';
50
50
  export { EvmChainsService } from './generated/services/EvmChainsService.js';
51
51
  export { EvmTransactionsService } from './generated/services/EvmTransactionsService.js';
52
52
  export { HealthCheckService } from './generated/services/HealthCheckService.js';
53
+ export { NfTsService } from './generated/services/NfTsService.js';
53
54
  export { OperationsService } from './generated/services/OperationsService.js';
54
55
  export { PrimaryNetworkService } from './generated/services/PrimaryNetworkService.js';
55
56
  export { PrimaryNetworkBalancesService } from './generated/services/PrimaryNetworkBalancesService.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avalabs/glacier-sdk",
3
- "version": "2.8.0-canary.6c3da76.0+6c3da76",
3
+ "version": "2.8.0-canary.80115cd.0+80115cd",
4
4
  "description": "sdk for interacting with glacier-api",
5
5
  "author": "Oliver Wang <oliver.wang@avalabs.org>",
6
6
  "homepage": "https://github.com/ava-labs/avalanche-sdks#readme",
@@ -29,5 +29,5 @@
29
29
  "bugs": {
30
30
  "url": "https://github.com/ava-labs/avalanche-sdks/issues"
31
31
  },
32
- "gitHead": "6c3da7685b2f3ba4969f32e67dc3f7e5517ddbb3"
32
+ "gitHead": "80115cd3f91a58ad08a057f21a3c659d9284d352"
33
33
  }