2018-08-07 02:03:49 +02:00
|
|
|
import { connect } from 'react-redux'
|
2020-02-24 23:58:26 +01:00
|
|
|
import { compose } from 'redux'
|
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 }) => {
|
2020-02-14 21:32:56 +01:00
|
|
|
const { pendingTokens, suggestedTokens, tokens } = metamask
|
2020-01-13 17:29:21 +01:00
|
|
|
const params = { ...pendingTokens, ...suggestedTokens }
|
2018-08-07 02:03:49 +02:00
|
|
|
|
|
|
|
return {
|
|
|
|
pendingTokens: params,
|
2020-02-14 21:32:56 +01:00
|
|
|
tokens,
|
2018-08-07 02:03:49 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-15 21:34:12 +01:00
|
|
|
const mapDispatchToProps = (dispatch) => {
|
2018-08-07 02:03:49 +02:00
|
|
|
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)
|