Retrieve positions

1. Retrieve all positions of one pool by ownerAddress

Method: sdk.Position.getPositionList()

Params:

  • accountAddress: The user account address.

  • assignPoolIDs: An array of pool ID.

  • showDisplay: When some testnet rpc nodes can't return object's display data, you can set this option to false, avoid returning errors. Default set true.

Example

async function retrievalPositions() {
  const res = await TestnetSDK.Position.getPositionList(
    '0xd2e4df21b920fba945aa8ad148069a196f0680879c40118beabc3046e2cd8d24',
    ['0x0128aade80123e3f6c5c0eac1a2dee2512bbdc92c9c1b386b0fd66e6cddfaa72'],
    false
  )
  console.log('get positions of one pool by owner address', res)
}

2. Retrieve all positions of one pool

Method: sdk.Pool.getPositionList()

Params:

  • positionHandle: The position handle of pool.

Example

3. Retrieve one position

Method: sdk.Position.getPositionById()

Params

  • positionID: The position object ID.

  • calculateRewarder: Whether to calculate the rewarder of the position.

  • showDisplay: When some testnet rpc nodes can't return object's display data, you can set this option to false, avoid returning errors. default set true.

Exmaple

4. Batch retrieval of position fee

Method sdk.Position.batchFetchPositionFees()

Params:

  • positionIDs: An array of position ID.

Example

Last updated