All amounts on Flynet use a consistent wire shape:
{
"value": "1000000000000000000",
"currency": "FLY"
}
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.
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)
const wei = response.amount.value; // "1000000000000000000" (string)
const flyDisplay = Number(wei) / 1e18; // 1
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)
function formatFly(wei) {
const s = String(wei).padStart(19, "0");
const whole = s.slice(0, -18) || "0";
const frac = s.slice(-18).replace(/0+$/, "");
return frac ? `${whole}.${frac}` : whole;
}
formatFly("25000000000000000001"); // "25.000000000000000001"
formatFly("25000000000000000000"); // "25"
formatFly("1"); // "0.000000000000000001"
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.
Currency
v1 supports FLY only. Other currency values are rejected with
HTTP 400 on routes that accept Money input.
Common conversions
| FLY | wei (value) |
|---|
| 0.001 FLY | "1000000000000000" |
| 0.01 FLY | "10000000000000000" |
| 0.1 FLY | "100000000000000000" |
| 1 FLY | "1000000000000000000" |
| 10 FLY | "10000000000000000000" |
| 100 FLY | "100000000000000000000" |
| 1,000 FLY | "1000000000000000000000" |
In requests
When sending Money to Flynet, use the same shape:
{
"amount": {
"value": "1000000000000000000",
"currency": "FLY"
}
}