@avalabs/glacier-sdk 2.8.0-alpha.89 → 2.8.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/CHANGELOG.md +218 -0
  2. package/README.md +0 -10
  3. package/__tests__/glacier-sdk.test.js +7 -0
  4. package/dist/index.d.ts +3 -3209
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +153 -1531
  7. package/dist/index.js.map +1 -0
  8. package/dist/src/generated/models.d.ts +385 -0
  9. package/dist/src/generated/models.d.ts.map +1 -0
  10. package/dist/src/glacierClient.d.ts +93 -0
  11. package/dist/src/glacierClient.d.ts.map +1 -0
  12. package/dist/src/types.d.ts +13 -0
  13. package/dist/src/types.d.ts.map +1 -0
  14. package/index.ts +2 -0
  15. package/package.json +15 -12
  16. package/rollup.config.js +33 -0
  17. package/src/generated/models.ts +460 -0
  18. package/src/glacierClient.ts +190 -0
  19. package/src/types.ts +6 -0
  20. package/swagger/generateModels.js +40 -0
  21. package/tsconfig.json +7 -0
  22. package/esm/generated/Glacier.d.ts +0 -18
  23. package/esm/generated/Glacier.js +0 -28
  24. package/esm/generated/core/ApiError.d.ts +0 -13
  25. package/esm/generated/core/ApiError.js +0 -13
  26. package/esm/generated/core/ApiRequestOptions.d.ts +0 -15
  27. package/esm/generated/core/ApiResult.d.ts +0 -9
  28. package/esm/generated/core/BaseHttpRequest.d.ts +0 -11
  29. package/esm/generated/core/BaseHttpRequest.js +0 -7
  30. package/esm/generated/core/CancelablePromise.d.ts +0 -28
  31. package/esm/generated/core/CancelablePromise.js +0 -86
  32. package/esm/generated/core/FetchHttpRequest.js +0 -13
  33. package/esm/generated/core/OpenAPI.d.ts +0 -18
  34. package/esm/generated/core/OpenAPI.js +0 -13
  35. package/esm/generated/core/request.js +0 -244
  36. package/esm/generated/models/Address.d.ts +0 -8
  37. package/esm/generated/models/Asset.d.ts +0 -28
  38. package/esm/generated/models/AssetType.d.ts +0 -8
  39. package/esm/generated/models/AssetType.js +0 -9
  40. package/esm/generated/models/Block.d.ts +0 -15
  41. package/esm/generated/models/BlockchainId.d.ts +0 -9
  42. package/esm/generated/models/BlockchainId.js +0 -10
  43. package/esm/generated/models/CChainAtomicBalances.d.ts +0 -8
  44. package/esm/generated/models/CChainExportTransaction.d.ts +0 -58
  45. package/esm/generated/models/CChainExportTransaction.js +0 -8
  46. package/esm/generated/models/CChainImportTransaction.d.ts +0 -58
  47. package/esm/generated/models/CChainImportTransaction.js +0 -8
  48. package/esm/generated/models/CChainSharedAssetBalance.d.ts +0 -30
  49. package/esm/generated/models/CPBlockchainId.d.ts +0 -7
  50. package/esm/generated/models/CPBlockchainId.js +0 -8
  51. package/esm/generated/models/CancelListingEventResponse.d.ts +0 -5
  52. package/esm/generated/models/ChainAddressChainIdMap.d.ts +0 -8
  53. package/esm/generated/models/ChainAddressChainIdMapListResponse.d.ts +0 -7
  54. package/esm/generated/models/ChainInfo.d.ts +0 -30
  55. package/esm/generated/models/ChainStatus.d.ts +0 -6
  56. package/esm/generated/models/ChainStatus.js +0 -7
  57. package/esm/generated/models/CloseAuctionEventResponse.d.ts +0 -6
  58. package/esm/generated/models/CollectionMetrics.d.ts +0 -40
  59. package/esm/generated/models/CollectionSortByOption.d.ts +0 -8
  60. package/esm/generated/models/CollectionSortByOption.js +0 -9
  61. package/esm/generated/models/ContractType.d.ts +0 -7
  62. package/esm/generated/models/ContractType.js +0 -8
  63. package/esm/generated/models/CreateTransactionExportRequest.d.ts +0 -11
  64. package/esm/generated/models/CurrencyCode.d.ts +0 -18
  65. package/esm/generated/models/CurrencyCode.js +0 -19
  66. package/esm/generated/models/EVMInput.d.ts +0 -14
  67. package/esm/generated/models/EVMOutput.d.ts +0 -14
  68. package/esm/generated/models/Erc1155Token.d.ts +0 -19
  69. package/esm/generated/models/Erc1155Token.js +0 -8
  70. package/esm/generated/models/Erc1155TokenBalance.d.ts +0 -28
  71. package/esm/generated/models/Erc1155TokenBalance.js +0 -8
  72. package/esm/generated/models/Erc1155TokenMetadata.d.ts +0 -20
  73. package/esm/generated/models/Erc1155Transfer.d.ts +0 -27
  74. package/esm/generated/models/Erc1155TransferDetails.d.ts +0 -11
  75. package/esm/generated/models/Erc20Token.d.ts +0 -38
  76. package/esm/generated/models/Erc20Token.js +0 -8
  77. package/esm/generated/models/Erc20TokenBalance.d.ts +0 -51
  78. package/esm/generated/models/Erc20TokenBalance.js +0 -8
  79. package/esm/generated/models/Erc20Transfer.d.ts +0 -27
  80. package/esm/generated/models/Erc20TransferDetails.d.ts +0 -11
  81. package/esm/generated/models/Erc721Token.d.ts +0 -31
  82. package/esm/generated/models/Erc721Token.js +0 -8
  83. package/esm/generated/models/Erc721TokenBalance.d.ts +0 -35
  84. package/esm/generated/models/Erc721TokenBalance.js +0 -8
  85. package/esm/generated/models/Erc721TokenMetadata.d.ts +0 -19
  86. package/esm/generated/models/Erc721Transfer.d.ts +0 -26
  87. package/esm/generated/models/Erc721TransferDetails.d.ts +0 -10
  88. package/esm/generated/models/ErcType.d.ts +0 -8
  89. package/esm/generated/models/ErcType.js +0 -9
  90. package/esm/generated/models/EvmNetworkOptions.d.ts +0 -6
  91. package/esm/generated/models/FullNativeTransactionDetails.d.ts +0 -62
  92. package/esm/generated/models/GetBlockResponse.d.ts +0 -49
  93. package/esm/generated/models/GetChainResponse.d.ts +0 -30
  94. package/esm/generated/models/GetContractInformationResponse.d.ts +0 -58
  95. package/esm/generated/models/GetNativeBalanceResponse.d.ts +0 -10
  96. package/esm/generated/models/GetTransactionResponse.d.ts +0 -35
  97. package/esm/generated/models/InternalTransaction.d.ts +0 -33
  98. package/esm/generated/models/InternalTransactionDetails.d.ts +0 -17
  99. package/esm/generated/models/InternalTransactionOpCall.d.ts +0 -11
  100. package/esm/generated/models/InternalTransactionOpCall.js +0 -12
  101. package/esm/generated/models/ListBlocksResponse.d.ts +0 -11
  102. package/esm/generated/models/ListCChainAtomicBalancesResponse.d.ts +0 -7
  103. package/esm/generated/models/ListCChainExportTxsResponse.d.ts +0 -11
  104. package/esm/generated/models/ListCChainImportTxsResponse.d.ts +0 -11
  105. package/esm/generated/models/ListChainsResponse.d.ts +0 -7
  106. package/esm/generated/models/ListCollectibleBalancesResponse.d.ts +0 -16
  107. package/esm/generated/models/ListErc1155BalancesResponse.d.ts +0 -14
  108. package/esm/generated/models/ListErc1155TransactionsResponse.d.ts +0 -11
  109. package/esm/generated/models/ListErc20BalancesResponse.d.ts +0 -14
  110. package/esm/generated/models/ListErc20TransactionsResponse.d.ts +0 -11
  111. package/esm/generated/models/ListErc721BalancesResponse.d.ts +0 -14
  112. package/esm/generated/models/ListErc721TransactionsResponse.d.ts +0 -11
  113. package/esm/generated/models/ListInternalTransactionsResponse.d.ts +0 -11
  114. package/esm/generated/models/ListListingsResponse.d.ts +0 -11
  115. package/esm/generated/models/ListNativeTransactionsResponse.d.ts +0 -11
  116. package/esm/generated/models/ListNftCollectionWithMetricsResponse.d.ts +0 -11
  117. package/esm/generated/models/ListPChainBalancesResponse.d.ts +0 -7
  118. package/esm/generated/models/ListPChainTransactionsResponse.d.ts +0 -11
  119. package/esm/generated/models/ListPChainUtxosResponse.d.ts +0 -11
  120. package/esm/generated/models/ListTransactionDetailsResponse.d.ts +0 -11
  121. package/esm/generated/models/ListTransfersResponse.d.ts +0 -13
  122. package/esm/generated/models/ListUtxosResponse.d.ts +0 -11
  123. package/esm/generated/models/ListXChainBalancesResponse.d.ts +0 -7
  124. package/esm/generated/models/ListXChainTransactionsResponse.d.ts +0 -11
  125. package/esm/generated/models/ListXChainVerticesResponse.d.ts +0 -11
  126. package/esm/generated/models/ListingCurrencyType.d.ts +0 -6
  127. package/esm/generated/models/ListingCurrencyType.js +0 -7
  128. package/esm/generated/models/ListingEventType.d.ts +0 -8
  129. package/esm/generated/models/ListingEventType.js +0 -9
  130. package/esm/generated/models/ListingResponse.d.ts +0 -19
  131. package/esm/generated/models/ListingType.d.ts +0 -6
  132. package/esm/generated/models/ListingType.js +0 -7
  133. package/esm/generated/models/ListingsSortByOption.d.ts +0 -5
  134. package/esm/generated/models/ListingsSortByOption.js +0 -6
  135. package/esm/generated/models/Method.d.ts +0 -24
  136. package/esm/generated/models/Money.d.ts +0 -14
  137. package/esm/generated/models/NativeTokenBalance.d.ts +0 -41
  138. package/esm/generated/models/NativeTransaction.d.ts +0 -55
  139. package/esm/generated/models/Network.d.ts +0 -6
  140. package/esm/generated/models/Network.js +0 -7
  141. package/esm/generated/models/NetworkToken.d.ts +0 -23
  142. package/esm/generated/models/NetworkTokenDetails.d.ts +0 -18
  143. package/esm/generated/models/NftCollection.d.ts +0 -22
  144. package/esm/generated/models/NftCollectionWithMetrics.d.ts +0 -24
  145. package/esm/generated/models/NftFilterOptionsProperty.d.ts +0 -10
  146. package/esm/generated/models/NftSearchBody.d.ts +0 -10
  147. package/esm/generated/models/NftSearchResultTypeOption.d.ts +0 -6
  148. package/esm/generated/models/NftSearchResultTypeOption.js +0 -7
  149. package/esm/generated/models/NftTokenMetadataStatus.d.ts +0 -15
  150. package/esm/generated/models/NftTokenMetadataStatus.js +0 -16
  151. package/esm/generated/models/OpenListingEventResponse.d.ts +0 -17
  152. package/esm/generated/models/OperationStatus.d.ts +0 -8
  153. package/esm/generated/models/OperationStatus.js +0 -9
  154. package/esm/generated/models/OperationStatusCode.d.ts +0 -7
  155. package/esm/generated/models/OperationStatusCode.js +0 -8
  156. package/esm/generated/models/OperationStatusResponse.d.ts +0 -15
  157. package/esm/generated/models/OperationTransactionExportMetadata.d.ts +0 -18
  158. package/esm/generated/models/OperationType.d.ts +0 -5
  159. package/esm/generated/models/OperationType.js +0 -6
  160. package/esm/generated/models/PChainAsset.d.ts +0 -6
  161. package/esm/generated/models/PChainBalance.d.ts +0 -30
  162. package/esm/generated/models/PChainConsumedUtxo.d.ts +0 -11
  163. package/esm/generated/models/PChainEmittedUtxo.d.ts +0 -19
  164. package/esm/generated/models/PChainId.d.ts +0 -6
  165. package/esm/generated/models/PChainId.js +0 -7
  166. package/esm/generated/models/PChainTransaction.d.ts +0 -69
  167. package/esm/generated/models/PChainUtxo.d.ts +0 -22
  168. package/esm/generated/models/PaginationParams.d.ts +0 -13
  169. package/esm/generated/models/PrimaryNetworkOptions.d.ts +0 -6
  170. package/esm/generated/models/ProposerDetails.d.ts +0 -9
  171. package/esm/generated/models/PurchaseListingEventResponse.d.ts +0 -17
  172. package/esm/generated/models/ResourceLink.d.ts +0 -8
  173. package/esm/generated/models/ResourceLinkType.d.ts +0 -18
  174. package/esm/generated/models/ResourceLinkType.js +0 -19
  175. package/esm/generated/models/ReviewStatus.d.ts +0 -6
  176. package/esm/generated/models/ReviewStatus.js +0 -7
  177. package/esm/generated/models/RichAddress.d.ts +0 -26
  178. package/esm/generated/models/SortOrder.d.ts +0 -6
  179. package/esm/generated/models/SortOrder.js +0 -7
  180. package/esm/generated/models/TokenWithPrice.d.ts +0 -28
  181. package/esm/generated/models/TransactionDetails.d.ts +0 -36
  182. package/esm/generated/models/TransactionMethodType.d.ts +0 -7
  183. package/esm/generated/models/TransactionMethodType.js +0 -8
  184. package/esm/generated/models/TransactionStatus.d.ts +0 -6
  185. package/esm/generated/models/TransactionStatus.js +0 -7
  186. package/esm/generated/models/TransactionVertexDetail.d.ts +0 -16
  187. package/esm/generated/models/TrendingTimeframe.d.ts +0 -7
  188. package/esm/generated/models/TrendingTimeframe.js +0 -8
  189. package/esm/generated/models/UtilityAddresses.d.ts +0 -5
  190. package/esm/generated/models/Utxo.d.ts +0 -60
  191. package/esm/generated/models/UtxoCredential.d.ts +0 -12
  192. package/esm/generated/models/VmName.d.ts +0 -7
  193. package/esm/generated/models/VmName.js +0 -8
  194. package/esm/generated/models/XChainAssetBalance.d.ts +0 -29
  195. package/esm/generated/models/XChainAssetDetails.d.ts +0 -32
  196. package/esm/generated/models/XChainBalances.d.ts +0 -17
  197. package/esm/generated/models/XChainId.d.ts +0 -6
  198. package/esm/generated/models/XChainId.js +0 -7
  199. package/esm/generated/models/XChainSharedAssetBalance.d.ts +0 -30
  200. package/esm/generated/models/XChainTransaction.d.ts +0 -51
  201. package/esm/generated/models/XChainVertex.d.ts +0 -12
  202. package/esm/generated/services/EvmService.d.ts +0 -734
  203. package/esm/generated/services/EvmService.js +0 -518
  204. package/esm/generated/services/HealthCheckService.d.ts +0 -20
  205. package/esm/generated/services/HealthCheckService.js +0 -16
  206. package/esm/generated/services/OperationsService.d.ts +0 -30
  207. package/esm/generated/services/OperationsService.js +0 -28
  208. package/esm/generated/services/PrimaryNetworkService.d.ts +0 -387
  209. package/esm/generated/services/PrimaryNetworkService.js +0 -273
  210. package/esm/index.d.ts +0 -139
  211. package/esm/index.js +0 -45
