@covalenthq/client-sdk 0.2.7 → 0.2.8

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 (41) hide show
  1. package/README.md +10 -0
  2. package/dist/index.d.ts +8 -0
  3. package/dist/index.js +22 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/services/BalanceService.js.map +1 -1
  6. package/dist/services/BaseService.d.ts +2 -4
  7. package/dist/services/BaseService.js +3 -4
  8. package/dist/services/BaseService.js.map +1 -1
  9. package/dist/services/Client.d.ts +2 -2
  10. package/dist/services/Client.js +1 -1
  11. package/dist/services/NftService.d.ts +3 -3
  12. package/dist/services/NftService.js +2 -2
  13. package/dist/services/NftService.js.map +1 -1
  14. package/dist/services/XykService.d.ts +126 -29
  15. package/dist/services/XykService.js +186 -17
  16. package/dist/services/XykService.js.map +1 -1
  17. package/dist/util/types/BalanceServiceTypes.d.ts +259 -0
  18. package/dist/util/types/BalanceServiceTypes.js +3 -0
  19. package/dist/util/types/BalanceServiceTypes.js.map +1 -0
  20. package/dist/util/types/BaseServiceTypes.d.ts +172 -0
  21. package/dist/util/types/BaseServiceTypes.js +3 -0
  22. package/dist/util/types/BaseServiceTypes.js.map +1 -0
  23. package/dist/util/types/GenericTypes.d.ts +75 -0
  24. package/dist/util/types/GenericTypes.js +3 -0
  25. package/dist/util/types/GenericTypes.js.map +1 -0
  26. package/dist/util/types/NftServiceTypes.d.ts +213 -0
  27. package/dist/util/types/NftServiceTypes.js +3 -0
  28. package/dist/util/types/NftServiceTypes.js.map +1 -0
  29. package/dist/util/types/PricingServiceTypes.d.ts +44 -0
  30. package/dist/util/types/PricingServiceTypes.js +3 -0
  31. package/dist/util/types/PricingServiceTypes.js.map +1 -0
  32. package/dist/util/types/SecurityServiceTypes.d.ts +70 -0
  33. package/dist/util/types/SecurityServiceTypes.js +3 -0
  34. package/dist/util/types/SecurityServiceTypes.js.map +1 -0
  35. package/dist/util/types/TransactionServiceTypes.d.ts +314 -0
  36. package/dist/util/types/TransactionServiceTypes.js +3 -0
  37. package/dist/util/types/TransactionServiceTypes.js.map +1 -0
  38. package/dist/util/types/XykServiceTypes.d.ts +465 -0
  39. package/dist/util/types/XykServiceTypes.js +3 -0
  40. package/dist/util/types/XykServiceTypes.js.map +1 -0
  41. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { Chains, Response } from "./Client";
