@liqdlad/plugin-a2a-swap
v0.1.4
Published
A2A-Swap plugin for ElizaOS — autonomous token swaps and liquidity management on Solana via a constant-product AMM built for AI agents
Maintainers
Readme
@liqdlad/plugin-a2a-swap
ElizaOS plugin for A2A-Swap — the constant-product AMM built for autonomous AI agents on Solana.
Overview
A2A-Swap is a lightweight, agent-native decentralized exchange on Solana. Unlike traditional DEXes designed for human UIs, every instruction was designed for programmatic agent workflows:
- No tick ranges — constant-product x·y=k, simple to reason about
- No LP token mints — LP shares tracked on-chain in a
Positionaccount - Dual-approval mode —
approve_and_executerequires both agent + approver signatures, enabling multi-agent authorization workflows - Auto-compound — fees can be automatically reinvested into LP shares
Program ID: 8XJfG4mHqRZjByAd7HxHdEALfB8jVtJVQsdhGEmysTFq (mainnet-beta)
Installation
npm install @liqdlad/plugin-a2a-swapUsage
import { createAgent } from '@elizaos/core';
import { a2aSwapPlugin } from '@liqdlad/plugin-a2a-swap';
const agent = createAgent({
plugins: [a2aSwapPlugin],
// ...
});Environment Variables
| Variable | Required | Description |
|---|---|---|
| AGENT_PRIVATE_KEY | ✅ | Agent wallet secret key as JSON byte array, e.g. [1,2,3,...] |
| SOLANA_RPC_URL | optional | Solana RPC endpoint (default: https://api.mainnet-beta.solana.com) |
Actions
A2A_SIMULATE_SWAP
Simulate a swap and get fee breakdown without spending funds.
Options: mintIn, mintOut, amountIn (atomic units)
Returns: pool address, direction, protocol fee (0.020%), LP fee, estimated output, effective rate, price impact
Trigger phrases: simulate swap, estimate swap, quote swap, swap preview
A2A_SWAP
Execute an atomic token swap. Fully autonomous — no human approval needed.
Options: mintIn, mintOut, amountIn, optional maxSlippageBps (default: 50)
Trigger phrases: swap tokens, trade tokens, buy token, sell token
A2A_PROVIDE_LIQUIDITY
Deposit tokens into a pool and receive LP shares.
Options: mintA, mintB, amountA, optional amountB, optional autoCompound ("true"/"false")
Trigger phrases: provide liquidity, add liquidity, become LP
A2A_POOL_INFO
Fetch pool reserves, spot price, LP supply, and fee rate.
Options: mintA, mintB
Trigger phrases: pool info, pool stats, pool price, check pool
A2A_MY_FEES
Show accrued trading fees across all LP positions for the agent wallet.
Trigger phrases: my fees, check fees, claimable fees, earned fees
Live Pools (Mainnet)
| Pool | Address |
|---|---|
| SOL/USDC (30 bps) | BtBL5wpMbmabFimeUmLtjZAAeh4xWWf76NSpefMXb4TC |
Pools are permissionless — any agent can create a new pair.
Links
- Program: Solscan
- TypeScript SDK: @liqdlad/a2a-swap-sdk
- GitHub: liqdlad-rgb/a2a-swap
License
MIT
