For estimation of input amount of tokens while calling quoteExactOutputSingle
I use following for uni v2
const pair = await Fetcher.fetchPairData(tokenFrom, tokenTo, provider);
const route = new Route([pair], tokenFrom, tokenTo);
const amountOut = new TokenAmount(tokenTo, amountTo.toString());
const trade = Trade.exactOut(route, amountOut);
const amountIn = ethers.BigNumber.from(trade.inputAmount.raw.toString());
and for uni v3
const quoterContract = getUniswap3QuaterContract();
const amountIn = await quoterContract.callStatic.quoteExactOutputSingle(
tokenFromAddress,
tokenToAddress,
fee,
amountOut,
0
);
Does anyone know how to estimate token amount in for sushiswap?