swap routes through the Trails DEX API, including cross-chain swaps via --to-chain. deposit parks idle balances in Trails earn pools (Aave v3, Morpho, ERC-4626 vaults). withdraw exits those positions, with auto-discovery if you know only the asset and protocol. The CLI picks the highest-TVL pool by default; pass --protocol to constrain.
All three are dry-run by default. Pass --broadcast to execute.
How it works
--defi at wallet create time gives the smart wallet permission to interact with Aave v3, Morpho, and ERC-4626 vaults. Without --defi, deposit and withdraw fail with a session-rejection error before any funds move.
Commands
swap
--to-chain to bridge during the swap.
| Flag | Default | Purpose |
|---|---|---|
--wallet | main | Wallet name |
--chain | none | Source chain |
--from | required | Source token symbol |
--to | required | Destination token symbol |
--amount | required | Amount to swap |
--slippage | none | Tolerance 0–0.5 (e.g. 0.005 for 0.5%) |
--to-chain | none | Destination chain for cross-chain swap |
--broadcast | false | Execute the transaction |
deposit
--protocol, the CLI auto-selects the highest-TVL pool for the asset. --protocol aave or --protocol morpho constrains the choice.
| Flag | Default | Purpose |
|---|---|---|
--wallet | main | Wallet name |
--chain | none | Chain |
--asset | USDC | Asset symbol |
--amount | required | Amount to deposit |
--protocol | none | Filter: aave or morpho |
--broadcast | false | Execute the transaction |
withdraw
--amount max for a full exit.
| Flag | Default | Purpose |
|---|---|---|
--wallet | main | Wallet name |
--chain | none | Chain |
--position | none | aToken or vault share address |
--asset | none | Asset symbol (use with --protocol to auto-discover) |
--protocol | none | aave or morpho |
--amount | required | Underlying amount (Aave) or max / partial (ERC-4626) |
--broadcast | false | Execute the transaction |
Worked example
Implementation
Setup and wallets
Pass
--defi at wallet creation to enable swaps and yield.Transfers
Plain token transfers; no DEX routing.
Trails
The underlying DEX and earn-pool router.