Skip to content

Commit

Permalink
Update formatBigIntToString util function to include trailing 0 befor…
Browse files Browse the repository at this point in the history
…e decimal
  • Loading branch information
bigboydiamonds committed Oct 6, 2023
1 parent eeadb5f commit d963620
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/synapse-interface/utils/bigint/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export const formatBigIntToString = (
const idx = str.length - nativePrecision
str = `${str.slice(0, idx)}.${str.slice(idx)}`

// Handle values below zero by adding a '0' before the decimal point
if (str.startsWith('.')) {
str = '0' + str
}

// Trim to desired number of decimal places
if (decimalPlaces !== undefined) {
const decimalIdx = str.indexOf('.')
Expand Down

0 comments on commit d963620

Please sign in to comment.