Actions61
- Activity Actions
- Asset Actions
- Custom Query Actions
- Hub Actions
- Lending Actions
- Market Data Actions
- Position Management Actions
- Position Swap Actions
- Protocol Actions
- Reserve Actions
- Spoke Actions
- Swap Actions
- User Position Actions
Swap → Prepare Token Swap
AI-generatedSummary
Prepare a token swap on Aave V4.
Inputs
- chainId — Choose from the list, or specify an ID using an expression
- prepareSwapBuyToken (required) — The token address to buy (or 'native' for native token)
- prepareSwapSellToken (required) — The token address to sell (or 'native' for native token)
- prepareSwapAmount (required) — The amount to swap (in token units, e.g., 1.5)
- prepareSwapKind — Whether to specify exact sell amount or exact buy amount
- prepareSwapUserAddress (required) — The address initiating the swap
- prepareSwapReceiverAddress — The address to receive the tokens (optional, defaults to user address)
Output shape
A JSON object representing the prepared swap, typically containing a swap identifier and metadata.
The exact fields may vary; commonly includes swapId, chainId, and status, but additional fields can appear depending on the node version.
Examples
Example 1: Swap 1 ETH for DAI on Ethereum mainnet
{ "chainId": "1", "prepareSwapBuyToken": "0x6B175474E89094C44Da98b954EedeAC495271d0F", "prepareSwapSellToken": "0x...", "prepareSwapAmount": "1.0", "prepareSwapKind": "SELL", "prepareSwapUserAddress": "0x..." }
Example 2: Buy 500 USDC with native token on Polygon
{ "chainId": "137", "prepareSwapBuyToken": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", "prepareSwapSellToken": "native", "prepareSwapAmount": "500", "prepareSwapKind": "BUY", "prepareSwapUserAddress": "0x..." }
Example 3: Swap tokens using a custom receiver address
{ "chainId": "56", "prepareSwapBuyToken": "0x...", "prepareSwapSellToken": "0x...", "prepareSwapAmount": "2.5", "prepareSwapKind": "SELL", "prepareSwapUserAddress": "0x...", "prepareSwapReceiverAddress": "0xReceiver..." }