All amounts on Flynet use a consistent wire shape:
Why stringified
value is a stringified integer in the smallest unit of
currency. For FLY, that means wei: 18 decimals of precision.
1 FLY = "1000000000000000000".
The string format protects precision. Large FLY amounts exceed
JavaScript’s Number.MAX_SAFE_INTEGER. Treat value as a string
and convert with BigInt when you need to do math.
The published @flynetdev/core SDK ships
formatFly and formatUsdCents, the recommended way to turn wire values
into display strings. Both are exact and string-based, with no precision
loss.
If you’re not using the SDK, the hand-rolled equivalents below produce the
same results.
Chef’s warning - wei / 1e18 and Number(BigInt(wei) / BigInt(1e18)) both lose fractional FLY. The first silently rounds at ~16 significant digits; the second integer-truncates the fractional part entirely. Use one of the two correct approaches below.
Quick display (lossy past ~16 significant digits)
JavaScript Number is IEEE-754 double-precision. Anything beyond ~2^53 significant digits loses bits. Fine for UI labels on amounts under ~9 quadrillion FLY; not fine for ledgering or comparisons.
Exact display (string-based, no precision loss)
Use the exact formatter for anything you’d round-trip back to wei, compare to thresholds, or sum across rows. Use the quick formatter only for fire-and-forget UI strings.
USD amounts
Where the API expresses a USD value, it uses an integer number of
cents, not the { value, currency } wire shape and not a floating-point
dollar amount. 1099 means $10.99. Integer cents avoid the rounding
errors of binary floating point, the same reasoning behind stringified FLY
wei. Format with formatUsdCents from the SDK:
Currency
Payment Intents are FLY only in v1. Other currency values are rejected
with HTTP 400 on routes that accept Money input.
Common conversions
In requests
When sending Money to Flynet, use the same shape: