Skip to main content
This page helps you open a liquidity position, called minting, in the Shield Swap app or with the Typescript SDK, Python SDK, or CLI.

Your deposit and withdrawal address

Your chosen range and the current pool price determine how much of each deposited asset becomes liquidity. Any amount the range does not use stays with the position until you collect it. If you deposit 100 units of an asset and the range uses 80, the remaining 20 are position funds you can collect. Those unused funds do not earn trading fees. Choose who manages the position and where its payouts go before you mint. The recipient address owns the position and can manage its liquidity. The withdrawal address receives every payout and is fixed for the life of the position, including after a rebalance. Both default to your connected wallet. The pool, the range, the liquidity, and the amounts in a position are public. Who owns the position is confidential. See Public data.

Preview and mint

Prerequisites: Your authenticated mainnet client for Typescript, dex for Python, or CLI profile from Setup, funded with a confidential balance of both pool assets. See Fund a trading account.Choose the pool before submitting. Replace POOL_KEY with its key from the pool list. For Typescript, replace AMOUNT0_BASE_UNITS and AMOUNT1_BASE_UNITS with bigint deposit budgets in the pool’s token order. The Python example converts decimal strings to integer base units using each token’s decimals.For Typescript, define the confirmation helper before running the examples. Python includes its confirmation checks below.

Step 1: Choose the pool, amounts, and range

previewMint aligns the range to the pool’s tick spacing, calculates the liquidity the budget supports, and reports the amounts the range will consume. Nothing is spent.
Pass tickLower and tickUpper instead of rangePercent to set exact bounds. preview.inRange is false when the range does not include the current price. Zero liquidity means one side of the budget is empty or the amounts are too small for the range; a mint would still cost a fee and open nothing.

Step 2: Mint the position

Pass the amounts the preview reported, not the budget. That caps the mint at what the preview showed even if the price moves before the transaction finalizes.
minted.positionTokenId identifies the position for every later operation. withdrawal is where every collect pays, and it cannot be changed afterwards.

Step 3: Check the position

Save the transaction ID before waiting. The helper checks acceptance and waits for both the position state and its spendable record.
position.state.liquidity is the position’s share of the range. position.state.tokensOwed0 and tokensOwed1 can be nonzero right after a mint: any part of the desired amounts the range did not use is credited to the position for you to collect.

Wait between SDK operations

Continue with the authenticated mainnet client from Setup. Define the helper for your SDK before running the liquidity examples on this page and the pages that follow. Submit operations on a position one at a time.
waitForPosition checks transaction acceptance, then waits for the scanner to return the position. After an increase, decrease, or collect, pass the previous record’s tag so a stale record cannot satisfy the wait.
A timeout does not prove the transaction failed. Check the saved transaction ID before submitting another operation. Burn returns no replacement record; confirm its transaction and the removal of the public position row instead.

How it works on chain

mint transfers your desired token0 and token1 amounts into the AMM and creates a position. The amount used backs liquidity; any excess stays owed to the position until you collect it.

What mint creates

How liquidity is recorded

  1. The contract calculates liquidity and the amounts used at the current square-root price. Liquidity must be nonzero, and each used amount must meet its token minimum.
  2. It updates the boundary ticks, inserting any new boundaries with your supplied hints.
  3. It records the liquidity, owed balances, and current fee-growth checkpoints. Your position earns only subsequent fee growth.
Use spacing-aligned ticks with MIN_TICK <= tick_lower < tick_upper <= MAX_TICK. Fetch insertion hints immediately before submission; another accepted transaction can make a hint stale and cause your mint to be rejected.After acceptance, save the transaction ID, PositionNFT ciphertext, and change records before marking the input records spent. Live liquidity and owed balances are read from positions[token_id].

Next steps