mirror of
https://github.com/trezor/trezor-wallet
synced 2024-12-29 02:18:06 +00:00
use toFixed for fees on eth
This commit is contained in:
parent
83abbd9ac3
commit
8970f90d45
@ -115,7 +115,7 @@ export const recalculateTotalAmount = ($state: State): PayloadAction<State> => (
|
|||||||
if (isToken) {
|
if (isToken) {
|
||||||
const token = findToken(tokens, account.descriptor, state.currency, account.deviceState);
|
const token = findToken(tokens, account.descriptor, state.currency, account.deviceState);
|
||||||
if (token) {
|
if (token) {
|
||||||
state.amount = new BigNumber(token.balance).minus(pendingAmount).toString(10);
|
state.amount = new BigNumber(token.balance).minus(pendingAmount).toFixed();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const b = new BigNumber(account.balance).minus(pendingAmount);
|
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 fee = calculateFee(gasPrice, gasLimit);
|
||||||
const max = balance.minus(fee);
|
const max = balance.minus(fee);
|
||||||
if (max.lessThan(0)) return '0';
|
if (max.lessThan(0)) return '0';
|
||||||
return max.toString(10);
|
return max.toFixed();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return '0';
|
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<FeeLevel> => {
|
export const getFeeLevels = (symbol: string, gasPrice: BigNumber | string, gasLimit: string, selected?: FeeLevel): Array<FeeLevel> => {
|
||||||
const price: BigNumber = typeof gasPrice === 'string' ? new BigNumber(gasPrice) : gasPrice;
|
const price: BigNumber = typeof gasPrice === 'string' ? new BigNumber(gasPrice) : gasPrice;
|
||||||
const quarter: BigNumber = price.dividedBy(4);
|
const quarter: BigNumber = price.dividedBy(4);
|
||||||
const high: string = price.plus(quarter.times(2)).toString(10);
|
const high: string = price.plus(quarter.times(2)).toFixed();
|
||||||
const low: string = price.minus(quarter.times(2)).toString(10);
|
const low: string = price.minus(quarter.times(2)).toFixed();
|
||||||
|
|
||||||
const customLevel: FeeLevel = selected && selected.value === 'Custom' ? {
|
const customLevel: FeeLevel = selected && selected.value === 'Custom' ? {
|
||||||
value: 'Custom',
|
value: 'Custom',
|
||||||
@ -391,7 +391,7 @@ export const getFeeLevels = (symbol: string, gasPrice: BigNumber | string, gasLi
|
|||||||
{
|
{
|
||||||
value: 'Normal',
|
value: 'Normal',
|
||||||
gasPrice: gasPrice.toString(),
|
gasPrice: gasPrice.toString(),
|
||||||
label: `${calculateFee(price.toString(10), gasLimit)} ${symbol}`,
|
label: `${calculateFee(price.toFixed(), gasLimit)} ${symbol}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'Low',
|
value: 'Low',
|
||||||
|
Loading…
Reference in New Issue
Block a user