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'
|
2020-01-09 04:34:58 +01:00
|
|
|
import { addToken, removeSuggestedTokens } from '../../store/actions'
|
2018-08-07 02:03:49 +02:00
|
|
|
|
|
|
|
const mapStateToProps = ({ metamask }) => {
|
|
|
|
const { pendingTokens, suggestedTokens } = metamask
|
2020-01-13 17:29:21 +01:00
|
|
|
const params = { ...pendingTokens, ...suggestedTokens }
|
2018-08-07 02:03:49 +02:00
|
|
|
|
|
|
|
return {
|
|
|
|
pendingTokens: params,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => {
|
|
|
|
return {
|
2019-12-03 21:50:55 +01:00
|
|
|
addToken: ({ address, symbol, decimals, image }) => dispatch(addToken(address, symbol, Number(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)
|