File size: 984 Bytes
38c52d8 ffe639f 38c52d8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | const { OpenApiClient } = require('/home/luca/.nvm/versions/node/v22.22.1/lib/node_modules/gmgn-cli/dist/client/OpenApiClient.js');
async function main() {
const client = new OpenApiClient({
apiKey: process.env.GMGN_API_KEY || '',
host: 'https://openapi.gmgn.ai'
});
console.log('Fetching trenches...');
const apiRes = await client.getTrenches('bsc', ['new_creation', 'near_completion', 'completed'], ['flap'], 80);
const rawList = [
...(Array.isArray(apiRes?.new_creation) ? apiRes.new_creation : []),
...(Array.isArray(apiRes?.near_completion) ? apiRes.near_completion : []),
...(Array.isArray(apiRes?.completed) ? apiRes.completed : [])
];
const target = rawList.find(item => item.address?.toLowerCase() === '0xbd6bab2a8911ced4ba8150fdd35e5f7d4e807777');
if (target) {
console.log('Found token in trenches list:', JSON.stringify(target, null, 2));
} else {
console.log('Token not found in trenches list.');
}
}
main();
|