Plan a plain swap between two assets
plan_swapPlans a swap of one asset for another from the wallet, through an aggregator's route, and returns the unsigned transactions (an approval of the router when paying with a token, then the swap). Use only when a wallet needs an asset on its own; to fund a position, prefer plan_build, which buys the sides it needs in the chain's own pools. Returns: transactions[] (to, data, value in wei, gas), check (simulated, ok, failedStep, reason, ethNeeded, ethHeld), sendWithin, ifItReverts, slippagePct, from and to with expected and atLeast amounts, hops, router. Behavior: read-only on our side; nothing is signed or sent. The plan is laid out from the chain at this block and simulated from the owner; send it within check.sendWithin, and plan again rather than resend one that reverted. Costs quota units (agent_quota). Errors: refused when no route exists for that amount.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | The asset wanted: ETH, USDG, a token symbol or a 0x address. | |
| from | Yes | The asset paid: ETH, USDG, a token symbol or a 0x address. | |
| owner | Yes | The wallet that signs and sends. | |
| amount | Yes | How much of `from`, as a decimal string. | |
| slippagePct | No | Room for the price to move, in percent. Left out: from the pool's recent moves, 1.5% at least. |