fix(sdk-coin-vet): preserve precision for large value transactions #7597
+39
−1
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.
Ticket: COIN-0000
This PR fixes a critical issue in VET transaction processing where large numeric values lost precision due to JavaScript's Number type limitations.
When handling transactions with values exceeding ~15-17 significant digits, the values were converted to scientific notation (e.g.,
2.332734928448876e+22instead of23327349284488761096413).The issue was in Transaction.fromDeserializedSignedTransaction() which used Number(clause.value).toString(), converting large values to scientific notation. This caused transaction output parsing to fail when comparing the expected amount with the actual amount.
The fix:
Number(clause.value).toString()withnew BigNumber(clause.value).toFixed().This change ensures accurate value representation in VET transactions, particularly important for exchanges and applications handling large value transfers.