unrip/src
philipp cb7cb77a23
All checks were successful
deploy / deploy (push) Successful in 1m0s
fix: handle scientific notation in bigintAmount so trades stop crashing
Every quote evaluation was crashing with:
  SyntaxError: Cannot convert 6.034871047122912e+25 to a BigInt

NEAR Intents quote amounts arrive as JS numbers that JSON.parse
converts to scientific notation (e.g. 6.03e+25). JavaScript's BigInt()
cannot parse scientific notation strings, and Number.toFixed(0) also
returns scientific notation for numbers > 1e21.

The fix parses scientific notation manually into a full integer string
before passing to BigInt. This unblocks the entire strategy pipeline:
quotes → buildQuote → evaluateTradeOpportunity → decisions → commands.

Proof: bigintAmount(6.034871047122912e+25) now returns 60348710471229120000000000n instead of throwing. All 313 tests pass.

Assumptions: Token amounts are integers represented in base units. Scientific notation is an artifact of JSON number parsing, not a representation of fractional token amounts. Precision beyond Number.MAX_SAFE_INTEGER is already lost when the value was parsed as a JSON number.

Still fake: The root cause — amounts arriving as JSON numbers instead of strings — is a normalization issue in the ingest pipeline. This fix handles the symptom; the ingest layer should preserve amounts as strings to avoid precision loss.
2026-07-05 02:01:32 +02:00
..
apps fix: sync uncommitted refactoring changes to fix import errors 2026-06-17 18:52:38 +02:00
bus/kafka Ensure Kafka topics before use 2026-04-17 14:39:14 +02:00
core fix: handle scientific notation in bigintAmount so trades stop crashing 2026-07-05 02:01:32 +02:00
lib fix: replace broken evidence-gated pruning with simple TTL deletes 2026-06-28 13:21:40 +02:00
observers Add pre-credit funding visibility and durable alerts 2026-04-03 17:50:39 +02:00
operator-dashboard/static fix: OOM heuristic bug in quote outcomes 2026-06-16 16:30:09 +02:00
venues/near-intents fix: sync uncommitted refactoring changes to fix import errors 2026-06-17 18:52:38 +02:00