Appearance
Formatters
Display helpers from @swapped/connect-sdk/format. Use them so fiat and token amounts match the same rules as the hosted widget and the SDK’s own formatted.* fields.
Works the same in Core and React — import from the format entry, not from @swapped/connect-sdk or /react.
ts
import { TokenSymbol } from '@swapped/connect-sdk'
import {
formatCurrencyAmount,
formatTokenAmount,
} from '@swapped/connect-sdk/format'React hooks often already expose formatted strings (formattedMinAmount, balance.formatted.valueFiat, …). Reach for these helpers when you render your own amounts.
Currency
- formatCurrencyAmount — primary USD-style helper
- formatCurrency — fixed-decimal currency formatting
Token
- formatTokenAmount — token balances for UI
- formatCompactTokenAmount —
K/Mabbreviations
Numbers
pretty vs js-number
ts
formatCurrencyAmount(1234.5)
// "1,234.50" — pretty (UI labels)
formatCurrencyAmount(1234.5, { format: 'js-number' })
// "1234.50" — no separators (inputs / round-trips)Exchange Pay amount clamping in the React hooks uses format: 'js-number' when writing back into the input.