@monad-agent-kit/plugin-token
v0.1.1
Published
Token plugin for Monad Agent Kit - ERC20 and native MON operations
Maintainers
Readme
@monad-agent-kit/plugin-token
Token operations plugin for Monad Agent Kit — transfer, balance, approve, and allowance for native MON and ERC-20 tokens.
Installation
bun add @monad-agent-kit/core @monad-agent-kit/plugin-tokenUsage
import { MonadAgentKit } from "@monad-agent-kit/core"
import { tokenPlugin } from "@monad-agent-kit/plugin-token"
const agent = new MonadAgentKit({ privateKey: "0x..." })
await agent.use(tokenPlugin)Actions
transfer
Send native MON or ERC-20 tokens.
// Send native MON
await agent.execute("transfer", {
to: "0x...",
amount: "1.5",
})
// Send ERC-20 token
await agent.execute("transfer", {
to: "0x...",
amount: "100",
token: "0x...", // ERC-20 contract address
})batchTransfer
Execute multiple transfers in a single call. Supports mixed native MON and ERC-20 transfers.
await agent.execute("batchTransfer", {
transfers: [
{ to: "0xAlice", amount: "1.0" }, // MON
{ to: "0xBob", amount: "50", token: "0xUSDC" }, // ERC-20
{ to: "0xCharlie", amount: "2.0" }, // MON
],
})getBalance
Check token balance for any address.
// Native MON balance (own wallet)
await agent.execute("getBalance", {})
// ERC-20 balance for another address
await agent.execute("getBalance", {
address: "0x...",
token: "0x...",
})approve
Set ERC-20 spending allowance.
await agent.execute("approve", {
token: "0x...",
spender: "0x...",
amount: "1000",
})getAllowance
Check current ERC-20 allowance.
await agent.execute("getAllowance", {
token: "0x...",
spender: "0x...",
owner: "0x...", // optional, defaults to agent wallet
})Exports
import {
tokenPlugin, // Plugin object
transferAction, // Individual actions
batchTransferAction,
balanceAction,
approveAction,
allowanceAction,
erc20Abi, // Standard ERC-20 ABI
} from "@monad-agent-kit/plugin-token"License
MIT
