v3-sdk
v3-sdk copied to clipboard
Doesn't seem like this library can execute trades without a TickDataProvider
The library doesn't include the code for one (Just the interface), and there's no instructions for how to write one in the documents. None of the functionality for executing trades or estimating the price of trades works without one.
Am I missing something?
Can someone please give a solution for this problem? Can’t implement anything without TickDataProvider and no one tells me how I can make it.
a common pattern is to use createUncheckedTrade
and use the Quoter, see e.g. https://github.com/Uniswap/uniswap-interface/blob/main/src/hooks/useBestV3Trade.ts
sorry, docs on this coming soon.
Any update here ?
Related: Using Trade.exactIn()
fails with error No tick data provider was given
:
const swapRoute = new Route([swapPool], wethToken, usdcToken)
const trade: Trade<Currency, Currency, TradeType> = await Trade.exactIn(swapRoute, amountToSwap)
I don't want to use Trade.createUncheckedTrade()
. That takes an input amount and an output amount. I don't know or care much what the output amount is. I know my input amount (and my route).
Are you saying that Trade.exactIn()
isn't really implemented in the SDK?
Also, the source URL above from @NoahZinsmeister is now a 404.
Hey, bumping this up. Having the same issue
https://discord.com/channels/597638925346930701/607978109089611786/972959141402386482
This seemed to help. I am not sure why the code requires that there be an equal amount of netLiquidity between all ticks in a tickListDataProvider.
@NoahZinsmeister could you perhaps comment on this? I'm happy to put in a PR that gets rid of this necessity, because it seems unnecessary. If I remove the invariant()
that requires netLiquidity=ZERO
from my local package, then my pool swaps work just fine in their estimation. It seems needlessly complicated to require users to have a tickList that has net 0 liquidity
EDIT: @Yorkemartin because I see this has been assigned to you
I too have the same issue. any pointers?
I'm having this exact same issue, seems this is not resolved yet? I see that the example uses quote (https://github.com/Uniswap/examples/blob/main/v3-sdk/trading/src/libs/trading.ts#L58), which I will have to do as well I suppose, but as mentioned above, I don't want to care about the output amount if there's an exactIn
function.
Any Clear solution for that Trying to use Trade.bestTradeExactIn
but getting this error
If you construct a Pool without a TickDataProvider it's not possible to make accurate simulations. You can read the whitepaper to understand why Pools will always have 0 net liquidity in total. If you try to make a trade on any Uniswap Pool and "not care" about the output, i.e. accept 100% slippage, a sandwich bot will exploit your trade and steal most of it.
There are solutions to prevent that, for example using an MEV protection service, but this was not available when this sdk was written.