2018-07-31 07:03:20 +02:00
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import { withRouter } from 'react-router-dom'
|
|
|
|
import { compose } from 'recompose'
|
|
|
|
import TransactionList from './transaction-list.component'
|
|
|
|
import {
|
2018-12-09 21:48:06 +01:00
|
|
|
nonceSortedCompletedTransactionsSelector,
|
|
|
|
nonceSortedPendingTransactionsSelector,
|
2018-07-31 07:03:20 +02:00
|
|
|
} from '../../selectors/transactions'
|
2018-08-30 18:51:57 +02:00
|
|
|
import { getSelectedAddress, getAssetImages } from '../../selectors'
|
2018-08-06 07:25:58 +02:00
|
|
|
import { selectedTokenSelector } from '../../selectors/tokens'
|
2018-08-12 06:12:30 +02:00
|
|
|
import { updateNetworkNonce } from '../../actions'
|
2018-07-31 07:03:20 +02:00
|
|
|
|
|
|
|
const mapStateToProps = state => {
|
|
|
|
return {
|
2018-12-09 21:48:06 +01:00
|
|
|
completedTransactions: nonceSortedCompletedTransactionsSelector(state),
|
|
|
|
pendingTransactions: nonceSortedPendingTransactionsSelector(state),
|
2018-08-06 07:25:58 +02:00
|
|
|
selectedToken: selectedTokenSelector(state),
|
2018-08-12 06:12:30 +02:00
|
|
|
selectedAddress: getSelectedAddress(state),
|
2018-08-30 18:51:57 +02:00
|
|
|
assetImages: getAssetImages(state),
|
2018-08-12 06:12:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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),
|
2018-07-31 07:03:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default compose(
|
|
|
|
withRouter,
|
2018-08-12 06:12:30 +02:00
|
|
|
connect(mapStateToProps, mapDispatchToProps, mergeProps)
|
2018-07-31 07:03:20 +02:00
|
|
|
)(TransactionList)
|