Skip to main content

๐Ÿ“– Reference

Table of contentsโ€‹

Enumerationsโ€‹

Classesโ€‹

Interfacesโ€‹

Type Aliasesโ€‹

Variablesโ€‹

Functionsโ€‹

Type Aliasesโ€‹

AddLiquidityOptionsโ€‹

ฦฌ AddLiquidityOptions: MintOptions | IncreaseOptions

Defined inโ€‹

nonfungiblePositionManager.ts:77


FullWithdrawOptionsโ€‹

ฦฌ FullWithdrawOptions: ClaimOptions & WithdrawOptions

Defined inโ€‹

staker.ts:8


IncreaseOptionsโ€‹

ฦฌ IncreaseOptions: CommonAddLiquidityOptions & IncreaseSpecificOptions

Defined inโ€‹

nonfungiblePositionManager.ts:75


MintOptionsโ€‹

ฦฌ MintOptions: CommonAddLiquidityOptions & MintSpecificOptions

Defined inโ€‹

nonfungiblePositionManager.ts:74


PermitOptionsโ€‹

ฦฌ PermitOptions: StandardPermitArguments | AllowedPermitArguments

Defined inโ€‹

selfPermit.ts:22

Variablesโ€‹

ADDRESS_ZEROโ€‹

โ€ข Const ADDRESS_ZERO: "0x0000000000000000000000000000000000000000"

Defined inโ€‹

constants.ts:3


FACTORY_ADDRESSโ€‹

โ€ข Const FACTORY_ADDRESS: "0x1F98431c8aD98523631AE4a59f267346ea31F984"

Defined inโ€‹

constants.ts:1


POOL_INIT_CODE_HASHโ€‹

โ€ข Const POOL_INIT_CODE_HASH: "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54"

Defined inโ€‹

constants.ts:5


TICK_SPACINGSโ€‹

โ€ข Const TICK_SPACINGS: { [amount in FeeAmount]: number }

The default factory tick spacings by fee amount.

Defined inโ€‹

constants.ts:20

Functionsโ€‹

computePoolAddressโ€‹

โ–ธ computePoolAddress(__namedParameters): string

Computes a pool address

Parametersโ€‹

NameType
__namedParametersObject
__namedParameters.factoryAddressstring
__namedParameters.feeFeeAmount
__namedParameters.initCodeHashManualOverride?string
__namedParameters.tokenAToken
__namedParameters.tokenBToken

Returnsโ€‹

string

The pool address

Defined inโ€‹

utils/computePoolAddress.ts:16


encodeRouteToPathโ€‹

โ–ธ encodeRouteToPath(route, exactOutput): string

Converts a route to a hex encoded path

Parametersโ€‹

NameTypeDescription
routeRoute<Currency, Currency>the v3 path to convert to an encoded path
exactOutputbooleanwhether the route should be encoded in reverse, for making exact output swaps

Returnsโ€‹

string

Defined inโ€‹

utils/encodeRouteToPath.ts:11


encodeSqrtRatioX96โ€‹

โ–ธ encodeSqrtRatioX96(amount1, amount0): JSBI

Returns the sqrt ratio as a Q64.96 corresponding to a given ratio of amount1 and amount0

Parametersโ€‹

NameTypeDescription
amount1BigintIshThe numerator amount i.e., the amount of token1
amount0BigintIshThe denominator amount i.e., the amount of token0

Returnsโ€‹

JSBI

The sqrt ratio

Defined inโ€‹

utils/encodeSqrtRatioX96.ts:11


isSortedโ€‹

โ–ธ isSorted<T>(list, comparator): boolean

Determines if a tick list is sorted

Type parametersโ€‹

Name
T

Parametersโ€‹

NameTypeDescription
listT[]The tick list
comparator(a: T, b: T) => numberThe comparator

Returnsโ€‹

boolean

true if sorted

Defined inโ€‹

utils/isSorted.ts:7


maxLiquidityForAmountsโ€‹

โ–ธ maxLiquidityForAmounts(sqrtRatioCurrentX96, sqrtRatioAX96, sqrtRatioBX96, amount0, amount1, useFullPrecision): JSBI

Computes the maximum amount of liquidity received for a given amount of token0, token1, and the prices at the tick boundaries.

Parametersโ€‹

NameTypeDescription
sqrtRatioCurrentX96defaultthe current price
sqrtRatioAX96defaultprice at lower boundary
sqrtRatioBX96defaultprice at upper boundary
amount0BigintIshtoken0 amount
amount1BigintIshtoken1 amount
useFullPrecisionbooleanif false, liquidity will be maximized according to what the router can calculate, not what core can theoretically support

Returnsโ€‹

JSBI

Defined inโ€‹

utils/maxLiquidityForAmounts.ts:68


mostSignificantBitโ€‹

โ–ธ mostSignificantBit(x): number

Parametersโ€‹

NameType
xdefault

Returnsโ€‹

number

Defined inโ€‹

utils/mostSignificantBit.ts:12


nearestUsableTickโ€‹

โ–ธ nearestUsableTick(tick, tickSpacing): number

Returns the closest tick that is nearest a given tick and usable for the given tick spacing

Parametersโ€‹

NameTypeDescription
ticknumberthe target tick
tickSpacingnumberthe spacing of the pool

Returnsโ€‹

number

Defined inโ€‹

utils/nearestUsableTick.ts:9


priceToClosestTickโ€‹

โ–ธ priceToClosestTick(price): number

Returns the first tick for which the given price is greater than or equal to the tick price

Parametersโ€‹

NameTypeDescription
pricePrice<Token, Token>for which to return the closest tick that represents a price less than or equal to the input price, i.e. the price of the returned tick is less than or equal to the input price

Returnsโ€‹

number

Defined inโ€‹

utils/priceTickConversions.ts:29


subIn256โ€‹

โ–ธ subIn256(x, y): JSBI

Parametersโ€‹

NameType
xdefault
ydefault

Returnsโ€‹

JSBI

Defined inโ€‹

utils/tickLibrary.ts:11


tickToPriceโ€‹

โ–ธ tickToPrice(baseToken, quoteToken, tick): Price<Token, Token>

Returns a price object corresponding to the input tick and the base/quote token Inputs must be tokens because the address order is used to interpret the price represented by the tick

Parametersโ€‹

NameTypeDescription
baseTokenTokenthe base token of the price
quoteTokenTokenthe quote token of the price
ticknumberthe tick for which to return the price

Returnsโ€‹

Price<Token, Token>

Defined inโ€‹

utils/priceTickConversions.ts:14


toHexโ€‹

โ–ธ toHex(bigintIsh): string

Converts a big int to a hex string

Parametersโ€‹

NameType
bigintIshBigintIsh

Returnsโ€‹

string

The hex encoded calldata

Defined inโ€‹

utils/calldata.ts:23


tradeComparatorโ€‹

โ–ธ tradeComparator<TInput, TOutput, TTradeType>(a, b): number

Trades comparator, an extension of the input output comparator that also considers other dimensions of the trade in ranking them

Type parametersโ€‹

NameTypeDescription
TInputextends CurrencyThe input token, either Ether or an ERC-20
TOutputextends CurrencyThe output token, either Ether or an ERC-20
TTradeTypeextends TradeTypeThe trade type, either exact input or exact output

Parametersโ€‹

NameTypeDescription
aTrade<TInput, TOutput, TTradeType>The first trade to compare
bTrade<TInput, TOutput, TTradeType>The second trade to compare

Returnsโ€‹

number

A sorted ordering for two neighboring elements in a trade array

Defined inโ€‹

entities/trade.ts:16