@avalabs/glacier-sdk 2.8.0-canary.f701e46.0 → 2.8.0-canary.fb3cd8c.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
@@ -40,11 +40,11 @@ type OpenAPIConfig = {
40
40
  VERSION: string;
41
41
  WITH_CREDENTIALS: boolean;
42
42
  CREDENTIALS: 'include' | 'omit' | 'same-origin';
43
- TOKEN?: string | Resolver<string> | undefined;
44
- USERNAME?: string | Resolver<string> | undefined;
45
- PASSWORD?: string | Resolver<string> | undefined;
46
- HEADERS?: Headers | Resolver<Headers> | undefined;
47
- ENCODE_PATH?: ((path: string) => string) | undefined;
43
+ TOKEN?: string | Resolver<string>;
44
+ USERNAME?: string | Resolver<string>;
45
+ PASSWORD?: string | Resolver<string>;
46
+ HEADERS?: Headers | Resolver<Headers>;
47
+ ENCODE_PATH?: (path: string) => string;
48
48
  };
49
49
  declare const OpenAPI: OpenAPIConfig;
50
50
 
@@ -682,11 +682,12 @@ type GetChainResponse = {
682
682
  networkToken: NetworkToken;
683
683
  chainLogoUri?: string;
684
684
  private?: boolean;
685
- enabledFeatures?: Array<'nftIndexing'>;
685
+ enabledFeatures?: Array<'nftIndexing' | 'webhooks'>;
686
686
  };
687
687
 
688
688
  declare enum GlacierApiFeature {
689
- NFT_INDEXING = "nftIndexing"
689
+ NFT_INDEXING = "nftIndexing",
690
+ WEBHOOKS = "webhooks"
690
691
  }
691
692
 
