You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1013 B
33 lines
1013 B
4 years ago
|
import { connect } from 'react-redux';
|
||
|
import { compose } from 'redux';
|
||
|
import { withRouter } from 'react-router-dom';
|
||
|
import { addToken, removeSuggestedTokens } from '../../store/actions';
|
||
|
import { getMostRecentOverviewPage } from '../../ducks/history/history';
|
||
|
import ConfirmAddSuggestedToken from './confirm-add-suggested-token.component';
|
||
6 years ago
|
|
||
5 years ago
|
const mapStateToProps = (state) => {
|
||
4 years ago
|
const {
|
||
|
metamask: { pendingTokens, suggestedTokens, tokens },
|
||
4 years ago
|
} = state;
|
||
|
const params = { ...pendingTokens, ...suggestedTokens };
|
||
6 years ago
|
|
||
|
return {
|
||
5 years ago
|
mostRecentOverviewPage: getMostRecentOverviewPage(state),
|
||
6 years ago
|
pendingTokens: params,
|
||
5 years ago
|
tokens,
|
||
4 years ago
|
};
|
||
|
};
|
||
6 years ago
|
|
||
5 years ago
|
const mapDispatchToProps = (dispatch) => {
|
||
6 years ago
|
return {
|
||
4 years ago
|
addToken: ({ address, symbol, decimals, image }) =>
|
||
|
dispatch(addToken(address, symbol, Number(decimals), image)),
|
||
6 years ago
|
removeSuggestedTokens: () => dispatch(removeSuggestedTokens()),
|
||
4 years ago
|
};
|
||
|
};
|
||
6 years ago
|
|
||
6 years ago
|
export default compose(
|
||
|
withRouter,
|
||
4 years ago
|
connect(mapStateToProps, mapDispatchToProps),
|
||
4 years ago
|
)(ConfirmAddSuggestedToken);
|