DeFi plugin for Monad Agent Kit - DEX swaps via Kuru
npm install @monad-agent-kit/plugin-defiDeFi plugin for Monad Agent Kit — token swaps via Kuru DEX and 0x aggregator, liquidity provision, limit orders, and aPriori staking.
``bash`
bun add @monad-agent-kit/core @monad-agent-kit/plugin-defi
`typescript
import { MonadAgentKit } from "@monad-agent-kit/core"
import { defiPlugin } from "@monad-agent-kit/plugin-defi"
const agent = new MonadAgentKit({ privateKey: "0x..." })
await agent.use(defiPlugin)
`
`typescript
// Get a quote
const quote = await agent.execute("getQuote", {
tokenIn: "0x0000000000000000000000000000000000000000", // native MON
tokenOut: "0xUSDC",
amountIn: "1.0",
})
// Execute swap
await agent.execute("swap", {
tokenIn: "0x0000000000000000000000000000000000000000",
tokenOut: "0xUSDC",
amountIn: "1.0",
slippage: 50, // 0.5% in bps
})
// Multiple swaps in one call
await agent.execute("multiSwap", {
swaps: [
{ tokenIn: "0xMON", tokenOut: "0xUSDC", amountIn: "1.0" },
{ tokenIn: "0xMON", tokenOut: "0xWETH", amountIn: "0.5" },
],
})
`
Requires ZEROX_API_KEY environment variable.
`typescript
const quote = await agent.execute("getQuote0x", {
tokenIn: "0xWMON",
tokenOut: "0xUSDC",
amountIn: "1.0",
apiKey: process.env.ZEROX_API_KEY,
})
// Compare Kuru vs 0x
const best = await agent.execute("getBestQuote", {
tokenIn: "0xWMON",
tokenOut: "0xUSDC",
amountIn: "1.0",
})
`
`typescript`
await agent.execute("wrapMON", { amount: "1.0" })
await agent.execute("unwrapWMON", { amount: "1.0" })
`typescript
// Get pool info
await agent.execute("getPoolInfo", { pool: "0x..." })
// Get LP positions
await agent.execute("getLPPositions", { pool: "0x..." })
// Add liquidity
await agent.execute("addLiquidity", {
pool: "0x...",
quoteLiquidity: "100",
startPrice: "0.018",
endPrice: "0.020",
})
// Remove liquidity
await agent.execute("removeLiquidity", {
pool: "0x...",
orderIds: ["1", "2"],
})
`
`typescript
// Place a limit buy order
await agent.execute("placeLimitOrder", {
pool: "0x...",
side: "buy",
price: "0.018",
amount: "100",
})
// Get active orders
await agent.execute("getLimitOrders", { pool: "0x..." })
// Cancel orders
await agent.execute("cancelLimitOrder", {
pool: "0x...",
orderIds: ["1", "2"],
})
`
`typescript
// Stake MON for aprMON
await agent.execute("stake", { amount: "10.0" })
// Get staking info
await agent.execute("getStakeInfo", {})
// Request unstake (starts wait period)
await agent.execute("requestUnstake", { shares: "5.0" })
// Claim after wait period
await agent.execute("claimUnstake", { requestId: "123" })
`
| Action | Description |
|--------|-------------|
| getQuote | Get swap quote from Kuru DEX |swap
| | Execute token swap on Kuru |multiSwap
| | Batch, split, or consolidate swaps |getQuote0x
| | Get 0x aggregator quote (mainnet) |swap0x
| | Execute swap via 0x (mainnet) |getBestQuote
| | Compare Kuru vs 0x quotes |wrapMON
| | Wrap MON to WMON |unwrapWMON
| | Unwrap WMON to MON |getPoolInfo
| | Get Kuru pool parameters |getLPPositions
| | Get LP positions for an address |addLiquidity
| | Add concentrated liquidity |removeLiquidity
| | Remove liquidity by order IDs |placeLimitOrder
| | Place a limit order (buy/sell) |cancelLimitOrder
| | Cancel limit orders |getLimitOrders
| | Get active limit orders |stake
| | Stake MON for aprMON |requestUnstake
| | Request unstake |claimUnstake
| | Claim unstaked MON |getStakeInfo` | Get staking position and rewards |
|
MIT