Documentation Index
Fetch the complete documentation index at: https://v2-docs.exponent.finance/llms.txt
Use this file to discover all available pages before exploring further.
The getUserLpPositions() method retrieves all liquidity provider positions owned by a specific user in a given market.
Usage
import { MarketThree, LOCAL_ENV } from "@exponent-labs/exponent-sdk";
import { Connection, PublicKey } from "@solana/web3.js";
const connection = new Connection("https://api.mainnet-beta.solana.com");
const market = await MarketThree.load(LOCAL_ENV, connection, marketAddress);
// Get all LP positions for a user
const { lpPositions } = await market.getUserLpPositions(
wallet.publicKey,
marketAddress
);
// Iterate through positions
for (const positionArray of lpPositions) {
for (const position of positionArray) {
console.log("Position address:", position.publicKey.toBase58());
console.log("LP balance:", position.account.lpBalance);
console.log("Lower tick:", position.account.lowerTickIdx);
console.log("Upper tick:", position.account.upperTickIdx);
}
}
Parameters
| Parameter | Type | Required | Description |
|---|
owner | PublicKey | Yes | The wallet address of the position owner |
market | PublicKey | Yes | The market address to query positions from |
Returns
Returns an object with:
{
lpPositions: Array<Array<{ publicKey: PublicKey; account: LpPositionAccountData }>>;
}
| Property | Type | Description |
|---|
lpPositions | Array<Array<{ publicKey, account }>> | Nested array of LP position accounts with their public keys and account data |
Each position in the array contains:
publicKey - The position’s account address
account - The position account data including lpBalance, lowerTickIdx, upperTickIdx, fees, and emissions