diff --git a/src/utils/validation/stringIsFloat.ts b/src/utils/validation/stringIsFloat.ts index bc575c800..173f62669 100755 --- a/src/utils/validation/stringIsFloat.ts +++ b/src/utils/validation/stringIsFloat.ts @@ -14,12 +14,14 @@ export const stringIsFloat = (amount: string) => { // eslint-disable-next-line let [wholes, decimals] = amount.split('.'); + const LocalBigNumber = BigNumber.clone(); + if (decimals) { const areAllNumbers = decimals .split('') .every((digit) => !isNaN(parseInt(digit))); - BigNumber.set({ + LocalBigNumber.set({ DECIMAL_PLACES: areAllNumbers ? decimals.length : BigNumber.config().DECIMAL_PLACES @@ -30,6 +32,10 @@ export const stringIsFloat = (amount: string) => { } } const number = decimals ? [wholes, decimals].join('.') : wholes; - const bNparsed = new BigNumber(number); - return bNparsed.toString(10) === number && bNparsed.comparedTo(0) >= 0; + const bNparsed = LocalBigNumber(number); + + const output = + bNparsed.toString(10) === number && bNparsed.comparedTo(0) >= 0; + + return output; };