How it works
When you include destination calldata, funds are delivered to the destination contract and the encoded action is called immediately using the exact amount that arrived. You do not need to know the final amount in advance; the router substitutes it at execution time.- You encode the desired action (for example, a vault deposit) with a placeholder for the token amount.
- The API quotes a route that ends at the destination contract.
- Funds route and arrive at the contract.
- The encoded action executes with the actual arrived amount substituted in.
The amount placeholder
When encoding calldata, calldynamic() in the position where the token amount should appear. Trails replaces this placeholder with the exact amount of tokens that arrive at execution time.
This matters because the final amount may differ slightly from the quoted amount due to slippage or fee changes between quote and execution. Using the placeholder ensures the action always matches what actually arrived at execution time.
For other placeholders like self() (the intent wallet address), see Dynamic values.
React SDK (recommended)
Direct API
For server-side or headless integrations, passdestinationCalldata in the quote request:
Common destination actions
| Action | Description |
|---|---|
| Yield vault deposit | Deposit into an ERC-4626 or compatible vault; user receives yield-bearing shares |
| Staking | Stake tokens in a protocol; user earns staking rewards |
| Lending deposit | Supply to a lending protocol; user earns interest |
| Custom contract call | Any ABI-encoded function call on any contract at the destination |
Programmable destinations combine with any funding source. A customer can fund from a debit card and deposit into a yield vault in one action, with no intermediate steps.