0.0.1 • Published 9 months ago

@karpz/plugin-aio v0.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

image

AIO Crypto Plugin for Maiar

A comprehensive Solana blockchain and cryptocurrency information plugin for the Maiar AI framework. This plugin provides real-time crypto news, token information, wallet analysis, contract verification capabilities, and a rugpull checker.

Features

  • 🔄 Real-time cryptocurrency news and updates
  • 💰 Solana token price tracking and analysis
  • 📊 Comprehensive token information from multiple sources
  • 👛 Detailed wallet analysis and token holdings
  • ✅ Contract address verification
  • 🔍 Token metadata from Jupiter
  • 🔍 Rug Check Analysis

Installation

  1. Install the plugin dependencies:
npm install @solana/web3.js @solana/spl-token axios
  1. Configure your environment variables for the plugin:
RPC_URL=https://rpc.helius.xyz/?api-key=your_helius_api_key // can be any RPC URL
RAPID_API_KEY=your_rapid_api_key

Usage

Plugin Integration

Add the plugin to your Maiar runtime configuration:

import { AIOCryptoPlugin } from "./plugins/my-plugin/src/index";

const runtime = createRuntime({
  // ... other configuration
  plugins: [
    new AIOCryptoPlugin({
      RAPID_API_KEY: process.env.RAPID_API_KEY as string,
      RPC_URL: `https://rpc.helius.xyz/?api-key=${process.env.HELIUS_API_KEY}`
    }),
    // ... other plugins
  ]
});

Available Commands

1. Get Crypto News

Fetches real-time cryptocurrency news and market updates.

// Example usage in conversation
"What's the latest crypto news?"
"Show me recent crypto updates"
"Get cryptocurrency news"

Data Source: Cryptocurrency news is fetched using the Crypto News API via RapidAPI.

2. Get Contract Address

Retrieves Solana token mint addresses with verification.

// Example usage in conversation
"What's the contract for BONK?"
"Get SOL contract address"
"Show me DUST token address"

3. Get Token Information

Fetches comprehensive token data from multiple sources.

// Example usage in conversation
"Get info about BONK"
"Show me DUST token details"
"What's the data for SOL"

4. Get Token Price

Retrieves current token prices and 24h changes.

// Example usage in conversation
"What's the price of SOL?"
"Show BONK price"
"Get DUST token price"

5. Get Wallet Information

Analyzes wallet contents and token holdings.

// Example usage in conversation
"Show me wallet info for 5YNmS1R9nNSCDzb5a7mMJ1dwK9uHeAAF4CmPEwKgVWr8"
"What tokens are in wallet 5YNmS1R9nNSCDzb5a7mMJ1dwK9uHeAAF4CmPEwKgVWr8"

6. Rug Check Analysis

Analyzes token security and potential rug pull risks.

// Example usage in conversation
"Check if BONK is safe"
"Run rug check on DUST"
"Is this token safe: RAY"

Data Source: Security analysis is performed using the RugCheck API, which evaluates multiple risk factors including:

  • Liquidity pool security
  • Holder distribution
  • Contract permissions
  • Token metadata mutability

Rug Check Response

{
  risks: [
    {
      name: string,      // Risk factor name
      value: string,     // Quantitative measure
      description: string, // Detailed explanation
      score: number,     // Risk score
      level: "danger" | "warn" | "info"
    }
  ],
  score: number,         // Total risk score
  tokenProgram: string   // Token program ID
}

Data Sources

  • DexScreener API: Token pairs, prices, and market data
  • Jupiter API: Token metadata and verification
  • RapidAPI Crypto News: Real-time cryptocurrency news
  • Helius RPC: Solana blockchain interaction
  • Solana Web3.js: Wallet and token account analysis
  • RugCheck API: Token security analysis and risk assessment

Response Formats

Token Information Response

{
  dexscreener: {
    baseToken: {
      address: string,
      name: string,
      symbol: string
    },
    priceUsd: number,
    priceChange24h: number,
    // ... additional market data
  },
  jupiter: {
    // Token metadata from Jupiter
  }
}

Wallet Information Response

{
  address: string,
  sol: number,
  tokens: [
    {
      tokenAddress: string,
      name: string,
      symbol: string,
      balance: number,
      decimals: number
    }
  ]
}

Demo

https://github.com/user-attachments/assets/643a304a-eb44-46bc-9845-6094e11faa6f

Error Handling

The plugin includes comprehensive error handling for:

  • Invalid wallet addresses
  • Non-existent tokens
  • API rate limits
  • Network connectivity issues
  • Invalid token symbols

Dependencies

  • @solana/web3.js: ^1.x
  • @solana/spl-token: ^0.3.x
  • axios: ^1.x
  • @maiar-ai/core: Latest version

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.