๐ Reference
Table of contentsโ
Enumerationsโ
Classesโ
- FullMath
- LiquidityMath
- Multicall
- NoTickDataProvider
- NonfungiblePositionManager
- Payments
- Pool
- Position
- PositionLibrary
- Route
- SelfPermit
- SqrtPriceMath
- Staker
- SwapMath
- SwapQuoter
- SwapRouter
- Tick
- TickLibrary
- TickList
- TickListDataProvider
- TickMath
- Trade
Interfacesโ
- AllowedPermitArguments
- BestTradeOptions
- ClaimOptions
- CollectOptions
- CommonAddLiquidityOptions
- FeeOptions
- IncentiveKey
- IncreaseSpecificOptions
- MethodParameters
- MintSpecificOptions
- NFTPermitOptions
- QuoteOptions
- RemoveLiquidityOptions
- SafeTransferOptions
- StandardPermitArguments
- SwapOptions
- TickConstructorArgs
- TickDataProvider
- WithdrawOptions
Type Aliasesโ
Variablesโ
Functionsโ
- computePoolAddress
- encodeRouteToPath
- encodeSqrtRatioX96
- isSorted
- maxLiquidityForAmounts
- mostSignificantBit
- nearestUsableTick
- priceToClosestTick
- subIn256
- tickToPrice
- toHex
- tradeComparator
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โ
| Name | Type |
|---|---|
__namedParameters | Object |
__namedParameters.factoryAddress | string |
__namedParameters.fee | FeeAmount |
__namedParameters.initCodeHashManualOverride? | string |
__namedParameters.tokenA | Token |
__namedParameters.tokenB | Token |
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โ
| Name | Type | Description |
|---|---|---|
route | Route<Currency, Currency> | the v3 path to convert to an encoded path |
exactOutput | boolean | whether 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โ
| Name | Type | Description |
|---|---|---|
amount1 | BigintIsh | The numerator amount i.e., the amount of token1 |
amount0 | BigintIsh | The 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โ
| Name | Type | Description |
|---|---|---|
list | T[] | The tick list |
comparator | (a: T, b: T) => number | The 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โ
| Name | Type | Description |
|---|---|---|
sqrtRatioCurrentX96 | default | the current price |
sqrtRatioAX96 | default | price at lower boundary |
sqrtRatioBX96 | default | price at upper boundary |
amount0 | BigintIsh | token0 amount |
amount1 | BigintIsh | token1 amount |
useFullPrecision | boolean | if 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โ
| Name | Type |
|---|---|
x | default |
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โ
| Name | Type | Description |
|---|---|---|
tick | number | the target tick |
tickSpacing | number | the 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โ
| Name | Type | Description |
|---|---|---|
price | Price<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โ
| Name | Type |
|---|---|
x | default |
y | default |
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โ
| Name | Type | Description |
|---|---|---|
baseToken | Token | the base token of the price |
quoteToken | Token | the quote token of the price |
tick | number | the 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โ
| Name | Type |
|---|---|
bigintIsh | BigintIsh |
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โ
| Name | Type | Description |
|---|---|---|
TInput | extends Currency | The input token, either Ether or an ERC-20 |
TOutput | extends Currency | The output token, either Ether or an ERC-20 |
TTradeType | extends TradeType | The trade type, either exact input or exact output |
Parametersโ
| Name | Type | Description |
|---|---|---|
a | Trade<TInput, TOutput, TTradeType> | The first trade to compare |
b | Trade<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