Skip to content

Commit 6953800

Browse files
committed
fixes
1 parent a7602ca commit 6953800

File tree

1 file changed

+4
-35
lines changed

1 file changed

+4
-35
lines changed

packages/sui-agent/src/protocols/aftermath/PoolTool.ts

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -89,37 +89,17 @@ class PoolTool {
8989
await sdk.init();
9090
const pools = await sdk.Pools().getPools({ objectIds: [] });
9191

92-
console.log('Raw pools from SDK:', JSON.stringify(pools, null, 2));
93-
console.log('Number of pools from SDK:', pools.length);
94-
9592
// Process all pools
9693
const processedPools = await Promise.all(
9794
pools.map(async (poolInstance) => {
98-
console.log(
99-
'Processing pool instance:',
100-
JSON.stringify(poolInstance, null, 2),
101-
);
102-
if (!poolInstance.pool?.objectId) {
103-
console.log('Pool instance missing objectId:', poolInstance);
104-
return null;
105-
}
95+
if (!poolInstance.pool?.objectId) return null;
10696
return this.processPool(poolInstance, poolInstance.pool.objectId);
10797
}),
10898
);
10999

110-
console.log('Processed pools:', JSON.stringify(processedPools, null, 2));
111-
console.log('Number of processed pools:', processedPools.length);
112-
113-
const validPools = processedPools.filter((pool): pool is PoolInfo => {
114-
const isValid = pool !== null && pool.tokens.length > 0;
115-
if (!isValid) {
116-
console.log('Invalid pool:', pool);
117-
}
118-
return isValid;
119-
});
120-
121-
console.log('Valid pools:', JSON.stringify(validPools, null, 2));
122-
console.log('Number of valid pools:', validPools.length);
100+
const validPools = processedPools.filter(
101+
(pool): pool is PoolInfo => pool !== null && pool.tokens.length > 0,
102+
);
123103

124104
// Sort pools based on the specified metric
125105
const sortedPools = validPools.sort((a, b) => {
@@ -147,19 +127,11 @@ class PoolTool {
147127
valueB = b.tvl;
148128
}
149129

150-
console.log(
151-
`Comparing pools - A: ${a.id} (${valueA}) vs B: ${b.id} (${valueB})`,
152-
);
153130
return valueB - valueA; // Default to descending order
154131
});
155132

156-
console.log('Sorted pools:', JSON.stringify(sortedPools, null, 2));
157-
console.log('Number of sorted pools:', sortedPools.length);
158-
159133
// Take only the requested number of pools
160134
const topPools = sortedPools.slice(0, numPools);
161-
console.log('Top pools:', JSON.stringify(topPools, null, 2));
162-
console.log('Number of top pools:', topPools.length);
163135

164136
// Format the response with ranking information
165137
const rankedPools = topPools.map((pool, index) => ({
@@ -173,8 +145,6 @@ class PoolTool {
173145
},
174146
}));
175147

176-
console.log('Final ranked pools:', JSON.stringify(rankedPools, null, 2));
177-
178148
return JSON.stringify([
179149
{
180150
reasoning: `Successfully retrieved top ${numPools} pools ranked by ${metric}`,
@@ -190,7 +160,6 @@ class PoolTool {
190160
},
191161
]);
192162
} catch (error) {
193-
console.error('Error in getRankedPools:', error);
194163
return JSON.stringify([
195164
handleError(error, {
196165
reasoning: 'Failed to retrieve ranked pools',

0 commit comments

Comments
 (0)