aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/transaction-breakdown/transaction-breakdown.container.js
diff options
context:
space:
mode:
authorDan J Miller <danjm.com@gmail.com>2019-03-07 02:14:53 +0800
committerGitHub <noreply@github.com>2019-03-07 02:14:53 +0800
commitb8f143f1c3bcc760787c459e218e6bbb08162058 (patch)
tree5dc85dd0322d07f382ca4e6ff05724a75fbaee58 /ui/app/components/transaction-breakdown/transaction-breakdown.container.js
parentbe2d2bad4b2f2e57a95751bf431199899942489e (diff)
downloadtangerine-wallet-browser-b8f143f1c3bcc760787c459e218e6bbb08162058.tar.gz
tangerine-wallet-browser-b8f143f1c3bcc760787c459e218e6bbb08162058.tar.zst
tangerine-wallet-browser-b8f143f1c3bcc760787c459e218e6bbb08162058.zip
Handle undefined gas limits and prices in transaction-breakdown.component (#6246)
Diffstat (limited to 'ui/app/components/transaction-breakdown/transaction-breakdown.container.js')
-rw-r--r--ui/app/components/transaction-breakdown/transaction-breakdown.container.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/ui/app/components/transaction-breakdown/transaction-breakdown.container.js b/ui/app/components/transaction-breakdown/transaction-breakdown.container.js
index 919187b6f..3e85b9e23 100644
--- a/ui/app/components/transaction-breakdown/transaction-breakdown.container.js
+++ b/ui/app/components/transaction-breakdown/transaction-breakdown.container.js
@@ -1,14 +1,28 @@
import { connect } from 'react-redux'
import TransactionBreakdown from './transaction-breakdown.component'
import {getIsMainnet, getNativeCurrency, preferencesSelector} from '../../selectors'
+import { getHexGasTotal } from '../../helpers/confirm-transaction/util'
+import { sumHexes } from '../../helpers/transactions.util'
-const mapStateToProps = (state) => {
+const mapStateToProps = (state, ownProps) => {
+ const { transaction } = ownProps
+ const { txParams: { gas, gasPrice, value } = {}, txReceipt: { gasUsed } = {} } = transaction
const { showFiatInTestnets } = preferencesSelector(state)
const isMainnet = getIsMainnet(state)
+ const gasLimit = typeof gasUsed === 'string' ? gasUsed : gas
+
+ const hexGasTotal = gasLimit && gasPrice && getHexGasTotal({ gasLimit, gasPrice }) || '0x0'
+ const totalInHex = sumHexes(hexGasTotal, value)
+
return {
nativeCurrency: getNativeCurrency(state),
showFiat: (isMainnet || !!showFiatInTestnets),
+ totalInHex,
+ gas,
+ gasPrice,
+ value,
+ gasUsed,
}
}