From 144c6b7938c39719bc2504308ab7b4b5d8b55519 Mon Sep 17 00:00:00 2001 From: zqleslie <17967998@qq.com> Date: Sat, 6 Jun 2026 05:09:35 +0800 Subject: [PATCH] docs: add comprehensive README for fuel-agent-kit - Project overview and feature highlights - Quick start guide with code examples - Architecture documentation - Protocol integration docs (Mira, SwayLend, Read, Transfers) - Configuration and testing instructions - Contributing guidelines Fixes #3 --- README.md | 233 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..9494b49 --- /dev/null +++ b/README.md @@ -0,0 +1,233 @@ +# ๐Ÿš€ Fuel Agent Kit + +> **An AI agent toolkit for the Fuel Network ecosystem** โ€” enabling autonomous on-chain interactions across DeFi protocols. + +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) +[![Fuel Network](https://img.shields.io/badge/powered%20by-Fuel%20Network-00F58C)](https://fuel.network/) +[![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue)](https://www.typescriptlang.org/) +[![npm](https://img.shields.io/badge/npm-%E2%89%A516.0.0-red)](https://www.npmjs.com/) + +--- + +## ๐Ÿ“– Overview + +Fuel Agent Kit provides a modular, TypeScript-based framework for building AI agents that can interact with the Fuel Network. It includes built-in integrations with major Fuel DeFi protocols, transfer utilities, and a flexible tool-registration system. + +### โœจ Features + +- **Multi-Protocol Support** โ€” Out-of-the-box integrations for SwayLend (lending), Mira (DEX/AMM), and Read (data indexing) +- **Transfer Utilities** โ€” Secure asset transfer helpers with gas estimation and fee management +- **Agent Framework** โ€” Pluggable agent architecture with configurable tool chains +- **Type-Safe** โ€” Full TypeScript support with typed Fuel SDK interactions +- **Modular Design** โ€” Add or remove protocol integrations without touching core logic + +--- + +## ๐Ÿ“ฆ Installation + +```bash +npm install fuel-agent-kit +# or +pnpm install fuel-agent-kit +# or +yarn add fuel-agent-kit +``` + +--- + +## ๐Ÿš€ Quick Start + +```typescript +import { FuelAgent } from 'fuel-agent-kit'; +import { registerTools } from 'fuel-agent-kit/tools'; + +// Initialize the agent +const agent = new FuelAgent({ + network: 'testnet', + wallet: process.env.FUEL_WALLET, +}); + +// Register protocol tools +registerTools(agent, { + swaylend: true, // Enable lending/borrowing tools + mira: true, // Enable DEX swap tools + read: true, // Enable data read tools + transfers: true, // Enable transfer tools +}); + +// Execute actions +const result = await agent.execute('swap', { + fromAsset: 'ETH', + toAsset: 'USDC', + amount: 100, +}); +``` + +--- + +## ๐Ÿงฉ Architecture + +``` +fuel-agent-kit/ +โ”œโ”€โ”€ src/ +โ”‚ โ”œโ”€โ”€ index.ts # Main entry point +โ”‚ โ”œโ”€โ”€ agent.ts # Core agent implementation +โ”‚ โ”œโ”€โ”€ FuelAgent.ts # Fuel-specific agent logic +โ”‚ โ”œโ”€โ”€ tools.ts # Tool registration & routing +โ”‚ โ”œโ”€โ”€ constants.ts # Shared constants +โ”‚ โ”œโ”€โ”€ mira/ # Mira DEX integration +โ”‚ โ”œโ”€โ”€ swaylend/ # SwayLend lending integration +โ”‚ โ”œโ”€โ”€ read/ # Read protocol data tools +โ”‚ โ”œโ”€โ”€ transfers/ # Asset transfer utilities +โ”‚ โ”œโ”€โ”€ types/ # TypeScript type definitions +โ”‚ โ””โ”€โ”€ utils/ # Shared utility functions +โ”œโ”€โ”€ test/ # Test suites +โ”œโ”€โ”€ package.json +โ””โ”€โ”€ tsconfig.json +``` + +--- + +## ๐Ÿ”ง Protocol Integrations + +### ๐Ÿ’ฑ Mira (DEX/AMM) + +Automated market maker integration for token swaps on Fuel. + +```typescript +import { MiraTools } from 'fuel-agent-kit/mira'; + +const mira = new MiraTools(provider); +const swapResult = await mira.swap({ + inputToken: 'ETH', + outputToken: 'USDC', + amount: 100_000_000, // in atomic units + slippage: 0.01, // 1% +}); +``` + +### ๐Ÿฆ SwayLend (Lending) + +Supply and borrow assets on Fuel's lending protocol. + +```typescript +import { SwayLendTools } from 'fuel-agent-kit/swaylend'; + +const swaylend = new SwayLendTools(provider); +await swaylend.supply({ + asset: 'ETH', + amount: 500_000_000, +}); +``` + +### ๐Ÿ“Š Read (Data Indexing) + +Query indexed on-chain data with type-safe results. + +```typescript +import { ReadTools } from 'fuel-agent-kit/read'; + +const read = new ReadTools(provider); +const balances = await read.getAccountBalances(address); +``` + +### ๐Ÿ’ธ Transfers + +Secure asset transfers with gas estimation. + +```typescript +import { TransferTools } from 'fuel-agent-kit/transfers'; + +const transfer = new TransferTools(provider); +const tx = await transfer.send({ + to: recipientAddress, + asset: 'ETH', + amount: 10_000_000, +}); +``` + +--- + +## ๐Ÿ› ๏ธ Configuration + +### Environment Variables + +Copy `.env.example` to `.env` and configure: + +```env +FUEL_PROVIDER_URL=https://testnet.fuel.network/v1/graphql +FUEL_WALLET_PRIVATE_KEY=your_private_key_here +FUEL_NETWORK=testnet +``` + +### TypeScript Config + +The project uses `tsconfig.json` targeting modern TypeScript with strict mode enabled. + +--- + +## ๐Ÿงช Testing + +```bash +# Run all tests +npm test + +# Run with coverage +npm run test:coverage + +# Run specific test file +npx vitest run test/FuelAgent.test.ts +``` + +--- + +## ๐Ÿ“‹ Prerequisites + +- **Node.js** โ‰ฅ 16.0.0 +- **npm** / **pnpm** / **yarn** +- **Fuel Wallet** โ€” for signing transactions +- **Fuel Provider URL** โ€” testnet or mainnet endpoint + +--- + +## ๐Ÿค Contributing + +Contributions are welcome! Please: + +1. Fork the repository +2. Create a feature branch (`git checkout -b feat/your-feature`) +3. Commit your changes (`git commit -m 'feat: add your feature'`) +4. Push to the branch (`git push origin feat/your-feature`) +5. Open a Pull Request + +### Development Setup + +```bash +git clone https://github.com/priyanshudumps/fuel-agent-kit.git +cd fuel-agent-kit +npm install +npm run build +npm test +``` + +--- + +## ๐Ÿ“„ License + +This project is licensed under the MIT License โ€” see the [LICENSE](LICENSE) file for details. + +--- + +## ๐Ÿ”— Links + +- [Fuel Network](https://fuel.network/) +- [Fuel Documentation](https://docs.fuel.network/) +- [Mira DEX](https://mira.ly/) +- [SwayLend](https://swaylend.com/) +- [Report an Issue](https://github.com/priyanshudumps/fuel-agent-kit/issues) + +--- + +
+ Built with โค๏ธ for the Fuel ecosystem +