rainbow-me / rainbowkit

The best way to connect a wallet 🌈 🧰
https://rainbowkit.com
MIT License
2.42k stars 643 forks source link

[bug] Invalid balance formatting shows balance in exponential format #2015

Closed brijeshagal closed 4 months ago

brijeshagal commented 4 months ago

Is there an existing issue for this?

RainbowKit Version

^2.0.0

wagmi Version

^2.5.7

Current Behavior

When the balance is quite small, the wallet shows balance in exponential format as seen in screenshot below:

image

Expected Behavior

Balance should be shown in numeric form and not in scientific notation.

Steps To Reproduce

Very low balance on Base chain caused this. If balance is around 0.0000009 (simply 7 decimals), scientific notation is seen.

User Address: 0x1c512FaA65B2C9660bBe7c01f83Bc7bF175B700B

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

No response

Anything else?

No response

magiziz commented 4 months ago

@brijeshagal The formatted balance comes from useBalance hook from wagmi. You can raise a PR to their repo if you consider this an issue.

Wagmi github repo link: https://github.com/wevm/wagmi