Uniswap / sdk-core

⚙️ Code shared across TypeScript Uniswap SDK versions
MIT License
121 stars 355 forks source link

fractionish instanceof Array instead of JSBI #97

Closed mrosendin closed 11 months ago

mrosendin commented 11 months ago

Resolves https://github.com/Uniswap/v3-sdk/issues/94

This SO solution simply recommends using jsbi@3.2.5, however, in running v3-sdk tests I was still getting the error Could not parse fraction, occurring from Fraction.tryParseFunction. The transpiled sdk-core package doesn't seem to recognize the passed in variable fractionish as an instance of JSBI (perhaps due to loss of type signatures from transpilation).

JSBI is a subclass of Array, hence one workaround is to instead do this check:

fractionish instanceof Array