mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
rpc-engine not crashing when eth_watchToken
This commit is contained in:
parent
21a61f2987
commit
081884bd80
@ -57,7 +57,7 @@ class PreferencesController {
|
||||
addSuggestedToken (tokenOpts) {
|
||||
// TODO: Validate params
|
||||
const suggested = this.getSuggestedTokens()
|
||||
suggested[tokenOpts.address] = suggested
|
||||
suggested[tokenOpts.address] = tokenOpts
|
||||
this.store.updateState({ suggestedTokens: suggested })
|
||||
}
|
||||
|
||||
@ -69,11 +69,10 @@ class PreferencesController {
|
||||
* @param {Function} - next
|
||||
* @param {Function} - end
|
||||
*/
|
||||
requestAddToken(req, res, next, end) {
|
||||
requestAddToken (req, res, next, end) {
|
||||
if (req.method === 'eth_watchToken') {
|
||||
// TODO: Validate params!
|
||||
const [ rawAddress, symbol, decimals ] = req.params
|
||||
|
||||
const tokenOpts = {
|
||||
address: rawAddress,
|
||||
decimals,
|
||||
@ -82,8 +81,8 @@ class PreferencesController {
|
||||
|
||||
this.addSuggestedToken(tokenOpts)
|
||||
this.showAddTokenUi()
|
||||
|
||||
return end(rawAddress)
|
||||
res.result = rawAddress
|
||||
return end()
|
||||
} else {
|
||||
return next()
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ class Home extends Component {
|
||||
unapprovedTypedMessagesCount = 0,
|
||||
suggestedTokens = {},
|
||||
unconfirmedTransactionsCount = 0,
|
||||
|
||||
} = this.props
|
||||
|
||||
// suggested new tokens
|
||||
@ -177,11 +176,8 @@ Home.propTypes = {
|
||||
isPopup: PropTypes.bool,
|
||||
isMouseUser: PropTypes.bool,
|
||||
t: PropTypes.func,
|
||||
<<<<<<< HEAD
|
||||
suggestedTokens: PropTypes.object,
|
||||
=======
|
||||
unconfirmedTransactionsCount: PropTypes.number,
|
||||
>>>>>>> develop
|
||||
}
|
||||
|
||||
function mapStateToProps (state) {
|
||||
|
Loading…
Reference in New Issue
Block a user