|
|
@ -20,6 +20,7 @@ function mapStateToProps (state) { |
|
|
|
const { |
|
|
|
const { |
|
|
|
conversionRate, |
|
|
|
conversionRate, |
|
|
|
identities, |
|
|
|
identities, |
|
|
|
|
|
|
|
currentCurrency, |
|
|
|
} = state.metamask |
|
|
|
} = state.metamask |
|
|
|
const accounts = state.metamask.accounts |
|
|
|
const accounts = state.metamask.accounts |
|
|
|
const selectedAddress = state.metamask.selectedAddress || Object.keys(accounts)[0] |
|
|
|
const selectedAddress = state.metamask.selectedAddress || Object.keys(accounts)[0] |
|
|
@ -27,6 +28,7 @@ function mapStateToProps (state) { |
|
|
|
conversionRate, |
|
|
|
conversionRate, |
|
|
|
identities, |
|
|
|
identities, |
|
|
|
selectedAddress, |
|
|
|
selectedAddress, |
|
|
|
|
|
|
|
currentCurrency, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -45,15 +47,15 @@ function ConfirmSendEther () { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ConfirmSendEther.prototype.getAmount = function () { |
|
|
|
ConfirmSendEther.prototype.getAmount = function () { |
|
|
|
const { conversionRate } = this.props |
|
|
|
const { conversionRate, currentCurrency } = this.props |
|
|
|
const txMeta = this.gatherTxMeta() |
|
|
|
const txMeta = this.gatherTxMeta() |
|
|
|
const txParams = txMeta.txParams || {} |
|
|
|
const txParams = txMeta.txParams || {} |
|
|
|
console.log(txParams) |
|
|
|
console.log(`conversionRate, currentCurrency`, conversionRate, currentCurrency); |
|
|
|
const USD = conversionUtil(txParams.value, { |
|
|
|
const FIAT = conversionUtil(txParams.value, { |
|
|
|
fromNumericBase: 'hex', |
|
|
|
fromNumericBase: 'hex', |
|
|
|
toNumericBase: 'dec', |
|
|
|
toNumericBase: 'dec', |
|
|
|
fromCurrency: 'ETH', |
|
|
|
fromCurrency: 'ETH', |
|
|
|
toCurrency: 'USD', |
|
|
|
toCurrency: currentCurrency, |
|
|
|
numberOfDecimals: 2, |
|
|
|
numberOfDecimals: 2, |
|
|
|
fromDenomination: 'WEI', |
|
|
|
fromDenomination: 'WEI', |
|
|
|
conversionRate, |
|
|
|
conversionRate, |
|
|
@ -69,14 +71,14 @@ ConfirmSendEther.prototype.getAmount = function () { |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
USD, |
|
|
|
FIAT, |
|
|
|
ETH, |
|
|
|
ETH, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ConfirmSendEther.prototype.getGasFee = function () { |
|
|
|
ConfirmSendEther.prototype.getGasFee = function () { |
|
|
|
const { conversionRate } = this.props |
|
|
|
const { conversionRate, currentCurrency } = this.props |
|
|
|
const txMeta = this.gatherTxMeta() |
|
|
|
const txMeta = this.gatherTxMeta() |
|
|
|
const txParams = txMeta.txParams || {} |
|
|
|
const txParams = txMeta.txParams || {} |
|
|
|
|
|
|
|
|
|
|
@ -96,12 +98,12 @@ ConfirmSendEther.prototype.getGasFee = function () { |
|
|
|
|
|
|
|
|
|
|
|
const txFeeBn = gasBn.mul(gasPriceBn) |
|
|
|
const txFeeBn = gasBn.mul(gasPriceBn) |
|
|
|
|
|
|
|
|
|
|
|
const USD = conversionUtil(txFeeBn, { |
|
|
|
const FIAT = conversionUtil(txFeeBn, { |
|
|
|
fromNumericBase: 'BN', |
|
|
|
fromNumericBase: 'BN', |
|
|
|
toNumericBase: 'dec', |
|
|
|
toNumericBase: 'dec', |
|
|
|
fromDenomination: 'WEI', |
|
|
|
fromDenomination: 'WEI', |
|
|
|
fromCurrency: 'ETH', |
|
|
|
fromCurrency: 'ETH', |
|
|
|
toCurrency: 'USD', |
|
|
|
toCurrency: currentCurrency, |
|
|
|
numberOfDecimals: 2, |
|
|
|
numberOfDecimals: 2, |
|
|
|
conversionRate, |
|
|
|
conversionRate, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -116,7 +118,7 @@ ConfirmSendEther.prototype.getGasFee = function () { |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
USD, |
|
|
|
FIAT, |
|
|
|
ETH, |
|
|
|
ETH, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -125,10 +127,10 @@ ConfirmSendEther.prototype.getData = function () { |
|
|
|
const { identities } = this.props |
|
|
|
const { identities } = this.props |
|
|
|
const txMeta = this.gatherTxMeta() |
|
|
|
const txMeta = this.gatherTxMeta() |
|
|
|
const txParams = txMeta.txParams || {} |
|
|
|
const txParams = txMeta.txParams || {} |
|
|
|
const { USD: gasFeeInUSD, ETH: gasFeeInETH } = this.getGasFee() |
|
|
|
const { FIAT: gasFeeInFIAT, ETH: gasFeeInETH } = this.getGasFee() |
|
|
|
const { USD: amountInUSD, ETH: amountInETH } = this.getAmount() |
|
|
|
const { FIAT: amountInFIAT, ETH: amountInETH } = this.getAmount() |
|
|
|
|
|
|
|
|
|
|
|
const totalInUSD = addCurrencies(gasFeeInUSD, amountInUSD, { |
|
|
|
const totalInFIAT = addCurrencies(gasFeeInFIAT, amountInFIAT, { |
|
|
|
toNumericBase: 'dec', |
|
|
|
toNumericBase: 'dec', |
|
|
|
numberOfDecimals: 2, |
|
|
|
numberOfDecimals: 2, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -147,17 +149,17 @@ ConfirmSendEther.prototype.getData = function () { |
|
|
|
name: identities[txParams.to] ? identities[txParams.to].name : 'New Recipient', |
|
|
|
name: identities[txParams.to] ? identities[txParams.to].name : 'New Recipient', |
|
|
|
}, |
|
|
|
}, |
|
|
|
memo: txParams.memo || '', |
|
|
|
memo: txParams.memo || '', |
|
|
|
gasFeeInUSD, |
|
|
|
gasFeeInFIAT, |
|
|
|
gasFeeInETH, |
|
|
|
gasFeeInETH, |
|
|
|
amountInUSD, |
|
|
|
amountInFIAT, |
|
|
|
amountInETH, |
|
|
|
amountInETH, |
|
|
|
totalInUSD, |
|
|
|
totalInFIAT, |
|
|
|
totalInETH, |
|
|
|
totalInETH, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ConfirmSendEther.prototype.render = function () { |
|
|
|
ConfirmSendEther.prototype.render = function () { |
|
|
|
const { backToAccountDetail, selectedAddress } = this.props |
|
|
|
const { backToAccountDetail, selectedAddress, currentCurrency } = this.props |
|
|
|
const txMeta = this.gatherTxMeta() |
|
|
|
const txMeta = this.gatherTxMeta() |
|
|
|
const txParams = txMeta.txParams || {} |
|
|
|
const txParams = txMeta.txParams || {} |
|
|
|
|
|
|
|
|
|
|
@ -171,10 +173,10 @@ ConfirmSendEther.prototype.render = function () { |
|
|
|
name: toName, |
|
|
|
name: toName, |
|
|
|
}, |
|
|
|
}, |
|
|
|
memo, |
|
|
|
memo, |
|
|
|
gasFeeInUSD, |
|
|
|
gasFeeInFIAT, |
|
|
|
gasFeeInETH, |
|
|
|
gasFeeInETH, |
|
|
|
amountInUSD, |
|
|
|
amountInFIAT, |
|
|
|
totalInUSD, |
|
|
|
totalInFIAT, |
|
|
|
totalInETH, |
|
|
|
totalInETH, |
|
|
|
} = this.getData() |
|
|
|
} = this.getData() |
|
|
|
|
|
|
|
|
|
|
@ -239,8 +241,8 @@ ConfirmSendEther.prototype.render = function () { |
|
|
|
// `You're sending to Recipient ...${toAddress.slice(toAddress.length - 4)}`,
|
|
|
|
// `You're sending to Recipient ...${toAddress.slice(toAddress.length - 4)}`,
|
|
|
|
// ]),
|
|
|
|
// ]),
|
|
|
|
|
|
|
|
|
|
|
|
h('h3.flex-center.confirm-screen-send-amount', [`$${amountInUSD}`]), |
|
|
|
h('h3.flex-center.confirm-screen-send-amount', [`$${amountInFIAT}`]), |
|
|
|
h('h3.flex-center.confirm-screen-send-amount-currency', [ 'USD' ]), |
|
|
|
h('h3.flex-center.confirm-screen-send-amount-currency', [ currentCurrency.toUpperCase() ]), |
|
|
|
h('div.flex-center.confirm-memo-wrapper', [ |
|
|
|
h('div.flex-center.confirm-memo-wrapper', [ |
|
|
|
h('h3.confirm-screen-send-memo', [ memo ? `"${memo}"` : '' ]), |
|
|
|
h('h3.confirm-screen-send-memo', [ memo ? `"${memo}"` : '' ]), |
|
|
|
]), |
|
|
|
]), |
|
|
@ -265,7 +267,7 @@ ConfirmSendEther.prototype.render = function () { |
|
|
|
h('section.flex-row.flex-center.confirm-screen-row', [ |
|
|
|
h('section.flex-row.flex-center.confirm-screen-row', [ |
|
|
|
h('span.confirm-screen-label.confirm-screen-section-column', [ 'Gas Fee' ]), |
|
|
|
h('span.confirm-screen-label.confirm-screen-section-column', [ 'Gas Fee' ]), |
|
|
|
h('div.confirm-screen-section-column', [ |
|
|
|
h('div.confirm-screen-section-column', [ |
|
|
|
h('div.confirm-screen-row-info', `$${gasFeeInUSD} USD`), |
|
|
|
h('div.confirm-screen-row-info', `${gasFeeInFIAT} ${currentCurrency.toUpperCase()}`), |
|
|
|
|
|
|
|
|
|
|
|
h('div.confirm-screen-row-detail', `${gasFeeInETH} ETH`), |
|
|
|
h('div.confirm-screen-row-detail', `${gasFeeInETH} ETH`), |
|
|
|
]), |
|
|
|
]), |
|
|
@ -279,7 +281,7 @@ ConfirmSendEther.prototype.render = function () { |
|
|
|
]), |
|
|
|
]), |
|
|
|
|
|
|
|
|
|
|
|
h('div.confirm-screen-section-column', [ |
|
|
|
h('div.confirm-screen-section-column', [ |
|
|
|
h('div.confirm-screen-row-info', `$${totalInUSD} USD`), |
|
|
|
h('div.confirm-screen-row-info', `${totalInFIAT} ${currentCurrency.toUpperCase()}`), |
|
|
|
h('div.confirm-screen-row-detail', `${totalInETH} ETH`), |
|
|
|
h('div.confirm-screen-row-detail', `${totalInETH} ETH`), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|