impermax-sdk 2.1.267 → 2.1.268

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.
@@ -17,8 +17,6 @@ export default class OffchainPriceHelper {
17
17
  }>;
18
18
  private getAllCoingeckoPrices;
19
19
  private getCoingeckoTokenPrice;
20
- private initializeFantomTokenPrices;
21
- private getFantomTokenPrice;
22
20
  private getDexscreenerTokenPrice;
23
21
  private initializeDebankTokenPrice;
24
22
  getDebankTokenPrice(network: Networks, tokenAddress: Address): Promise<number>;
@@ -220,29 +220,32 @@ class OffchainPriceHelper {
220
220
  /* -----------------------------------------------------------------------
221
221
  * 3. Fantom (Equalizer's API)
222
222
  * ----------------------------------------------------------------------*/
223
- async initializeFantomTokenPrices() {
224
- try {
225
- const response = await fetch("https://eqapi-beta-8868m.ondigitalocean.app/fantom/v4/tokens");
226
- if (response.status != 200)
227
- return;
228
- const data = await response.json();
229
- if (!data?.data)
230
- return;
231
- this.fantomTokenPrices = Object.entries(data.data).reduce((acc, [address, data]) => {
232
- acc[address.toLowerCase()] = Number(data.priceUsd);
233
- return acc;
234
- }, {});
235
- }
236
- catch {
237
- this.fantomTokenPrices = {};
238
- }
239
- }
240
- async getFantomTokenPrice(tokenAddress) {
241
- if (!this.fantomTokenPricesInitialized)
242
- this.fantomTokenPricesInitialized = this.initializeFantomTokenPrices();
243
- await this.fantomTokenPricesInitialized;
244
- return this.fantomTokenPrices[tokenAddress.toLowerCase()] || 0;
245
- }
223
+ // NOTE: Deprecated
224
+ // private async initializeFantomTokenPrices(): Promise<void> {
225
+ // try {
226
+ // const response = await fetch(
227
+ // "https://eqapi-beta-8868m.ondigitalocean.app/fantom/v4/tokens",
228
+ // );
229
+ // if (response.status != 200) return;
230
+ // const data = await response.json();
231
+ // if (!data?.data) return;
232
+ // this.fantomTokenPrices = Object.entries(data.data).reduce(
233
+ // (acc, [address, data]: [string, any]) => {
234
+ // acc[address.toLowerCase()] = Number(data.priceUsd);
235
+ // return acc;
236
+ // },
237
+ // {} as Record<string, number>,
238
+ // );
239
+ // } catch {
240
+ // this.fantomTokenPrices = {};
241
+ // }
242
+ // }
243
+ //private async getFantomTokenPrice(tokenAddress: Address): Promise<number> {
244
+ // if (!this.fantomTokenPricesInitialized)
245
+ // this.fantomTokenPricesInitialized = this.initializeFantomTokenPrices();
246
+ // await this.fantomTokenPricesInitialized;
247
+ // return this.fantomTokenPrices[tokenAddress.toLowerCase()] || 0;
248
+ //}
246
249
  /* -----------------------------------------------------------------------
247
250
  * 4. Dexscreener
248
251
  * ----------------------------------------------------------------------*/
@@ -269,11 +272,11 @@ class OffchainPriceHelper {
269
272
  * Main logic of Price helper
270
273
  * ----------------------------------------------------------------------*/
271
274
  async initializeDebankTokenPrice(tokenAddress) {
272
- if (Object.keys(fantom_ids).includes(tokenAddress.toLowerCase())) {
273
- const result = await this.getFantomTokenPrice(tokenAddress);
274
- if (result)
275
- return result;
276
- }
275
+ // Deprecated
276
+ // if (Object.keys(fantom_ids).includes(tokenAddress.toLowerCase())) {
277
+ // const result = await this.getFantomTokenPrice(tokenAddress);
278
+ // if (result) return result;
279
+ // }
277
280
  if (Object.keys(dexscreener_ids).includes(tokenAddress.toLowerCase())) {
278
281
  const result = await this.getDexscreenerTokenPrice(tokenAddress.toLowerCase());
279
282
  if (result)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.267",
3
+ "version": "2.1.268",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",