Fetch all user positions for a pool for Meteora DLMM and their deposit amounts
In certain cases, dApps may need to fetch all the users, their positions and their deposits for a pool. One such case can be dashboard like UI for one particular pool, where every information related to the pool is displayed in details.
We can use SHYFT's GraphQL APIs to fetch the above mentioned case. The steps are as follows:
For a pool address, we fetch all the pool specific details, such as the tokens involved, its activeId, or lastUpdatedAt value. This can be obtained by querying the meteora_dlmm_LbPair account, with pubkey field being _eq to the pool address.
We fetch all the position details and the users for that particular pool, by querying the meteora_dlmm_Position and meteora_dlmm_PositionV2 accounts, by filtering the LbPair field being equal to the pool address.
Once we have the position addresses from the previous step, we get all transactions for the position address of each position. With SHYFT's parsed transactions, we can directly get the amounts deposited to the pool, for that particular position.