mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-24 11:01:41 +01:00
28 lines
848 B
JavaScript
28 lines
848 B
JavaScript
import { connect } from 'react-redux'
|
|
import { compose } from 'redux'
|
|
import ConfirmAddSuggestedToken from './confirm-add-suggested-token.component'
|
|
import { withRouter } from 'react-router-dom'
|
|
import { addToken, removeSuggestedTokens } from '../../store/actions'
|
|
|
|
const mapStateToProps = ({ metamask }) => {
|
|
const { pendingTokens, suggestedTokens, tokens } = metamask
|
|
const params = { ...pendingTokens, ...suggestedTokens }
|
|
|
|
return {
|
|
pendingTokens: params,
|
|
tokens,
|
|
}
|
|
}
|
|
|
|
const mapDispatchToProps = (dispatch) => {
|
|
return {
|
|
addToken: ({ address, symbol, decimals, image }) => dispatch(addToken(address, symbol, Number(decimals), image)),
|
|
removeSuggestedTokens: () => dispatch(removeSuggestedTokens()),
|
|
}
|
|
}
|
|
|
|
export default compose(
|
|
withRouter,
|
|
connect(mapStateToProps, mapDispatchToProps)
|
|
)(ConfirmAddSuggestedToken)
|