dex.getSellQuote
Gets the quote for selling a specific amount of tokens.
Usage
import { } from 'viem'
import { } from './viem.config'
const = await .dex.getSellQuote({
: ('100', 6),
: '0x20c0000000000000000000000000000000000001',
: '0x20c0000000000000000000000000000000000002',
})
.('Amount received:', )
Amount received: 99700000nReturn Type
type ReturnType = bigintReturns 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.
blockNumber (optional)
- Type:
bigint
Block number to read the state from.
blockOverrides (optional)
- Type:
BlockOverrides
Block overrides to apply to the state.
blockTag (optional)
- Type:
BlockTag
Block tag to read the state from.
stateOverride (optional)
- Type:
StateOverride
State override to apply.