mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Merge pull request #5555 from MetaMask/support-wallet-watch-asset
Support for prefix wallet_watchAsset
This commit is contained in:
commit
b0c649a4e3
@ -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':
|
||||
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user