Swap Tokens (Solana)
monei_swap_tokens_solanaSwap tokens on Solana automatically: SOL to SPL, SPL to SOL, or SPL to SPL using your Monei wallet, with slippage control.
Instructions
Swaps one token for another on Solana using the user's Monei wallet.
Routing is automatic based on which fields you provide:
outputMint provided + no inputMint → SOL to SPL token (e.g. SOL → USDC)
inputMint + outputMint both provided → SPL to SPL token (e.g. USDC → USDT)
inputMint provided + no outputMint → SPL token to SOL (e.g. USDC → SOL)
Before calling:
Confirm the user has sufficient balance using monei_get_solana_portfolio
Mint addresses for common tokens: USDC = EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v, USDT = Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
Show the user what they are swapping and get confirmation before executing
Args:
amount (number|string): Amount to swap. SOL-to-token: number (e.g. 1). Token-to-SOL: string (e.g. '100'). Token-to-token: number.
inputMint (string, optional): Mint address of the SPL token to sell. Omit when selling SOL.
outputMint (string, optional): Mint address of the SPL token to buy. Omit when buying SOL.
slippageBps (number, optional): Slippage tolerance in basis points. Default 50 (0.5%).
Returns: { "signature": string, // Solana transaction signature "txUrl": string, // Explorer URL to view the transaction "route": string // Human-readable description of what was swapped }
Examples:
"Swap 1 SOL for USDC" -> amount: 1, outputMint: USDC mint, no inputMint
"Swap 100 USDC for SOL" -> amount: "100", inputMint: USDC mint, no outputMint
"Swap 50 USDC for USDT on Solana" -> amount: 50, inputMint: USDC mint, outputMint: USDT mint
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount to swap. For SOL-to-token use a number (e.g. 1 for 1 SOL). For token-to-SOL use a string (e.g. '100' for 100 USDC). For token-to-token use a number. | |
| inputMint | No | Mint address of the token to sell. Omit if selling native SOL. | |
| outputMint | No | Mint address of the token to buy. Omit if buying native SOL. | |
| slippageBps | No | Slippage tolerance in basis points. Default is 50 (0.5%). |