Skip to content

dex.getSellQuote ​

Gets the quote for selling a specific amount of tokens.

Usage ​

ts
import { Actions } from 'wagmi/tempo'
import { parseUnits } from 'viem'
import { config } from './config'

const amountOut = await Actions.dex.getSellQuote(config, {
  amountIn: parseUnits('100', 6),
  tokenIn: '0x20c0000000000000000000000000000000000001',
  tokenOut: '0x20c0000000000000000000000000000000000002',
})

console.log('Amount received:', amountOut)
// @log: Amount received: 99700000n
ts
import { createConfig, http } from 'wagmi'
import { tempo } from 'wagmi/chains'
import { tempoWallet } from 'wagmi/tempo'

export const config = createConfig({
  connectors: [tempoWallet()],
  chains: [tempo],
  multiInjectedProviderDiscovery: false,
  transports: {
    [tempo.id]: http(),
  },
})

Return Type ​

ts
type ReturnType = bigint

Returns the amount of tokenOut received for selling the specified amountIn of tokenIn.

Parameters ​

amountIn ​

  • Type: bigint

Amount of tokenIn to sell.

tokenIn ​

  • Type: Address

Address of the token to sell.

tokenOut ​

  • Type: Address

Address of the token to receive.

Viem ​

Released under the MIT License.