You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
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.
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.
The text was updated successfully, but these errors were encountered:
NoUJoe
changed the title
Feature: Add a "amountFromReadable" method to BaseCurrency
Feature: Add an "amountFromReadable" method to BaseCurrency
Jun 6, 2023
NoUJoe
changed the title
Feature: Add an "amountFromReadable" method to BaseCurrency
Feature: Add an "amountFromReadable" method to BaseCurrency / CurrencyAmount
Jun 7, 2023
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.
The text was updated successfully, but these errors were encountered: