fix(frontend): parse limit-order units safely#13289
Draft
cursor[bot] wants to merge 1 commit into
Draft
Conversation
Co-authored-by: Antonio Ventilii <AntonioVentilii@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Limit-order submission converts the reviewed human base amount and price into candid bigint units. The merged helpers multiplied JavaScript
numbervalues by10 ** decimalsand passed.toFixed(0)intoBigInt. For 18-decimal tokens, valid values such as1000scale to1e+21, whichBigIntrejects, and high-precision decimal values can also be rounded to a different smallest-unit amount than the UI reviewed.Awareness checked before and after the fix: recent merged limit-order PRs #13253, #13254, #13255; open stacked limit-order PRs #13256-#13268 and staging branch #13220; related OISY TRADE stale-principal PR #13246; PR bodies, reviews/comments, commit messages, docs/spec
docs/ai/spec-driven-development/specs/2026-06-04-feat-limit-orders.md, open/recent issues, and PR/issue searches fortoQuantity,toPriceUnits, limit-order precision, and OISY TRADE conversion. No active or merged work was found that fixes this conversion trigger; the open stack makes the helpers reachable but does not cover this bug.Changes
BigIntinput and for decimal precision preservation.Tests
PATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" npm run preparePATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" npm run test -- --run src/frontend/src/tests/lib/utils/oisy-trade.utils.spec.tsPATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" npm run formatPATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" npm run lint -- --max-warnings 0PATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" npm run checkPATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" npm run test(915 files passed, 1 skipped; 15685 tests passed, 10 skipped, 1 todo)PATH="/home/ubuntu/.nvm/versions/node/v24.18.0/bin:$PATH" npm run lint:lockfile