Gets Positions

1. Get all positions of one pool by ownerAddress

Use sdk.Position.getPositionList() method.

Function Parameters

  • account_address: The user account address

  • assign_pool_ids: An array of pool ID

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

Example

const account_address = '0xcd0247d0b67e53dde69b285e7a748e3dc390e8a5244eb9dd9c5c53d95e4cf0aa'
const assign_pool_ids = ['0x83c101a55563b037f4cd25e5b326b26ae6537dc8048004c1408079f7578dd160']
const res = await sdk.Position.getPositionList(account_address, assign_pool_ids, false)

2. Get all positions of one pool

Use sdk.Pool.getPositionList() method.

Function Parameters

  • position_handle: The position handle of pool

Example

3. Get one position

Use sdk.Position.getPositionById() method.

Function Parameters

  • position_id: The position object ID

  • calculate_rewarder: Whether to calculate the rewarder of the position

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

Example

3. Get detailed position information

Use sdk.Position.getPositionInfoList() method.

This method retrieves the actual liquidity of impaired positions after trimming. For normal positions, the liquidity value obtained from getPositionInfoList is consistent with the liquidity value obtained from getPositionList.

Function Parameters

  • position_info_list: An array of objects containing position_handle and position_ids.

Example

4. Batch get position fees

Use sdk.Position.batchFetchPositionFees() method.

Function Parameters

  • position_ids: An array of position ID

Example

Last updated