@@ -1,18 +0,0 @@
1
- import { BaseHttpRequest } from './core/BaseHttpRequest.js';
2
- import { OpenAPIConfig } from './core/OpenAPI.js';
3
- import { EvmService } from './services/EvmService.js';
4
- import { HealthCheckService } from './services/HealthCheckService.js';
5
- import { OperationsService } from './services/OperationsService.js';
6
- import { PrimaryNetworkService } from './services/PrimaryNetworkService.js';
7
-
8
- type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
9
- declare class Glacier {
10
- readonly evm: EvmService;
11
- readonly healthCheck: HealthCheckService;
12
- readonly operations: OperationsService;
13
- readonly primaryNetwork: PrimaryNetworkService;
14
- readonly request: BaseHttpRequest;
15
- constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
16
- }
17
-
18
- export { Glacier };
@@ -1,28 +0,0 @@
1
- import { FetchHttpRequest } from './core/FetchHttpRequest.js';
2
- import { EvmService } from './services/EvmService.js';
3
- import { HealthCheckService } from './services/HealthCheckService.js';
4
- import { OperationsService } from './services/OperationsService.js';
5
- import { PrimaryNetworkService } from './services/PrimaryNetworkService.js';
6
-
7
- class Glacier {
8
- constructor(config, HttpRequest = FetchHttpRequest) {
9
- var _a, _b, _c, _d;
10
- this.request = new HttpRequest({
11
- BASE: (_a = config == null ? void 0 : config.BASE) != null ? _a : "",
12
- VERSION: (_b = config == null ? void 0 : config.VERSION) != null ? _b : "Beta",
13
- WITH_CREDENTIALS: (_c = config == null ? void 0 : config.WITH_CREDENTIALS) != null ? _c : false,
14
- CREDENTIALS: (_d = config == null ? void 0 : config.CREDENTIALS) != null ? _d : "include",
15
- TOKEN: config == null ? void 0 : config.TOKEN,
16
- USERNAME: config == null ? void 0 : config.USERNAME,
17
- PASSWORD: config == null ? void 0 : config.PASSWORD,
18
- HEADERS: config == null ? void 0 : config.HEADERS,
19
- ENCODE_PATH: config == null ? void 0 : config.ENCODE_PATH
20
- });
21
- this.evm = new EvmService(this.request);
22
- this.healthCheck = new HealthCheckService(this.request);
23
- this.operations = new OperationsService(this.request);
24
- this.primaryNetwork = new PrimaryNetworkService(this.request);
25
- }
26
- }
27
-
28
- export { Glacier };
@@ -1,13 +0,0 @@
1
- import { ApiRequestOptions } from './ApiRequestOptions.js';
2
- import { ApiResult } from './ApiResult.js';
3
-
4
- declare class ApiError extends Error {
5
- readonly url: string;
6
- readonly status: number;
7
- readonly statusText: string;
8
- readonly body: any;
9
- readonly request: ApiRequestOptions;
10
- constructor(request: ApiRequestOptions, response: ApiResult, message: string);
11
- }
12
-
13
- export { ApiError };
@@ -1,13 +0,0 @@
1
- class ApiError extends Error {
2
- constructor(request, response, message) {
3
- super(message);
4
- this.name = "ApiError";
5
- this.url = response.url;
6
- this.status = response.status;
7
- this.statusText = response.statusText;
8
- this.body = response.body;
9
- this.request = request;
10
- }
11
- }
12
-
13
- export { ApiError };
@@ -1,15 +0,0 @@
1
- type ApiRequestOptions = {
2
- readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
3
- readonly url: string;
4
- readonly path?: Record<string, any>;
5
- readonly cookies?: Record<string, any>;
6
- readonly headers?: Record<string, any>;
7
- readonly query?: Record<string, any>;
8
- readonly formData?: Record<string, any>;
9
- readonly body?: any;
10
- readonly mediaType?: string;
11
- readonly responseHeader?: string;
12
- readonly errors?: Record<number, string>;
13
- };
14
-
15
- export { ApiRequestOptions };
@@ -1,9 +0,0 @@
1
- type ApiResult = {
2
- readonly url: string;
3
- readonly ok: boolean;
4
- readonly status: number;
5
- readonly statusText: string;
6
- readonly body: any;
7
- };
8
-
9
- export { ApiResult };
@@ -1,11 +0,0 @@
1
- import { ApiRequestOptions } from './ApiRequestOptions.js';
2
- import { CancelablePromise } from './CancelablePromise.js';
3
- import { OpenAPIConfig } from './OpenAPI.js';
4
-
5
- declare abstract class BaseHttpRequest {
6
- readonly config: OpenAPIConfig;
7
- constructor(config: OpenAPIConfig);
8
- abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
9
- }
10
-
11
- export { BaseHttpRequest };
@@ -1,7 +0,0 @@
1
- class BaseHttpRequest {
2
- constructor(config) {
3
- this.config = config;
4
- }
5
- }
6
-
7
- export { BaseHttpRequest };
@@ -1,28 +0,0 @@
1
- declare class CancelError extends Error {
2
- constructor(message: string);
3
- get isCancelled(): boolean;
4
- }
5
- interface OnCancel {
6
- readonly isResolved: boolean;
7
- readonly isRejected: boolean;
8
- readonly isCancelled: boolean;
9
- (cancelHandler: () => void): void;
10
- }
11
- declare class CancelablePromise<T> implements Promise<T> {
12
- readonly [Symbol.toStringTag]: string;
13
- private _isResolved;
14
- private _isRejected;
15
- private _isCancelled;
16
- private readonly _cancelHandlers;
17
- private readonly _promise;
18
- private _resolve?;
19
- private _reject?;
20
- constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
21
- then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
22
- catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
23
- finally(onFinally?: (() => void) | null): Promise<T>;
24
- cancel(): void;
25
- get isCancelled(): boolean;
26
- }
27
-
28
- export { CancelError, CancelablePromise, OnCancel };
@@ -1,86 +0,0 @@
1
- class CancelError extends Error {
2
- constructor(message) {
3
- super(message);
4
- this.name = "CancelError";
5
- }
6
- get isCancelled() {
7
- return true;
8
- }
9
- }
10
- class CancelablePromise {
11
- constructor(executor) {
12
- this._isResolved = false;
13
- this._isRejected = false;
14
- this._isCancelled = false;
15
- this._cancelHandlers = [];
16
- this._promise = new Promise((resolve, reject) => {
17
- this._resolve = resolve;
18
- this._reject = reject;
19
- const onResolve = (value) => {
20
- var _a;
21
- if (this._isResolved || this._isRejected || this._isCancelled) {
22
- return;
23
- }
24
- this._isResolved = true;
25
- (_a = this._resolve) == null ? void 0 : _a.call(this, value);
26
- };
27
- const onReject = (reason) => {
28
- var _a;
29
- if (this._isResolved || this._isRejected || this._isCancelled) {
30
- return;
31
- }
32
- this._isRejected = true;
33
- (_a = this._reject) == null ? void 0 : _a.call(this, reason);
34
- };
35
- const onCancel = (cancelHandler) => {
36
- if (this._isResolved || this._isRejected || this._isCancelled) {
37
- return;
38
- }
39
- this._cancelHandlers.push(cancelHandler);
40
- };
41
- Object.defineProperty(onCancel, "isResolved", {
42
- get: () => this._isResolved
43
- });
44
- Object.defineProperty(onCancel, "isRejected", {
45
- get: () => this._isRejected
46
- });
47
- Object.defineProperty(onCancel, "isCancelled", {
48
- get: () => this._isCancelled
49
- });
50
- return executor(onResolve, onReject, onCancel);
51
- });
52
- }
53
- then(onFulfilled, onRejected) {
54
- return this._promise.then(onFulfilled, onRejected);
55
- }
56
- catch(onRejected) {
57
- return this._promise.catch(onRejected);
58
- }
59
- finally(onFinally) {
60
- return this._promise.finally(onFinally);
61
- }
62
- cancel() {
63
- var _a;
64
- if (this._isResolved || this._isRejected || this._isCancelled) {
65
- return;
66
- }
67
- this._isCancelled = true;
68
- if (this._cancelHandlers.length) {
69
- try {
70
- for (const cancelHandler of this._cancelHandlers) {
71
- cancelHandler();
72
- }
73
- } catch (error) {
74
- console.warn("Cancellation threw an error", error);
75
- return;
76
- }
77
- }
78
- this._cancelHandlers.length = 0;
79
- (_a = this._reject) == null ? void 0 : _a.call(this, new CancelError("Request aborted"));
80
- }
81
- get isCancelled() {
82
- return this._isCancelled;
83
- }
84
- }
85
-
86
- export { CancelError, CancelablePromise };
@@ -1,13 +0,0 @@
1
- import { BaseHttpRequest } from './BaseHttpRequest.js';
2
- import { request } from './request.js';
3
-
4
- class FetchHttpRequest extends BaseHttpRequest {
5
- constructor(config) {
6
- super(config);
7
- }
8
- request(options) {
9
- return request(this.config, options);
10
- }
11
- }
12
-
13
- export { FetchHttpRequest };
@@ -1,18 +0,0 @@
1
- import { ApiRequestOptions } from './ApiRequestOptions.js';
2
-
3
- type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
4
- type Headers = Record<string, string>;
5
- type OpenAPIConfig = {
6
- BASE: string;
7
- VERSION: string;
8
- WITH_CREDENTIALS: boolean;
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;
15
- };
16
- declare const OpenAPI: OpenAPIConfig;
17
-
18
- export { OpenAPI, OpenAPIConfig };
@@ -1,13 +0,0 @@
1
- const OpenAPI = {
2
- BASE: "",
3
- VERSION: "Beta",
4
- WITH_CREDENTIALS: false,
5
- CREDENTIALS: "include",
6
- TOKEN: void 0,
7
- USERNAME: void 0,
8
- PASSWORD: void 0,
9
- HEADERS: void 0,
10
- ENCODE_PATH: void 0
11
- };
12
-
13
- export { OpenAPI };
@@ -1,244 +0,0 @@
1
- import { ApiError } from './ApiError.js';
2
- import { CancelablePromise } from './CancelablePromise.js';
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
- const isDefined = (value) => {
24
- return value !== void 0 && value !== null;
25
- };
26
- const isString = (value) => {
27
- return typeof value === "string";
28
- };
29
- const isStringWithValue = (value) => {
30
- return isString(value) && value !== "";
31
- };
32
- const isBlob = (value) => {
33
- return typeof value === "object" && typeof value.type === "string" && typeof value.stream === "function" && typeof value.arrayBuffer === "function" && typeof value.constructor === "function" && typeof value.constructor.name === "string" && /^(Blob|File)$/.test(value.constructor.name) && /^(Blob|File)$/.test(value[Symbol.toStringTag]);
34
- };
35
- const isFormData = (value) => {
36
- return value instanceof FormData;
37
- };
38
- const base64 = (str) => {
39
- try {
40
- return btoa(str);
41
- } catch (err) {
42
- return Buffer.from(str).toString("base64");
43
- }
44
- };
45
- const getQueryString = (params) => {
46
- const qs = [];
47
- const append = (key, value) => {
48
- qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
49
- };
50
- const process = (key, value) => {
51
- if (isDefined(value)) {
52
- if (Array.isArray(value)) {
53
- value.forEach((v) => {
54
- process(key, v);
55
- });
56
- } else if (typeof value === "object") {
57
- Object.entries(value).forEach(([k, v]) => {
58
- process(`${key}[${k}]`, v);
59
- });
60
- } else {
61
- append(key, value);
62
- }
63
- }
64
- };
65
- Object.entries(params).forEach(([key, value]) => {
66
- process(key, value);
67
- });
68
- if (qs.length > 0) {
69
- return `?${qs.join("&")}`;
70
- }
71
- return "";
72
- };
73
- const getUrl = (config, options) => {
74
- const encoder = config.ENCODE_PATH || encodeURI;
75
- const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
76
- var _a;
77
- if ((_a = options.path) == null ? void 0 : _a.hasOwnProperty(group)) {
78
- return encoder(String(options.path[group]));
79
- }
80
- return substring;
81
- });
82
- const url = `${config.BASE}${path}`;
83
- if (options.query) {
84
- return `${url}${getQueryString(options.query)}`;
85
- }
86
- return url;
87
- };
88
- const getFormData = (options) => {
89
- if (options.formData) {
90
- const formData = new FormData();
91
- const process = (key, value) => {
92
- if (isString(value) || isBlob(value)) {
93
- formData.append(key, value);
94
- } else {
95
- formData.append(key, JSON.stringify(value));
96
- }
97
- };
98
- Object.entries(options.formData).filter(([_, value]) => isDefined(value)).forEach(([key, value]) => {
99
- if (Array.isArray(value)) {
100
- value.forEach((v) => process(key, v));
101
- } else {
102
- process(key, value);
103
- }
104
- });
105
- return formData;
106
- }
107
- return void 0;
108
- };
109
- const resolve = async (options, resolver) => {
110
- if (typeof resolver === "function") {
111
- return resolver(options);
112
- }
113
- return resolver;
114
- };
115
- const getHeaders = async (config, options) => {
116
- const token = await resolve(options, config.TOKEN);
117
- const username = await resolve(options, config.USERNAME);
118
- const password = await resolve(options, config.PASSWORD);
119
- const additionalHeaders = await resolve(options, config.HEADERS);
120
- const headers = Object.entries(__spreadValues(__spreadValues({
121
- Accept: "application/json"
122
- }, additionalHeaders), options.headers)).filter(([_, value]) => isDefined(value)).reduce((headers2, [key, value]) => __spreadProps(__spreadValues({}, headers2), {
123
- [key]: String(value)
124
- }), {});
125
- if (isStringWithValue(token)) {
126
- headers["Authorization"] = `Bearer ${token}`;
127
- }
128
- if (isStringWithValue(username) && isStringWithValue(password)) {
129
- const credentials = base64(`${username}:${password}`);
130
- headers["Authorization"] = `Basic ${credentials}`;
131
- }
132
- if (options.body) {
133
- if (options.mediaType) {
134
- headers["Content-Type"] = options.mediaType;
135
- } else if (isBlob(options.body)) {
136
- headers["Content-Type"] = options.body.type || "application/octet-stream";
137
- } else if (isString(options.body)) {
138
- headers["Content-Type"] = "text/plain";
139
- } else if (!isFormData(options.body)) {
140
- headers["Content-Type"] = "application/json";
141
- }
142
- }
143
- return new Headers(headers);
144
- };
145
- const getRequestBody = (options) => {
146
- var _a;
147
- if (options.body) {
148
- if ((_a = options.mediaType) == null ? void 0 : _a.includes("/json")) {
149
- return JSON.stringify(options.body);
150
- } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
151
- return options.body;
152
- } else {
153
- return JSON.stringify(options.body);
154
- }
155
- }
156
- return void 0;
157
- };
158
- const sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
159
- const controller = new AbortController();
160
- const request2 = {
161
- headers,
162
- body: body != null ? body : formData,
163
- method: options.method,
164
- signal: controller.signal
165
- };
166
- if (config.WITH_CREDENTIALS) {
167
- request2.credentials = config.CREDENTIALS;
168
- }
169
- onCancel(() => controller.abort());
170
- return await fetch(url, request2);
171
- };
172
- const getResponseHeader = (response, responseHeader) => {
173
- if (responseHeader) {
174
- const content = response.headers.get(responseHeader);
175
- if (isString(content)) {
176
- return content;
177
- }
178
- }
179
- return void 0;
180
- };
181
- const getResponseBody = async (response) => {
182
- if (response.status !== 204) {
183
- try {
184
- const contentType = response.headers.get("Content-Type");
185
- if (contentType) {
186
- const isJSON = contentType.toLowerCase().startsWith("application/json");
187
- if (isJSON) {
188
- return await response.json();
189
- } else {
190
- return await response.text();
191
- }
192
- }
193
- } catch (error) {
194
- console.error(error);
195
- }
196
- }
197
- return void 0;
198
- };
199
- const catchErrorCodes = (options, result) => {
200
- const errors = __spreadValues({
201
- 400: "Bad Request",
202
- 401: "Unauthorized",
203
- 403: "Forbidden",
204
- 404: "Not Found",
205
- 500: "Internal Server Error",
206
- 502: "Bad Gateway",
207
- 503: "Service Unavailable"
208
- }, options.errors);
209
- const error = errors[result.status];
210
- if (error) {
211
- throw new ApiError(options, result, error);
212
- }
213
- if (!result.ok) {
214
- throw new ApiError(options, result, "Generic Error");
215
- }
216
- };
217
- const request = (config, options) => {
218
- return new CancelablePromise(async (resolve2, reject, onCancel) => {
219
- try {
220
- const url = getUrl(config, options);
221
- const formData = getFormData(options);
222
- const body = getRequestBody(options);
223
- const headers = await getHeaders(config, options);
224
- if (!onCancel.isCancelled) {
225
- const response = await sendRequest(config, options, url, body, formData, headers, onCancel);
226
- const responseBody = await getResponseBody(response);
227
- const responseHeader = getResponseHeader(response, options.responseHeader);
228
- const result = {
229
- url,
230
- ok: response.ok,
231
- status: response.status,
232
- statusText: response.statusText,
233
- body: responseHeader != null ? responseHeader : responseBody
234
- };
235
- catchErrorCodes(options, result);
236
- resolve2(result.body);
237
- }
238
- } catch (error) {
239
- reject(error);
240
- }
241
- });
242
- };
243
-
244
- export { request, sendRequest };
@@ -1,8 +0,0 @@
1
- type Address = {
2
- /**
3
- * A wallet or contract address in mixed-case checksum encoding.
4
- */
5
- address: string;
6
- };
7
-
8
- export { Address };
@@ -1,28 +0,0 @@
1
- type Asset = {
2
- /**
3
- * Unique ID for an asset.
4
- */
5
- assetId: string;
6
- /**
7
- * Name of this asset.
8
- */
9
- name: string;
10
- /**
11
- * Symbol for this asset (max 4 characters).
12
- */
13
- symbol: string;
14
- /**
15
- * Denomination of this asset to represent fungibility.
16
- */
17
- denomination: number;
18
- /**
19
- * Type of asset like SECP256K1 or NFT.
20
- */
21
- type: string;
22
- /**
23
- * Amount of the asset.
24
- */
25
- amount: string;
26
- };
27
-
28
- export { Asset };
@@ -1,8 +0,0 @@
1
- declare enum AssetType {
2
- FIXED_CAP = "Fixed Cap",
3
- UNLIMITED_CAP = "Unlimited Cap",
4
- STABLECOIN = "Stablecoin",
5
- NFT = "NFT"
6
- }
7
-
8
- export { AssetType };
@@ -1,9 +0,0 @@
1
- var AssetType = /* @__PURE__ */ ((AssetType2) => {
2
- AssetType2["FIXED_CAP"] = "Fixed Cap";
3
- AssetType2["UNLIMITED_CAP"] = "Unlimited Cap";
4
- AssetType2["STABLECOIN"] = "Stablecoin";
5
- AssetType2["NFT"] = "NFT";
6
- return AssetType2;
7
- })(AssetType || {});
8
-
9
- export { AssetType };
@@ -1,15 +0,0 @@
1
- import { ProposerDetails } from './ProposerDetails.js';
2
-
3
- type Block = {
4
- blockNumber: string;
5
- blockHash: string;
6
- parentHash: string;
7
- blockTimestamp: number;
8
- blockType: string;
9
- txCount: number;
10
- transactions?: Array<string>;
11
- blockSizeBytes: number;
12
- proposerDetails?: ProposerDetails;
13
- };
14
-
15
- export { Block };
@@ -1,9 +0,0 @@
1
- declare enum BlockchainId {
2
- P_CHAIN = "p-chain",
3
- X_CHAIN = "x-chain",
4
- C_CHAIN = "c-chain",
5
- _11111111111111111111111111111111LPO_YY = "11111111111111111111111111111111LpoYY",
6
- _2O_YMBNV4E_NHYQK2FJJ_V5N_VQLDBTM_NJZQ5S3QS3LO6FTN_C6FBY_M = "2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM"
7
- }
8
-
9
- export { BlockchainId };
@@ -1,10 +0,0 @@
1
- var BlockchainId = /* @__PURE__ */ ((BlockchainId2) => {
2
- BlockchainId2["P_CHAIN"] = "p-chain";
3
- BlockchainId2["X_CHAIN"] = "x-chain";
4
- BlockchainId2["C_CHAIN"] = "c-chain";
5
- BlockchainId2["_11111111111111111111111111111111LPO_YY"] = "11111111111111111111111111111111LpoYY";
6
- BlockchainId2["_2O_YMBNV4E_NHYQK2FJJ_V5N_VQLDBTM_NJZQ5S3QS3LO6FTN_C6FBY_M"] = "2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM";
7
- return BlockchainId2;
8
- })(BlockchainId || {});
9
-
10
- export { BlockchainId };
@@ -1,8 +0,0 @@
1
- import { CChainSharedAssetBalance } from './CChainSharedAssetBalance.js';
2
-
3
- type CChainAtomicBalances = {
4
- atomicMemoryUnlocked: Array<CChainSharedAssetBalance>;
5
- atomicMemoryLocked: Array<CChainSharedAssetBalance>;
6
- };
7
-
8
- export { CChainAtomicBalances };