Function: frameSlot0()
gSwap SDK 2.0.0-rc.4 / frameSlot0
Function: frameSlot0()
frameSlot0(
slot0):FramedSlot0
Defined in: packages/gswap-sdk/dist/index.d.ts:4385
Puts a slot0 answer into the frame of the request. The backend always answers in the pool's
canonical order and says so with flippedFromRequest; when the caller asked for the reverse
order the price is inverted here (at 60 significant digits, so a very large or very small
reciprocal keeps its precision) and the tick is re-derived from the inverted price with the
contract's greatest-tick rule. Negating the tick instead is wrong for a price between ticks
(and -t - 1 is wrong for a price exactly on a tick: sqrtPrice 1 / tick 0 stays 1 / 0).
Parameters
slot0
flippedFromRequest?
boolean
sqrtPrice
string
tick
number
Returns
Example
const slot0 = await gSwap.pools.getSlot0('A', 'B', 500);
const { sqrtPrice, tick } = frameSlot0(slot0);