add support for wallet_watchAsset

feature/default_network_editable
Esteban MIno 6 years ago
parent ea214945cf
commit 75661673e5
  1. 2
      app/scripts/controllers/preferences.js
  2. 5
      test/unit/app/controllers/preferences-controller-test.js

@ -104,7 +104,7 @@ class PreferencesController {
* @param {Function} - end * @param {Function} - end
*/ */
async requestWatchAsset (req, res, next, 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 const { type, options } = req.params
switch (type) { switch (type) {
case 'ERC20': case 'ERC20':

@ -375,6 +375,11 @@ describe('preferences controller', function () {
await preferencesController.requestWatchAsset(req, res, asy.next, asy.end) await preferencesController.requestWatchAsset(req, res, asy.next, asy.end)
sandbox.assert.called(stubEnd) sandbox.assert.called(stubEnd)
sandbox.assert.notCalled(stubNext) 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 () { it('should through error if method is supported but asset type is not', async function () {
req.method = 'metamask_watchAsset' req.method = 'metamask_watchAsset'

Loading…
Cancel
Save