|
| 1 | +# Your AI Agent - Onchain Workflow |
| 2 | + |
| 3 | +This template demonstrates how to create AI agents that can analyze blockchain data using the GoldRush API tools. It showcases various capabilities like analyzing token balances, NFT holdings, and transaction history across multiple blockchains. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Token balance analysis across supported blockchains |
| 8 | +- NFT holdings tracking with metadata |
| 9 | +- Transaction history monitoring |
| 10 | +- Historical token price analysis |
| 11 | +- Multi-agent workflow coordination |
| 12 | + |
| 13 | +## Getting Started |
| 14 | + |
| 15 | +1. Install dependencies: |
| 16 | + |
| 17 | +```bash |
| 18 | +npm install |
| 19 | +``` |
| 20 | + |
| 21 | +2. Create a `.env` file in the root directory with your API keys: |
| 22 | + |
| 23 | +```bash |
| 24 | +OPENAI_API_KEY=your_openai_api_key |
| 25 | +GOLDRUSH_API_KEY=your_goldrush_api_key |
| 26 | +``` |
| 27 | + |
| 28 | +3. Run the development server: |
| 29 | + |
| 30 | +```bash |
| 31 | +npm run dev |
| 32 | +``` |
| 33 | + |
| 34 | + |
| 35 | +## Available Tools |
| 36 | + |
| 37 | +### 1. Token Balances Tool |
| 38 | +Fetches token balances for any wallet address with: |
| 39 | +- Token amounts and USD values |
| 40 | +- Token metadata (symbol, decimals, contract address) |
| 41 | + |
| 42 | +### 2. NFT Holdings Tool |
| 43 | +Retrieves NFT holdings with: |
| 44 | +- Collection information |
| 45 | +- Token IDs and ownership details |
| 46 | +- Media URLs and metadata |
| 47 | + |
| 48 | +### 3. Transaction History Tool |
| 49 | +Analyzes transaction history including: |
| 50 | +- Transaction types (transfers, swaps, mints) |
| 51 | +- Token movements and values |
| 52 | +- Timestamps and block information |
| 53 | + |
| 54 | +### 4. Historical Token Price Tool |
| 55 | +Provides historical price data with: |
| 56 | +- Price history over customizable timeframes (1h, 24h, 7d, 30d) |
| 57 | +- Token prices in USD |
| 58 | +- Detailed price data points |
| 59 | + |
| 60 | +## Example Usage |
| 61 | + |
| 62 | +```typescript |
| 63 | +import { |
| 64 | + Agent, |
| 65 | + ZeeWorkflow, |
| 66 | + TokenBalancesTool, |
| 67 | + NFTBalancesTool, |
| 68 | + TransactionsTool, |
| 69 | +} from "@covalenthq/ai-agent-sdk"; |
| 70 | + |
| 71 | +const tools = { |
| 72 | + tokenBalances: new TokenBalancesTool(process.env.GOLDRUSH_API_KEY), |
| 73 | + nftBalances: new NFTBalancesTool(process.env.GOLDRUSH_API_KEY), |
| 74 | + transactions: new TransactionsTool(process.env.GOLDRUSH_API_KEY), |
| 75 | +}; |
| 76 | + |
| 77 | +const walletAnalyzer = new Agent({ |
| 78 | + name: "WalletAnalyzer", |
| 79 | + model: { |
| 80 | + provider: "OPEN_AI", |
| 81 | + name: "gpt-4o-mini", |
| 82 | + }, |
| 83 | + description: "An AI assistant that analyzes wallet activities and provides insights about holdings and transactions.", |
| 84 | + instructions: [ |
| 85 | + "Analyze wallet token balances and provide insights about holdings", |
| 86 | + "Check NFT collections owned by the wallet", |
| 87 | + "Review recent transactions and identify patterns", |
| 88 | + "Provide comprehensive analysis of the wallet's activity", |
| 89 | + ], |
| 90 | + tools, |
| 91 | +}); |
| 92 | +``` |
| 93 | + |
| 94 | + |
| 95 | +## License |
| 96 | + |
| 97 | +MIT - See [LICENSE](./LICENSE) file for details. |
| 98 | + |
| 99 | +## Support |
| 100 | + |
| 101 | +For support and discussions, join our [Telegram community](https://t.me/CXT_Agent_SDK). |
0 commit comments