Skip to main content
This page helps you collect the funds a position holds for you and close a position you no longer need, in the Shield Swap app or with the Typescript SDK, Python SDK, or CLI.

How position funds work

Your position funds include earned fees, unused deposits, and proceeds from liquidity you removed. Collecting pays these funds to the withdrawal address fixed when you minted. You cannot choose a different destination when collecting. You can collect without changing your liquidity or range. The liquidity you leave in the position can continue earning fees while its range is active. Funds waiting for collection do not earn trading fees. Burning removes a position that has no liquidity and no position funds left. In the app, this happens for you when you decrease a position by 100 percent. With the SDKs or CLI, it is a separate call after the final collect.

Collect and burn

Prerequisites: Your authenticated mainnet client for Typescript, dex for Python, or CLI profile from Setup, and a position with an owed balance, for example after Decreasing liquidity.Request the amounts the position reports it owes, read back from chain, rather than amounts assumed from an earlier decrease. A request above the owed total is rejected; a request below it succeeds and leaves the remainder owed.Replace POSITION_TOKEN_ID with the ID of the position you intend to change. Define the confirmation helper for your SDK before running these examples.

Step 1: Collect what is owed

collect has no recipient parameter; payment goes to the withdrawal address fixed at mint. Despite their names, uncollectedFees0 and uncollectedFees1 include both the settled owed balances and fees accrued since the last checkpoint. Do not add the owed balances again.

Step 2: Burn the empty position

Burn succeeds only after liquidity and both owed balances are zero.
The confirmation helper waits for a record whose tag differs from the one the collect spent. Pass that replacement record to burn.

How it works on chain

collect pays requested amounts to the withdrawal address fixed at mint. burn closes the position after its liquidity and both owed balances reach zero.

What each operation changes

How a collect settles

  1. The contract settles pending fees using the position’s current liquidity and fee growth inside its range.
  2. It checks each requested base-unit amount against that token’s total owed balance, including the newly settled fees. A request above either total rejects the transaction.
  3. It subtracts the payouts and advances the fee checkpoints. Any uncollected whole base units remain owed.
Fee settlement rounds down at the checkpoint; fractions below one base unit are not carried forward. See LP fee entitlements and Q128.128 fee growth.

Close the position in order

  1. Decrease all liquidity and wait for acceptance and the replacement PositionNFT.
  2. Collect both owed balances and wait for acceptance and another replacement record.
  3. Confirm that liquidity, tokens_owed0, and tokens_owed1 are all zero.
  4. Burn using the latest record. The position is closed once the burn is accepted.
Collection amounts and position accounting are public; the withdrawal address and payout records are confidential. See Public data.

Next steps