π₯·User Data
This guide explains how to fetch detailed user position data, including liquidity shares and profit/loss metrics.
Contract IDs
Mainnet:
000080350ca5ef204bc29b3232bb197e12bec6b473f5e6bdb749a6921197e83cTestnet:
00000eecf6a990576c12bfa9e12ee089a5b1ea65e6de1456687ba1f4dc7fd463
1. Get All User Positions
Fetch all liquidity positions for a specific user address across all pools.
Method: get_user_positions(address)
Args: address (string) - The user's wallet address (or Caller ID).
Example Request
USER_ADDRESS="H..." # Replace with actual address
curl -s -G "https://node1.mainnet.hathor.network/v1a/nano_contract/state" \
--data-urlencode "id=000080350ca5ef204bc29b3232bb197e12bec6b473f5e6bdb749a6921197e83c" \
--data-urlencode "calls[]=get_user_positions(\"$USER_ADDRESS\")" \
| jqResponse Structure
Returns a dictionary where keys are Pool Keys and values are UserPosition objects.
2. Get User Profit Info
Get the profit and loss (PnL) analysis for a user's position in a specific pool.
Method: get_user_profit_info(address, pool_key)
Args:
address: User's wallet addresspool_key: The unique pool identifier
Example Request
Response Structure
Returns a UserProfitInfo object.
Last updated