turbos-finance / turbos-clmm-sdk

6 stars 5 forks source link

getUnclaimedFeesAndRewards don't really use getPrice function #19

Open idotial opened 4 months ago

idotial commented 4 months ago
async function get_price(coinType) {
    console.log(prices[coinType]);
    prices[coinType];
}
let a = await sdk.nft.getUnclaimedFeesAndRewards({
    poolId: pool.objectId,
    position: positions[0],
    getPrice: get_price,
});
console.log(a);

I tested with the above code, and it logs

0.00358469938851854
1.29
0.00358469938851854
1.29
{
  fees: '0',
  rewards: '1',
  total: '1',
  fields: {
    scaledFeeOwedA: '259.597052875',
    scaledFeeOwedB: '0.225338313',
    feeOwedA: '259597052875',
    feeOwedB: '225338313',
    collectRewards: [ '0', '1996379655', '0' ],
    scaledCollectRewards: [ '0', '1.996379655', '0' ]
  }
}

seems getPrice function get call and returns correct price, but price didn't get use in the result

blockJser commented 4 months ago

the statistical fee and reward values are usd value. and fee value should not be 0. there is a problem with your data.If the price is not used, rewards value must also be 0.