1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 03:20:23 +01:00
metamask-extension/ui/app/pages/confirm-transaction/confirm-transaction.container.js
Erik Marks 728026d1f7
Fix batch transaction UX (#7473)
* order transactions from oldest to newest in UI

* update json-rpc-engine, eth-json-rpc-middleware

* update e2e and integration tests
2020-01-10 06:34:02 -08:00

72 lines
2.1 KiB
JavaScript

import { connect } from 'react-redux'
import { compose } from 'recompose'
import { withRouter } from 'react-router-dom'
import {
setTransactionToConfirm,
clearConfirmTransaction,
} from '../../ducks/confirm-transaction/confirm-transaction.duck'
import {
isTokenMethodAction,
} from '../../helpers/utils/transactions.util'
import {
fetchBasicGasAndTimeEstimates,
} from '../../ducks/gas/gas.duck'
import {
getContractMethodData,
getTokenParams,
} from '../../store/actions'
import ConfirmTransaction from './confirm-transaction.component'
import { unconfirmedTransactionsListSelector } from '../../selectors/confirm-transaction'
const mapStateToProps = (state, ownProps) => {
const {
metamask: {
send,
unapprovedTxs,
abTests: { fullScreenVsPopup },
},
} = state
const { match: { params = {} } } = ownProps
const { id } = params
const unconfirmedTransactions = unconfirmedTransactionsListSelector(state)
const totalUnconfirmed = unconfirmedTransactions.length
const transaction = totalUnconfirmed
? unapprovedTxs[id] || unconfirmedTransactions[0]
: {}
const { id: transactionId, transactionCategory } = transaction
const trackABTest = false
return {
totalUnapprovedCount: totalUnconfirmed,
send,
unapprovedTxs,
id,
paramsTransactionId: id && String(id),
transactionId: transactionId && String(transactionId),
transaction,
isTokenMethodAction: isTokenMethodAction(transactionCategory),
trackABTest,
fullScreenVsPopupTestGroup: fullScreenVsPopup,
}
}
const mapDispatchToProps = dispatch => {
return {
setTransactionToConfirm: transactionId => {
dispatch(setTransactionToConfirm(transactionId))
},
clearConfirmTransaction: () => dispatch(clearConfirmTransaction()),
fetchBasicGasAndTimeEstimates: () => dispatch(fetchBasicGasAndTimeEstimates()),
getContractMethodData: (data) => dispatch(getContractMethodData(data)),
getTokenParams: (tokenAddress) => dispatch(getTokenParams(tokenAddress)),
}
}
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps),
)(ConfirmTransaction)