@avalabs/glacier-sdk 2.8.0-canary.f35ad12.0 → 2.8.0-canary.f3e3bdc.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 +1567 -683
- package/dist/index.js +665 -202
- package/esm/generated/Glacier.d.ts +10 -0
- package/esm/generated/Glacier.js +38 -10
- package/esm/generated/core/ApiError.js +5 -0
- package/esm/generated/core/CancelablePromise.d.ts +2 -8
- package/esm/generated/core/CancelablePromise.js +41 -31
- package/esm/generated/core/OpenAPI.d.ts +5 -5
- package/esm/generated/core/request.js +39 -40
- package/esm/generated/models/ActiveDelegatorDetails.d.ts +7 -3
- package/esm/generated/models/ActiveDelegatorDetails.js +8 -0
- package/esm/generated/models/ActiveValidatorDetails.d.ts +14 -6
- package/esm/generated/models/ActiveValidatorDetails.js +8 -0
- package/esm/generated/models/AddressActivityMetadata.d.ts +12 -0
- package/esm/generated/models/{XChainAssetBalance.d.ts → AggregatedAssetAmount.d.ts} +5 -6
- package/esm/generated/models/{Asset.d.ts → AssetAmount.d.ts} +5 -6
- package/esm/generated/models/AssetWithPriceInfo.d.ts +32 -0
- package/esm/generated/models/CChainExportTransaction.d.ts +3 -3
- package/esm/generated/models/CChainImportTransaction.d.ts +3 -3
- package/esm/generated/models/CChainSharedAssetBalance.d.ts +3 -4
- package/esm/generated/models/ChainInfo.d.ts +2 -3
- package/esm/generated/models/ChainStatus.d.ts +3 -0
- package/esm/generated/models/CompletedDelegatorDetails.d.ts +7 -3
- package/esm/generated/models/CompletedDelegatorDetails.js +8 -0
- package/esm/generated/models/CompletedValidatorDetails.d.ts +9 -3
- package/esm/generated/models/CompletedValidatorDetails.js +8 -0
- package/esm/generated/models/ContractSubmissionBody.d.ts +10 -0
- package/esm/generated/models/ContractSubmissionErc1155.d.ts +31 -0
- package/esm/generated/models/ContractSubmissionErc1155.js +8 -0
- package/esm/generated/models/ContractSubmissionErc20.d.ts +31 -0
- package/esm/generated/models/ContractSubmissionErc20.js +8 -0
- package/esm/generated/models/ContractSubmissionErc721.d.ts +29 -0
- package/esm/generated/models/ContractSubmissionErc721.js +8 -0
- package/esm/generated/models/ContractSubmissionUnknown.d.ts +25 -0
- package/esm/generated/models/ContractSubmissionUnknown.js +8 -0
- package/esm/generated/models/CreateEvmTransactionExportRequest.d.ts +2 -6
- package/esm/generated/models/CreatePrimaryNetworkTransactionExportRequest.d.ts +2 -6
- package/esm/generated/models/CurrencyCode.d.ts +3 -0
- package/esm/generated/models/DeliveredSourceNotIndexedTeleporterMessage.d.ts +27 -0
- package/esm/generated/models/DeliveredSourceNotIndexedTeleporterMessage.js +8 -0
- package/esm/generated/models/DeliveredTeleporterMessage.d.ts +29 -0
- package/esm/generated/models/DeliveredTeleporterMessage.js +8 -0
- package/esm/generated/models/EVMInput.d.ts +3 -3
- package/esm/generated/models/EVMOperationType.d.ts +5 -0
- package/esm/generated/models/EVMOperationType.js +6 -0
- package/esm/generated/models/EVMOutput.d.ts +3 -3
- package/esm/generated/models/Erc1155Contract.d.ts +2 -1
- package/esm/generated/models/Erc1155TokenMetadata.d.ts +0 -3
- package/esm/generated/models/Erc20Contract.d.ts +2 -1
- package/esm/generated/models/Erc721Contract.d.ts +0 -1
- package/esm/generated/models/Erc721TokenMetadata.d.ts +0 -3
- package/esm/generated/models/EventType.d.ts +5 -0
- package/esm/generated/models/EventType.js +6 -0
- package/esm/generated/models/GetChainResponse.d.ts +2 -3
- package/esm/generated/models/GetPrimaryNetworkBlockResponse.d.ts +1 -0
- package/esm/generated/models/GlacierApiFeature.d.ts +5 -0
- package/esm/generated/models/GlacierApiFeature.js +6 -0
- package/esm/generated/models/HistoricalReward.d.ts +2 -5
- package/esm/generated/models/ImageAsset.d.ts +0 -3
- package/esm/generated/models/ListContractsResponse.d.ts +1 -1
- package/esm/generated/models/ListNftTokens.d.ts +12 -0
- package/esm/generated/models/ListTransfersResponse.d.ts +1 -1
- package/esm/generated/models/ListValidatorDetailsResponse.d.ts +3 -2
- package/esm/generated/models/ListWebhooksResponse.d.ts +11 -0
- package/esm/generated/models/Method.d.ts +0 -3
- package/esm/generated/models/Money.d.ts +0 -3
- package/esm/generated/models/NextPageToken.d.ts +8 -0
- package/esm/generated/models/NftTokenMetadataStatus.d.ts +3 -0
- package/esm/generated/models/OperationType.d.ts +4 -2
- package/esm/generated/models/OperationType.js +3 -1
- package/esm/generated/models/PChainBalance.d.ts +15 -15
- package/esm/generated/models/PChainSharedAsset.d.ts +22 -0
- package/esm/generated/models/PChainTransaction.d.ts +13 -7
- package/esm/generated/models/PChainTransactionType.d.ts +8 -4
- package/esm/generated/models/PChainTransactionType.js +8 -4
- package/esm/generated/models/PChainUtxo.d.ts +34 -14
- package/esm/generated/models/PendingDelegatorDetails.d.ts +7 -3
- package/esm/generated/models/PendingDelegatorDetails.js +8 -0
- package/esm/generated/models/PendingReward.d.ts +3 -3
- package/esm/generated/models/PendingTeleporterMessage.d.ts +27 -0
- package/esm/generated/models/PendingTeleporterMessage.js +8 -0
- package/esm/generated/models/PendingValidatorDetails.d.ts +9 -4
- package/esm/generated/models/PendingValidatorDetails.js +8 -0
- package/esm/generated/models/PricingProviders.d.ts +5 -0
- package/esm/generated/models/PrimaryNetworkAssetCap.d.ts +9 -0
- package/esm/generated/models/PrimaryNetworkAssetCap.js +7 -0
- package/esm/generated/models/PrimaryNetworkAssetType.d.ts +9 -0
- package/esm/generated/models/PrimaryNetworkAssetType.js +7 -0
- package/esm/generated/models/PrimaryNetworkBlock.d.ts +1 -0
- package/esm/generated/models/PrimaryNetworkOperationType.d.ts +7 -0
- package/esm/generated/models/PrimaryNetworkOperationType.js +8 -0
- package/esm/generated/models/PrimaryNetworkOptions.d.ts +1 -1
- package/esm/generated/models/PrimaryNetworkTxType.d.ts +8 -5
- package/esm/generated/models/PrimaryNetworkTxType.js +8 -5
- package/esm/generated/models/RegisterWebhookRequest.d.ts +19 -0
- package/esm/generated/models/RemovedValidatorDetails.d.ts +19 -0
- package/esm/generated/models/RemovedValidatorDetails.js +8 -0
- package/esm/generated/models/RewardType.d.ts +2 -1
- package/esm/generated/models/RewardType.js +1 -0
- package/esm/generated/models/Rewards.d.ts +2 -0
- package/esm/generated/models/RpcErrorDto.d.ts +7 -0
- package/esm/generated/models/RpcErrorResponseDto.d.ts +9 -0
- package/esm/generated/models/RpcRequestBodyDto.d.ts +8 -0
- package/esm/generated/models/RpcSuccessResponseDto.d.ts +7 -0
- package/esm/generated/models/SharedSecretsResponse.d.ts +5 -0
- package/esm/generated/models/Subnet.d.ts +17 -0
- package/esm/generated/models/SubnetOwnershipInfo.d.ts +16 -0
- package/esm/generated/models/TeleporterDestinationTransaction.d.ts +9 -0
- package/esm/generated/models/TeleporterReceipt.d.ts +6 -0
- package/esm/generated/models/TeleporterRewardDetails.d.ts +37 -0
- package/esm/generated/models/TeleporterRewardDetails.js +8 -0
- package/esm/generated/models/TeleporterSourceTransaction.d.ts +7 -0
- package/esm/generated/models/TransactionMethodType.d.ts +3 -0
- package/esm/generated/models/UnknownContract.d.ts +0 -1
- package/esm/generated/models/UpdateContractResponse.d.ts +10 -0
- package/esm/generated/models/UpdateWebhookRequest.d.ts +12 -0
- package/esm/generated/models/Utxo.d.ts +30 -30
- package/esm/generated/models/UtxoCredential.d.ts +2 -2
- package/esm/generated/models/ValidationStatusType.d.ts +2 -1
- package/esm/generated/models/ValidationStatusType.js +1 -0
- package/esm/generated/models/ValidatorHealthDetails.d.ts +20 -0
- package/esm/generated/models/WebhookResponse.d.ts +25 -0
- package/esm/generated/models/WebhookStatus.d.ts +6 -0
- package/esm/generated/models/WebhookStatus.js +7 -0
- package/esm/generated/models/WebhookStatusType.d.ts +6 -0
- package/esm/generated/models/WebhookStatusType.js +7 -0
- package/esm/generated/models/XChainAssetDetails.d.ts +5 -8
- package/esm/generated/models/XChainBalances.d.ts +3 -3
- package/esm/generated/models/XChainLinearTransaction.d.ts +6 -8
- package/esm/generated/models/XChainNonLinearTransaction.d.ts +6 -8
- package/esm/generated/models/XChainSharedAssetBalance.d.ts +3 -4
- package/esm/generated/models/XChainTransactionType.d.ts +13 -0
- package/esm/generated/models/XChainTransactionType.js +11 -0
- package/esm/generated/services/DefaultService.d.ts +30 -0
- package/esm/generated/services/DefaultService.js +30 -0
- package/esm/generated/services/EvmBalancesService.d.ts +25 -25
- package/esm/generated/services/EvmBalancesService.js +8 -8
- package/esm/generated/services/EvmBlocksService.d.ts +7 -7
- package/esm/generated/services/EvmBlocksService.js +4 -4
- package/esm/generated/services/EvmChainsService.d.ts +7 -2
- package/esm/generated/services/EvmChainsService.js +4 -2
- package/esm/generated/services/EvmContractsService.d.ts +48 -0
- package/esm/generated/services/EvmContractsService.js +36 -0
- package/esm/generated/services/EvmTransactionsService.d.ts +91 -49
- package/esm/generated/services/EvmTransactionsService.js +33 -33
- package/esm/generated/services/NfTsService.d.ts +76 -0
- package/esm/generated/services/NfTsService.js +56 -0
- package/esm/generated/services/OperationsService.d.ts +11 -11
- package/esm/generated/services/OperationsService.js +10 -10
- package/esm/generated/services/PrimaryNetworkBlocksService.d.ts +10 -10
- package/esm/generated/services/PrimaryNetworkBlocksService.js +8 -8
- package/esm/generated/services/PrimaryNetworkRewardsService.d.ts +21 -8
- package/esm/generated/services/PrimaryNetworkRewardsService.js +12 -6
- package/esm/generated/services/PrimaryNetworkService.d.ts +51 -31
- package/esm/generated/services/PrimaryNetworkService.js +27 -17
- package/esm/generated/services/PrimaryNetworkTransactionsService.d.ts +20 -16
- package/esm/generated/services/PrimaryNetworkTransactionsService.js +8 -8
- package/esm/generated/services/PrimaryNetworkUtxOsService.d.ts +5 -5
- package/esm/generated/services/PrimaryNetworkUtxOsService.js +2 -2
- package/esm/generated/services/PrimaryNetworkVerticesService.d.ts +10 -10
- package/esm/generated/services/PrimaryNetworkVerticesService.js +6 -6
- package/esm/generated/services/TeleporterService.d.ts +57 -0
- package/esm/generated/services/TeleporterService.js +39 -0
- package/esm/generated/services/WebhooksService.d.ts +95 -0
- package/esm/generated/services/WebhooksService.js +80 -0
- package/esm/index.d.ts +46 -3
- package/esm/index.js +29 -2
- package/package.json +3 -3
- package/esm/generated/models/CreateEvmTransactionExportRequest.js +0 -8
- package/esm/generated/models/CreatePrimaryNetworkTransactionExportRequest.js +0 -8
- package/esm/generated/models/PChainAsset.d.ts +0 -6
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { BaseHttpRequest } from './core/BaseHttpRequest.js';
|
|
2
2
|
import { OpenAPIConfig } from './core/OpenAPI.js';
|
|
3
|
+
import { DefaultService } from './services/DefaultService.js';
|
|
3
4
|
import { EvmBalancesService } from './services/EvmBalancesService.js';
|
|
4
5
|
import { EvmBlocksService } from './services/EvmBlocksService.js';
|
|
5
6
|
import { EvmChainsService } from './services/EvmChainsService.js';
|
|
7
|
+
import { EvmContractsService } from './services/EvmContractsService.js';
|
|
6
8
|
import { EvmTransactionsService } from './services/EvmTransactionsService.js';
|
|
7
9
|
import { HealthCheckService } from './services/HealthCheckService.js';
|
|
10
|
+
import { NfTsService } from './services/NfTsService.js';
|
|
8
11
|
import { OperationsService } from './services/OperationsService.js';
|
|
9
12
|
import { PrimaryNetworkService } from './services/PrimaryNetworkService.js';
|
|
10
13
|
import { PrimaryNetworkBalancesService } from './services/PrimaryNetworkBalancesService.js';
|
|
@@ -13,14 +16,19 @@ import { PrimaryNetworkRewardsService } from './services/PrimaryNetworkRewardsSe
|
|
|
13
16
|
import { PrimaryNetworkTransactionsService } from './services/PrimaryNetworkTransactionsService.js';
|
|
14
17
|
import { PrimaryNetworkUtxOsService } from './services/PrimaryNetworkUtxOsService.js';
|
|
15
18
|
import { PrimaryNetworkVerticesService } from './services/PrimaryNetworkVerticesService.js';
|
|
19
|
+
import { TeleporterService } from './services/TeleporterService.js';
|
|
20
|
+
import { WebhooksService } from './services/WebhooksService.js';
|
|
16
21
|
|
|
17
22
|
type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
|
|
18
23
|
declare class Glacier {
|
|
24
|
+
readonly default: DefaultService;
|
|
19
25
|
readonly evmBalances: EvmBalancesService;
|
|
20
26
|
readonly evmBlocks: EvmBlocksService;
|
|
21
27
|
readonly evmChains: EvmChainsService;
|
|
28
|
+
readonly evmContracts: EvmContractsService;
|
|
22
29
|
readonly evmTransactions: EvmTransactionsService;
|
|
23
30
|
readonly healthCheck: HealthCheckService;
|
|
31
|
+
readonly nfTs: NfTsService;
|
|
24
32
|
readonly operations: OperationsService;
|
|
25
33
|
readonly primaryNetwork: PrimaryNetworkService;
|
|
26
34
|
readonly primaryNetworkBalances: PrimaryNetworkBalancesService;
|
|
@@ -29,6 +37,8 @@ declare class Glacier {
|
|
|
29
37
|
readonly primaryNetworkTransactions: PrimaryNetworkTransactionsService;
|
|
30
38
|
readonly primaryNetworkUtxOs: PrimaryNetworkUtxOsService;
|
|
31
39
|
readonly primaryNetworkVertices: PrimaryNetworkVerticesService;
|
|
40
|
+
readonly teleporter: TeleporterService;
|
|
41
|
+
readonly webhooks: WebhooksService;
|
|
32
42
|
readonly request: BaseHttpRequest;
|
|
33
43
|
constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
|
|
34
44
|
}
|
package/esm/generated/Glacier.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { FetchHttpRequest } from './core/FetchHttpRequest.js';
|
|
2
|
+
import { DefaultService } from './services/DefaultService.js';
|
|
2
3
|
import { EvmBalancesService } from './services/EvmBalancesService.js';
|
|
3
4
|
import { EvmBlocksService } from './services/EvmBlocksService.js';
|
|
4
5
|
import { EvmChainsService } from './services/EvmChainsService.js';
|
|
6
|
+
import { EvmContractsService } from './services/EvmContractsService.js';
|
|
5
7
|
import { EvmTransactionsService } from './services/EvmTransactionsService.js';
|
|
6
8
|
import { HealthCheckService } from './services/HealthCheckService.js';
|
|
9
|
+
import { NfTsService } from './services/NfTsService.js';
|
|
7
10
|
import { OperationsService } from './services/OperationsService.js';
|
|
8
11
|
import { PrimaryNetworkService } from './services/PrimaryNetworkService.js';
|
|
9
12
|
import { PrimaryNetworkBalancesService } from './services/PrimaryNetworkBalancesService.js';
|
|
@@ -12,26 +15,49 @@ import { PrimaryNetworkRewardsService } from './services/PrimaryNetworkRewardsSe
|
|
|
12
15
|
import { PrimaryNetworkTransactionsService } from './services/PrimaryNetworkTransactionsService.js';
|
|
13
16
|
import { PrimaryNetworkUtxOsService } from './services/PrimaryNetworkUtxOsService.js';
|
|
14
17
|
import { PrimaryNetworkVerticesService } from './services/PrimaryNetworkVerticesService.js';
|
|
18
|
+
import { TeleporterService } from './services/TeleporterService.js';
|
|
19
|
+
import { WebhooksService } from './services/WebhooksService.js';
|
|
15
20
|
|
|
16
21
|
class Glacier {
|
|
22
|
+
default;
|
|
23
|
+
evmBalances;
|
|
24
|
+
evmBlocks;
|
|
25
|
+
evmChains;
|
|
26
|
+
evmContracts;
|
|
27
|
+
evmTransactions;
|
|
28
|
+
healthCheck;
|
|
29
|
+
nfTs;
|
|
30
|
+
operations;
|
|
31
|
+
primaryNetwork;
|
|
32
|
+
primaryNetworkBalances;
|
|
33
|
+
primaryNetworkBlocks;
|
|
34
|
+
primaryNetworkRewards;
|
|
35
|
+
primaryNetworkTransactions;
|
|
36
|
+
primaryNetworkUtxOs;
|
|
37
|
+
primaryNetworkVertices;
|
|
38
|
+
teleporter;
|
|
39
|
+
webhooks;
|
|
40
|
+
request;
|
|
17
41
|
constructor(config, HttpRequest = FetchHttpRequest) {
|
|
18
|
-
var _a, _b, _c, _d;
|
|
19
42
|
this.request = new HttpRequest({
|
|
20
|
-
BASE:
|
|
21
|
-
VERSION:
|
|
22
|
-
WITH_CREDENTIALS:
|
|
23
|
-
CREDENTIALS:
|
|
24
|
-
TOKEN: config
|
|
25
|
-
USERNAME: config
|
|
26
|
-
PASSWORD: config
|
|
27
|
-
HEADERS: config
|
|
28
|
-
ENCODE_PATH: config
|
|
43
|
+
BASE: config?.BASE ?? "https://glacier-api-dev.avax.network",
|
|
44
|
+
VERSION: config?.VERSION ?? "Beta",
|
|
45
|
+
WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
|
|
46
|
+
CREDENTIALS: config?.CREDENTIALS ?? "include",
|
|
47
|
+
TOKEN: config?.TOKEN,
|
|
48
|
+
USERNAME: config?.USERNAME,
|
|
49
|
+
PASSWORD: config?.PASSWORD,
|
|
50
|
+
HEADERS: config?.HEADERS,
|
|
51
|
+
ENCODE_PATH: config?.ENCODE_PATH
|
|
29
52
|
});
|
|
53
|
+
this.default = new DefaultService(this.request);
|
|
30
54
|
this.evmBalances = new EvmBalancesService(this.request);
|
|
31
55
|
this.evmBlocks = new EvmBlocksService(this.request);
|
|
32
56
|
this.evmChains = new EvmChainsService(this.request);
|
|
57
|
+
this.evmContracts = new EvmContractsService(this.request);
|
|
33
58
|
this.evmTransactions = new EvmTransactionsService(this.request);
|
|
34
59
|
this.healthCheck = new HealthCheckService(this.request);
|
|
60
|
+
this.nfTs = new NfTsService(this.request);
|
|
35
61
|
this.operations = new OperationsService(this.request);
|
|
36
62
|
this.primaryNetwork = new PrimaryNetworkService(this.request);
|
|
37
63
|
this.primaryNetworkBalances = new PrimaryNetworkBalancesService(this.request);
|
|
@@ -40,6 +66,8 @@ class Glacier {
|
|
|
40
66
|
this.primaryNetworkTransactions = new PrimaryNetworkTransactionsService(this.request);
|
|
41
67
|
this.primaryNetworkUtxOs = new PrimaryNetworkUtxOsService(this.request);
|
|
42
68
|
this.primaryNetworkVertices = new PrimaryNetworkVerticesService(this.request);
|
|
69
|
+
this.teleporter = new TeleporterService(this.request);
|
|
70
|
+
this.webhooks = new WebhooksService(this.request);
|
|
43
71
|
}
|
|
44
72
|
}
|
|
45
73
|
|
|
@@ -9,15 +9,9 @@ interface OnCancel {
|
|
|
9
9
|
(cancelHandler: () => void): void;
|
|
10
10
|
}
|
|
11
11
|
declare class CancelablePromise<T> implements Promise<T> {
|
|
12
|
-
|
|
13
|
-
private _isResolved;
|
|
14
|
-
private _isRejected;
|
|
15
|
-
private _isCancelled;
|
|
16
|
-
private readonly _cancelHandlers;
|
|
17
|
-
private readonly _promise;
|
|
18
|
-
private _resolve?;
|
|
19
|
-
private _reject?;
|
|
12
|
+
#private;
|
|
20
13
|
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
|
|
14
|
+
get [Symbol.toStringTag](): string;
|
|
21
15
|
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
22
16
|
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
23
17
|
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
@@ -8,66 +8,75 @@ class CancelError extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
class CancelablePromise {
|
|
11
|
+
#isResolved;
|
|
12
|
+
#isRejected;
|
|
13
|
+
#isCancelled;
|
|
14
|
+
#cancelHandlers;
|
|
15
|
+
#promise;
|
|
16
|
+
#resolve;
|
|
17
|
+
#reject;
|
|
11
18
|
constructor(executor) {
|
|
12
|
-
this
|
|
13
|
-
this
|
|
14
|
-
this
|
|
15
|
-
this
|
|
16
|
-
this
|
|
17
|
-
this
|
|
18
|
-
this
|
|
19
|
+
this.#isResolved = false;
|
|
20
|
+
this.#isRejected = false;
|
|
21
|
+
this.#isCancelled = false;
|
|
22
|
+
this.#cancelHandlers = [];
|
|
23
|
+
this.#promise = new Promise((resolve, reject) => {
|
|
24
|
+
this.#resolve = resolve;
|
|
25
|
+
this.#reject = reject;
|
|
19
26
|
const onResolve = (value) => {
|
|
20
|
-
|
|
21
|
-
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
27
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
22
28
|
return;
|
|
23
29
|
}
|
|
24
|
-
this
|
|
25
|
-
|
|
30
|
+
this.#isResolved = true;
|
|
31
|
+
if (this.#resolve)
|
|
32
|
+
this.#resolve(value);
|
|
26
33
|
};
|
|
27
34
|
const onReject = (reason) => {
|
|
28
|
-
|
|
29
|
-
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
35
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
30
36
|
return;
|
|
31
37
|
}
|
|
32
|
-
this
|
|
33
|
-
|
|
38
|
+
this.#isRejected = true;
|
|
39
|
+
if (this.#reject)
|
|
40
|
+
this.#reject(reason);
|
|
34
41
|
};
|
|
35
42
|
const onCancel = (cancelHandler) => {
|
|
36
|
-
if (this
|
|
43
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
37
44
|
return;
|
|
38
45
|
}
|
|
39
|
-
this.
|
|
46
|
+
this.#cancelHandlers.push(cancelHandler);
|
|
40
47
|
};
|
|
41
48
|
Object.defineProperty(onCancel, "isResolved", {
|
|
42
|
-
get: () => this
|
|
49
|
+
get: () => this.#isResolved
|
|
43
50
|
});
|
|
44
51
|
Object.defineProperty(onCancel, "isRejected", {
|
|
45
|
-
get: () => this
|
|
52
|
+
get: () => this.#isRejected
|
|
46
53
|
});
|
|
47
54
|
Object.defineProperty(onCancel, "isCancelled", {
|
|
48
|
-
get: () => this
|
|
55
|
+
get: () => this.#isCancelled
|
|
49
56
|
});
|
|
50
57
|
return executor(onResolve, onReject, onCancel);
|
|
51
58
|
});
|
|
52
59
|
}
|
|
60
|
+
get [Symbol.toStringTag]() {
|
|
61
|
+
return "Cancellable Promise";
|
|
62
|
+
}
|
|
53
63
|
then(onFulfilled, onRejected) {
|
|
54
|
-
return this.
|
|
64
|
+
return this.#promise.then(onFulfilled, onRejected);
|
|
55
65
|
}
|
|
56
66
|
catch(onRejected) {
|
|
57
|
-
return this.
|
|
67
|
+
return this.#promise.catch(onRejected);
|
|
58
68
|
}
|
|
59
69
|
finally(onFinally) {
|
|
60
|
-
return this.
|
|
70
|
+
return this.#promise.finally(onFinally);
|
|
61
71
|
}
|
|
62
72
|
cancel() {
|
|
63
|
-
|
|
64
|
-
if (this._isResolved || this._isRejected || this._isCancelled) {
|
|
73
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
65
74
|
return;
|
|
66
75
|
}
|
|
67
|
-
this
|
|
68
|
-
if (this.
|
|
76
|
+
this.#isCancelled = true;
|
|
77
|
+
if (this.#cancelHandlers.length) {
|
|
69
78
|
try {
|
|
70
|
-
for (const cancelHandler of this
|
|
79
|
+
for (const cancelHandler of this.#cancelHandlers) {
|
|
71
80
|
cancelHandler();
|
|
72
81
|
}
|
|
73
82
|
} catch (error) {
|
|
@@ -75,11 +84,12 @@ class CancelablePromise {
|
|
|
75
84
|
return;
|
|
76
85
|
}
|
|
77
86
|
}
|
|
78
|
-
this.
|
|
79
|
-
|
|
87
|
+
this.#cancelHandlers.length = 0;
|
|
88
|
+
if (this.#reject)
|
|
89
|
+
this.#reject(new CancelError("Request aborted"));
|
|
80
90
|
}
|
|
81
91
|
get isCancelled() {
|
|
82
|
-
return this
|
|
92
|
+
return this.#isCancelled;
|
|
83
93
|
}
|
|
84
94
|
}
|
|
85
95
|
|
|
@@ -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
|
|
11
|
-
USERNAME?: string | Resolver<string
|
|
12
|
-
PASSWORD?: string | Resolver<string
|
|
13
|
-
HEADERS?: Headers | Resolver<Headers
|
|
14
|
-
ENCODE_PATH?: (path: string) => string;
|
|
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;
|
|
15
15
|
};
|
|
16
16
|
declare const OpenAPI: OpenAPIConfig;
|
|
17
17
|
|
|
@@ -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
|
-
|
|
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;
|
|
@@ -113,13 +93,18 @@ const resolve = async (options, resolver) => {
|
|
|
113
93
|
return resolver;
|
|
114
94
|
};
|
|
115
95
|
const getHeaders = async (config, options) => {
|
|
116
|
-
const token = await
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
+
]);
|
|
102
|
+
const headers = Object.entries({
|
|
103
|
+
Accept: "application/json",
|
|
104
|
+
...additionalHeaders,
|
|
105
|
+
...options.headers
|
|
106
|
+
}).filter(([_, value]) => isDefined(value)).reduce((headers2, [key, value]) => ({
|
|
107
|
+
...headers2,
|
|
123
108
|
[key]: String(value)
|
|
124
109
|
}), {});
|
|
125
110
|
if (isStringWithValue(token)) {
|
|
@@ -129,7 +114,7 @@ const getHeaders = async (config, options) => {
|
|
|
129
114
|
const credentials = base64(`${username}:${password}`);
|
|
130
115
|
headers["Authorization"] = `Basic ${credentials}`;
|
|
131
116
|
}
|
|
132
|
-
if (options.body) {
|
|
117
|
+
if (options.body !== void 0) {
|
|
133
118
|
if (options.mediaType) {
|
|
134
119
|
headers["Content-Type"] = options.mediaType;
|
|
135
120
|
} else if (isBlob(options.body)) {
|
|
@@ -143,9 +128,8 @@ const getHeaders = async (config, options) => {
|
|
|
143
128
|
return new Headers(headers);
|
|
144
129
|
};
|
|
145
130
|
const getRequestBody = (options) => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if ((_a = options.mediaType) == null ? void 0 : _a.includes("/json")) {
|
|
131
|
+
if (options.body !== void 0) {
|
|
132
|
+
if (options.mediaType?.includes("/json")) {
|
|
149
133
|
return JSON.stringify(options.body);
|
|
150
134
|
} else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
|
|
151
135
|
return options.body;
|
|
@@ -159,7 +143,7 @@ const sendRequest = async (config, options, url, body, formData, headers, onCanc
|
|
|
159
143
|
const controller = new AbortController();
|
|
160
144
|
const request2 = {
|
|
161
145
|
headers,
|
|
162
|
-
body: body
|
|
146
|
+
body: body ?? formData,
|
|
163
147
|
method: options.method,
|
|
164
148
|
signal: controller.signal
|
|
165
149
|
};
|
|
@@ -183,7 +167,8 @@ const getResponseBody = async (response) => {
|
|
|
183
167
|
try {
|
|
184
168
|
const contentType = response.headers.get("Content-Type");
|
|
185
169
|
if (contentType) {
|
|
186
|
-
const
|
|
170
|
+
const jsonTypes = ["application/json", "application/problem+json"];
|
|
171
|
+
const isJSON = jsonTypes.some((type) => contentType.toLowerCase().startsWith(type));
|
|
187
172
|
if (isJSON) {
|
|
188
173
|
return await response.json();
|
|
189
174
|
} else {
|
|
@@ -197,21 +182,35 @@ const getResponseBody = async (response) => {
|
|
|
197
182
|
return void 0;
|
|
198
183
|
};
|
|
199
184
|
const catchErrorCodes = (options, result) => {
|
|
200
|
-
const errors =
|
|
185
|
+
const errors = {
|
|
201
186
|
400: "Bad Request",
|
|
202
187
|
401: "Unauthorized",
|
|
203
188
|
403: "Forbidden",
|
|
204
189
|
404: "Not Found",
|
|
205
190
|
500: "Internal Server Error",
|
|
206
191
|
502: "Bad Gateway",
|
|
207
|
-
503: "Service Unavailable"
|
|
208
|
-
|
|
192
|
+
503: "Service Unavailable",
|
|
193
|
+
...options.errors
|
|
194
|
+
};
|
|
209
195
|
const error = errors[result.status];
|
|
210
196
|
if (error) {
|
|
211
197
|
throw new ApiError(options, result, error);
|
|
212
198
|
}
|
|
213
199
|
if (!result.ok) {
|
|
214
|
-
|
|
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
|
+
);
|
|
215
214
|
}
|
|
216
215
|
};
|
|
217
216
|
const request = (config, options) => {
|
|
@@ -230,7 +229,7 @@ const request = (config, options) => {
|
|
|
230
229
|
ok: response.ok,
|
|
231
230
|
status: response.status,
|
|
232
231
|
statusText: response.statusText,
|
|
233
|
-
body: responseHeader
|
|
232
|
+
body: responseHeader ?? responseBody
|
|
234
233
|
};
|
|
235
234
|
catchErrorCodes(options, result);
|
|
236
235
|
resolve2(result.body);
|
|
@@ -241,4 +240,4 @@ const request = (config, options) => {
|
|
|
241
240
|
});
|
|
242
241
|
};
|
|
243
242
|
|
|
244
|
-
export { request, sendRequest };
|
|
243
|
+
export { base64, catchErrorCodes, getFormData, getHeaders, getQueryString, getRequestBody, getResponseBody, getResponseHeader, isBlob, isDefined, isFormData, isString, isStringWithValue, request, resolve, sendRequest };
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { DelegationStatusType } from './DelegationStatusType.js';
|
|
2
|
-
|
|
3
1
|
type ActiveDelegatorDetails = {
|
|
4
2
|
txHash: string;
|
|
3
|
+
nodeId: string;
|
|
5
4
|
rewardAddresses: Array<string>;
|
|
6
5
|
amountDelegated: string;
|
|
7
6
|
delegationFee: string;
|
|
8
7
|
startTimestamp: number;
|
|
9
8
|
endTimestamp: number;
|
|
10
|
-
delegationStatus: DelegationStatusType;
|
|
11
9
|
estimatedGrossReward: string;
|
|
12
10
|
estimatedNetReward: string;
|
|
11
|
+
delegationStatus: ActiveDelegatorDetails.delegationStatus;
|
|
13
12
|
};
|
|
13
|
+
declare namespace ActiveDelegatorDetails {
|
|
14
|
+
enum delegationStatus {
|
|
15
|
+
ACTIVE = "active"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
14
18
|
|
|
15
19
|
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,20 +1,28 @@
|
|
|
1
1
|
import { Rewards } from './Rewards.js';
|
|
2
|
-
import {
|
|
2
|
+
import { ValidatorHealthDetails } from './ValidatorHealthDetails.js';
|
|
3
3
|
|
|
4
4
|
type ActiveValidatorDetails = {
|
|
5
|
+
txHash: string;
|
|
5
6
|
nodeId: string;
|
|
7
|
+
subnetId: string;
|
|
6
8
|
amountStaked: string;
|
|
7
|
-
delegationFee
|
|
9
|
+
delegationFee?: string;
|
|
8
10
|
startTimestamp: number;
|
|
9
11
|
endTimestamp: number;
|
|
10
|
-
validationStatus: ValidationStatusType;
|
|
11
12
|
stakePercentage: number;
|
|
12
13
|
delegatorCount: number;
|
|
13
|
-
amountDelegated
|
|
14
|
+
amountDelegated?: string;
|
|
14
15
|
uptimePerformance: number;
|
|
15
|
-
avalancheGoVersion
|
|
16
|
-
delegationCapacity
|
|
16
|
+
avalancheGoVersion?: string;
|
|
17
|
+
delegationCapacity?: string;
|
|
17
18
|
potentialRewards: Rewards;
|
|
19
|
+
validationStatus: ActiveValidatorDetails.validationStatus;
|
|
20
|
+
validatorHealth: ValidatorHealthDetails;
|
|
18
21
|
};
|
|
22
|
+
declare namespace ActiveValidatorDetails {
|
|
23
|
+
enum validationStatus {
|
|
24
|
+
ACTIVE = "active"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
19
27
|
|
|
20
28
|
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 };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type AddressActivityMetadata = {
|
|
2
|
+
/**
|
|
3
|
+
* Ethereum address for the address_activity event type
|
|
4
|
+
*/
|
|
5
|
+
address: string;
|
|
6
|
+
/**
|
|
7
|
+
* Array of hexadecimal strings of the event signatures.
|
|
8
|
+
*/
|
|
9
|
+
eventSignatures?: Array<string>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { AddressActivityMetadata };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { PrimaryNetworkAssetType } from './PrimaryNetworkAssetType.js';
|
|
2
|
+
|
|
3
|
+
type AggregatedAssetAmount = {
|
|
2
4
|
/**
|
|
3
5
|
* Unique ID for an asset.
|
|
4
6
|
*/
|
|
@@ -15,10 +17,7 @@ type XChainAssetBalance = {
|
|
|
15
17
|
* Denomination of this asset to represent fungibility.
|
|
16
18
|
*/
|
|
17
19
|
denomination: number;
|
|
18
|
-
|
|
19
|
-
* Type of asset like SECP256K1 or NFT.
|
|
20
|
-
*/
|
|
21
|
-
type: string;
|
|
20
|
+
type: PrimaryNetworkAssetType;
|
|
22
21
|
/**
|
|
23
22
|
* Amount of the asset.
|
|
24
23
|
*/
|
|
@@ -26,4 +25,4 @@ type XChainAssetBalance = {
|
|
|
26
25
|
utxoCount: number;
|
|
27
26
|
};
|
|
28
27
|
|
|
29
|
-
export {
|
|
28
|
+
export { AggregatedAssetAmount };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { PrimaryNetworkAssetType } from './PrimaryNetworkAssetType.js';
|
|
2
|
+
|
|
3
|
+
type AssetAmount = {
|
|
2
4
|
/**
|
|
3
5
|
* Unique ID for an asset.
|
|
4
6
|
*/
|
|
@@ -15,14 +17,11 @@ type Asset = {
|
|
|
15
17
|
* Denomination of this asset to represent fungibility.
|
|
16
18
|
*/
|
|
17
19
|
denomination: number;
|
|
18
|
-
|
|
19
|
-
* Type of asset like SECP256K1 or NFT.
|
|
20
|
-
*/
|
|
21
|
-
type: string;
|
|
20
|
+
type: PrimaryNetworkAssetType;
|
|
22
21
|
/**
|
|
23
22
|
* Amount of the asset.
|
|
24
23
|
*/
|
|
25
24
|
amount: string;
|
|
26
25
|
};
|
|
27
26
|
|
|
28
|
-
export {
|
|
27
|
+
export { AssetAmount };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Money } from './Money.js';
|
|
2
|
+
import { PrimaryNetworkAssetType } from './PrimaryNetworkAssetType.js';
|
|
3
|
+
|
|
4
|
+
type AssetWithPriceInfo = {
|
|
5
|
+
/**
|
|
6
|
+
* Unique ID for an asset.
|
|
7
|
+
*/
|
|
8
|
+
assetId: string;
|
|
9
|
+
/**
|
|
10
|
+
* Name of this asset.
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* Symbol for this asset (max 4 characters).
|
|
15
|
+
*/
|
|
16
|
+
symbol: string;
|
|
17
|
+
/**
|
|
18
|
+
* Denomination of this asset to represent fungibility.
|
|
19
|
+
*/
|
|
20
|
+
denomination: number;
|
|
21
|
+
type: PrimaryNetworkAssetType;
|
|
22
|
+
/**
|
|
23
|
+
* Amount of the asset.
|
|
24
|
+
*/
|
|
25
|
+
amount: string;
|
|
26
|
+
/**
|
|
27
|
+
* The historical asset price at the time the reward was granted, if available. Note, this is only provided if the reward occured more than 24 hours ago.
|
|
28
|
+
*/
|
|
29
|
+
historicalPrice?: Money;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { AssetWithPriceInfo };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AssetAmount } from './AssetAmount.js';
|
|
2
2
|
import { EVMInput } from './EVMInput.js';
|
|
3
3
|
import { Utxo } from './Utxo.js';
|
|
4
4
|
|
|
@@ -26,11 +26,11 @@ type CChainExportTransaction = {
|
|
|
26
26
|
/**
|
|
27
27
|
* Assets unlocked by inputs of this transaction.
|
|
28
28
|
*/
|
|
29
|
-
amountUnlocked: Array<
|
|
29
|
+
amountUnlocked: Array<AssetAmount>;
|
|
30
30
|
/**
|
|
31
31
|
* Assets created by outputs of this transaction.
|
|
32
32
|
*/
|
|
33
|
-
amountCreated: Array<
|
|
33
|
+
amountCreated: Array<AssetAmount>;
|
|
34
34
|
/**
|
|
35
35
|
* Source chain for an atomic transaction.
|
|
36
36
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AssetAmount } from './AssetAmount.js';
|
|
2
2
|
import { EVMOutput } from './EVMOutput.js';
|
|
3
3
|
import { Utxo } from './Utxo.js';
|
|
4
4
|
|
|
@@ -26,11 +26,11 @@ type CChainImportTransaction = {
|
|
|
26
26
|
/**
|
|
27
27
|
* Assets unlocked by inputs of this transaction.
|
|
28
28
|
*/
|
|
29
|
-
amountUnlocked: Array<
|
|
29
|
+
amountUnlocked: Array<AssetAmount>;
|
|
30
30
|
/**
|
|
31
31
|
* Assets created by outputs of this transaction.
|
|
32
32
|
*/
|
|
33
|
-
amountCreated: Array<
|
|
33
|
+
amountCreated: Array<AssetAmount>;
|
|
34
34
|
/**
|
|
35
35
|
* Source chain for an atomic transaction.
|
|
36
36
|
*/
|