Uniswap / v3-sdk

🛠 An SDK for building applications on top of Uniswap V3
MIT License
547 stars 425 forks source link

Generating callData using NonFungiblePositionManager.removeCallParameters() fails #138

Open 99linesofcode opened 2 years ago

99linesofcode commented 2 years ago

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