NonfungiblePositionManager
The NonfungiblePositionManager class builds calldata for all liquidity position operations: mint, increase, collect fees, and remove. All transactions target NONFUNGIBLE_POSITION_MANAGER_ADDRESSES[chainId].
addCallParameters
Mint a new position or increase liquidity on an existing one.
typescript
import { NonfungiblePositionManager, NONFUNGIBLE_POSITION_MANAGER_ADDRESSES, ChainId } from '@hydrexfi/hydrex-sdk';
// Mint new position
const { calldata, value } = NonfungiblePositionManager.addCallParameters(position, {
slippageTolerance: new Percent(50, 10_000),
recipient: '0xYourWallet',
deadline: Math.floor(Date.now() / 1000) + 1200,
});
// Increase existing position
const { calldata: increaseCalldata } = NonfungiblePositionManager.addCallParameters(position, {
tokenId: '42',
slippageTolerance: new Percent(50, 10_000),
deadline: Math.floor(Date.now() / 1000) + 1200,
});ℹ
Omit
tokenId to mint a new position NFT. Include it to add to an existing position.collectCallParameters
Collect accrued trading fees without removing liquidity.
typescript
const { calldata, value } = NonfungiblePositionManager.collectCallParameters({
tokenId: '42',
recipient: '0xYourWallet',
expectedCurrencyOwed0: CurrencyAmount.fromRawAmount(USDC, '0'),
expectedCurrencyOwed1: CurrencyAmount.fromRawAmount(WETH, '0'),
});removeCallParameters
Remove some or all liquidity, optionally collecting fees in the same call.
typescript
const { calldata, value } = NonfungiblePositionManager.removeCallParameters(position, {
tokenId: '42',
liquidityPercentage: new Percent(100, 100),
slippageTolerance: new Percent(50, 10_000),
deadline: Math.floor(Date.now() / 1000) + 1200,
collectOptions: {
expectedCurrencyOwed0: CurrencyAmount.fromRawAmount(USDC, '0'),
expectedCurrencyOwed1: CurrencyAmount.fromRawAmount(WETH, '0'),
recipient: '0xYourWallet',
},
});Contract Addresses
| Network | Address |
|---|---|
| Base Mainnet | 0xC63E9672f8e93234C73cE954a1d1292e4103Ab86 |