1
+ import { Chains, Quotes, Response } from "./Client";
2
2
  declare class PoolResponse {
3
3
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
4
4
  updated_at: Date;
@@ -13,8 +13,10 @@ declare class PoolResponse {
13
13
  constructor(data: PoolResponse);
14
14
  }
15
15
  declare class Pool {
16
+ /** * The pair address. */
16
17
  exchange: string;
17
18
  swap_count_24h: string;
19
+ /** * The total liquidity converted to fiat in `quote-currency`. */
18
20
  total_liquidity_quote: string;
19
21
  volume_24h_quote: string;
20
22
  fee_24h_quote: string;
@@ -26,7 +28,7 @@ declare class Pool {
26
28
  chain_name: string;
27
29
  /** * The requested chain ID eg: `1`. */
28
30
  chain_id: string;
29
- /** * The name of the DEX, eg: `uniswap`. */
31
+ /** * The name of the DEX, eg: `uniswap_v2`. */
30
32
  dex_name: string;
31
33
  volume_7d_quote: string;
32
34
  annualized_fee: string;
@@ -65,6 +67,36 @@ declare class Token {
65
67
  volume_out_7d: string;
66
68
  constructor(data: Token);
67
69
  }
70
+ declare class PoolToDexResponse {
71
+ /** * The timestamp when the response was generated. Useful to show data staleness to users. */
72
+ updated_at: Date;
73
+ /** * The requested address. */
74
+ address: string;
75
+ /** * The requested chain ID eg: `1`. */
76
+ chain_id: number;
77
+ /** * The requested chain name eg: `eth-mainnet`. */
78
+ chain_name: string;
79
+ /** * List of response items. */
80
+ items: PoolToDexItem[];
81
+ constructor(data: PoolToDexResponse);
82
+ }
83
+ declare class SupportedDex {
84
+ /** * The requested chain ID eg: `1`. */
85
+ chain_id: string;
86
+ /** * The requested chain name eg: `eth-mainnet`. */
87
+ chain_name: string;
88
+ /** * The name of the DEX, eg: `uniswap_v2`. */
89
+ dex_name: string;
90
+ factory_contract_address: string;
91
+ router_contract_addresses: string;
92
+ swap_fee: number;
93
+ constructor(data: SupportedDex);
94
+ }
95
+ declare class PoolToDexItem extends SupportedDex {
96
+ /** * The dex logo URL */
97
+ logo_url: string;
98
+ constructor(data: PoolToDexItem);
99
+ }
68
100
  declare class PoolByAddressResponse {
69
101
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
70
102
  updated_at: Date;
@@ -79,8 +111,10 @@ declare class PoolByAddressResponse {
79
111
  constructor(data: PoolByAddressResponse);
80
112
  }
81
113
  declare class PoolWithTimeseries {
114
+ /** * The pair address. */
82
115
  exchange: string;
83
116
  swap_count_24h: string;
117
+ /** * The total liquidity converted to fiat in `quote-currency`. */
84
118
  total_liquidity_quote: string;
85
119
  volume_24h_quote: string;
86
120
  fee_24h_quote: string;
@@ -90,7 +124,7 @@ declare class PoolWithTimeseries {
90
124
  quote_rate: string;
91
125
  /** * The requested chain ID eg: `1`. */
92
126
  chain_id: string;
93
- /** * The name of the DEX, eg: `uniswap`. */
127
+ /** * The name of the DEX, eg: `uniswap_v2`. */
94
128
  dex_name: string;
95
129
  volume_7d_quote: string;
96
130
  annualized_fee: string;
@@ -107,11 +141,12 @@ declare class PoolWithTimeseries {
107
141
  constructor(data: PoolWithTimeseries);
108
142
  }
109
143
  declare class VolumeTimeseries {
110
- /** * The name of the DEX, eg: `uniswap`. */
144
+ /** * The name of the DEX, eg: `uniswap_v2`. */
111
145
  dex_name: string;
112
146
  /** * The requested chain ID eg: `1`. */
113
147
  chain_id: string;
114
148
  dt: string;
149
+ /** * The pair address. */
115
150
  exchange: string;
116
151
  sum_amount_0_in: string;
117
152
  sum_amount_0_out: string;
@@ -124,11 +159,12 @@ declare class VolumeTimeseries {
124
159
  constructor(data: VolumeTimeseries);
125
160
  }
126
161
  declare class LiquidityTimeseries {
127
- /** * The name of the DEX, eg: `uniswap`. */
162
+ /** * The name of the DEX, eg: `uniswap_v2`. */
128
163
  dex_name: string;
129
164
  /** * The requested chain ID eg: `1`. */
130
165
  chain_id: string;
131
166
  dt: string;
167
+ /** * The pair address. */
132
168
  exchange: string;
133
169
  r0_c: string;
134
170
  r1_c: string;
@@ -138,11 +174,12 @@ declare class LiquidityTimeseries {
138
174
  constructor(data: LiquidityTimeseries);
139
175
  }
140
176
  declare class PriceTimeseries {
141
- /** * The name of the DEX, eg: `uniswap`. */
177
+ /** * The name of the DEX, eg: `uniswap_v2`. */
142
178
  dex_name: string;
143
179
  /** * The requested chain ID eg: `1`. */
144
180
  chain_id: string;
145
181
  dt: string;
182
+ /** * The pair address. */
146
183
  exchange: string;
147
184
  price_of_token_0_in_token_1: string;
148
185
  price_of_token_0_in_token_1_description: string;
@@ -154,6 +191,57 @@ declare class PriceTimeseries {
154
191
  price_of_token_1_in_quote_currency: string;
155
192
  constructor(data: PriceTimeseries);
156
193
  }
194
+ declare class PoolsDexDataResponse {
195
+ /** * The timestamp when the response was generated. Useful to show data staleness to users. */
196
+ updated_at: Date;
197
+ /** * The requested address. */
198
+ address: string;
199
+ /** * The requested chain ID eg: `1`. */
200
+ chain_id: number;
201
+ /** * The requested chain name eg: `eth-mainnet`. */
202
+ chain_name: string;
203
+ /** * The requested quote currency eg: `USD`. */
204
+ quote_currency: string;
205
+ /** * List of response items. */
206
+ items: PoolsDexDataItem[];
207
+ /** * Pagination metadata. */
208
+ pagination: Pagination;
209
+ constructor(data: PoolsDexDataResponse);
210
+ }
211
+ declare class PoolsDexDataItem {
212
+ /** * The name of the DEX, eg: `uniswap_v2`. */
213
+ dex_name: string;
214
+ /** * The pair address. */
215
+ exchange: string;
216
+ /** * The combined ticker symbol of token0 and token1 separated with a hypen. */
217
+ exchange_ticker_symbol: string;
218
+ /** * The dex logo URL for the pair address. */
219
+ exchange_logo_url: string;
220
+ /** * The total liquidity converted to fiat in `quote-currency`. */
221
+ total_liquidity_quote: number;
222
+ /** * A prettier version of the total liquidity quote for rendering purposes. */
223
+ pretty_total_liquidity_quote: string;
224
+ /** * Token0's contract metadata and reserve data. */
225
+ token_0: PoolsDexToken;
226
+ /** * Token1's contract metadata and reserve data. */
227
+ token_1: PoolsDexToken;
228
+ constructor(data: PoolsDexDataItem);
229
+ }
230
+ declare class PoolsDexToken {
231
+ /** * Use contract decimals to format the token balance for display purposes - divide the balance by `10^{contract_decimals}`. */
232
+ contract_decimals: number;
233
+ /** * The ticker symbol for this contract. This field is set by a developer and non-unique across a network. */
234
+ contract_ticker_symbol: string;
235
+ /** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
236
+ contract_address: string;
237
+ /** * The contract logo URL. */
238
+ logo_url: string;
239
+ /** * The reserves for the token. */
240
+ reserve: string;
241
+ /** * The exchange rate for the requested quote currency. */
242
+ quote_rate: number;
243
+ constructor(data: PoolsDexToken);
244
+ }
157
245
  declare class AddressExchangeBalancesResponse {
158
246
  /** * The requested address. */
159
247
  address: string;
@@ -225,7 +313,7 @@ declare class TokenV2Volume {
225
313
  chain_name: string;
226
314
  /** * The requested chain ID eg: `1`. */
227
315
  chain_id: string;
228
- /** * The name of the DEX, eg: `uniswap`. */
316
+ /** * The name of the DEX, eg: `uniswap_v2`. */
229
317
  dex_name: string;
230
318
  /** * Use the relevant `contract_address` to lookup prices, logos, token transfers, etc. */
231
319
  contract_address: string;
@@ -242,6 +330,7 @@ declare class TokenV2Volume {
242
330
  swap_count_24h: number;
243
331
  /** * The exchange rate for the requested quote currency. */
244
332
  quote_rate: number;
333
+ /** * The total liquidity converted to fiat in `quote-currency`. */
245
334
  total_liquidity_quote: number;
246
335
  total_volume_24h_quote: number;
247
336
  constructor(data: TokenV2Volume);
@@ -255,18 +344,6 @@ declare class SupportedDexesResponse {
255
344
  pagination: Pagination;
256
345
  constructor(data: SupportedDexesResponse);
257
346
  }
258
- declare class SupportedDex {
259
- /** * The requested chain ID eg: `1`. */
260
- chain_id: string;
261
- /** * The requested chain name eg: `eth-mainnet`. */
262
- chain_name: string;
263
- /** * The name of the DEX, eg: `uniswap`. */
264
- dex_name: string;
265
- factory_contract_address: string;
266
- router_contract_addresses: string;
267
- swap_fee: number;
268
- constructor(data: SupportedDex);
269
- }
270
347
  declare class SingleNetworkExchangeTokenResponse {
271
348
  /** * The timestamp when the response was generated. Useful to show data staleness to users. */
272
349
  updated_at: Date;
@@ -371,7 +448,7 @@ declare class EcosystemChartDataResponse {
371
448
  constructor(data: EcosystemChartDataResponse);
372
449
  }
373
450
  declare class UniswapLikeEcosystemCharts {
374
- /** * The name of the DEX, eg: `uniswap`. */
451
+ /** * The name of the DEX, eg: `uniswap_v2`. */
375
452
  dex_name: string;
376
453
  /** * The requested chain ID eg: `1`. */
377
454
  chain_id: string;
@@ -388,7 +465,7 @@ declare class UniswapLikeEcosystemCharts {
388
465
  constructor(data: UniswapLikeEcosystemCharts);
389
466
  }
390
467
  declare class VolumeEcosystemChart {
391
- /** * The name of the DEX, eg: `uniswap`. */
468
+ /** * The name of the DEX, eg: `uniswap_v2`. */
392
469
  dex_name: string;
393
470
  /** * The requested chain ID eg: `1`. */
394
471
  chain_id: string;
@@ -400,7 +477,7 @@ declare class VolumeEcosystemChart {
400
477
  constructor(data: VolumeEcosystemChart);
401
478
  }
402
479
  declare class LiquidityEcosystemChart {
403
- /** * The name of the DEX, eg: `uniswap`. */
480
+ /** * The name of the DEX, eg: `uniswap_v2`. */
404
481
  dex_name: string;
405
482
  /** * The requested chain ID eg: `1`. */
406
483
  chain_id: string;
@@ -430,6 +507,10 @@ declare class HealthData {
430
507
  latest_block_signed_at: Date;
431
508
  constructor(data: HealthData);
432
509
  }
510
+ export interface GetPoolsForTokenAddressQueryParamOpts {
511
+ /** * The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`. */
512
+ quoteCurrency?: Quotes;
513
+ }
433
514
  /**
434
515
  * XYK APIs
435
516
  *
@@ -444,6 +525,13 @@ export declare class XykService {
444
525
  *
445
526
  */
446
527
  getPools(chainName: Chains, dexName: string): Promise<Response<PoolResponse>>;
528
+ /**
529
+ *
530
+ * @param {string} chainName - The chain name eg: `eth-mainnet`.
531
+ * @param {string} poolAddress - The requested pool address.
532
+ *
533
+ */
534
+ getDexForPoolAddress(chainName: Chains, poolAddress: string): Promise<Response<PoolToDexResponse>>;
447
535
  /**
448
536
  *
449
537
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
@@ -452,6 +540,15 @@ export declare class XykService {
452
540
  *
453
541
  */
454
542
  getPoolByAddress(chainName: Chains, dexName: string, poolAddress: string): Promise<Response<PoolByAddressResponse>>;
543
+ /**
544
+ *
545
+ * @param {string} chainName - The chain name eg: `eth-mainnet`.
546
+ * @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
547
+ * @param {GetPoolsForTokenAddressQueryParamOpts} queryParamOpts
548
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
549
+ *
550
+ */
551
+ getPoolsForTokenAddress(chainName: Chains, tokenAddress: string, queryParamOpts?: GetPoolsForTokenAddressQueryParamOpts): Promise<Response<PoolsDexDataResponse>>;
455
552
  /**
456
553
  *
457
554
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
@@ -463,7 +560,7 @@ export declare class XykService {
463
560
  /**
464
561
  *
465
562
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
466
- * @param {string} dexName - The DEX name eg: `uniswap`.
563
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
467
564
  *
468
565
  */
469
566
  getNetworkExchangeTokens(chainName: Chains, dexName: string): Promise<Response<NetworkExchangeTokensResponse>>;
@@ -476,7 +573,7 @@ export declare class XykService {
476
573
  /**
477
574
  *
478
575
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
479
- * @param {string} dexName - The DEX name eg: `uniswap`.
576
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
480
577
  * @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
481
578
  *
482
579
  */
@@ -484,7 +581,7 @@ export declare class XykService {
484
581
  /**
485
582
  *
486
583
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
487
- * @param {string} dexName - The DEX name eg: `uniswap`.
584
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
488
585
  * @param {string} accountAddress - The account address. Passing in an `ENS` or `RNS` resolves automatically.
489
586
  *
490
587
  */
@@ -492,7 +589,7 @@ export declare class XykService {
492
589
  /**
493
590
  *
494
591
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
495
- * @param {string} dexName - The DEX name eg: `uniswap`.
592
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
496
593
  * @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
497
594
  *
498
595
  */
@@ -500,7 +597,7 @@ export declare class XykService {
500
597
  /**
501
598
  *
502
599
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
503
- * @param {string} dexName - The DEX name eg: `uniswap`.
600
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
504
601
  * @param {string} poolAddress - The pool contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
505
602
  *
506
603
  */
@@ -508,14 +605,14 @@ export declare class XykService {
508
605
  /**
509
606
  *
510
607
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
511
- * @param {string} dexName - The DEX name eg: `uniswap`.
608
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
512
609
  *
513
610
  */
514
611
  getEcosystemChartData(chainName: Chains, dexName: string): Promise<Response<EcosystemChartDataResponse>>;
515
612
  /**
516
613
  *
517
614
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
518
- * @param {string} dexName - The DEX name eg: `uniswap`.
615
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
519
616
  *
520
617
  */
521
618
  getHealthData(chainName: Chains, dexName: string): Promise<Response<HealthDataResponse>>;
@@ -55,6 +55,31 @@ class Token {
55
55
  this.volume_out_7d = data.volume_out_7d;
56
56
  }
57
57
  }
58
+ class PoolToDexResponse {
59
+ constructor(data) {
60
+ this.updated_at = data.updated_at && data.updated_at !== null ? (0, date_fns_1.parseISO)(data.updated_at.toString()) : null;
61
+ this.address = data.address;
62
+ this.chain_id = data.chain_id;
63
+ this.chain_name = data.chain_name;
64
+ this.items = data.items && data.items !== null ? data.items.map((itemData) => new PoolToDexItem(itemData)) : null;
65
+ }
66
+ }
67
+ class SupportedDex {
68
+ constructor(data) {
69
+ this.chain_id = data.chain_id;
70
+ this.chain_name = data.chain_name;
71
+ this.dex_name = data.dex_name;
72
+ this.factory_contract_address = data.factory_contract_address;
73
+ this.router_contract_addresses = data.router_contract_addresses;
74
+ this.swap_fee = data.swap_fee;
75
+ }
76
+ }
77
+ class PoolToDexItem extends SupportedDex {
78
+ constructor(data) {
79
+ super(data);
80
+ this.logo_url = data.logo_url;
81
+ }
82
+ }
58
83
  class PoolByAddressResponse {
59
84
  constructor(data) {
60
85
  this.updated_at = data.updated_at && data.updated_at !== null ? (0, date_fns_1.parseISO)(data.updated_at.toString()) : null;
@@ -133,6 +158,39 @@ class PriceTimeseries {
133
158
  this.price_of_token_1_in_quote_currency = data.price_of_token_1_in_quote_currency;
134
159
  }
135
160
  }
161
+ class PoolsDexDataResponse {
162
+ constructor(data) {
163
+ this.updated_at = data.updated_at && data.updated_at !== null ? (0, date_fns_1.parseISO)(data.updated_at.toString()) : null;
164
+ this.address = data.address;
165
+ this.chain_id = data.chain_id;
166
+ this.chain_name = data.chain_name;
167
+ this.quote_currency = data.quote_currency;
168
+ this.items = data.items && data.items !== null ? data.items.map((itemData) => new PoolsDexDataItem(itemData)) : null;
169
+ this.pagination = data.pagination && data.pagination !== null ? new Pagination(data.pagination) : null;
170
+ }
171
+ }
172
+ class PoolsDexDataItem {
173
+ constructor(data) {
174
+ this.dex_name = data.dex_name;
175
+ this.exchange = data.exchange;
176
+ this.exchange_ticker_symbol = data.exchange_ticker_symbol;
177
+ this.exchange_logo_url = data.exchange_logo_url;
178
+ this.total_liquidity_quote = data.total_liquidity_quote;
179
+ this.pretty_total_liquidity_quote = data.pretty_total_liquidity_quote;
180
+ this.token_0 = data.token_0 && data.token_0 !== null ? new PoolsDexToken(data.token_0) : null;
181
+ this.token_1 = data.token_1 && data.token_1 !== null ? new PoolsDexToken(data.token_1) : null;
182
+ }
183
+ }
184
+ class PoolsDexToken {
185
+ constructor(data) {
186
+ this.contract_decimals = data.contract_decimals;
187
+ this.contract_ticker_symbol = data.contract_ticker_symbol;
188
+ this.contract_address = data.contract_address;
189
+ this.logo_url = data.logo_url;
190
+ this.reserve = data.reserve;
191
+ this.quote_rate = data.quote_rate;
192
+ }
193
+ }
136
194
  class AddressExchangeBalancesResponse {
137
195
  constructor(data) {
138
196
  this.address = data.address;
@@ -206,16 +264,6 @@ class SupportedDexesResponse {
206
264
  this.pagination = data.pagination && data.pagination !== null ? new Pagination(data.pagination) : null;
207
265
  }
208
266
  }
209
- class SupportedDex {
210
- constructor(data) {
211
- this.chain_id = data.chain_id;
212
- this.chain_name = data.chain_name;
213
- this.dex_name = data.dex_name;
214
- this.factory_contract_address = data.factory_contract_address;
215
- this.router_contract_addresses = data.router_contract_addresses;
216
- this.swap_fee = data.swap_fee;
217
- }
218
- }
219
267
  class SingleNetworkExchangeTokenResponse {
220
268
  constructor(data) {
221
269
  this.updated_at = data.updated_at && data.updated_at !== null ? (0, date_fns_1.parseISO)(data.updated_at.toString()) : null;
@@ -409,6 +457,64 @@ class XykService {
409
457
  }
410
458
  }
411
459
  }
460
+ /**
461
+ *
462
+ * @param {string} chainName - The chain name eg: `eth-mainnet`.
463
+ * @param {string} poolAddress - The requested pool address.
464
+ *
465
+ */
466
+ async getDexForPoolAddress(chainName, poolAddress) {
467
+ let success = false;
468
+ let data;
469
+ let response;
470
+ const backoff = new backoff_1.ExponentialBackoff();
471
+ while (!success) {
472
+ try {
473
+ const urlParams = new URLSearchParams();
474
+ response = await fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/address/${poolAddress}/dex_name/?${urlParams}`, {
475
+ headers: {
476
+ "Authorization": `Bearer ${this.apiKey}`,
477
+ "X-Requested-With": Client_1.userAgent
478
+ }
479
+ });
480
+ data = await response.json();
481
+ if (data.error && data.error_code === 429) {
482
+ try {
483
+ await backoff.backOff();
484
+ }
485
+ catch (error) {
486
+ success = true;
487
+ return {
488
+ data: null,
489
+ error: data.error,
490
+ error_code: data ? data.error_code : response.status,
491
+ error_message: data ? data.error_message : "401 Authorization Required"
492
+ };
493
+ }
494
+ }
495
+ else {
496
+ const dataClass = new PoolToDexResponse(data.data);
497
+ (0, ApiHelpers_1.checkAndModifyResponse)(dataClass);
498
+ success = true;
499
+ return {
500
+ data: dataClass,
501
+ error: data.error,
502
+ error_code: data ? data.error_code : response.status,
503
+ error_message: data ? data.error_message : "401 Authorization Required"
504
+ };
505
+ }
506
+ }
507
+ catch (error) {
508
+ success = true;
509
+ return {
510
+ data: null,
511
+ error: true,
512
+ error_code: data ? data.error_code : response.status,
513
+ error_message: data ? data.error_message : "401 Authorization Required"
514
+ };
515
+ }
516
+ }
517
+ }
412
518
  /**
413
519
  *
414
520
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
@@ -468,6 +574,69 @@ class XykService {
468
574
  }
469
575
  }
470
576
  }
577
+ /**
578
+ *
579
+ * @param {string} chainName - The chain name eg: `eth-mainnet`.
580
+ * @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
581
+ * @param {GetPoolsForTokenAddressQueryParamOpts} queryParamOpts
582
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, and `GBP`.
583
+ *
584
+ */
585
+ async getPoolsForTokenAddress(chainName, tokenAddress, queryParamOpts) {
586
+ let success = false;
587
+ let data;
588
+ let response;
589
+ const backoff = new backoff_1.ExponentialBackoff();
590
+ while (!success) {
591
+ try {
592
+ const urlParams = new URLSearchParams();
593
+ if (queryParamOpts?.quoteCurrency !== undefined) {
594
+ urlParams.append("quote-currency", queryParamOpts?.quoteCurrency.toString());
595
+ }
596
+ response = await fetch(`https://api.covalenthq.com/v1/${chainName}/xy=k/address/${tokenAddress}/pools/?${urlParams}`, {
597
+ headers: {
598
+ "Authorization": `Bearer ${this.apiKey}`,
599
+ "X-Requested-With": Client_1.userAgent
600
+ }
601
+ });
602
+ data = await response.json();
603
+ if (data.error && data.error_code === 429) {
604
+ try {
605
+ await backoff.backOff();
606
+ }
607
+ catch (error) {
608
+ success = true;
609
+ return {
610
+ data: null,
611
+ error: data.error,
612
+ error_code: data ? data.error_code : response.status,
613
+ error_message: data ? data.error_message : "401 Authorization Required"
614
+ };
615
+ }
616
+ }
617
+ else {
618
+ const dataClass = new PoolsDexDataResponse(data.data);
619
+ (0, ApiHelpers_1.checkAndModifyResponse)(dataClass);
620
+ success = true;
621
+ return {
622
+ data: dataClass,
623
+ error: data.error,
624
+ error_code: data ? data.error_code : response.status,
625
+ error_message: data ? data.error_message : "401 Authorization Required"
626
+ };
627
+ }
628
+ }
629
+ catch (error) {
630
+ success = true;
631
+ return {
632
+ data: null,
633
+ error: true,
634
+ error_code: data ? data.error_code : response.status,
635
+ error_message: data ? data.error_message : "401 Authorization Required"
636
+ };
637
+ }
638
+ }
639
+ }
471
640
  /**
472
641
  *
473
642
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
@@ -530,7 +699,7 @@ class XykService {
530
699
  /**
531
700
  *
532
701
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
533
- * @param {string} dexName - The DEX name eg: `uniswap`.
702
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
534
703
  *
535
704
  */
536
705
  async getNetworkExchangeTokens(chainName, dexName) {
@@ -645,7 +814,7 @@ class XykService {
645
814
  /**
646
815
  *
647
816
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
648
- * @param {string} dexName - The DEX name eg: `uniswap`.
817
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
649
818
  * @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
650
819
  *
651
820
  */
@@ -704,7 +873,7 @@ class XykService {
704
873
  /**
705
874
  *
706
875
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
707
- * @param {string} dexName - The DEX name eg: `uniswap`.
876
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
708
877
  * @param {string} accountAddress - The account address. Passing in an `ENS` or `RNS` resolves automatically.
709
878
  *
710
879
  */
@@ -763,7 +932,7 @@ class XykService {
763
932
  /**
764
933
  *
765
934
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
766
- * @param {string} dexName - The DEX name eg: `uniswap`.
935
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
767
936
  * @param {string} tokenAddress - The token contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
768
937
  *
769
938
  */
@@ -822,7 +991,7 @@ class XykService {
822
991
  /**
823
992
  *
824
993
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
825
- * @param {string} dexName - The DEX name eg: `uniswap`.
994
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
826
995
  * @param {string} poolAddress - The pool contract address. Passing in an `ENS`, `RNS`, `Lens Handle`, or an `Unstoppable Domain` resolves automatically.
827
996
  *
828
997
  */
@@ -881,7 +1050,7 @@ class XykService {
881
1050
  /**
882
1051
  *
883
1052
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
884
- * @param {string} dexName - The DEX name eg: `uniswap`.
1053
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
885
1054
  *
886
1055
  */
887
1056
  async getEcosystemChartData(chainName, dexName) {
@@ -939,7 +1108,7 @@ class XykService {
939
1108
  /**
940
1109
  *
941
1110
  * @param {string} chainName - The chain name eg: `eth-mainnet`.
942
- * @param {string} dexName - The DEX name eg: `uniswap`.
1111
+ * @param {string} dexName - The DEX name eg: `uniswap_v2`.
943
1112
  *
944
1113
  */
945
1114
  async getHealthData(chainName, dexName) {