aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers
diff options
context:
space:
mode:
authorEsteban MIno <efmino@uc.cl>2018-08-04 04:42:13 +0800
committerEsteban MIno <efmino@uc.cl>2018-08-04 04:42:13 +0800
commit081884bd8095b2027e88fabdfe297f6d2fc8c38e (patch)
treef57368bb3d2c9001d159ff1075c09572e7bdf89d /app/scripts/controllers
parent21a61f2987ae83a48bb1f7256ec9c34978413eb2 (diff)
downloadtangerine-wallet-browser-081884bd8095b2027e88fabdfe297f6d2fc8c38e.tar.gz
tangerine-wallet-browser-081884bd8095b2027e88fabdfe297f6d2fc8c38e.tar.zst
tangerine-wallet-browser-081884bd8095b2027e88fabdfe297f6d2fc8c38e.zip
rpc-engine not crashing when eth_watchToken
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r--app/scripts/controllers/preferences.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js
index 8a4a63bb6..50f716852 100644
--- a/app/scripts/controllers/preferences.js
+++ b/app/scripts/controllers/preferences.js
@@ -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()
}