API Reference

Get Position Details

You can use the getPositionDetails() function to retrieve details of a specific position by providing its ID (which you can retrieve from the getUserPositions() function).

Example

import { QueryChain } from "@firefly-exchange/library-sui/dist/src/spot";
import { SuiClient } from "@firefly-exchange/library-sui";

const client = new SuiClient({ url: "https://fullnode.mainnet.sui.io:443" });

/// Parameters:
/// - posID           : The unique ID of the position being queried

async function getPositionDetails(posID: string){
    let qc = new QueryChain(client);
    let pos = await qc.getPositionDetails(posID);
    return pos
}

await getPositionDetails("0x202ca4622f4902d671b37ba8d65fd0418351ce5ac7e7e432ddff13c2236333d1")

Response

{
   "owner":"0xa2d6fcd5ed2ae13fe527a96c96100120d519900599f33e38ee112d80e51f9269",
   "pool_id":"0x3b585786b13af1d8ea067ab37101b6513a05d2f90cfe60e8b1d9e1b46a63c4fa",
   "position_id":"0x17d3d6ff7e9790aaf05ceb7c6300e162b1d8291750158b63c6dd5625cebd4295",
   "lower_tick":-63400,
   "upper_tick":-61520,
   "liquidity":0,
   "fee_growth_coin_a":0,
   "fee_growth_coin_b":0,
   "fee_rate":2000,
   "token_a_fee":0,
   "token_b_fee":0
}