Skip to main content

Open, deposit, claim, withdraw, close

binWeights is a raw per-bin weight array — the SDK doesn’t ship shape presets (Spot / Curve / Bid-Ask). Generating a triangular or U-shaped curve from a shape name is a few lines of plain TypeScript you write yourself; see Positions and liquidity.

Reading position state

position.data exposes the decoded on-chain Position account directly from the cached account — no extra fetch needed:
position.getInfo() returns a full summary — deposited amounts and the total fee a claimFee call would sweep right now, each in both gross* (before any Token-2022 transfer fee) and net* (what you’d actually receive) forms:
info.bins (same as calling position.getBinInfos() directly) is the per-bin breakdown getInfo() sums to produce those totals — always raw, since gross*/net* only apply once, to the aggregate:
Both are computed entirely from cached data. getBinInfos() makes no RPC calls at all; getInfo() makes exactly one round trip (via Pool.getTransferFees()) to resolve each mint’s live transfer-fee rate.

Looking up positions

Refresh a position’s cached state after it changes on-chain:
Look up every position minted to a given owner, across all their pools:
Or fetch a single position directly if you already know its address:

Claiming across many positions

Position.claimAllFees():
  • Skips positions with nothing pending, checked locally with no extra RPC.
  • Batches the rest into fixed-size instruction groups (3 positions per transaction by default, overridable via a third argument), one transaction per batch.
  • Shares a single set of ATA setup/teardown instructions across the whole batch, rather than repeating them per position.
  • Requires every position in the call to belong to the same pool.