forked from github/github-mcp-server
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget_all_programs.js
More file actions
68 lines (59 loc) · 2.05 KB
/
get_all_programs.js
File metadata and controls
68 lines (59 loc) · 2.05 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const https = require('https');
const fs = require('fs');
const HELIUS_API_KEY = process.env.HELIUS_API_KEY || 'your-api-key';
const programs = [
'4eJZVbbsiLAG6EkWvgEYEWKEpdhJPFBYMeJ6DBX98w6a',
'jaJrDgf4U8DAZcUD3t5AwL7Cfe2QnkpXZXGegdUHc4ZE',
'11111111111111111111111111111111',
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA',
'So11111111111111111111111111111111111111112',
'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
'Stake11111111111111111111111111111111111111',
'Vote111111111111111111111111111111111111111',
'BPFLoaderUpgradeab1e11111111111111111111111',
'JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4',
'4Ec7ZxZS6Sbdg5UGSLHbAnM7GQHp2eFd4KYWRexAipQT'
];
function rpcCall(method, params) {
return new Promise((resolve, reject) => {
const data = JSON.stringify({ jsonrpc: '2.0', id: 1, method, params });
const options = {
hostname: 'mainnet.helius-rpc.com',
path: `/?api-key=${HELIUS_API_KEY}`,
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Content-Length': data.length }
};
const req = https.request(options, res => {
let body = '';
res.on('data', chunk => body += chunk);
res.on('end', () => resolve(JSON.parse(body)));
});
req.on('error', reject);
req.write(data);
req.end();
});
}
async function main() {
const results = [];
for (const addr of programs) {
console.log(`Checking: ${addr}`);
const info = await rpcCall('getAccountInfo', [addr, { encoding: 'jsonParsed' }]);
if (info.result?.value) {
const { lamports, owner, executable } = info.result.value;
results.push({
address: addr,
balance: lamports / 1e9,
owner,
executable,
exists: true
});
console.log(`✅ ${lamports / 1e9} SOL`);
} else {
results.push({ address: addr, exists: false });
console.log('❌ NOT FOUND');
}
}
fs.writeFileSync('program_results.json', JSON.stringify(results, null, 2));
console.log('\n✅ Results saved to program_results.json');
}
main().catch(console.error);