v3-sdk icon indicating copy to clipboard operation
v3-sdk copied to clipboard

Generating callData using NonFungiblePositionManager.removeCallParameters() fails

Open 99linesofcode opened this issue 3 years ago • 0 comments

Results in:

Error: could not parse Fraction

Assuming fetched position data: image

With a position.liquidity.toString() value of 341124671496446

And the following example code:

  const position = await positionManagerContract.positions(db.data?.positions[0].id);

  console.log(position);


  const remove = NonfungiblePositionManager.removeCallParameters(position, {
    tokenId: db.data?.positions[0].id,
    liquidityPercentage: new Percent(1),
    slippageTolerance: new Percent(50, 10_000),
    deadline: (await provider.getBlock('latest')).timestamp + 150,
    burnToken: false, // true to burn NFT
    collectOptions: {
      expectedCurrencyOwed0: CurrencyAmount.fromRawAmount(token0, position.feeGrowthInside0LastX128),
      expectedCurrencyOwed1: CurrencyAmount.fromRawAmount(token1, position.feeGrowthInside1LastX128),
      recipient: wallet.address
    }
  });

  console.log(remove);

It fails here:

image

99linesofcode avatar Aug 01 '22 17:08 99linesofcode