[TKN-748] Add "increase_liquidity_by_token_amounts_v2" Instruction, SDK builders, and integration tests #1159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new v2-only instruction that increases position liquidity by specifying token maxima (
token_max_a/token_max_b) instead of a direct liquidity amount. It wires the instruction into the program entrypoint, exposes it through the legacy SDK builders and facade, and adds comprehensive parity-level integration tests.Program (Anchor / Solana)
increase_liquidity_by_token_amounts_v2.programs/whirlpool/src/lib.rsand v2 mod re-exports.estimate_max_liquidity_from_token_amountsto safely compute liquidity from token maxima using U256 utilities for safe, overflow-free, and fee-aware arithmetic.LiquidityIncreasedevent. ReturnsLiquidityZerowhen maxima imply no computed liquidity, andTokenMaxExceededif fee-inclusive amounts surpass the maxima.Generated Code
target/idl/whirlpool.json) has been updated.increaseLiquidityByTokenAmountsV2.Legacy SDK (Builders and Facade)
legacy-sdk/whirlpool/src/instructions/v2/increase-liquidity-by-token-amounts-ix.ts. Handles transfer-hook remaining accounts and memo program logic.WhirlpoolIx.increaseLiquidityByTokenAmountsV2Ix(...)insrc/ix.ts.Tests (Parity-Level Integration)
A new test suite,
increase_liquidity_by_token_amounts_v2.test.ts, provides extensive coverage, including:MAX_U64edge cases.