I'm trying to get the amount of each token currently held on a liquidity pool position on uniswap v3 (on pyhton) based on the token ID of the NFT. I was abble to get info about the position calling :
contract = web3.eth.contract(address=addr_uni_nft_pos,abi=abi_uni_pos)
contract.functions.positions(nft_token_id).call()
from which I'm getting:
{'nonce': 0,
'operator': '0x0000000000000000000000000000000000000000',
'token0': '0x4d224452801ACEd8B2F0aebE155379bb5D594381',
'token1': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
'fee': 3000,
'tickLower': -56700,
'tickUpper': -55740,
'liquidity': 0,
'feeGrowthInside0LastX128': 115792089237316195423570985008687907853246859851719844967496612553656335272574,
'feeGrowthInside1LastX128': 115792089237316195423570985008687907853269894723013691862125737150933929444085,
'tokensOwed0': 0,
'tokensOwed1': 0}
However I want to get the total amount (deposited + rewards) of each token currently held on the pool, independently if the position is or not on range. Is there a way to do this? I was thinking in simply looking at the minting event of the NFT itself, but surely there is a simpler way.
Thanks in advance.