Create a new file and initialize the Skannr client:
import { Skannr } from '@skannr/sdk'
// Initialize Skannr with your API key
const skannr = new Skannr({
apiKey: 'your-api-key-here',
network: 'ethereum' // or 'polygon', 'bsc', 'arbitrum', etc.
}
console.log('Skannr initialized successfully!')
Pro Tip
Store your API key in environment variables for security. Use process.env.SKANNR_API_KEY
instead of hardcoding it.
Now let's scan a token for potential security risks:
async function scanToken() {
try {
// Scan a token address
const result = await skannr.scanToken({
address: '0xA0b86a33E6441E6C8A2Dd4e5b5b6e8e8e8e8e8e8'
}
console.log('Scan Result:', result)
console.log('Is Honeypot:', result.isHoneypot)
console.log('Risk Score:', result.riskScore)
} catch (error) {
console.error('Scan failed:', error.message)
}
}
// Run the scan
scanToken()
Here's what each field in the scan result means:
Boolean indicating if the token has sell restrictions or other honeypot characteristics.
Numerical score from 0-100. Higher scores indicate higher risk.
Array of specific risk factors detected in the token contract.
Token information including name, symbol, decimals, and total supply.
Liquidity pool information and trading volume data.
Whether the token contract has been verified on block explorers.
Here's what a typical scan result looks like:
{
"isHoneypot": false,
"riskScore": 25,
"riskFactors": ["high_tax", "low_liquidity"],
"metadata": {
"name": "Example Token",
"symbol": "EXT",
"decimals": 18
},
"liquidity": {
"total": "$45,230",
"volume24h": "$12,450"
},
"verified": true
}