@covalenthq/client-sdk 2.2.5 → 2.2.6

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/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var version = "2.2.5";
3
+ var version = "2.2.6";
4
4
 
5
5
  const bigIntParser = (val) => {
6
6
  if (val === null || val === undefined) {
@@ -2304,6 +2304,35 @@ class PricingService {
2304
2304
  };
2305
2305
  return await this.execution.execute(endpoint, parseData);
2306
2306
  }
2307
+ /**
2308
+ *
2309
+ * Get the spot token pair prices for a specified pool contract address. Supports pools on Uniswap V2, V3 and their forks.
2310
+ *
2311
+ * @param {Chain} chainName - The chain name eg: `eth-mainnet` or 1.
2312
+ * @param {string} contractAddress - The pool contract address.
2313
+ * @param {GetTokenPricesQueryParamOpts} queryParamOpts
2314
+ * - `quoteCurrency`: The currency to convert. Supports `USD`, `CAD`, `EUR`, `SGD`, `INR`, `JPY`, `VND`, `CNY`, `KRW`, `RUB`, `TRY`, `NGN`, `ARS`, `AUD`, `CHF`, `GBP`, `BTC` and `ETH`.
2315
+ *
2316
+ */
2317
+ async getPoolSpotPrices(chainName, contractAddress, queryParamOpts) {
2318
+ const endpoint = endpointGenerator(`pricing/spot_prices/${chainName}/pools/${contractAddress}`, [
2319
+ {
2320
+ key: "quote-currency",
2321
+ value: queryParamOpts?.quoteCurrency,
2322
+ },
2323
+ ]);
2324
+ const parseData = (data) => {
2325
+ if (data.data) {
2326
+ data.data.forEach((dataItem) => {
2327
+ dataItem.updated_at = dataItem.updated_at
2328
+ ? new Date(dataItem.updated_at)
2329
+ : null;
2330
+ });
2331
+ }
2332
+ return data;
2333
+ };
2334
+ return await this.execution.execute(endpoint, parseData);
2335
+ }
2307
2336
  }
2308
2337
 
2309
2338
  /**