@avalabs/glacier-sdk 2.8.0-alpha.8 → 2.8.0-alpha.80

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/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './src/generated/models';
2
- export * from './src/glacierClient';
package/rollup.config.js DELETED
@@ -1,33 +0,0 @@
1
- import json from '@rollup/plugin-json';
2
- import commonjs from 'rollup-plugin-commonjs';
3
- import del from 'rollup-plugin-delete';
4
- import typescript from 'rollup-plugin-typescript2';
5
- import ttypescript from 'ttypescript';
6
-
7
- export default {
8
- input: './index.ts',
9
- output: {
10
- dir: 'dist',
11
- format: 'cjs',
12
- sourcemap: process.env.BUILD === 'production' ? false : true,
13
- },
14
- plugins: [
15
- del({ targets: 'dist/*' }),
16
- typescript({
17
- typescript: ttypescript,
18
- tsconfig: 'tsconfig.json',
19
- tsconfigOverride: {
20
- exclude: ['./test/**'],
21
- // index.ts is included here and not in tsconfig.ts so relative imports
22
- // are imported correctly by VS Code.
23
- include: ['src', 'index.ts'],
24
- compilerOptions: {
25
- rootDir: './',
26
- },
27
- },
28
- }),
29
- json(),
30
- commonjs(),
31
- ],
32
- external: ['big.js'],
33
- };
@@ -1,460 +0,0 @@
1
- /* eslint-disable */
2
- /* tslint:disable */
3
- /*
4
- * ---------------------------------------------------------------
5
- * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
6
- * ## ##
7
- * ## AUTHOR: acacode ##
8
- * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
9
- * ---------------------------------------------------------------
10
- */
11
-
12
- export enum CurrencyCode {
13
- Usd = 'usd',
14
- Eur = 'eur',
15
- Aud = 'aud',
16
- Cad = 'cad',
17
- Chf = 'chf',
18
- Clp = 'clp',
19
- Czk = 'czk',
20
- Dkk = 'dkk',
21
- Gbp = 'gbp',
22
- Hkd = 'hkd',
23
- Huf = 'huf',
24
- }
25
-
26
- export interface Money {
27
- /**
28
- * ISO 4217 currency code.
29
- * @example usd
30
- */
31
- currencyCode: CurrencyCode;
32
-
33
- /**
34
- * Monetary value in base 10 decimals.
35
- * @example 42.42
36
- */
37
- value: number;
38
- }
39
-
40
- export interface NativeTokenBalance {
41
- name: string;
42
- symbol: string;
43
- decimals: number;
44
- logoUri?: string;
45
- chainId: string;
46
- price?: Money;
47
- balance: string;
48
- balanceValue?: Money;
49
- }
50
-
51
- export interface NativeBalance {
52
- nativeTokenBalance: NativeTokenBalance;
53
- }
54
-
55
- export interface Erc20TokenBalance {
56
- /** @example 0x71C7656EC7ab88b098defB751B7401B5f6d8976F */
57
- address: string;
58
- name: string;
59
- symbol: string;
60
- decimals: number;
61
- logoUri?: string;
62
- price?: Money;
63
- chainId: string;
64
- balance: string;
65
- balanceValue?: Money;
66
- }
67
-
68
- export interface Erc20Balances {
69
- /** 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. */
70
- nextPageToken?: string;
71
- erc20TokenBalances: Erc20TokenBalance[];
72
- }
73
-
74
- export enum Erc721MetadataStatus {
75
- UNKNOWN = 'UNKNOWN',
76
- MISSING_TOKEN = 'MISSING_TOKEN',
77
- INVALID_TOKEN_URI = 'INVALID_TOKEN_URI',
78
- INVALID_TOKEN_URI_SCHEME = 'INVALID_TOKEN_URI_SCHEME',
79
- UNREACHABLE_TOKEN_URI = 'UNREACHABLE_TOKEN_URI',
80
- THROTTLED_TOKEN_URI = 'THROTTLED_TOKEN_URI',
81
- METADATA_CONTENT_TOO_LARGE = 'METADATA_CONTENT_TOO_LARGE',
82
- INVALID_METADATA = 'INVALID_METADATA',
83
- INVALID_METADATA_JSON = 'INVALID_METADATA_JSON',
84
- INDEXED = 'INDEXED',
85
- UNINDEXED = 'UNINDEXED',
86
- }
87
-
88
- export interface Erc721Metadata {
89
- /**
90
- * The metadata indexing status of the nft.
91
- * @example indexed
92
- */
93
- indexStatus: Erc721MetadataStatus;
94
- metadataLastUpdatedTimestamp?: number;
95
- name?: string;
96
- symbol?: string;
97
- imageUri?: string;
98
- description?: string;
99
- animationUri?: string;
100
- externalUrl?: string;
101
- background?: string;
102
- attributes?: string;
103
- }
104
-
105
- export interface Erc721TokenBalance {
106
- /** @example 0x71C7656EC7ab88b098defB751B7401B5f6d8976F */
107
- address: string;
108
- name: string;
109
- symbol: string;
110
- tokenId: string;
111
- tokenUri: string;
112
- metadata: Erc721Metadata;
113
- chainId: string;
114
- }
115
-
116
- export interface Erc721Balances {
117
- /** 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. */
118
- nextPageToken?: string;
119
- erc721TokenBalances: Erc721TokenBalance[];
120
- }
121
-
122
- export interface Block {
123
- /**
124
- * The block number on the chain.
125
- * @example 339
126
- */
127
- blockNumber: string;
128
-
129
- /**
130
- * The block finality timestamp.
131
- * @example 1648672486
132
- */
133
- blockTimestamp: number;
134
-
135
- /**
136
- * The block hash identifier.
137
- * @example 0x17533aeb5193378b9ff441d61728e7a2ebaf10f61fd5310759451627dfca2e7c
138
- */
139
- blockHash: string;
140
-
141
- /** The number of transactions in the block. */
142
- txCount: number;
143
-
144
- /** The base gas fee for a transaction to be included in the block. */
145
- baseFee: string;
146
-
147
- /** The gas used for transactions in the block. */
148
- gasUsed: string;
149
-
150
- /** The total gas limit set for transactions in the block. */
151
- gasLimit: string;
152
- gasCost: string;
153
-
154
- /** The hash of the parent block. */
155
- parentHash: string;
156
-
157
- /** The amount of fees spent/burned for transactions in the block. */
158
- feesSpent: string;
159
-
160
- /** The cumulative number of transactions for the chain including this block. */
161
- cumulativeTransactions: string;
162
- }
163
-
164
- export interface ListBlocks {
165
- /** 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. */
166
- nextPageToken?: string;
167
- blocks: Block[];
168
- }
169
-
170
- export interface ListTransfers {
171
- /** 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. */
172
- nextPageToken?: string;
173
- transfers: Erc20Transfer[] | Erc721Transfer[];
174
- }
175
-
176
- export interface RichAddress {
177
- name?: string;
178
- symbol?: string;
179
- decimals?: number;
180
- logoUri?: string;
181
-
182
- /** @example 0x71C7656EC7ab88b098defB751B7401B5f6d8976F */
183
- address: string;
184
- }
185
-
186
- export interface Method {
187
- /**
188
- * The contract method hash identifier.
189
- * @example 0xa9059cbb
190
- */
191
- methodHash: string;
192
-
193
- /**
194
- * The contract method name including parameter types.
195
- * @example transfer(address,uint256)
196
- */
197
- methodName?: string;
198
- }
199
-
200
- export interface NativeTransaction {
201
- /**
202
- * The block number on the chain.
203
- * @example 339
204
- */
205
- blockNumber: string;
206
-
207
- /**
208
- * The block finality timestamp.
209
- * @example 1648672486
210
- */
211
- blockTimestamp: number;
212
-
213
- /**
214
- * The block hash identifier.
215
- * @example 0x17533aeb5193378b9ff441d61728e7a2ebaf10f61fd5310759451627dfca2e7c
216
- */
217
- blockHash: string;
218
-
219
- /**
220
- * The index at which the transaction occured in the block (0-indexed).
221
- * @example 0
222
- */
223
- blockIndex: number;
224
-
225
- /**
226
- * The transaction hash identifier.
227
- * @example 0x3e9303f81be00b4af28515dab7b914bf3dbff209ea10e7071fa24d4af0a112d4
228
- */
229
- txHash: string;
230
-
231
- /**
232
- * The transaction status, which is either 0 (failed) or 1 (successful).
233
- * @example 1
234
- */
235
- txStatus: string;
236
-
237
- /**
238
- * The transaction type.
239
- * @example 1
240
- */
241
- txType: number;
242
-
243
- /**
244
- * The gas limit set for the transaction.
245
- * @example 51373
246
- */
247
- gasLimit: string;
248
-
249
- /**
250
- * The amount of gas used.
251
- * @example 51373
252
- */
253
- gasUsed: string;
254
-
255
- /**
256
- * The gas price denominated by the number of decimals of the native token.
257
- * @example 470000000000
258
- */
259
- gasPrice: string;
260
-
261
- /**
262
- * The nonce used by the sender of the transaction.
263
- * @example 1
264
- */
265
- nonce: string;
266
- from: RichAddress;
267
- to: RichAddress;
268
- method?: Method;
269
-
270
- /** @example 10000000000000000000 */
271
- value: string;
272
- }
273
-
274
- export interface Erc20Token {
275
- /** @example 0x71C7656EC7ab88b098defB751B7401B5f6d8976F */
276
- address: string;
277
- name: string;
278
- symbol: string;
279
- decimals: number;
280
- logoUri?: string;
281
- price?: Money;
282
- }
283
-
284
- export interface Erc20TransferDetails {
285
- from: RichAddress;
286
- to: RichAddress;
287
- erc20Token: Erc20Token;
288
-
289
- /** @example 10000000000000000000 */
290
- value: string;
291
- }
292
-
293
- export interface Erc721Token {
294
- /** @example 0x71C7656EC7ab88b098defB751B7401B5f6d8976F */
295
- address: string;
296
- name: string;
297
- symbol: string;
298
- tokenId: string;
299
- tokenUri: string;
300
- metadata: Erc721Metadata;
301
- }
302
-
303
- export interface Erc721TransferDetails {
304
- from: RichAddress;
305
- to: RichAddress;
306
- erc721Token: Erc721Token;
307
- }
308
-
309
- export enum InternalTransactionOpCall {
310
- UNKNOWN = 'UNKNOWN',
311
- CALL = 'CALL',
312
- CREATE = 'CREATE',
313
- CREATE2 = 'CREATE2',
314
- CALLCODE = 'CALLCODE',
315
- DELEGATECALL = 'DELEGATECALL',
316
- STATICCALL = 'STATICCALL',
317
- }
318
-
319
- export interface InternalTransactionDetails {
320
- from: RichAddress;
321
- to: RichAddress;
322
- internalTxType: InternalTransactionOpCall;
323
-
324
- /** @example 10000000000000000000 */
325
- value: string;
326
- isReverted: boolean;
327
- }
328
-
329
- export interface TransactionDetails {
330
- nativeTransaction: NativeTransaction;
331
- erc20Transfers?: Erc20TransferDetails[];
332
- erc721Transfers?: Erc721TransferDetails[];
333
- internalTransactions?: InternalTransactionDetails[];
334
- }
335
-
336
- export interface ListTransactionDetails {
337
- /** 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. */
338
- nextPageToken?: string;
339
- transactions: TransactionDetails[];
340
- }
341
-
342
- export interface ListNativeTransactions {
343
- /** 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. */
344
- nextPageToken?: string;
345
- transactions: NativeTransaction[];
346
- }
347
-
348
- export interface Erc20Transfer {
349
- /**
350
- * The block number on the chain.
351
- * @example 339
352
- */
353
- blockNumber: string;
354
-
355
- /**
356
- * The block finality timestamp.
357
- * @example 1648672486
358
- */
359
- blockTimestamp: number;
360
-
361
- /**
362
- * The transaction hash identifier.
363
- * @example 0x3e9303f81be00b4af28515dab7b914bf3dbff209ea10e7071fa24d4af0a112d4
364
- */
365
- txHash: string;
366
- from: RichAddress;
367
- to: RichAddress;
368
- erc20Token: Erc20Token;
369
-
370
- /** @example 10000000000000000000 */
371
- value: string;
372
- }
373
-
374
- export interface ListErc20Transactions {
375
- /** 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. */
376
- nextPageToken?: string;
377
- transactions: Erc20Transfer[];
378
- }
379
-
380
- export interface Erc721Transfer {
381
- /**
382
- * The block number on the chain.
383
- * @example 339
384
- */
385
- blockNumber: string;
386
-
387
- /**
388
- * The block finality timestamp.
389
- * @example 1648672486
390
- */
391
- blockTimestamp: number;
392
-
393
- /**
394
- * The transaction hash identifier.
395
- * @example 0x3e9303f81be00b4af28515dab7b914bf3dbff209ea10e7071fa24d4af0a112d4
396
- */
397
- txHash: string;
398
- from: RichAddress;
399
- to: RichAddress;
400
- erc721Token: Erc721Token;
401
- }
402
-
403
- export interface ListErc721Transactions {
404
- /** 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. */
405
- nextPageToken?: string;
406
- transactions: Erc721Transfer[];
407
- }
408
-
409
- export interface NetworkToken {
410
- name: string;
411
- symbol: string;
412
- decimals: number;
413
- logoUri?: string;
414
- description?: string;
415
- }
416
-
417
- export interface NetworkTokenDetails {
418
- networkToken: NetworkToken;
419
- currentPrice?: Money;
420
- historicalPrice?: Money;
421
- }
422
-
423
- export interface FullTransactionDetails {
424
- nativeTransaction: NativeTransaction;
425
- erc20Transfers?: Erc20TransferDetails[];
426
- erc721Transfers?: Erc721TransferDetails[];
427
- internalTransactions?: InternalTransactionDetails[];
428
- networkTokenDetails: NetworkTokenDetails;
429
- }
430
-
431
- export enum VmName {
432
- EVM = 'EVM',
433
- BITCOIN = 'BITCOIN',
434
- ETHEREUM = 'ETHEREUM',
435
- }
436
-
437
- export interface UtilityAddresses {
438
- multicall?: string;
439
- }
440
-
441
- export interface ChainInfo {
442
- chainId: string;
443
- chainName: string;
444
- description: string;
445
- platformChainId?: string;
446
- subnetId?: string;
447
- vmId?: string;
448
- vmName: VmName;
449
- explorerUrl?: string;
450
- rpcUrl: string;
451
- wsUrl?: string;
452
- isTestnet: boolean;
453
- utilityAddresses?: UtilityAddresses;
454
- networkToken: NetworkToken;
455
- chainLogoUri?: string;
456
- }
457
-
458
- export interface Chains {
459
- chains: ChainInfo[];
460
- }
@@ -1,190 +0,0 @@
1
- import { HttpClient, HttpOptions } from '@avalabs/utils-sdk';
2
- import {
3
- ChainInfo,
4
- Chains,
5
- CurrencyCode,
6
- Erc20Balances,
7
- Erc721Balances,
8
- ListTransactionDetails,
9
- NativeBalance,
10
- TransactionDetails,
11
- } from './generated/models';
12
- import { HealthStatusCheck } from './types';
13
-
14
- export class GlacierClient {
15
- private httpClient: HttpClient;
16
- constructor(
17
- private baseUrl: string,
18
- private version = 'v1',
19
- private httpOptions?: HttpOptions
20
- ) {
21
- this.httpClient = new HttpClient(
22
- `${this.baseUrl}/${this.version}`,
23
- this.httpOptions
24
- );
25
- }
26
- /**
27
- *
28
- * @name HealthCheck
29
- * @summary Get the health of the service.
30
- * @request GET:/${version}/health-check
31
- * @response `200` `{ status?: string, info?: Record<string, { status?: string }>, error?: Record<string, { status?: string }>, details?: Record<string, { status?: string }> }` The Health Check is successful
32
- * @response `503` `{ status?: string, info?: Record<string, { status?: string }>, error?: Record<string, { status?: string }>, details?: Record<string, { status?: string }> }` The Health Check is not successful
33
- */
34
- healthCheck(
35
- params: Record<string, any> = {},
36
- customOptions: HttpOptions = {}
37
- ) {
38
- return this.httpClient.get<HealthStatusCheck>(
39
- `/health-check`,
40
- params,
41
- customOptions
42
- );
43
- }
44
-
45
- /**
46
- * No description
47
- *
48
- * @name GetNativeBalance
49
- * @summary Get native token balance of a wallet address for a given chain.
50
- * @request GET:/v1/chains/{chainId}/addresses/{address}/balances:getNative
51
- * @response `200` `NativeBalanceDto`
52
- */
53
- getNativeBalance(
54
- chainId: string,
55
- address: string,
56
- query?: {
57
- currency?: CurrencyCode;
58
- },
59
- params: Record<string, any> = {},
60
- customOptions: HttpOptions = {}
61
- ) {
62
- return this.httpClient.get<NativeBalance>(
63
- `/chains/${chainId}/addresses/${address}/balances:getNative`,
64
- { ...query, ...params },
65
- customOptions
66
- );
67
- }
68
- /**
69
- *
70
- * @name ListErc20Balances
71
- * @summary Get erc-20 token balances of a wallet address for a given chain.
72
- * @request GET:/v1/chains/{chainId}/addresses/{address}/balances:listErc20
73
- * @response `200` `Erc20BalancesDto`
74
- */
75
- listErc20Balances(
76
- chainId: string,
77
- address: string,
78
- query?: {
79
- pageSize?: number;
80
- pageToken?: string;
81
- currency?: CurrencyCode;
82
- },
83
- params: Record<string, any> = {},
84
- customOptions: HttpOptions = {}
85
- ) {
86
- return this.httpClient.get<Erc20Balances>(
87
- `/chains/${chainId}/addresses/${address}/balances:listErc20`,
88
- { ...query, ...params },
89
- customOptions
90
- );
91
- }
92
- /**
93
- * No description
94
- *
95
- * @name ListErc721Balances
96
- * @summary Get erc-721 token balances of a wallet address for a given chain.
97
- * @request GET:/v1/chains/{chainId}/addresses/{address}/balances:listErc721
98
- * @response `200` `Erc721BalancesDto`
99
- */
100
- listErc721Balances(
101
- chainId: string,
102
- address: string,
103
- query?: {
104
- pageSize?: number;
105
- pageToken?: string;
106
- currency?: CurrencyCode;
107
- },
108
- params: Record<string, any> = {},
109
- customOptions: HttpOptions = {}
110
- ) {
111
- return this.httpClient.get<Erc721Balances>(
112
- `/chains/${chainId}/addresses/${address}/balances:listErc721`,
113
- { ...query, ...params },
114
- customOptions
115
- );
116
- }
117
- /**
118
- * @description Gets a list of transactions where the given wallet address had an on-chain interaction for a given chain. The erc20 transfers, erc721 transfers, and internal transactions returned as part of the native transactions are only those where the address had an interaction. Therefore the transactions returned from this list may not be complete representations of the on-chain data. For a complete view of a transaction use the `/chains/:chainId/transactions/:txHash` endpoint.
119
- *
120
- * @name ListTransactions
121
- * @summary Gets a list of transactions for a wallet address and chain.
122
- * @request GET:/v1/chains/{chainId}/addresses/{address}/transactions
123
- * @response `200` `ListTransactionDetailsDto`
124
- */
125
- listTransactions(
126
- chainId: string,
127
- address: string,
128
- query?: { pageSize?: number; pageToken?: string },
129
- params: Record<string, any> = {},
130
- customOptions: HttpOptions = {}
131
- ) {
132
- return this.httpClient.get<ListTransactionDetails>(
133
- `/chains/${chainId}/addresses/${address}/transactions`,
134
- { ...query, ...params },
135
- customOptions
136
- );
137
- }
138
- /**
139
- *
140
- * @name GetTransaction
141
- * @summary Gets the details of a single transaction.
142
- * @request GET:/v1/chains/{chainId}/transactions/{txHash}
143
- * @response `200` `TransactionDetailsDto`
144
- */
145
- getTransaction(
146
- chainId: string,
147
- txHash: string,
148
- params: Record<string, any> = {},
149
- customOptions: HttpOptions = {}
150
- ) {
151
- return this.httpClient.get<TransactionDetails>(
152
- `/chains/${chainId}/transactions/${txHash}`,
153
- params,
154
- customOptions
155
- );
156
- }
157
- /**
158
- *
159
- * @name SupportedChains
160
- * @summary Gets the list of chains supported by the api.
161
- * @request GET:/v1/chains
162
- * @response `200` `ChainsDto`
163
- */
164
- supportedChains(
165
- params: Record<string, any> = {},
166
- customOptions: HttpOptions = {}
167
- ) {
168
- return this.httpClient.get<Chains>(`/chains`, params, customOptions);
169
- }
170
-
171
- /**
172
- * No description
173
- *
174
- * @name GetChainInfo
175
- * @summary Gets chain information by chain id.
176
- * @request GET:/v1/chains/{chainId}
177
- * @response `200` `ChainInfoDto`
178
- */
179
- getChainInfo(
180
- chainId: string,
181
- params: Record<string, any> = {},
182
- customOptions: HttpOptions = {}
183
- ) {
184
- return this.httpClient.get<ChainInfo>(
185
- `/chains/${chainId}`,
186
- params,
187
- customOptions
188
- );
189
- }
190
- }
package/src/types.ts DELETED
@@ -1,6 +0,0 @@
1
- export interface HealthStatusCheck {
2
- status?: string;
3
- info?: Record<string, { status?: string }>;
4
- error?: Record<string, { status?: string }>;
5
- details?: Record<string, { status?: string }>;
6
- }