@merkl/api 0.20.124 → 0.20.126
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.
@@ -51,7 +51,6 @@ export class Erc20TVLBuilder {
|
|
51
51
|
const result = await ChainInteractionService(computeChainId).fetchState(calls);
|
52
52
|
let index = 0;
|
53
53
|
for (const [i, { campaign }] of subTypeTVLs.entries()) {
|
54
|
-
log.local(`building TVLs for subtype ${subType} using deprecated code`);
|
55
54
|
const { campaignParameters } = campaign;
|
56
55
|
const { whitelist, blacklist } = campaignParameters;
|
57
56
|
if (whitelist?.length > 0) {
|
@@ -74,12 +73,14 @@ export class Erc20TVLBuilder {
|
|
74
73
|
tvls = tvls.concat(subTypeTVLs);
|
75
74
|
}
|
76
75
|
else {
|
76
|
+
log.local(`building TVLs for subtype ${subType} using deprecated code`);
|
77
77
|
// @deprecated In case we don't have the new builder, use the old erc20 dynamic data
|
78
78
|
const dynamicDataList = await new Erc20DynamicData().build(computeChainId, campaignsOfSubType);
|
79
79
|
if (dynamicDataList.length !== campaignsOfSubType.length) {
|
80
80
|
throw new Error("Erc20TVLBuilder: dynamicDataList.length !== campaignsOfSubType.length");
|
81
81
|
}
|
82
82
|
for (const [index, dynamicData] of dynamicDataList.entries()) {
|
83
|
+
console.log(dynamicData);
|
83
84
|
tvls.push({
|
84
85
|
campaign: campaignsOfSubType[index],
|
85
86
|
tvl: dynamicData.tvl,
|
@@ -207,40 +207,6 @@ export default class PriceService {
|
|
207
207
|
catch (error) {
|
208
208
|
log.error("❌ call to fetch camelot api price failed", error);
|
209
209
|
}
|
210
|
-
/** Retro API price completion */
|
211
|
-
try {
|
212
|
-
await axios
|
213
|
-
.get("https://retro-backend.stabl.finance/api/v1/assets")
|
214
|
-
.then(res => {
|
215
|
-
if (res.data.success) {
|
216
|
-
for (const x of res.data.data) {
|
217
|
-
if (this._prices[x.symbol] === undefined || this._prices[x.symbol] === null) {
|
218
|
-
this._prices[x.symbol] = x.price;
|
219
|
-
}
|
220
|
-
}
|
221
|
-
}
|
222
|
-
});
|
223
|
-
}
|
224
|
-
catch (error) {
|
225
|
-
log.error("❌ call to fetch retro api price failed", error);
|
226
|
-
}
|
227
|
-
/** Blueprint API price completion */
|
228
|
-
try {
|
229
|
-
await axios
|
230
|
-
.get("https://blue-backend.stabl.finance/api/v1/assets")
|
231
|
-
.then(res => {
|
232
|
-
if (res.data.success) {
|
233
|
-
for (const x of res.data.data) {
|
234
|
-
if (this._prices[x.symbol] === undefined || this._prices[x.symbol] === null) {
|
235
|
-
this._prices[x.symbol] = x.price;
|
236
|
-
}
|
237
|
-
}
|
238
|
-
}
|
239
|
-
});
|
240
|
-
}
|
241
|
-
catch (error) {
|
242
|
-
log.error("❌ call to fetch blueprint api price failed", error);
|
243
|
-
}
|
244
210
|
/** Flux price completion */
|
245
211
|
promises.push((async () => {
|
246
212
|
try {
|
@@ -12,7 +12,7 @@ export default class CoingeckoService {
|
|
12
12
|
return await this.fetchPrices(filteredTokens);
|
13
13
|
}
|
14
14
|
buildUrl(tokens) {
|
15
|
-
const
|
15
|
+
const tickerParams = tokens
|
16
16
|
.map(token => {
|
17
17
|
const args = token.args;
|
18
18
|
if (!args?.ticker)
|
@@ -20,7 +20,7 @@ export default class CoingeckoService {
|
|
20
20
|
return `coingecko:${args.ticker}`;
|
21
21
|
})
|
22
22
|
.join(",");
|
23
|
-
return this.baseUrl.concat(
|
23
|
+
return this.baseUrl.concat(tickerParams);
|
24
24
|
}
|
25
25
|
async fetchPrices(tickers) {
|
26
26
|
const chunkSize = 200;
|
@@ -28,7 +28,7 @@ export default class CoingeckoService {
|
|
28
28
|
for (let i = 0; i < tickers.length; i += chunkSize) {
|
29
29
|
chunks.push(tickers.slice(i, Math.min(tickers.length, i + chunkSize)));
|
30
30
|
}
|
31
|
-
const promises = (await Promise.
|
31
|
+
const promises = (await Promise.allSettled(chunks.map(async (chunk) => {
|
32
32
|
const url = this.buildUrl(chunk);
|
33
33
|
return axios
|
34
34
|
.get(url, { timeout: 10000 })
|
@@ -37,7 +37,9 @@ export default class CoingeckoService {
|
|
37
37
|
log.error("❌ CoingeckoService not responding", err);
|
38
38
|
throw "❌ CoingeckoService not responding";
|
39
39
|
});
|
40
|
-
})))
|
40
|
+
})))
|
41
|
+
.filter(result => result.status === "fulfilled")
|
42
|
+
.map(result => result.value);
|
41
43
|
return promises.reduce((acc, val) => acc.concat(val), []);
|
42
44
|
}
|
43
45
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation> Need to be typed according to coinguekko answer type
|