Open NoUJoe opened 1 year ago
I would like to work on this @NoUJoe
@ashutosh887 not that I have any authority here, but go for it my guy!
IDK who's the maintainer here @NoUJoe Let's see
@ashutosh887 seems like no one! You could probably claim the role as yours!
Unless I've missed it, but I have looked, there doesn't seem to be any built in method to convert a "display"/"readable" currency value to it's "atomic" amount. e.g 1.234ETH = 1234000000000000000
Is there any reason why not? Seems like a very common action to perform, as for the most part, user inputs are going to be in readable units, which need to be converted for use in contracts etc.
Strangely, in the "routing a trade" example (https://docs.uniswap.org/sdk/v3/guides/routing), it contains a function "fromReadableAmount":
https://github.com/Uniswap/examples/blob/0071bb5883fba6f4cc39a5f1644ac941e4f24822/v3-sdk/routing/src/libs/conversion.ts#L3
But this is in an example, and not part of the SDK. (also having
amount: number
is a bad idea imo but im nit-picking an example here...)Just thought this makes sense. I don't think I'm missing it, as this is why I went to the example to see what was done in there.
Edit: Makes more sense for it to be in CurrencyAmount than BaseCurrency on second thought.