mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fixed API for watchAsset (#14545)
* Fixed API for watchAsset * Fixed boolean return value for watchAsset
This commit is contained in:
parent
27ad7279cd
commit
74b5401302
@ -1,3 +1,4 @@
|
|||||||
|
import { ethErrors } from 'eth-rpc-errors';
|
||||||
import { MESSAGE_TYPE } from '../../../../../shared/constants/app';
|
import { MESSAGE_TYPE } from '../../../../../shared/constants/app';
|
||||||
|
|
||||||
const watchAsset = {
|
const watchAsset = {
|
||||||
@ -36,9 +37,14 @@ async function watchAssetHandler(
|
|||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const { options: asset, type } = req.params;
|
const { options: asset, type } = req.params;
|
||||||
res.result = await handleWatchAssetRequest(asset, type);
|
const handleWatchAssetResult = await handleWatchAssetRequest(asset, type);
|
||||||
|
await handleWatchAssetResult.result;
|
||||||
|
res.result = true;
|
||||||
return end();
|
return end();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (error.message === 'User rejected to watch the asset.') {
|
||||||
|
return end(ethErrors.provider.userRejectedRequest());
|
||||||
|
}
|
||||||
return end(error);
|
return end(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user