@thebadlab/sdk-onchain
v1.0.0
Published
Blockchain intelligence SDK with multi-AI provider support for token analysis, wallet profiling, smart contract explanation, and whale tracking
Maintainers
Readme
TheBadLab SDK
A powerful TypeScript/JavaScript SDK for blockchain intelligence with multi-AI provider support. Get token insights, analyze wallets, explain smart contracts, track whale activity, and query blockchain data using natural language.
Features
- Multi-AI Provider Support: Integration with OpenAI, xAI (Grok), and Google Gemini
- Token Intelligence: Get real-time market data, price information, and AI-powered insights
- Smart Contract Analysis: Explain smart contracts in natural language with AI
- Wallet Profiling: Analyze wallet activity, holdings, and behavior patterns
- Whale Tracking: Detect and monitor large token holders
- Natural Language Queries: Ask questions about tokens, wallets, and contracts in plain English
- Market Insights: Access price data, market cap, volume, and trends
Installation
npm install @thebadlab/sdk-onchainQuick Start
import { TheBadLab } from '@thebadlab/sdk-onchain';
const sdk = new TheBadLab({
aiProviders: [
{
name: 'openai',
apiKey: 'your-openai-api-key',
model: 'gpt-4-turbo'
}
],
defaultProvider: 'openai',
etherscanApiKey: 'your-etherscan-api-key'
});
const response = await sdk.query('What is the price of USDC?');
console.log(response.answer);
const tokenInfo = await sdk.tokens.getTokenInsights('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48');
console.log(tokenInfo);Configuration
Required API Keys
- AI Provider API Key: At least one AI provider (OpenAI, xAI, or Gemini)
- Etherscan API Key: For blockchain data (optional but recommended)
Configuration Options
interface TheBadLabConfig {
aiProviders: AIProviderConfig[];
defaultProvider?: 'openai' | 'xai' | 'gemini';
blockchainRpcUrl?: string;
etherscanApiKey?: string;
}Core Modules
Token Module
Get token information, market data, and search for tokens.
Wallet Module
Profile wallets, detect whales, and analyze holder behavior.
Contract Module
Retrieve smart contract details, source code, and ABI.
AI Providers
- OpenAI: GPT-4, GPT-3.5 Turbo
- xAI: Grok models
- Gemini: Google's AI models
Key Methods
Natural Language Queries
await sdk.query('question', 'provider');Token Analysis
await sdk.getTokenInsights('address');
await sdk.searchTokens('query');Wallet Analysis
await sdk.analyzeWallet('address');
await sdk.findWhales('tokenAddress');Contract Analysis
await sdk.explainContract('address');
await sdk.analyzeContract('address');Use Cases
- Build AI-powered crypto analytics platforms
- Create intelligent trading bots with natural language understanding
- Develop wallet monitoring and alert systems
- Build smart contract audit and explanation tools
- Create whale tracking and portfolio analysis applications
Architecture
src/
├── TheBadLab.ts # Main SDK class
├── index.ts # Public exports
├── providers/ # AI provider integrations
│ ├── OpenAIProvider.ts
│ ├── xAIProvider.ts
│ └── GeminiProvider.ts
├── modules/ # Blockchain intelligence modules
│ ├── TokenModule.ts
│ ├── WalletModule.ts
│ └── ContractModule.ts
├── types/ # TypeScript type definitions
│ └── index.ts
└── utils/ # Helper utilities
└── helpers.tsRequirements
- Node.js 16+
- TypeScript 4.5+ (for development)
- At least one AI provider API key
- Etherscan API key (optional)
License
MIT
Support
For issues, questions, or contributions, please visit the repository.
Examples
See HOWTOUSE.md for detailed examples and use cases.
