Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

simulateSwapExactAmountOut

Quote the input needed for a swap given an exact output amount and a route.

Signature

function simulateSwapExactAmountOut(
  client: Client,
  parameters: {
    output: Coin
    route: SwapRoute
    height?: number
  },
): Promise<Coin>

Example

import { createPublicClient, createTransport, testnet } from "@left-curve/sdk"
 
const client = createPublicClient({ chain: testnet, transport: createTransport() })
const quote = await client.simulateSwapExactAmountOut({
  output: { denom: "bridge/usdc", amount: "100000000" },
  route: [{ baseDenom: "dango", quoteDenom: "bridge/usdc" }],
})
console.log(quote.amount)

Parameters

outputCoin. Exact output { denom, amount } in base units.

routeSwapRoute. Array of PairId hops.

heightnumber, optional. Block height. Default 0 (latest).

Returns

Coin — the simulated input { denom, amount }.

See also