Skip to main content

How do I track token flows in a Quoter simulation?

Pass tokenIn, amountIn, and tokenOut so Quoter knows which assets to track. The predicted outputs come back in result.amountOut, one value per tokenOut, in wei.

J
Written by Javier Diaz

Pass tokenIn, amountIn, and tokenOut so Enso Quoter knows which assets to track. The predicted outputs come back in result.amountOut, one value per tokenOut, in wei.

Definition

Token-flow fields are how you tell the simulator which balances matter. The calldata can touch many contracts; Quoter reports the output amounts for the tokens you list, not a full trace of every internal transfer unless you track those tokens.

How it works

  • Set tokenIn to the input token addresses and amountIn to the matching input amounts, as string arrays in wei, one amount per tokenIn.

  • Set tokenOut to the output token addresses you want previewed.

  • If tokens are received by an address other than the sender, set optional receiver.

  • After simulation, result.amountOut is aligned with tokenOut. Use result.status to decide whether to show those amounts.

  • For a batch simulate call, the same top-level tokenIn, tokenOut, and amountIn apply to every transaction in the request.

How Enso does this

These fields are required on POST https://quoter.api.enso.build/api/v1/simulate. See Simulating Transactions and How It Works. They do not change the calldata; they only select what the fork preview measures.

FAQ

What if I omit tokenOut?

tokenIn, tokenOut, and amountIn are required. Without them, the request is invalid (HTTP 400 for missing required fields).

Can I track both the spent token and a position token?

Yes. List every output address you want measured in tokenOut, and read the corresponding amountOut entries.

Related articles

  • How do I preview the output of a transaction?

  • How do I estimate tokens received from a contract call?

  • How do I simulate multiple transactions at once?

  • What is minAmountOut?

  • How do I simulate a DeFi transaction before sending it?

Sources

Did this answer your question?