formatAbbreviated

fun formatAbbreviated(amount: BigInteger, tokenType: String): String

Abbreviated whole-token format for tight surfaces (pills, chips, badges).

Drops the fractional part below 1,000 (integers only) and switches to K/M/B/T suffixes above that, with a single trimmed decimal. Token symbol is not appended — callers decorate (e.g. append "D" for DUST in asymmetric layouts where the primary asset is unmarked).

Examples (NIGHT, 6 decimals):

  • 0"0"

  • 1_000_000 (1 NIGHT) → "1"

  • 850_000_000 (850) → "850"

  • 1_500_000_000 (1.5K) → "1.5K"

  • 10_000_000_000 (10K) → "10K"

  • 2_300_000_000_000 (2.3M) → "2.3M"

Examples (DUST, 15 decimals):

  • 364_409_359_999_999_999 (~364.4) → "364" (integer below 1K)

  • 1_500_000_000_000_000_000"1.5K"

Truncates (not rounds) so amounts don't visually round up as the fractional dust generates in the background.