From 8970f90d4573f6247c70d19ee6d58be608e93eca Mon Sep 17 00:00:00 2001 From: slowbackspace Date: Tue, 8 Jan 2019 13:23:46 +0100 Subject: [PATCH] use toFixed for fees on eth --- src/actions/ethereum/SendFormValidationActions.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/actions/ethereum/SendFormValidationActions.js b/src/actions/ethereum/SendFormValidationActions.js index 9407c5ce..f5283ff6 100644 --- a/src/actions/ethereum/SendFormValidationActions.js +++ b/src/actions/ethereum/SendFormValidationActions.js @@ -115,7 +115,7 @@ export const recalculateTotalAmount = ($state: State): PayloadAction => ( if (isToken) { const token = findToken(tokens, account.descriptor, state.currency, account.deviceState); if (token) { - state.amount = new BigNumber(token.balance).minus(pendingAmount).toString(10); + state.amount = new BigNumber(token.balance).minus(pendingAmount).toFixed(); } } else { const b = new BigNumber(account.balance).minus(pendingAmount); @@ -359,7 +359,7 @@ export const calculateMaxAmount = (balance: BigNumber, gasPrice: string, gasLimi const fee = calculateFee(gasPrice, gasLimit); const max = balance.minus(fee); if (max.lessThan(0)) return '0'; - return max.toString(10); + return max.toFixed(); } catch (error) { return '0'; } @@ -368,8 +368,8 @@ export const calculateMaxAmount = (balance: BigNumber, gasPrice: string, gasLimi export const getFeeLevels = (symbol: string, gasPrice: BigNumber | string, gasLimit: string, selected?: FeeLevel): Array => { const price: BigNumber = typeof gasPrice === 'string' ? new BigNumber(gasPrice) : gasPrice; const quarter: BigNumber = price.dividedBy(4); - const high: string = price.plus(quarter.times(2)).toString(10); - const low: string = price.minus(quarter.times(2)).toString(10); + const high: string = price.plus(quarter.times(2)).toFixed(); + const low: string = price.minus(quarter.times(2)).toFixed(); const customLevel: FeeLevel = selected && selected.value === 'Custom' ? { value: 'Custom', @@ -391,7 +391,7 @@ export const getFeeLevels = (symbol: string, gasPrice: BigNumber | string, gasLi { value: 'Normal', gasPrice: gasPrice.toString(), - label: `${calculateFee(price.toString(10), gasLimit)} ${symbol}`, + label: `${calculateFee(price.toFixed(), gasLimit)} ${symbol}`, }, { value: 'Low',