Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stake input fields should use BigInt for accuracy? #77

Open
jonijuup opened this issue Mar 4, 2022 · 2 comments
Open

Stake input fields should use BigInt for accuracy? #77

jonijuup opened this issue Mar 4, 2022 · 2 comments
Assignees

Comments

@jonijuup
Copy link
Collaborator

jonijuup commented Mar 4, 2022

Muzamil pointed out that the Stake input field in StakeSubRow should use BigInt for accuracy. It currently uses the rounded value (staked.juiceValue).

Muzamil's suggestion:
const [stakeAmount, setStakeAmount] = useState(staked?.juiceValue || "");
To
const [stakeAmount, setStakeAmount] = useState(formatUnits(staked.rawJuiceValue, juiceDecimals));

Probably will make the inputs quite hard to use with the millions of Juice people have currently. Thoughts? 😅

@jonijuup
Copy link
Collaborator Author

jonijuup commented Mar 4, 2022

Maybe fix this after #73 is merged, so we'll keep the "Save" button disabling if the stake has not been edited (without comparing changes, people can mistakenly save stakes that have no actual changes made).

@JaniAnttonen
Copy link
Member

Muzamil's suggestion:
const [stakeAmount, setStakeAmount] = useState(staked?.juiceValue || "");
To
const [stakeAmount, setStakeAmount] = useState(formatUnits(staked.rawJuiceValue, juiceDecimals));

Better way to do this is to have a beautified balance together with the raw value. Good way to get it is with a callback formatting the raw value with formatUnits()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants