Skip to main content

Function: alignTickDownOrNaN()

gSwap SDK 2.0.0-rc.4


gSwap SDK 2.0.0-rc.4 / alignTickDownOrNaN

Function: alignTickDownOrNaN()

alignTickDownOrNaN(tick, spacing): number

Defined in: packages/gswap-sdk/dist/index.d.ts:4247

alignTickDown that answers NaN instead of throwing: the greatest multiple of spacing that is no greater than tick, or NaN when spacing is not a positive integer (a pool whose spacing has not loaded yet) or tick is not a number. For an app shell and for a drag handler, which must not throw while the spacing is missing. alignTickDown (the SDK's own call sites use it) gives the same value and throws for the bad spacing.

Parameters​

tick​

number

spacing​

number

Returns​

number

Example​

alignTickDownOrNaN(-61, 60); // -120: it floors, it does not truncate toward zero
alignTickDownOrNaN(100, 0); // NaN