A specialized Cardano DeFi AI agent powered by Minswap's aggregator API. This agent provides comprehensive DeFi functionality including real-time ADA pricing, wallet analysis, token discovery, swap route optimization, and transaction building across Cardano's leading DEX protocols.
- π€ Complete AI Agent Setup - Pre-configured agent with OpenAPI specification for Minswap integration
- π° Real-time ADA Pricing - Get current ADA prices in 40+ currencies with 24-hour change data
- π Wallet Analysis - Comprehensive Cardano wallet balance and token analysis
- π Token Discovery - Search and filter Cardano native tokens with verification status
- π Swap Optimization - Find optimal swap routes across multiple DEX protocols:
- MinswapV2
- SundaeSwap
- WingRiders
- MuesliSwap
- VyFinance
- π Order Management - Track pending swap orders across all supported protocols
- π Transaction Building - Create unsigned Cardano transactions ready for wallet signing
- β‘ Next.js 15 with App Router and TypeScript
- π¨ Modern Development Stack - Tailwind CSS, ESLint, TypeScript
- π One-Command Development - Integrated with
make-agentfor seamless development - π Production Ready - Built-in deployment scripts and Vercel integration
- Node.js 18+ and pnpm (or npm)
- A Bitte wallet account
- Git
git clone https://github.com/BitteProtocol/minswap-agent.git
cd minswap-agent
pnpm installCreate a .env.local file:
# Required: Get your API key from https://key.bitte.ai
BITTE_API_KEY='your-api-key'
# Required: Your account ID (can be any identifier)
ACCOUNT_ID='your-account-id'
# Optional: For local development
NEXT_PUBLIC_HOST='localhost'
PORT=3000pnpm run devThis command will:
- Start your Next.js application on
http://localhost:3000 - Launch
make-agentdevelopment mode - Prompt you to sign a message in your Bitte wallet to authenticate
- Open your agent in the Bitte playground for testing
- Enable hot reload for seamless development
# Build without deployment
pnpm run build
# Build and deploy to production
pnpm run build:deployThe Minswap agent includes comprehensive DeFi tools for Cardano ecosystem interaction:
- Purpose: Get real-time ADA prices in 40+ currencies
- Parameters:
currency(optional, defaults to USD) - Features: 24-hour price change tracking
- Use Case: Portfolio valuation and price monitoring
- Purpose: Comprehensive wallet balance and token analysis
- Parameters:
address(Cardano wallet),amount_in_decimal(optional) - Features: ADA balance, token holdings, minimum lovelace requirements
- Use Case: Portfolio analysis and asset management
- Purpose: Search and filter Cardano native tokens
- Parameters:
query,only_verified,assets,search_after - Features: Verification status, pricing data, project information
- Methods: Both GET (query params) and POST (JSON body)
- Use Case: Token research and discovery
- Purpose: Find optimal swap routes across multiple DEXs
- Parameters:
amount,token_in,token_out,slippage, etc. - Features: Multi-hop routing, protocol exclusion, price impact analysis
- Methods: Both GET (query params) and POST (JSON body)
- Integration: Aggregates liquidity across 5 major DEX protocols
- Purpose: Track pending swap orders across all protocols
- Parameters:
owner_address,amount_in_decimal - Features: Cross-protocol order tracking, detailed order information
- Use Case: Order monitoring and management
- Purpose: Build unsigned Cardano transactions for swaps
- Parameters:
sender,min_amount_out,estimate,amount_in_decimal - Features: CBOR transaction output ready for wallet signing
- Integration: Uses estimate data to construct valid transactions
- Purpose: Get user account and EVM address information
- Context-Aware: Automatically populated by Bitte's context system
- Use Case: User identification and multi-chain support
- Purpose: Get supported blockchain information
- Implementation: Returns available blockchain networks
- Use Case: Multi-chain awareness and network selection
The agent is configured through AI plugin manifests at /api/ai-plugin/route.ts and /app/ai-plugin/route.ts. These endpoints return OpenAPI specifications that define:
{
name: "Minswap Agent",
description: "A specialized Cardano DeFi assistant powered by Minswap's aggregator API...",
instructions: "You are a Cardano DeFi specialist focused on Minswap integration...",
tools: [
{ type: "get-ada-price" },
{ type: "get-wallet-balance" },
{ type: "search-tokens" },
{ type: "search-tokens-query" },
{ type: "get-swap-estimate" },
{ type: "get-swap-estimate-query" },
{ type: "get-pending-orders" },
{ type: "build-swap-tx" },
{ type: "get-user" },
{ type: "get-blockchains" },
{ type: "generate-cardano-tx" }
],
categories: ["DeFi", "DAO", "Social"],
chainIds: [1, 8453]
}- Dual Method Support: Many endpoints support both GET (query parameters) and POST (JSON body) for AI agent flexibility
- Token Symbol Mapping: Automatic conversion of common symbols (MIN, DJED, SHEN, ADA) to proper token IDs
- Workflow Integration: Designed for estimate β build-tx β generate-cardano-tx workflow
- Error Handling: Comprehensive validation and error reporting
- Deployment URL: Automatically detected from Vercel or environment variables
1. User: "I want to swap 10 ADA for MIN tokens"
2. Agent searches for MIN token using searchTokensQuery
3. Agent gets swap estimate using getSwapEstimateQuery
4. Agent asks user for wallet address
5. Agent builds transaction using buildSwapTx
6. Agent returns unsigned transaction CBOR for wallet signing
1. User: "What's the current ADA price in EUR?"
2. Agent calls getAdaPrice with currency=eur
3. Agent returns current price and 24h change
1. User provides Cardano wallet address
2. Agent calls getWalletBalance
3. Agent returns comprehensive portfolio breakdown
| Variable | Required | Description | Example |
|---|---|---|---|
BITTE_API_KEY |
β | Your Bitte API key from key.bitte.ai | bitte_key_... |
ACCOUNT_ID |
β | Your account identifier | your-account-id |
NEXT_PUBLIC_HOST |
β | Development host | localhost |
PORT |
β | Development port | 3000 |
NEXT_PUBLIC_BASE_URL |
β | Base URL for assets | https://yourdomain.com |
# Development with hot reload and make-agent
pnpm run dev
# Next.js development only (without make-agent)
pnpm run dev:agent
# Production build (local)
pnpm run build
# Build and deploy to production
pnpm run build:deploy
# Linting
pnpm run lint- Push your code to GitHub
- Connect your repository to Vercel
- Add environment variables in Vercel dashboard:
BITTE_API_KEYACCOUNT_ID
- Deploy! The build process automatically runs
make-agent deploy
# Build and deploy manually
pnpm run build:deployTo add your own tools to the agent:
// src/app/api/tools/my-tool/route.ts
import { NextResponse } from "next/server";
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const param = searchParams.get("param");
// Your tool logic here
return NextResponse.json({ result: "success" });
}Update both /api/ai-plugin/route.ts and /app/ai-plugin/route.ts:
// Add to tools array
tools: [
// ... existing tools
{ type: "my-tool" }
],
// Add to paths object
paths: {
// ... existing paths
"/api/tools/my-tool": {
get: {
summary: "My custom tool",
description: "Description of what your tool does",
operationId: "my-tool",
parameters: [
{
name: "param",
in: "query",
required: true,
schema: { type: "string" }
}
],
responses: {
"200": {
description: "Successful response",
content: {
"application/json": {
schema: {
type: "object",
properties: {
result: { type: "string" }
}
}
}
}
}
}
}
}
}Modify the instructions field in both agent configurations to include guidance on when and how to use your new tool.
- @bitte-ai/agent-sdk - Core SDK for Bitte integration
- make-agent - Development and deployment tooling
- Next.js 15 - React framework with App Router
- Minswap Aggregator API - Cardano DEX aggregation service
- vercel-url - Automatic deployment URL detection
- π Bitte Protocol Documentation
- π¬ Join our Telegram - Get help and connect with other developers
- π Report Issues
- π Next.js Documentation
- π OpenAPI Specification
- ποΈ Minswap Protocol
minswap-agent/
βββ src/app/
β βββ api/
β β βββ ai-plugin/route.ts # Agent manifest endpoint
β β βββ tools/ # Tool endpoints
β β βββ get-ada-price/
β β βββ get-wallet-balance/
β β βββ search-tokens/
β β βββ get-swap-estimate/
β β βββ get-pending-orders/
β β βββ build-swap-tx/
β β βββ get-user/
β β βββ get-blockchains/
β βββ ai-plugin/route.ts # Alternative agent manifest
β βββ config.ts # Environment configuration
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page
βββ public/ # Static assets
βββ package.json # Dependencies and scripts
βββ README.md # This file
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
MIT License - see LICENSE file for details.
Built with β€οΈ using Bitte Protocol and Minswap