File tree Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Original file line number Diff line number Diff line change
1
+ const axios = require ( 'axios' )
1
2
2
- const { get } = require ( '../helper/http' )
3
- const { toUSDTBalances } = require ( '../helper/balances' )
3
+ const url = 'https://stat.icpex.org/durable/api/pair/query/all/metadata'
4
+
5
+ const tvl = async ( api ) => {
6
+ const { data } = await axios . get ( url )
7
+ data . data . forEach ( ( { locked } ) => {
8
+ const { total_usd } = locked
9
+ if ( ! total_usd ) return
10
+ api . addUSDValue ( total_usd )
11
+ } )
12
+ }
4
13
5
14
module . exports = {
6
15
misrepresentedTokens : true ,
7
16
icp : { tvl } ,
8
- }
9
-
10
- async function tvl ( ) {
11
- let result = await get ( 'https://metrics.icpex.org/llama/tvl' ) ;
12
- if ( result . retCode === 1 && result . retMsg === "success" ) {
13
- const tvl = result . data ;
14
- return toUSDTBalances ( tvl ) ;
15
- } else {
16
- throw new Error ( `API error! message: ${ result . retMsg } ` ) ;
17
- }
18
- }
17
+ }
You can’t perform that action at this time.
0 commit comments