Use useOutputOfCallAt — and an index when the earlier action returns an array — so a later Bundle action consumes that output instead of a hardcoded amount.
Definition
Chaining means each step in a Bundle can take the actual output of a previous step. That keeps a swap-then-deposit, or harvest-then-route, accurate when the intermediate size is not known in advance.
How it works
Set a later
amountInoramountOutto{ "useOutputOfCallAt": 0 }to consume the first action (zero-based).If that action returns an array, add
index, for example{ "useOutputOfCallAt": 0, "index": 1 }.References must point at an earlier output. A missing or future reference fails during bundle construction.
Some checks do not expose a normal consumable output. Consult the action output table before chaining off them.
How Enso does this
The Bundle API documents this reference object and shows a route action followed by a deposit that uses { useOutputOfCallAt: 0 }, then an enso slippage check on the deposit output. See also What is useOutputOfCallAt? in this Help Center and the Actions reference.
FAQ
Can two later actions both consume the same earlier output?
Follow the action output table. A reference always points at an already-built earlier output; whether that output can be consumed twice depends on the action, not on a generic rule invented here.
Do I still pass a static amountIn on the first action?
Yes. The first action needs a concrete input (or a flashloan). Later actions can then reference its output.
Related articles
What is useOutputOfCallAt?
How do I add checks or slippage guards inside a bundle?
How do I use a flashloan in an Enso bundle?
How do I harvest or claim rewards in the same transaction?
How do I bundle multiple DeFi actions into one transaction?
