Skip to content

Commit

Permalink
Fix "use max" in send flow (#2689)
Browse files Browse the repository at this point in the history
  • Loading branch information
wachunei authored May 17, 2021
1 parent 98b973f commit 13d03cd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions app/components/Views/SendFlow/Amount/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
renderFromWei,
weiToFiat,
fromWei,
fromTokenMinimalUnit,
toWei,
isDecimal,
toTokenMinimalUnit,
Expand All @@ -36,7 +35,8 @@ import {
weiToFiatNumber,
balanceToFiatNumber,
getCurrencySymbol,
handleWeiNumber
handleWeiNumber,
fromTokenMinimalUnitString
} from '../../../../util/number';
import { getTicker, generateTransferData, getEther } from '../../../../util/transactions';
import { util } from '@metamask/controllers';
Expand Down Expand Up @@ -657,10 +657,16 @@ class Amount extends PureComponent {
} else {
const exchangeRate = contractExchangeRates[selectedAsset.address];
if (internalPrimaryCurrencyIsCrypto || !exchangeRate) {
input = fromTokenMinimalUnit(contractBalances[selectedAsset.address], selectedAsset.decimals);
input = fromTokenMinimalUnitString(
contractBalances[selectedAsset.address]?.toString(10),
selectedAsset.decimals
);
} else {
input = `${balanceToFiatNumber(
fromTokenMinimalUnit(contractBalances[selectedAsset.address], selectedAsset.decimals),
fromTokenMinimalUnitString(
contractBalances[selectedAsset.address]?.toString(10),
selectedAsset.decimals
),
conversionRate,
exchangeRate
)}`;
Expand Down

0 comments on commit 13d03cd

Please sign in to comment.