🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

drainbrain-sdk

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

drainbrain-sdk

Official TypeScript SDK for the DrainBrain API - AI-powered Solana token rug pull detection

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

drainbrain-sdk

Official TypeScript SDK for the DrainBrain API - AI-powered Solana token rug pull detection.

DrainBrain uses a 4-model ML ensemble (heuristic scoring + XGBoost v1 + XGBoost v2 + GRU temporal model) trained on 175K+ labeled tokens to predict rug pulls before they happen.

Installation

npm install drainbrain-sdk

Quick Start

import { DrainBrainClient } from "drainbrain-sdk";

const client = new DrainBrainClient("db_live_your_api_key_here");

const result = await client.scan("TokenMintAddress...");
console.log(result.score);     // 0-100 risk score
console.log(result.riskLevel); // "LOW" | "MEDIUM" | "HIGH" | "CRITICAL"
console.log(result.isRug);     // true if score >= 70

Getting an API Key

  • Go to rugslayer.com/drainbrain
  • Generate a free API key (100 scans/day)
  • Upgrade to Pro ($199/mo, 10K scans/min) or PAYG ($0.005/scan) for full analysis

API Methods

scan(mint, options?)

Scan a single Solana token for rug pull risk.

const result = await client.scan("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");

// Free tier response
console.log(result.mint);      // Token mint address
console.log(result.score);     // 0-100 risk score
console.log(result.riskLevel); // "LOW" | "MEDIUM" | "HIGH" | "CRITICAL"
console.log(result.isRug);     // true if score >= 70
console.log(result.cached);    // true if served from 5-min cache
console.log(result.timestamp); // ISO 8601

// Pro/PAYG tier - additional fields
console.log(result.rugStage);          // 0-5 rug stage
console.log(result.rugStageName);      // e.g. "Accumulation"
console.log(result.honeypot);          // { isHoneypot, reason }
console.log(result.confidence);        // 0-1 scoring confidence
console.log(result.breakdown);         // { authority, liquidity, holders, behavior, wallet }
console.log(result.riskFlags);         // ["mint_authority_enabled", ...]
console.log(result.temporalScore);     // GRU temporal risk score
console.log(result.temporalStage);     // GRU predicted rug stage
console.log(result.estimatedPullHours); // Estimated hours until rug
console.log(result.responseTimeMs);    // API response time

Scan with Action (Pro/PAYG only)

// Get a Jupiter swap quote if the token is risky
const result = await client.scan("TokenMint...", {
  action: "quote_if_risky",
  riskThreshold: 70, // default
});

if (result.action?.triggered) {
  console.log(result.action.swapQuote); // Jupiter swap quote details
}

batchScan(mints)

Scan up to 10 tokens in parallel. Requires Pro or PAYG tier.

const batch = await client.batchScan([
  "TokenMint1...",
  "TokenMint2...",
  "TokenMint3...",
]);

console.log(`Scanned ${batch.count} tokens in ${batch.totalMs}ms`);
console.log(`${batch.errors.length} failures`);

for (const result of batch.results) {
  console.log(`${result.mint}: ${result.score} (${result.riskLevel})`);
}

for (const err of batch.errors) {
  console.error(`${err.mint}: ${err.error}`);
}

health()

Check API status and model availability.

const health = await client.health();

console.log(health.status);  // "ok"
console.log(health.version); // "1.0.0"
console.log(health.ensemble); // "heuristic 30% + XGBoost 30% + GRU 40%"

// Model availability
console.log(health.models.xgboost.available); // true/false
console.log(health.models.gru.available);     // true/false
console.log(health.models.heuristic.available); // always true

Configuration

const client = new DrainBrainClient("db_live_...", {
  baseUrl: "https://rugslayer.com", // default
  timeout: 30000,                    // 30s default (ms)
});

Error Handling

All API errors throw a DrainBrainError with the HTTP status code and error message.

import { DrainBrainClient, DrainBrainError } from "drainbrain-sdk";

const client = new DrainBrainClient("db_live_...");

try {
  const result = await client.scan("TokenMint...");
} catch (error) {
  if (error instanceof DrainBrainError) {
    console.error(`API error ${error.status}: ${error.message}`);

    switch (error.status) {
      case 401:
        console.error("Invalid API key");
        break;
      case 403:
        console.error("Feature requires Pro/PAYG tier");
        break;
      case 429:
        console.error(`Rate limited. Retry after ${error.retryAfter}s`);
        break;
      case 504:
        console.error("Scan timed out - token may be illiquid");
        break;
    }
  }
}

Rate Limits

TierRate LimitPrice
Free100/day$0
Pro10,000/min$199/mo
PAYG1,000/min$0.005/scan

Requirements

  • Node.js >= 18 (uses native fetch)
  • Zero dependencies

License

MIT

Keywords

solana

FAQs

Package last updated on 21 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts