mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #2433 from danjm/NewUI-flat-precision-improvements
[NewUI] Improves precision of a calculation in send, and in confirm
This commit is contained in:
commit
0cbaec16f3
@ -224,7 +224,7 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
|
|||||||
]),
|
]),
|
||||||
|
|
||||||
h('div.confirm-screen-section-column', [
|
h('div.confirm-screen-section-column', [
|
||||||
h('div.confirm-screen-row-info', `${fiatAmount + fiatGas} ${currentCurrency}`),
|
h('div.confirm-screen-row-info', `${addCurrencies(fiatAmount, fiatGas)} ${currentCurrency}`),
|
||||||
h('div.confirm-screen-row-detail', `${addCurrencies(tokenAmount, tokenGas || '0')} ${symbol}`),
|
h('div.confirm-screen-row-detail', `${addCurrencies(tokenAmount, tokenGas || '0')} ${symbol}`),
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
|
@ -2,7 +2,7 @@ const Component = require('react').Component
|
|||||||
const h = require('react-hyperscript')
|
const h = require('react-hyperscript')
|
||||||
const inherits = require('util').inherits
|
const inherits = require('util').inherits
|
||||||
const Identicon = require('../identicon')
|
const Identicon = require('../identicon')
|
||||||
const { conversionUtil } = require('../../conversion-util')
|
const { conversionUtil, multiplyCurrencies } = require('../../conversion-util')
|
||||||
|
|
||||||
module.exports = CurrencyDisplay
|
module.exports = CurrencyDisplay
|
||||||
|
|
||||||
@ -40,7 +40,9 @@ CurrencyDisplay.prototype.getAmount = function (value) {
|
|||||||
const { selectedToken } = this.props
|
const { selectedToken } = this.props
|
||||||
const { decimals } = selectedToken || {}
|
const { decimals } = selectedToken || {}
|
||||||
const multiplier = Math.pow(10, Number(decimals || 0))
|
const multiplier = Math.pow(10, Number(decimals || 0))
|
||||||
const sendAmount = '0x' + Number(value * multiplier).toString(16)
|
|
||||||
|
const sendAmount = multiplyCurrencies(value, multiplier, {toNumericBase: 'hex'})
|
||||||
|
|
||||||
return selectedToken
|
return selectedToken
|
||||||
? sendAmount
|
? sendAmount
|
||||||
: toHexWei(value)
|
: toHexWei(value)
|
||||||
|
Loading…
Reference in New Issue
Block a user