2018-08-07 02:03:49 +02:00
|
|
|
import { connect } from 'react-redux'
|
2018-08-16 23:28:07 +02:00
|
|
|
import { compose } from 'recompose'
|
2018-08-07 02:03:49 +02:00
|
|
|
import ConfirmAddSuggestedToken from './confirm-add-suggested-token.component'
|
2018-08-16 23:28:07 +02:00
|
|
|
import { withRouter } from 'react-router-dom'
|
2018-08-07 02:03:49 +02:00
|
|
|
|
|
|
|
const extend = require('xtend')
|
|
|
|
|
2018-08-17 01:19:19 +02:00
|
|
|
const { addToken, removeSuggestedTokens } = require('../../../actions')
|
2018-08-07 02:03:49 +02:00
|
|
|
|
|
|
|
const mapStateToProps = ({ metamask }) => {
|
|
|
|
const { pendingTokens, suggestedTokens } = metamask
|
|
|
|
const params = extend(pendingTokens, suggestedTokens)
|
|
|
|
|
|
|
|
return {
|
|
|
|
pendingTokens: params,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => {
|
|
|
|
return {
|
2018-08-23 20:54:40 +02:00
|
|
|
addToken: ({address, symbol, decimals, image}) => dispatch(addToken(address, symbol, decimals, image)),
|
2018-08-07 02:03:49 +02:00
|
|
|
removeSuggestedTokens: () => dispatch(removeSuggestedTokens()),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-16 23:28:07 +02:00
|
|
|
export default compose(
|
|
|
|
withRouter,
|
|
|
|
connect(mapStateToProps, mapDispatchToProps)
|
|
|
|
)(ConfirmAddSuggestedToken)
|