Comments (4)
Looks like we have a flexible way to format N
amount here:
https://github.com/near/near-api-js/blob/master/src/utils/format.ts
@frol if you feel like we need something more specific - feel free to reopen this issue.
from near-api-js.
- We need to design how this shows up in UI
@frol do you mind providing some specific requirements for near-api-js?
from near-api-js.
The main requirement is to display any amounts of NEAR in a human-readable format no matter how small or how huge the value is, we should just use all the metric prefixes, so the number is always less than 1000 and greater or equal than 1:
- 1 NEAR (N)
- 999.99 milliNEAR (mN)
- 1 yoctoNEAR (yN)
- 999 yoctoNEAR (yN)
- 1 zeptoNEAR (zN) [1000 yoctoNEAR]
- 1 kiloNEAR (kN) [1000 NEAR]
We should not round the amounts up, so 9,999,999,999 yN should be 9.99 femtoNEAR, thus we need to indicate that there is some more tokens, e.g. 9.99+ fN or 9.99~ fN.
In Explorer, we display the balances, transfers, and fees, so the amounts of tokens we need to display can be both huge and small.
from near-api-js.
The main requirement is to display any amounts of NEAR in a human-readable format
As far as user interfaces go (wallet, shell, explorer, etc) i suggest we round things off to simple values of NEAR because that's what humans are expecting (you have ~$1, not $1.00000000001). The API should surface the exact number along with a human readable value. The UI can show the human readable value with the exact number showing up as a tooltip (or similar hidden-before-reveal container)
from near-api-js.
Related Issues (20)
- Security: Supply chain protection is bad
- Get result of an execution plan
- Rework 'accounts' package tests due to removal of top-level account creation functionality
- functionCall arguments formated in Json only HOT 28
- The `wallet.requestSignIn` stopped working on v3.0.0 HOT 2
- Replace crypto-browserify with another library
- Error: Length of buffer does not match length of ASN.1 sequence HOT 31
- Error: Unable to resolve module http from ./node_modules/@near-js/providers/lib/fetch.js http could not be found within the project HOT 2
- Get correct publicKey from biometric getKeys using indexer HOT 1
- Support nearcore 1.37 HOT 1
- [Error] createAccount don't work on testnet. HOT 8
- How to get the account balance based on a particular block or date HOT 4
- SignedDelegate is not working
- Biometric createKey failing with Bitwarden password manager "expected βidβ or βrawIdβ field" HOT 6
- Passkeys/webauthn popup not triggering in Chrome HOT 11
- Account.sendMoney transaction execution level
- Updating RPC error schema HOT 2
- yarn + latest wallet selector + latest near-api-js == error HOT 6
- Error sending signed transaction with v4.0.3 HOT 5
- `provider.sendTransaction(signedTx)` always fails for FailoverRpcProvider HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from near-api-js.