1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-02 14:15:06 +01:00
metamask-extension/ui/app/components/transaction-list/transaction-list.container.js
2018-12-09 12:48:06 -08:00

45 lines
1.4 KiB
JavaScript

import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { compose } from 'recompose'
import TransactionList from './transaction-list.component'
import {
nonceSortedCompletedTransactionsSelector,
nonceSortedPendingTransactionsSelector,
} from '../../selectors/transactions'
import { getSelectedAddress, getAssetImages } from '../../selectors'
import { selectedTokenSelector } from '../../selectors/tokens'
import { updateNetworkNonce } from '../../actions'
const mapStateToProps = state => {
return {
completedTransactions: nonceSortedCompletedTransactionsSelector(state),
pendingTransactions: nonceSortedPendingTransactionsSelector(state),
selectedToken: selectedTokenSelector(state),
selectedAddress: getSelectedAddress(state),
assetImages: getAssetImages(state),
}
}
const mapDispatchToProps = dispatch => {
return {
updateNetworkNonce: address => dispatch(updateNetworkNonce(address)),
}
}
const mergeProps = (stateProps, dispatchProps, ownProps) => {
const { selectedAddress, ...restStateProps } = stateProps
const { updateNetworkNonce, ...restDispatchProps } = dispatchProps
return {
...restStateProps,
...restDispatchProps,
...ownProps,
updateNetworkNonce: () => updateNetworkNonce(selectedAddress),
}
}
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps, mergeProps)
)(TransactionList)