Token price display with automatic notation selection.
Bonding curve prices span many orders of magnitude. This module picks the most readable notation automatically so each project does not reimplement the same range-checking logic.
Web3.Ui.PriceDisplay.view []
{ decimals = 18, symbol = "PLS" }
priceWei
Web3.Ui.PriceDisplay.format 18 priceWei
--> "0.0042" (fixed for normal range)
--> "1.23M" (SI suffix for large)
--> "4.56e-10" (scientific for tiny)Format a price BigInt as a human-readable string. No symbol appended.
See view for notation selection rules.
Display a token price, automatically selecting notation.
Notation rules:
1.23,0.456,0.00123)4.56e-10)CSS class:
web3-price