aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-10-21 13:27:08 +0800
committerGitHub <noreply@github.com>2018-10-21 13:27:08 +0800
commitb0c649a4e3c68293e08e764bbf4d53939df88e2d (patch)
tree5b58de5dfa96e96dcb527c7fd618f93a20c75fe8
parentb53a1f492c3339ef6fe070ac7d02b63a4393669c (diff)
parent75661673e5b2573ee9ab3a378130e4383c4c034f (diff)
downloadtangerine-wallet-browser-b0c649a4e3c68293e08e764bbf4d53939df88e2d.tar
tangerine-wallet-browser-b0c649a4e3c68293e08e764bbf4d53939df88e2d.tar.gz
tangerine-wallet-browser-b0c649a4e3c68293e08e764bbf4d53939df88e2d.tar.bz2
tangerine-wallet-browser-b0c649a4e3c68293e08e764bbf4d53939df88e2d.tar.lz
tangerine-wallet-browser-b0c649a4e3c68293e08e764bbf4d53939df88e2d.tar.xz
tangerine-wallet-browser-b0c649a4e3c68293e08e764bbf4d53939df88e2d.tar.zst
tangerine-wallet-browser-b0c649a4e3c68293e08e764bbf4d53939df88e2d.zip
Merge pull request #5555 from MetaMask/support-wallet-watch-asset
Support for prefix wallet_watchAsset
-rw-r--r--app/scripts/controllers/preferences.js2
-rw-r--r--test/unit/app/controllers/preferences-controller-test.js5
2 files changed, 6 insertions, 1 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js
index 689506a7a..20b13398c 100644
--- a/app/scripts/controllers/preferences.js
+++ b/app/scripts/controllers/preferences.js
@@ -104,7 +104,7 @@ class PreferencesController {
* @param {Function} - end
*/
async requestWatchAsset (req, res, next, end) {
- if (req.method === 'metamask_watchAsset') {
+ if (req.method === 'metamask_watchAsset' || req.method === 'wallet_watchAsset') {
const { type, options } = req.params
switch (type) {
case 'ERC20':
diff --git a/test/unit/app/controllers/preferences-controller-test.js b/test/unit/app/controllers/preferences-controller-test.js
index 02f421de2..7f2804a83 100644
--- a/test/unit/app/controllers/preferences-controller-test.js
+++ b/test/unit/app/controllers/preferences-controller-test.js
@@ -375,6 +375,11 @@ describe('preferences controller', function () {
await preferencesController.requestWatchAsset(req, res, asy.next, asy.end)
sandbox.assert.called(stubEnd)
sandbox.assert.notCalled(stubNext)
+ req.method = 'wallet_watchAsset'
+ req.params.type = 'someasset'
+ await preferencesController.requestWatchAsset(req, res, asy.next, asy.end)
+ sandbox.assert.calledTwice(stubEnd)
+ sandbox.assert.notCalled(stubNext)
})
it('should through error if method is supported but asset type is not', async function () {
req.method = 'metamask_watchAsset'