692
693
  type ChainInfo = {
@@ -706,7 +707,7 @@ type ChainInfo = {
706
707
  networkToken: NetworkToken;
707
708
  chainLogoUri?: string;
708
709
  private?: boolean;
709
- enabledFeatures?: Array<'nftIndexing'>;
710
+ enabledFeatures?: Array<'nftIndexing' | 'webhooks'>;
710
711
  };
711
712
 
712
713
  type ListChainsResponse = {
@@ -4243,13 +4244,6 @@ declare namespace DeliveredTeleporterMessage {
4243
4244
  }
4244
4245
  }
4245
4246
 
4246
- type NextPageToken = {
4247
- /**
4248
- * A token, which can be sent as `pageToken` to retrieve the next page. If this field is omitted or empty, there are no subsequent pages.
4249
- */
4250
- nextPageToken?: string;
4251
- };
4252
-
4253
4247
  type PendingTeleporterMessage = {
4254
4248
  messageId: string;
4255
4249
  teleporterContractAddress: string;
@@ -4272,6 +4266,14 @@ declare namespace PendingTeleporterMessage {
4272
4266
  }
4273
4267
  }
4274
4268
 
4269
+ type ListTeleporterMessagesResponse = {
4270
+ /**
4271
+ * A token, which can be sent as `pageToken` to retrieve the next page. If this field is omitted or empty, there are no subsequent pages.
4272
+ */
4273
+ nextPageToken?: string;
4274
+ messages: Array<(PendingTeleporterMessage | DeliveredTeleporterMessage)>;
4275
+ };
4276
+
4275
4277
  declare class TeleporterService {
4276
4278
  readonly httpRequest: BaseHttpRequest;
4277
4279
  constructor(httpRequest: BaseHttpRequest);
@@ -4290,7 +4292,7 @@ declare class TeleporterService {
4290
4292
  /**
4291
4293
  * List teleporter messages
4292
4294
  * Lists teleporter messages. Ordered by timestamp in descending order.
4293
- * @returns any
4295
+ * @returns ListTeleporterMessagesResponse
4294
4296
  * @throws ApiError
4295
4297
  */
4296
4298
  listTeleporterMessages({ pageToken, pageSize, sourceBlockchainId, destinationBlockchainId, to, from, }: {
@@ -4318,14 +4320,21 @@ declare class TeleporterService {
4318
4320
  * The address of the sender of the teleporter message.
4319
4321
  */
4320
4322
  from?: string;
4321
- }): CancelablePromise<NextPageToken>;
4323
+ }): CancelablePromise<ListTeleporterMessagesResponse>;
4322
4324
  }
4323
4325
 
4326
+ type AddressesChangeRequest = {
4327
+ /**
4328
+ * Ethereum address(es) for the address_activity event type
4329
+ */
4330
+ addresses: Array<any[]>;
4331
+ };
4332
+
4324
4333
  type AddressActivityMetadata = {
4325
4334
  /**
4326
- * Ethereum address for the address_activity event type
4335
+ * Ethereum address(es) for the address_activity event type
4327
4336
  */
4328
- address: string;
4337
+ addresses: Array<any[]>;
4329
4338
  /**
4330
4339
  * Array of hexadecimal strings of the event signatures.
4331
4340
  */
@@ -4406,8 +4415,8 @@ declare class WebhooksService {
4406
4415
  readonly httpRequest: BaseHttpRequest;
4407
4416
  constructor(httpRequest: BaseHttpRequest);
4408
4417
  /**
4409
- * Register a webhook
4410
- * Registers a new webhook.
4418
+ * Create a webhook
4419
+ * Create a new webhook.
4411
4420
  * @returns WebhookResponse
4412
4421
  * @throws ApiError
4413
4422
  */
@@ -4485,6 +4494,32 @@ declare class WebhooksService {
4485
4494
  * @throws ApiError
4486
4495
  */
4487
4496
  getSharedSecret(): CancelablePromise<SharedSecretsResponse>;
4497
+ /**
4498
+ * Add address(es) to a webhook
4499
+ * Adding address(es) to a given webhook.
4500
+ * @returns WebhookResponse
4501
+ * @throws ApiError
4502
+ */
4503
+ addAddressesToWebhook({ id, requestBody, }: {
4504
+ /**
4505
+ * The webhook identifier.
4506
+ */
4507
+ id: string;
4508
+ requestBody: AddressesChangeRequest;
4509
+ }): CancelablePromise<WebhookResponse>;
4510
+ /**
4511
+ * Remove address(es) from a webhook
4512
+ * Removing address(es) from a given webhook.
4513
+ * @returns WebhookResponse
4514
+ * @throws ApiError
4515
+ */
4516
+ removeAddressesFromWebhook({ id, requestBody, }: {
4517
+ /**
4518
+ * The webhook identifier.
4519
+ */
4520
+ id: string;
4521
+ requestBody: AddressesChangeRequest;
4522
+ }): CancelablePromise<WebhookResponse>;
4488
4523
  }
4489
4524
 
4490
4525
  type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
@@ -4529,4 +4564,11 @@ declare class ApiError extends Error {
4529
4564
  constructor(request: ApiRequestOptions, response: ApiResult, message: string);
4530
4565
  }
4531
4566
 
4532
- export { ActiveDelegatorDetails, ActiveValidatorDetails, AddressActivityMetadata, AggregatedAssetAmount, ApiError, AssetAmount, AssetWithPriceInfo, BaseHttpRequest, Blockchain, BlockchainId, BlockchainIds, BlockchainInfo, CChainAtomicBalances, CChainExportTransaction, CChainImportTransaction, CChainSharedAssetBalance, CancelError, CancelablePromise, ChainAddressChainIdMap, ChainAddressChainIdMapListResponse, ChainInfo, ChainStatus, CompletedDelegatorDetails, CompletedValidatorDetails, ContractDeploymentDetails, ContractSubmissionBody, ContractSubmissionErc1155, ContractSubmissionErc20, ContractSubmissionErc721, ContractSubmissionUnknown, CreateEvmTransactionExportRequest, CreatePrimaryNetworkTransactionExportRequest, CurrencyCode, DefaultService, DelegationStatusType, DelegatorsDetails, DeliveredSourceNotIndexedTeleporterMessage, DeliveredTeleporterMessage, EVMInput, EVMOperationType, EVMOutput, Erc1155Contract, Erc1155Token, Erc1155TokenBalance, Erc1155TokenMetadata, Erc1155Transfer, Erc1155TransferDetails, Erc20Contract, Erc20Token, Erc20TokenBalance, Erc20Transfer, Erc20TransferDetails, Erc721Contract, Erc721Token, Erc721TokenBalance, Erc721TokenMetadata, Erc721Transfer, Erc721TransferDetails, EventType, EvmBalancesService, EvmBlock, EvmBlocksService, EvmChainsService, EvmContractsService, EvmNetworkOptions, EvmTransactionsService, FullNativeTransactionDetails, GetChainResponse, GetEvmBlockResponse, GetNativeBalanceResponse, GetNetworkDetailsResponse, GetPrimaryNetworkBlockResponse, GetTransactionResponse, Glacier, GlacierApiFeature, HealthCheckService, HistoricalReward, ImageAsset, InternalTransaction, InternalTransactionDetails, InternalTransactionOpCall, ListBlockchainsResponse, ListCChainAtomicBalancesResponse, ListCChainAtomicTransactionsResponse, ListChainsResponse, ListCollectibleBalancesResponse, ListContractsResponse, ListDelegatorDetailsResponse, ListErc1155BalancesResponse, ListErc1155TransactionsResponse, ListErc20BalancesResponse, ListErc20TransactionsResponse, ListErc721BalancesResponse, ListErc721TransactionsResponse, ListEvmBlocksResponse, ListHistoricalRewardsResponse, ListInternalTransactionsResponse, ListNativeTransactionsResponse, ListNftTokens, ListPChainBalancesResponse, ListPChainTransactionsResponse, ListPChainUtxosResponse, ListPendingRewardsResponse, ListPrimaryNetworkBlocksResponse, ListSubnetsResponse, ListTransactionDetailsResponse, ListTransfersResponse, ListUtxosResponse, ListValidatorDetailsResponse, ListWebhooksResponse, ListXChainBalancesResponse, ListXChainTransactionsResponse, ListXChainVerticesResponse, Method, Money, NativeTokenBalance, NativeTransaction, Network, NetworkToken, NetworkTokenDetails, NetworkType, NextPageToken, NfTsService, NftTokenMetadataStatus, OpenAPI, OpenAPIConfig, OperationStatus, OperationStatusCode, OperationStatusResponse, OperationType, OperationsService, PChainBalance, PChainId, PChainSharedAsset, PChainTransaction, PChainTransactionType, PChainUtxo, PendingDelegatorDetails, PendingReward, PendingTeleporterMessage, PendingValidatorDetails, PricingProviders, PrimaryNetwork, PrimaryNetworkAssetCap, PrimaryNetworkAssetType, PrimaryNetworkBalancesService, PrimaryNetworkBlock, PrimaryNetworkBlocksService, PrimaryNetworkChainInfo, PrimaryNetworkChainName, PrimaryNetworkOperationType, PrimaryNetworkOptions, PrimaryNetworkRewardsService, PrimaryNetworkService, PrimaryNetworkTransactionsService, PrimaryNetworkTxType, PrimaryNetworkUtxOsService, PrimaryNetworkVerticesService, ProposerDetails, RegisterWebhookRequest, RemovedValidatorDetails, ResourceLink, ResourceLinkType, RewardType, Rewards, RichAddress, RpcErrorDto, RpcErrorResponseDto, RpcRequestBodyDto, RpcService, RpcSuccessResponseDto, SharedSecretsResponse, SortOrder, StakingDistribution, Subnet, SubnetOwnershipInfo, TeleporterDestinationTransaction, TeleporterReceipt, TeleporterRewardDetails, TeleporterService, TeleporterSourceTransaction, TransactionDetails, TransactionExportMetadata, TransactionMethodType, TransactionStatus, TransactionVertexDetail, UnknownContract, UpdateContractResponse, UpdateWebhookRequest, UtilityAddresses, Utxo, UtxoCredential, UtxoType, ValidationStatusType, ValidatorHealthDetails, ValidatorsDetails, VmName, WebhookResponse, WebhookStatus, WebhookStatusType, WebhooksService, XChainAssetDetails, XChainBalances, XChainId, XChainLinearTransaction, XChainNonLinearTransaction, XChainSharedAssetBalance, XChainTransactionType, XChainVertex };
4567
+ type NextPageToken = {
4568
+ /**
4569
+ * A token, which can be sent as `pageToken` to retrieve the next page. If this field is omitted or empty, there are no subsequent pages.
4570
+ */
4571
+ nextPageToken?: string;
4572
+ };
4573
+
4574
+ export { ActiveDelegatorDetails, ActiveValidatorDetails, AddressActivityMetadata, AddressesChangeRequest, AggregatedAssetAmount, ApiError, AssetAmount, AssetWithPriceInfo, BaseHttpRequest, Blockchain, BlockchainId, BlockchainIds, BlockchainInfo, CChainAtomicBalances, CChainExportTransaction, CChainImportTransaction, CChainSharedAssetBalance, CancelError, CancelablePromise, ChainAddressChainIdMap, ChainAddressChainIdMapListResponse, ChainInfo, ChainStatus, CompletedDelegatorDetails, CompletedValidatorDetails, ContractDeploymentDetails, ContractSubmissionBody, ContractSubmissionErc1155, ContractSubmissionErc20, ContractSubmissionErc721, ContractSubmissionUnknown, CreateEvmTransactionExportRequest, CreatePrimaryNetworkTransactionExportRequest, CurrencyCode, DefaultService, DelegationStatusType, DelegatorsDetails, DeliveredSourceNotIndexedTeleporterMessage, DeliveredTeleporterMessage, EVMInput, EVMOperationType, EVMOutput, Erc1155Contract, Erc1155Token, Erc1155TokenBalance, Erc1155TokenMetadata, Erc1155Transfer, Erc1155TransferDetails, Erc20Contract, Erc20Token, Erc20TokenBalance, Erc20Transfer, Erc20TransferDetails, Erc721Contract, Erc721Token, Erc721TokenBalance, Erc721TokenMetadata, Erc721Transfer, Erc721TransferDetails, EventType, EvmBalancesService, EvmBlock, EvmBlocksService, EvmChainsService, EvmContractsService, EvmNetworkOptions, EvmTransactionsService, FullNativeTransactionDetails, GetChainResponse, GetEvmBlockResponse, GetNativeBalanceResponse, GetNetworkDetailsResponse, GetPrimaryNetworkBlockResponse, GetTransactionResponse, Glacier, GlacierApiFeature, HealthCheckService, HistoricalReward, ImageAsset, InternalTransaction, InternalTransactionDetails, InternalTransactionOpCall, ListBlockchainsResponse, ListCChainAtomicBalancesResponse, ListCChainAtomicTransactionsResponse, ListChainsResponse, ListCollectibleBalancesResponse, ListContractsResponse, ListDelegatorDetailsResponse, ListErc1155BalancesResponse, ListErc1155TransactionsResponse, ListErc20BalancesResponse, ListErc20TransactionsResponse, ListErc721BalancesResponse, ListErc721TransactionsResponse, ListEvmBlocksResponse, ListHistoricalRewardsResponse, ListInternalTransactionsResponse, ListNativeTransactionsResponse, ListNftTokens, ListPChainBalancesResponse, ListPChainTransactionsResponse, ListPChainUtxosResponse, ListPendingRewardsResponse, ListPrimaryNetworkBlocksResponse, ListSubnetsResponse, ListTeleporterMessagesResponse, ListTransactionDetailsResponse, ListTransfersResponse, ListUtxosResponse, ListValidatorDetailsResponse, ListWebhooksResponse, ListXChainBalancesResponse, ListXChainTransactionsResponse, ListXChainVerticesResponse, Method, Money, NativeTokenBalance, NativeTransaction, Network, NetworkToken, NetworkTokenDetails, NetworkType, NextPageToken, NfTsService, NftTokenMetadataStatus, OpenAPI, OpenAPIConfig, OperationStatus, OperationStatusCode, OperationStatusResponse, OperationType, OperationsService, PChainBalance, PChainId, PChainSharedAsset, PChainTransaction, PChainTransactionType, PChainUtxo, PendingDelegatorDetails, PendingReward, PendingTeleporterMessage, PendingValidatorDetails, PricingProviders, PrimaryNetwork, PrimaryNetworkAssetCap, PrimaryNetworkAssetType, PrimaryNetworkBalancesService, PrimaryNetworkBlock, PrimaryNetworkBlocksService, PrimaryNetworkChainInfo, PrimaryNetworkChainName, PrimaryNetworkOperationType, PrimaryNetworkOptions, PrimaryNetworkRewardsService, PrimaryNetworkService, PrimaryNetworkTransactionsService, PrimaryNetworkTxType, PrimaryNetworkUtxOsService, PrimaryNetworkVerticesService, ProposerDetails, RegisterWebhookRequest, RemovedValidatorDetails, ResourceLink, ResourceLinkType, RewardType, Rewards, RichAddress, RpcErrorDto, RpcErrorResponseDto, RpcRequestBodyDto, RpcService, RpcSuccessResponseDto, SharedSecretsResponse, SortOrder, StakingDistribution, Subnet, SubnetOwnershipInfo, TeleporterDestinationTransaction, TeleporterReceipt, TeleporterRewardDetails, TeleporterService, TeleporterSourceTransaction, TransactionDetails, TransactionExportMetadata, TransactionMethodType, TransactionStatus, TransactionVertexDetail, UnknownContract, UpdateContractResponse, UpdateWebhookRequest, UtilityAddresses, Utxo, UtxoCredential, UtxoType, ValidationStatusType, ValidatorHealthDetails, ValidatorsDetails, VmName, WebhookResponse, WebhookStatus, WebhookStatusType, WebhooksService, XChainAssetDetails, XChainBalances, XChainId, XChainLinearTransaction, XChainNonLinearTransaction, XChainSharedAssetBalance, XChainTransactionType, XChainVertex };
package/dist/index.js CHANGED
@@ -53,16 +53,14 @@ class CancelablePromise {
53
53
  return;
54
54
  }
55
55
  this.#isResolved = true;
56
- if (this.#resolve)
57
- this.#resolve(value);
56
+ this.#resolve?.(value);
58
57
  };
59
58
  const onReject = (reason) => {
60
59
  if (this.#isResolved || this.#isRejected || this.#isCancelled) {
61
60
  return;
62
61
  }
63
62
  this.#isRejected = true;
64
- if (this.#reject)
65
- this.#reject(reason);
63
+ this.#reject?.(reason);
66
64
  };
67
65
  const onCancel = (cancelHandler) => {
68
66
  if (this.#isResolved || this.#isRejected || this.#isCancelled) {
@@ -110,8 +108,7 @@ class CancelablePromise {
110
108
  }
111
109
  }
112
110
  this.#cancelHandlers.length = 0;
113
- if (this.#reject)
114
- this.#reject(new CancelError("Request aborted"));
111
+ this.#reject?.(new CancelError("Request aborted"));
115
112
  }
116
113
  get isCancelled() {
117
114
  return this.#isCancelled;
@@ -210,12 +207,10 @@ const resolve = async (options, resolver) => {
210
207
  return resolver;
211
208
  };
212
209
  const getHeaders = async (config, options) => {
213
- const [token, username, password, additionalHeaders] = await Promise.all([
214
- resolve(options, config.TOKEN),
215
- resolve(options, config.USERNAME),
216
- resolve(options, config.PASSWORD),
217
- resolve(options, config.HEADERS)
218
- ]);
210
+ const token = await resolve(options, config.TOKEN);
211
+ const username = await resolve(options, config.USERNAME);
212
+ const password = await resolve(options, config.PASSWORD);
213
+ const additionalHeaders = await resolve(options, config.HEADERS);
219
214
  const headers = Object.entries({
220
215
  Accept: "application/json",
221
216
  ...additionalHeaders,
@@ -231,7 +226,7 @@ const getHeaders = async (config, options) => {
231
226
  const credentials = base64(`${username}:${password}`);
232
227
  headers["Authorization"] = `Basic ${credentials}`;
233
228
  }
234
- if (options.body !== void 0) {
229
+ if (options.body) {
235
230
  if (options.mediaType) {
236
231
  headers["Content-Type"] = options.mediaType;
237
232
  } else if (isBlob(options.body)) {
@@ -314,20 +309,7 @@ const catchErrorCodes = (options, result) => {
314
309
  throw new ApiError(options, result, error);
315
310
  }
316
311
  if (!result.ok) {
317
- const errorStatus = result.status ?? "unknown";
318
- const errorStatusText = result.statusText ?? "unknown";
319
- const errorBody = (() => {
320
- try {
321
- return JSON.stringify(result.body, null, 2);
322
- } catch (e) {
323
- return void 0;
324
- }
325
- })();
326
- throw new ApiError(
327
- options,
328
- result,
329
- `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`
330
- );
312
+ throw new ApiError(options, result, "Generic Error");
331
313
  }
332
314
  };
333
315
  const request = (config, options) => {
@@ -1591,6 +1573,34 @@ class WebhooksService {
1591
1573
  url: "/v1/webhooks:getSharedSecret"
1592
1574
  });
1593
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
+ }
1594
1604
  }
1595
1605
 
1596
1606
  class Glacier {
@@ -1871,6 +1881,7 @@ var EVMOperationType = /* @__PURE__ */ ((EVMOperationType2) => {
1871
1881
 
1872
1882
  var GlacierApiFeature = /* @__PURE__ */ ((GlacierApiFeature2) => {
1873
1883
  GlacierApiFeature2["NFT_INDEXING"] = "nftIndexing";
1884
+ GlacierApiFeature2["WEBHOOKS"] = "webhooks";
1874
1885
  return GlacierApiFeature2;
1875
1886
  })(GlacierApiFeature || {});
1876
1887
 
@@ -28,16 +28,14 @@ class CancelablePromise {
28
28
  return;
29
29
  }
30
30
  this.#isResolved = true;
31
- if (this.#resolve)
32
- this.#resolve(value);
31
+ this.#resolve?.(value);
33
32
  };
34
33
  const onReject = (reason) => {
35
34
  if (this.#isResolved || this.#isRejected || this.#isCancelled) {
36
35
  return;
37
36
  }
38
37
  this.#isRejected = true;
39
- if (this.#reject)
40
- this.#reject(reason);
38
+ this.#reject?.(reason);
41
39
  };
42
40
  const onCancel = (cancelHandler) => {
43
41
  if (this.#isResolved || this.#isRejected || this.#isCancelled) {
@@ -85,8 +83,7 @@ class CancelablePromise {
85
83
  }
86
84
  }
87
85
  this.#cancelHandlers.length = 0;
88
- if (this.#reject)
89
- this.#reject(new CancelError("Request aborted"));
86
+ this.#reject?.(new CancelError("Request aborted"));
90
87
  }
91
88
  get isCancelled() {
92
89
  return this.#isCancelled;
@@ -7,11 +7,11 @@ type OpenAPIConfig = {
7
7
  VERSION: string;
8
8
  WITH_CREDENTIALS: boolean;
9
9
  CREDENTIALS: 'include' | 'omit' | 'same-origin';
10
- TOKEN?: string | Resolver<string> | undefined;
11
- USERNAME?: string | Resolver<string> | undefined;
12
- PASSWORD?: string | Resolver<string> | undefined;
13
- HEADERS?: Headers | Resolver<Headers> | undefined;
14
- ENCODE_PATH?: ((path: string) => string) | undefined;
10
+ TOKEN?: string | Resolver<string>;
11
+ USERNAME?: string | Resolver<string>;
12
+ PASSWORD?: string | Resolver<string>;
13
+ HEADERS?: Headers | Resolver<Headers>;
14
+ ENCODE_PATH?: (path: string) => string;
15
15
  };
16
16
  declare const OpenAPI: OpenAPIConfig;
17
17
 
@@ -93,12 +93,10 @@ const resolve = async (options, resolver) => {
93
93
  return resolver;
94
94
  };
95
95
  const getHeaders = async (config, options) => {
96
- const [token, username, password, additionalHeaders] = await Promise.all([
97
- resolve(options, config.TOKEN),
98
- resolve(options, config.USERNAME),
99
- resolve(options, config.PASSWORD),
100
- resolve(options, config.HEADERS)
101
- ]);
96
+ const token = await resolve(options, config.TOKEN);
97
+ const username = await resolve(options, config.USERNAME);
98
+ const password = await resolve(options, config.PASSWORD);
99
+ const additionalHeaders = await resolve(options, config.HEADERS);
102
100
  const headers = Object.entries({
103
101
  Accept: "application/json",
104
102
  ...additionalHeaders,
@@ -114,7 +112,7 @@ const getHeaders = async (config, options) => {
114
112
  const credentials = base64(`${username}:${password}`);
115
113
  headers["Authorization"] = `Basic ${credentials}`;
116
114
  }
117
- if (options.body !== void 0) {
115
+ if (options.body) {
118
116
  if (options.mediaType) {
119
117
  headers["Content-Type"] = options.mediaType;
120
118
  } else if (isBlob(options.body)) {
@@ -197,20 +195,7 @@ const catchErrorCodes = (options, result) => {
197
195
  throw new ApiError(options, result, error);
198
196
  }
199
197
  if (!result.ok) {
200
- const errorStatus = result.status ?? "unknown";
201
- const errorStatusText = result.statusText ?? "unknown";
202
- const errorBody = (() => {
203
- try {
204
- return JSON.stringify(result.body, null, 2);
205
- } catch (e) {
206
- return void 0;
207
- }
208
- })();
209
- throw new ApiError(
210
- options,
211
- result,
212
- `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`
213
- );
198
+ throw new ApiError(options, result, "Generic Error");
214
199
  }
215
200
  };
216
201
  const request = (config, options) => {
@@ -240,4 +225,4 @@ const request = (config, options) => {
240
225
  });
241
226
  };
242
227
 
243
- export { base64, catchErrorCodes, getFormData, getHeaders, getQueryString, getRequestBody, getResponseBody, getResponseHeader, isBlob, isDefined, isFormData, isString, isStringWithValue, request, resolve, sendRequest };
228
+ export { request, sendRequest };
@@ -1,8 +1,8 @@
1
1
  type AddressActivityMetadata = {
2
2
  /**
3
- * Ethereum address for the address_activity event type
3
+ * Ethereum address(es) for the address_activity event type
4
4
  */
5
- address: string;
5
+ addresses: Array<any[]>;
6
6
  /**
7
7
  * Array of hexadecimal strings of the event signatures.
8
8
  */
@@ -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,7 +20,7 @@ type ChainInfo = {
20
20
  networkToken: NetworkToken;
21
21
  chainLogoUri?: string;
22
22
  private?: boolean;
23
- enabledFeatures?: Array<'nftIndexing'>;
23
+ enabledFeatures?: Array<'nftIndexing' | 'webhooks'>;
24
24
  };
25
25
 
26
26
  export { ChainInfo };
@@ -20,7 +20,7 @@ type GetChainResponse = {
20
20
  networkToken: NetworkToken;
21
21
  chainLogoUri?: string;
22
22
  private?: boolean;
23
- enabledFeatures?: Array<'nftIndexing'>;
23
+ enabledFeatures?: Array<'nftIndexing' | 'webhooks'>;
24
24
  };
25
25
 
26
26
  export { GetChainResponse };
@@ -1,5 +1,6 @@
1
1
  declare enum GlacierApiFeature {
2
- NFT_INDEXING = "nftIndexing"
2
+ NFT_INDEXING = "nftIndexing",
3
+ WEBHOOKS = "webhooks"
3
4
  }
4
5
 
5
6
  export { GlacierApiFeature };
@@ -1,5 +1,6 @@
1
1
  var GlacierApiFeature = /* @__PURE__ */ ((GlacierApiFeature2) => {
2
2
  GlacierApiFeature2["NFT_INDEXING"] = "nftIndexing";
3
+ GlacierApiFeature2["WEBHOOKS"] = "webhooks";
3
4
  return GlacierApiFeature2;
4
5
  })(GlacierApiFeature || {});
5
6
 
@@ -0,0 +1,12 @@
1
+ import { DeliveredTeleporterMessage } from './DeliveredTeleporterMessage.js';
2
+ import { PendingTeleporterMessage } from './PendingTeleporterMessage.js';
3
+
4
+ type ListTeleporterMessagesResponse = {
5
+ /**
6
+ * A token, which can be sent as `pageToken` to retrieve the next page. If this field is omitted or empty, there are no subsequent pages.
7
+ */
8
+ nextPageToken?: string;
9
+ messages: Array<(PendingTeleporterMessage | DeliveredTeleporterMessage)>;
10
+ };
11
+
12
+ export { ListTeleporterMessagesResponse };
@@ -1,6 +1,6 @@
1
1
  import { DeliveredSourceNotIndexedTeleporterMessage } from '../models/DeliveredSourceNotIndexedTeleporterMessage.js';
2
2
  import { DeliveredTeleporterMessage } from '../models/DeliveredTeleporterMessage.js';
3
- import { NextPageToken } from '../models/NextPageToken.js';
3
+ import { ListTeleporterMessagesResponse } from '../models/ListTeleporterMessagesResponse.js';
4
4
  import { PendingTeleporterMessage } from '../models/PendingTeleporterMessage.js';
5
5
  import { CancelablePromise } from '../core/CancelablePromise.js';
6
6
  import { BaseHttpRequest } from '../core/BaseHttpRequest.js';
@@ -23,7 +23,7 @@ declare class TeleporterService {
23
23
  /**
24
24
  * List teleporter messages
25
25
  * Lists teleporter messages. Ordered by timestamp in descending order.
26
- * @returns any
26
+ * @returns ListTeleporterMessagesResponse
27
27
  * @throws ApiError
28
28
  */
29
29
  listTeleporterMessages({ pageToken, pageSize, sourceBlockchainId, destinationBlockchainId, to, from, }: {
@@ -51,7 +51,7 @@ declare class TeleporterService {
51
51
  * The address of the sender of the teleporter message.
52
52
  */
53
53
  from?: string;
54
- }): CancelablePromise<NextPageToken>;
54
+ }): CancelablePromise<ListTeleporterMessagesResponse>;
55
55
  }
56
56
 
57
57
  export { TeleporterService };
@@ -1,3 +1,4 @@
1
+ import { AddressesChangeRequest } from '../models/AddressesChangeRequest.js';
1
2
  import { ListWebhooksResponse } from '../models/ListWebhooksResponse.js';
2
3
  import { RegisterWebhookRequest } from '../models/RegisterWebhookRequest.js';
3
4
  import { SharedSecretsResponse } from '../models/SharedSecretsResponse.js';
@@ -11,8 +12,8 @@ declare class WebhooksService {
11
12
  readonly httpRequest: BaseHttpRequest;
12
13
  constructor(httpRequest: BaseHttpRequest);
13
14
  /**
14
- * Register a webhook
15
- * Registers a new webhook.
15
+ * Create a webhook
16
+ * Create a new webhook.
16
17
  * @returns WebhookResponse
17
18
  * @throws ApiError
18
19
  */
@@ -90,6 +91,32 @@ declare class WebhooksService {
90
91
  * @throws ApiError
91
92
  */
92
93
  getSharedSecret(): CancelablePromise<SharedSecretsResponse>;
94
+ /**
95
+ * Add address(es) to a webhook
96
+ * Adding address(es) to a given webhook.
97
+ * @returns WebhookResponse
98
+ * @throws ApiError
99
+ */
100
+ addAddressesToWebhook({ id, requestBody, }: {
101
+ /**
102
+ * The webhook identifier.
103
+ */
104
+ id: string;
105
+ requestBody: AddressesChangeRequest;
106
+ }): CancelablePromise<WebhookResponse>;
107
+ /**
108
+ * Remove address(es) from a webhook
109
+ * Removing address(es) from a given webhook.
110
+ * @returns WebhookResponse
111
+ * @throws ApiError
112
+ */
113
+ removeAddressesFromWebhook({ id, requestBody, }: {
114
+ /**
115
+ * The webhook identifier.
116
+ */
117
+ id: string;
118
+ requestBody: AddressesChangeRequest;
119
+ }): CancelablePromise<WebhookResponse>;
93
120
  }
94
121
 
95
122
  export { WebhooksService };
@@ -75,6 +75,34 @@ class WebhooksService {
75
75
  url: "/v1/webhooks:getSharedSecret"
76
76
  });
77
77
  }
78
+ addAddressesToWebhook({
79
+ id,
80
+ requestBody
81
+ }) {
82
+ return this.httpRequest.request({
83
+ method: "PATCH",
84
+ url: "/v1/webhooks/{id}/addresses",
85
+ path: {
86
+ "id": id
87
+ },
88
+ body: requestBody,
89
+ mediaType: "application/json"
90
+ });
91
+ }
92
+ removeAddressesFromWebhook({
93
+ id,
94
+ requestBody
95
+ }) {
96
+ return this.httpRequest.request({
97
+ method: "DELETE",
98
+ url: "/v1/webhooks/{id}/addresses",
99
+ path: {
100
+ "id": id
101
+ },
102
+ body: requestBody,
103
+ mediaType: "application/json"
104
+ });
105
+ }
78
106
  }
79
107
 
80
108
  export { WebhooksService };
package/esm/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { OpenAPI, OpenAPIConfig } from './generated/core/OpenAPI.js';
6
6
  export { ActiveDelegatorDetails } from './generated/models/ActiveDelegatorDetails.js';
7
7
  export { ActiveValidatorDetails } from './generated/models/ActiveValidatorDetails.js';
8
8
  export { AddressActivityMetadata } from './generated/models/AddressActivityMetadata.js';
9
+ export { AddressesChangeRequest } from './generated/models/AddressesChangeRequest.js';
9
10
  export { AggregatedAssetAmount } from './generated/models/AggregatedAssetAmount.js';
10
11
  export { AssetAmount } from './generated/models/AssetAmount.js';
11
12
  export { AssetWithPriceInfo } from './generated/models/AssetWithPriceInfo.js';
@@ -96,6 +97,7 @@ export { ListPChainUtxosResponse } from './generated/models/ListPChainUtxosRespo
96
97
  export { ListPendingRewardsResponse } from './generated/models/ListPendingRewardsResponse.js';
97
98
  export { ListPrimaryNetworkBlocksResponse } from './generated/models/ListPrimaryNetworkBlocksResponse.js';
98
99
  export { ListSubnetsResponse } from './generated/models/ListSubnetsResponse.js';
100
+ export { ListTeleporterMessagesResponse } from './generated/models/ListTeleporterMessagesResponse.js';
99
101
  export { ListTransactionDetailsResponse } from './generated/models/ListTransactionDetailsResponse.js';
100
102
  export { ListTransfersResponse } from './generated/models/ListTransfersResponse.js';
101
103
  export { ListUtxosResponse } from './generated/models/ListUtxosResponse.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avalabs/glacier-sdk",
3
- "version": "2.8.0-canary.f701e46.0+f701e46",
3
+ "version": "2.8.0-canary.fb3cd8c.0+fb3cd8c",
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",
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "sideEffects": false,
16
16
  "devDependencies": {
17
- "openapi-typescript-codegen": "0.28.0"
17
+ "openapi-typescript-codegen": "0.24.0"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
@@ -29,5 +29,5 @@
29
29
  "bugs": {
30
30
  "url": "https://github.com/ava-labs/avalanche-sdks/issues"
31
31
  },
32
- "gitHead": "f701e466f229a57c74d5950f17ce557fd72362c0"
32
+ "gitHead": "fb3cd8ce18f3aea50a4a92ca18f3b0f41c172725"
33
33
  }