Creates Position instances and generates V4PositionManager calldata for adding liquidity.
This method uses Uniswap V3 SDK's Position.fromAmounts/fromAmount0/fromAmount1 to create positions, and V4PositionManager.addCallParameters to generate the mint calldata. It handles both existing pools and new pool creation, with support for Permit2 batch approvals and native currency handling. No blockchain calls are made - this is purely a calldata generation method.
Promise
Generates V4PositionManager calldata for collecting accumulated fees from positions.
This method uses V4PositionManager.collectCallParameters to create calldata for collecting fees earned by a liquidity position. It handles both currency0 and currency1 fee collection with proper recipient addressing. No blockchain calls are made - this is purely a calldata generation method.
Promise - Calldata and value for the collect transaction
Generates V4PositionManager calldata for removing liquidity from existing positions.
This method uses V4PositionManager.removeCallParameters to create burn calldata for reducing or completely removing liquidity from a position. It calculates the appropriate amounts based on the liquidity percentage to remove. No blockchain calls are made - this is purely a calldata generation method.
Promise - Calldata and value for the burn transaction
Generates Universal Router calldata for executing token swaps using Uniswap V4.
This method uses the V4Planner from the Uniswap V4 SDK to build swap actions and parameters. It creates SWAP_EXACT_IN_SINGLE actions with settle and take operations, and optionally includes Permit2 signatures for token approvals. No blockchain calls are made - this is purely a calldata generation method that returns Universal Router calldata.
Hex - Encoded Universal Router calldata ready for transaction execution
Returns the address of a specific contract.
The address of the specified contract.
Returns the FeeTier enum for accessing standard fee tiers.
The FeeTier enum containing LOWEST, LOW, MEDIUM, and HIGH fee tiers
Creates a Uniswap V4 Pool instance by fetching real-time pool state from the blockchain.
This method uses multicall to efficiently fetch pool data from the V4StateView contract, calling getSlot0() and getLiquidity() in a single transaction. It then uses the Uniswap V4 SDK's Pool constructor with the live data to create a fully initialized pool instance.
Promise
Retrieves a complete Uniswap V4 position instance with pool and token information.
This method fetches position details and builds a fully initialized Position instance using the Uniswap V4 SDK. It includes the pool state, token metadata, position liquidity data, and current pool tick, providing a comprehensive view of the position.
The NFT token ID of the position
Promise
Retrieves basic position information without SDK instances.
This method fetches raw position data from the blockchain and returns it without creating SDK instances. It's more efficient when you only need position metadata (tick range, liquidity, pool key) without requiring Position or Pool objects. Also fetches pool state (slot0 and liquidity) to avoid redundant calls when building full position instances.
Use this method when:
Use getPosition() instead when you need SDK instances for swaps, calculations, or other operations.
The NFT token ID of the position
Promise
Simulates a token swap using the V4 Quoter contract to get exact output amounts and gas estimates.
This method uses client.simulateContract() to call V4Quoter.quoteExactInputSingle() and simulate the swap without executing it. It provides accurate pricing information and gas estimates for the transaction without requiring multicall since it's a single contract simulation.
Promise
Fetches tick information for a given pool key and tick from V4 StateView.
This method uses client.readContract() to call V4StateView.getTickInfo() and retrieve tick data including liquidity and fee growth information. It first creates Token instances from the pool key currencies, computes the PoolId, and then reads the tick info from the blockchain.
Tick query parameters including pool key and tick index
Promise
Fetches ERC20 token metadata and creates Currency instances using Uniswap SDK-Core.
This method uses multicall to efficiently fetch symbol(), name(), and decimals() from multiple ERC20 tokens in a single transaction. For native currency (ETH), it creates an Ether instance using the chain ID. For ERC20 tokens, it creates Token instances with the fetched metadata.
Promise<Currency[]> - Array of Currency instances (Token or Ether)
Prepares Permit2 batch approval data for multiple tokens using the Permit2 SDK.
This method uses multicall to efficiently fetch allowance() data from the Permit2 contract for multiple tokens in a single transaction. It creates batch permit structures that allow the Universal Router to spend multiple tokens. Typically used for adding liquidity where multiple token approvals are needed. Use the returned toSign.values for signing.
Promise
Prepares Permit2 single token approval data using the Permit2 SDK.
This method creates a single permit structure that allows the Universal Router to spend one token. It's typically used for swaps where only one token approval is needed. No blockchain calls are made - this is purely a permit data generation method. Use the returned toSign.values for signing the permit data.
Promise
Main class for interacting with Uniswap V4 contracts. Provides a flexible and scalable way to interact with different chains and contracts without requiring multiple instances.