diff options
author | Esteban MIno <efmino@uc.cl> | 2018-10-20 00:57:11 +0800 |
---|---|---|
committer | Esteban MIno <efmino@uc.cl> | 2018-10-20 00:57:11 +0800 |
commit | 75661673e5b2573ee9ab3a378130e4383c4c034f (patch) | |
tree | e99b18cf0804aabd0fe96807cd680c3ba186a37b | |
parent | ea214945cf88cef457147bd33a3017c8ea97956a (diff) | |
download | dexon-wallet-75661673e5b2573ee9ab3a378130e4383c4c034f.tar.gz dexon-wallet-75661673e5b2573ee9ab3a378130e4383c4c034f.tar.zst dexon-wallet-75661673e5b2573ee9ab3a378130e4383c4c034f.zip |
add support for wallet_watchAsset
-rw-r--r-- | app/scripts/controllers/preferences.js | 2 | ||||
-rw-r--r-- | test/unit/app/controllers/preferences-controller-test.js | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index 8eb2bce0..16620ca9 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 b5ccf3fb..e81b072d 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' |