Swap Tokens (EVM)
monei_swap_tokens_evmExchange tokens on EVM networks via Monei wallet. Supports native-to-ERC20, ERC20-to-ERC20, and ERC20-to-native swaps with automatic routing and slippage control.
Instructions
Swaps one token for another on an EVM network using the user's Monei wallet.
Routing is automatic based on which fields you provide:
No tokenIn + tokenOut provided → Native to ERC-20 (e.g. ETH → USDC)
tokenIn + tokenOut both provided → ERC-20 to ERC-20 (e.g. USDC → USDT)
tokenIn provided + no tokenOut → ERC-20 to Native (e.g. USDC → ETH)
Before calling:
Confirm the user has sufficient balance using monei_get_evm_portfolio
If the user doesn't know contract addresses, look them up from their portfolio token list
Show the user what they are swapping and get confirmation before executing
Args:
amount (string): Amount to swap. Native-to-token: native amount (e.g. '0.1'). Token swaps: tokenIn amount.
chainId (number): Chain to swap on. 56=BSC, 137=Polygon, 8453=Base, 1=Ethereum, 42161=Arbitrum, 10=Optimism
tokenIn (string, optional): ERC-20 contract address of token to sell. Omit for native token sells.
tokenOut (string, optional): ERC-20 contract address of token to buy. Omit for native token buys.
slippageBps (number, optional): Slippage tolerance in basis points. Default 50 (0.5%).
Returns: { "txHash": string, // Transaction hash — can be checked on the block explorer "amount": string, "chainId": number, "route": string // Human-readable description of what was swapped }
Examples:
"Swap 0.1 ETH for USDC on Base" -> amount: "0.1", chainId: 8453, tokenOut: USDC contract
"Swap 100 USDC for USDT on BSC" -> amount: "100", chainId: 56, tokenIn: USDC contract, tokenOut: USDT contract
"Swap 50 USDC for BNB" -> amount: "50", chainId: 56, tokenIn: USDC contract, no tokenOut
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount to swap as a string. For native-to-token swaps this is the native amount (e.g. '0.1' ETH). For token swaps this is the tokenIn amount. | |
| chainId | Yes | Chain to swap on. 56=BSC, 137=Polygon, 8453=Base, 1=Ethereum, 42161=Arbitrum, 10=Optimism | |
| tokenIn | No | Contract address of the token to sell. Omit if selling the native token (ETH, BNB, MATIC). | |
| tokenOut | No | Contract address of the token to buy. Omit if buying the native token (ETH, BNB, MATIC). | |
| slippageBps | No | Slippage tolerance in basis points. Default is 50 (0.5%). Max is 10000 (100%). |