Skip to content

Commit

Permalink
Fix getTvl
Browse files Browse the repository at this point in the history
  • Loading branch information
philippe-git committed Nov 13, 2023
1 parent 1a11dd1 commit d8564c2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pages/api/getTVL.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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)
Expand Down

0 comments on commit d8564c2

Please sign in to comment.