Description
src/lineItemNormalizer.ts normalizes line-item amounts to 2 decimal places using JavaScript floating-point arithmetic, which introduces rounding errors for values with 7 significant decimal places (Stellar's native precision). The fix should use integer arithmetic in stroops.
Acceptance Criteria
Context
- Target file:
src/lineItemNormalizer.ts
- Do not use BigDecimal libraries; use BigInt arithmetic
Description
src/lineItemNormalizer.tsnormalizes line-item amounts to 2 decimal places using JavaScript floating-point arithmetic, which introduces rounding errors for values with 7 significant decimal places (Stellar's native precision). The fix should use integer arithmetic in stroops.Acceptance Criteria
normalize(0.0000001)returns'0.00'andnormalize(0.0000005)returns'0.00'(document the rounding choice used)Context
src/lineItemNormalizer.ts