Skip to main content
A Shield Swap position has public economic state and a PositionNFT record. The record authorizes position changes. Its token ID remains stable while replacement records are issued through the position lifecycle.

Preview a position

Choose a pool and read balances for both tokens. previewMint aligns the range to tick spacing, calculates the supported liquidity, and reports the token amounts the position would consume.
You can pass tickLower and tickUpper together instead of rangePercent. preview.inRange tells you whether the position will earn fees at the current tick. State can move between preview and finalization, so set minimum amounts when the application needs tighter deposit protection.

Mint

Resolve token programs, then use the aligned range and consumed amounts returned by the preview.
recipient receives the PositionNFT and controls the position. withdrawal receives every later collect payout. The withdrawal address is fixed at mint and cannot be changed. Confirm both addresses before submission. They may be different from each other and from the transaction signer. Mint creates the first PositionNFT. Store its token ID and wait for the new record before offering another position action.

Find owned positions

Mapping state may appear before the replacement record reaches the scanner. Poll for the expected record after each accepted action.

Increase liquidity

An increase spends the current position record and both token records. It keeps the same position token ID and issues an updated PositionNFT.
The tick range and withdrawal address do not change. A local-key client can select records through its scanner. A wallet client must supply its position and token record requests.

Decrease and collect

decreaseLiquidity moves principal and accrued fees into the position’s owed balances. It does not transfer token records to the LP.
Collect sends token records to the immutable withdrawal address stored in the PositionNFT. It has no recipient parameter. Increase, decrease, and collect each consume the current position record and issue a replacement, so wait for that replacement before the next action.

Close the position

Burn succeeds after liquidity and both owed balances reach zero.
The closing order is:
  1. Decrease all remaining liquidity.
  2. Collect all owed token amounts.
  3. Confirm the latest replacement PositionNFT is available.
  4. Burn the empty position.
Burn consumes the final record and removes the public position. It does not issue a replacement. See Liquidity provider workflow, minting a position, and collecting and burning for the contract-level behavior.