|
| 1 | + |
| 2 | +# @elizaos/plugin-apro |
| 3 | + |
| 4 | +Foundation plugin that enables advanced agent interactions, data verification, and price queries on the Eliza OS platform. It streamlines agent creation, verification processes, and provides a flexible framework for building robust agent-based solutions. |
| 5 | + |
| 6 | +## Overview |
| 7 | + |
| 8 | +The Apro plugin bridges agent-based logic with the Eliza ecosystem. It handles agent registration, data verification, and price queries, empowering both automated and user-driven workflows. |
| 9 | + |
| 10 | +## Features |
| 11 | + |
| 12 | +### Agent Operations |
| 13 | +- **Agent Creation**: Deploy new agents with custom settings |
| 14 | +- **Registration**: Register agents on-chain or via standardized processes |
| 15 | +- **Multi-Signer Framework**: Supports threshold-based approval flows |
| 16 | + |
| 17 | +### Data Verification |
| 18 | +- **Chain Validation**: Verify data authenticity on-chain |
| 19 | +- **Transaction Execution**: Handle verification logic with built-in security checks |
| 20 | +- **Auto-Hashing**: Convert raw data to hashed formats when needed |
| 21 | +- **Metadata Parsing**: Validate content type, encoding, and compression |
| 22 | + |
| 23 | +### Price Queries |
| 24 | +- **Live Price Data**: Fetch price information for various pairs |
| 25 | +- **Format Validation**: Normalize user query inputs to standard trading-pair formats |
| 26 | +- **APIs Integration**: Retrieve real-time or near-real-time pricing information |
| 27 | + |
| 28 | +## Security Features |
| 29 | + |
| 30 | +### Access Control |
| 31 | +- **Private Key Management**: Safe usage of private keys for transaction signing |
| 32 | +- **Environment Variables**: Secure injection of credentials |
| 33 | +- **On-Chain Validation**: Leverage on-chain contract checks |
| 34 | + |
| 35 | +### Verification |
| 36 | +- **Input Validation**: Strict schema checks before on-chain operations |
| 37 | +- **Transaction Receipts**: Provide verifiable transaction details |
| 38 | +- **Error Handling**: Detailed error logs for quick debugging |
| 39 | + |
| 40 | +## Installation |
| 41 | + |
| 42 | +```bash |
| 43 | +npm install @elizaos/plugin-apro |
| 44 | +``` |
| 45 | + |
| 46 | +## Configuration |
| 47 | + |
| 48 | +Configure the plugin by setting environment variables or runtime settings: |
| 49 | +- APRO_RPC_URL |
| 50 | +- APRO_PROXY_ADDRESS |
| 51 | +- APRO_PRIVATE_KEY |
| 52 | +- APRO_CONVERTER_ADDRESS |
| 53 | +- APRO_AUTO_HASH_DATA |
| 54 | + |
| 55 | +## Usage |
| 56 | + |
| 57 | +### Basic Setup |
| 58 | +```typescript |
| 59 | +import { aproPlugin } from "@elizaos/plugin-apro"; |
| 60 | + |
| 61 | +// Initialize the plugin |
| 62 | +const runtime = await initializeRuntime({ |
| 63 | + plugins: [aproPlugin], |
| 64 | +}); |
| 65 | +``` |
| 66 | + |
| 67 | +### Actions |
| 68 | + |
| 69 | +#### CREATE_AND_REGISTER_AGENT |
| 70 | +Creates and registers an agent using specified settings. |
| 71 | + |
| 72 | +```typescript |
| 73 | +const result = await runtime.executeAction("CREATE_AND_REGISTER_AGENT", { |
| 74 | + signers: [...], |
| 75 | + threshold: 3, |
| 76 | + agentHeader: { ... }, |
| 77 | + // ...other fields... |
| 78 | +}); |
| 79 | +``` |
| 80 | + |
| 81 | +#### VERIFY |
| 82 | +Verifies data on-chain via the Agent SDK. |
| 83 | + |
| 84 | +```typescript |
| 85 | +const result = await runtime.executeAction("VERIFY", { |
| 86 | + payload: { |
| 87 | + data: "0x...hexData", |
| 88 | + signatures: [...], |
| 89 | + }, |
| 90 | + agent: "0x...agentAddress", |
| 91 | + digest: "0x...digestString", |
| 92 | +}); |
| 93 | +``` |
| 94 | + |
| 95 | +#### PRICE_QUERY |
| 96 | +Fetches live price data for a specified trading pair. |
| 97 | + |
| 98 | +```typescript |
| 99 | +const result = await runtime.executeAction("PRICE_QUERY", { |
| 100 | + pair: "BTC/USD", |
| 101 | +}); |
| 102 | +``` |
| 103 | + |
| 104 | +## Performance Optimization |
| 105 | + |
| 106 | +1. **Cache Management** |
| 107 | + - Implement caching for frequent queries |
| 108 | + - Monitor retrieval times and cache hits |
| 109 | + |
| 110 | +2. **Network Efficiency** |
| 111 | + - Batch requests where possible |
| 112 | + - Validate response parsing to reduce overhead |
| 113 | + |
| 114 | +## System Requirements |
| 115 | +- Node.js 16.x or higher |
| 116 | +- Sufficient network access to on-chain endpoints |
| 117 | +- Basic configuration of environment variables |
| 118 | +- Minimum 4GB RAM recommended |
| 119 | + |
| 120 | +## Troubleshooting |
| 121 | + |
| 122 | +1. **Invalid Agent Settings** |
| 123 | + - Ensure signers and threshold are correct |
| 124 | + - Validate agentHeader for proper UUIDs and numeric values |
| 125 | + |
| 126 | +2. **Verification Failures** |
| 127 | + - Check the input data formats |
| 128 | + - Confirm environment variables are set |
| 129 | + |
| 130 | +3. **Price Query Errors** |
| 131 | + - Verify the trading pair format |
| 132 | + - Check external API availability |
| 133 | + |
| 134 | +## Safety & Security |
| 135 | + |
| 136 | +1. **Credential Management** |
| 137 | + - Store private keys securely |
| 138 | + - Do not commit secrets to version control |
| 139 | + |
| 140 | +2. **Transaction Limits** |
| 141 | + - Configure thresholds to mitigate abuse |
| 142 | + - Log transaction attempts and failures |
| 143 | + |
| 144 | +3. **Monitoring & Logging** |
| 145 | + - Track unusual activity |
| 146 | + - Maintain detailed audit logs |
| 147 | + |
| 148 | +## Support |
| 149 | + |
| 150 | +For issues or feature requests: |
| 151 | +1. Check existing documentation |
| 152 | +2. Submit a GitHub issue with relevant details |
| 153 | +3. Include transaction logs and system info if applicable |
| 154 | + |
| 155 | +## Contributing |
| 156 | + |
| 157 | +We welcome pull requests! Refer to the project’s CONTRIBUTING.md and open discussions to coordinate efforts. |
| 158 | + |
| 159 | +## Credits |
| 160 | + |
| 161 | +- [APRO](https://www.apro.com/) - Plugin sponsor and partner |
| 162 | +- [ai-agent-sdk-js](https://github.com/APRO-com/ai-agent-sdk-js) - Underlying agent SDK |
| 163 | +- [ethers.js](https://docs.ethers.io/) - Transaction and contract interaction |
| 164 | +- Community contributors for feedback and testing |
| 165 | + |
| 166 | +For more information about Apro plugin capabilities: |
| 167 | + |
| 168 | +- [Apro Documentation](https://docs.apro.com/en) |
| 169 | + |
| 170 | +## License |
| 171 | + |
| 172 | +This plugin is part of the Eliza project. Refer to the main project repository for licensing details. |
0 commit comments