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
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
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)
|