-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrugChecker.js
More file actions
26 lines (20 loc) · 835 Bytes
/
rugChecker.js
File metadata and controls
26 lines (20 loc) · 835 Bytes
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
const axios = require("axios");
const { Connection, PublicKey } = require("@solana/web3.js");
const connection = new Connection(process.env.SOLANA_RPC);
async function checkRugPull(tokenAddress) {
try {
const publicKey = new PublicKey(tokenAddress);
const accountInfo = await connection.getParsedAccountInfo(publicKey);
const mintAuthority = accountInfo.value?.data?.parsed?.info?.mintAuthority;
if (mintAuthority) {
console.log(`Token ${tokenAddress} has a mint authority: ${mintAuthority}`);
return false; // Mint authority present, not safe
}
console.log(`Token ${tokenAddress} is safe (no mint authority).`);
return true;
} catch (error) {
console.error(`Error checking rug pull for ${tokenAddress}:`, error.message);
return false;
}
}
module.exports = { checkRugPull };