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 Feb 9, 2024. It is now read-only.
Create helper functions that take a BN.js, string, or number as a NUMBER input and format it in human readable ways. Each api registry has chain decimal information, which should be used to properly format decimals, etc.
Suggestion
useBalance()?.freeBalance will return something like 1096562700458522 for Contracts on Rococo.
We should be able to easily display that as 1,196.56 ROC, 1196.5627, 1096.562700458522, etc. We can control how many significant numbers are shown, show the currency, use commas, etc.
Add helpers for decimal math without floating point numbers. e.g. Chain A uses 12 decimals and Chain B uses 18 decimals. If we want to calculate an exchange rate between the two we want to do this easily.
Motivation
Formatting BN is tedious, and very common.
Use Cases
Displaying a user's balance with only two decimals. e.g. 1,096.56 ROC
The text was updated successfully, but these errors were encountered:
Feature Request
Suggestion
useBalance()?.freeBalance
will return something like1096562700458522
for Contracts on Rococo.1,196.56 ROC
,1196.5627
,1096.562700458522
, etc. We can control how many significant numbers are shown, show the currency, use commas, etc.Motivation
Formatting BN is tedious, and very common.
Use Cases
Displaying a user's balance with only two decimals. e.g.
1,096.56 ROC
The text was updated successfully, but these errors were encountered: