From d8564c20f015b21c8ec18b5617584f9ca8982469 Mon Sep 17 00:00:00 2001 From: Philippe Date: Mon, 13 Nov 2023 19:29:30 +0100 Subject: [PATCH] Fix getTvl --- pages/api/getTVL.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pages/api/getTVL.js b/pages/api/getTVL.js index ba0904e0..5af110d3 100644 --- a/pages/api/getTVL.js +++ b/pages/api/getTVL.js @@ -35,7 +35,7 @@ export default fn(async () => { 'getTVLHarmony', 'getTVLArbitrum', 'getTVLOptimism', - 'getTVLMoonbeam', + // 'getTVLMoonbeam', // rpc started throwing bececause too many requests, ignoring it because not significant tvl 'getTVLKava', 'getTVLCelo', 'getTVLZkevm', @@ -48,6 +48,8 @@ export default fn(async () => { await Promise.all( endPoints.map(async (endPoint) => { let res = await (await fetch(`https://api.curve.fi/api/${endPoint}`)).json() + + if (typeof res?.data === 'undefined') throw new Error(`Can't retrieve (outdated) tvl data from ${endPoint}`); let sideChain = { 'chain': endPoint.replace('getTVL', ''), 'tvl': parseFloat(res.data.tvl)