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) {
|
addSuggestedToken (tokenOpts) {
|
||||||
// TODO: Validate params
|
// TODO: Validate params
|
||||||
const suggested = this.getSuggestedTokens()
|
const suggested = this.getSuggestedTokens()
|
||||||
suggested[tokenOpts.address] = suggested
|
suggested[tokenOpts.address] = tokenOpts
|
||||||
this.store.updateState({ suggestedTokens: suggested })
|
this.store.updateState({ suggestedTokens: suggested })
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,11 +69,10 @@ class PreferencesController {
|
|||||||
* @param {Function} - next
|
* @param {Function} - next
|
||||||
* @param {Function} - end
|
* @param {Function} - end
|
||||||
*/
|
*/
|
||||||
requestAddToken(req, res, next, end) {
|
requestAddToken (req, res, next, end) {
|
||||||
if (req.method === 'eth_watchToken') {
|
if (req.method === 'eth_watchToken') {
|
||||||
// TODO: Validate params!
|
// TODO: Validate params!
|
||||||
const [ rawAddress, symbol, decimals ] = req.params
|
const [ rawAddress, symbol, decimals ] = req.params
|
||||||
|
|
||||||
const tokenOpts = {
|
const tokenOpts = {
|
||||||
address: rawAddress,
|
address: rawAddress,
|
||||||
decimals,
|
decimals,
|
||||||
@ -82,8 +81,8 @@ class PreferencesController {
|
|||||||
|
|
||||||
this.addSuggestedToken(tokenOpts)
|
this.addSuggestedToken(tokenOpts)
|
||||||
this.showAddTokenUi()
|
this.showAddTokenUi()
|
||||||
|
res.result = rawAddress
|
||||||
return end(rawAddress)
|
return end()
|
||||||
} else {
|
} else {
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,6 @@ class Home extends Component {
|
|||||||
unapprovedTypedMessagesCount = 0,
|
unapprovedTypedMessagesCount = 0,
|
||||||
suggestedTokens = {},
|
suggestedTokens = {},
|
||||||
unconfirmedTransactionsCount = 0,
|
unconfirmedTransactionsCount = 0,
|
||||||
|
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
// suggested new tokens
|
// suggested new tokens
|
||||||
@ -177,11 +176,8 @@ Home.propTypes = {
|
|||||||
isPopup: PropTypes.bool,
|
isPopup: PropTypes.bool,
|
||||||
isMouseUser: PropTypes.bool,
|
isMouseUser: PropTypes.bool,
|
||||||
t: PropTypes.func,
|
t: PropTypes.func,
|
||||||
<<<<<<< HEAD
|
|
||||||
suggestedTokens: PropTypes.object,
|
suggestedTokens: PropTypes.object,
|
||||||
=======
|
|
||||||
unconfirmedTransactionsCount: PropTypes.number,
|
unconfirmedTransactionsCount: PropTypes.number,
|
||||||
>>>>>>> develop
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapStateToProps (state) {
|
function mapStateToProps (state) {
|
||||||
|
Loading…
Reference in New Issue
Block a user