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')
|
|
|
|
|
2019-03-22 00:03:30 +01:00
|
|
|
const { addToken, removeSuggestedTokens } = require('../../store/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)
|