Static
formatFormats a number with comma separators and up to 4 decimal places. Handles both string and number inputs, with fallback to "0" for invalid values.
The number to format
Formatted string with comma separators and optional decimals
Static
formatFormats a number as a percentage with 2 decimal places. Always includes the % symbol and handles invalid inputs gracefully.
The value to format as percentage
Formatted percentage string with % symbol
Static
formatFormats a gas value in Gwei (divides by 1e9). Converts raw gas values to human-readable format with appropriate units.
The gas value to format
Formatted gas value string with units
Static
formatCFXFormats a CFX value with proper decimals and unit. Handles scientific notation and converts to human-readable format. Uses 18 decimal places as the standard for CFX tokens.
The CFX value to format (in wei)
Formatted CFX value string
Utility class for formatting numbers in various formats used throughout the application. Handles formatting of regular numbers, percentages, gas values, CFX amounts, and token amounts.