@@ -32,17 +32,12 @@ const getPoolIds = async chain => {
3232 * @returns {Promise<Object|null> } - Pool data or null if error
3333 */
3434const getPoolData = async ( poolId , chain ) => {
35- try {
36- const result = await invokeViewFunction (
37- GET_POOL_VIEW_FUNCTION ,
38- [ ] ,
39- [ poolId ]
40- ) ;
41- return result [ 0 ] ;
42- } catch ( error ) {
43- console . error ( `Error fetching data for pool ${ poolId } : ${ error . message } ` ) ;
44- return null ;
45- }
35+ const result = await invokeViewFunction (
36+ GET_POOL_VIEW_FUNCTION ,
37+ [ ] ,
38+ [ poolId ]
39+ ) ;
40+ return result [ 0 ] ;
4641} ;
4742
4843module . exports = {
@@ -51,24 +46,18 @@ module.exports = {
5146 supra : {
5247 tvl : async api => {
5348 const poolIds = await getPoolIds ( api . chain ) ;
54- console . log ( "poolIds: " , poolIds )
5549 // Process pools in parallel for better performance
5650 const poolDataPromises = poolIds . map ( id => getPoolData ( id , api . chain ) ) ;
5751 const poolsData = await Promise . all ( poolDataPromises ) ;
5852
59- console . log ( "poolsData: " , poolsData )
60-
6153 // Add token reserves to TVL
6254 poolsData . forEach ( pool => {
6355 if ( pool ) {
64- console . log ( 'Adding token:' , pool . token_0 , 'with reserve:' , pool . token_0_reserve ) ;
6556 api . add ( pool . token_0 , pool . token_0_reserve ) ;
66- console . log ( 'Adding token:' , pool . token_1 , 'with reserve:' , pool . token_1_reserve ) ;
6757 api . add ( pool . token_1 , pool . token_1_reserve ) ;
6858 }
6959 } ) ;
7060
71- console . log ( 'Final balances:' , api . getBalances ( ) ) ;
7261 }
7362 }
7463} ;
0 commit comments