Skip to content

Commit

Permalink
addressing review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
NiranjanaBinoy committed Apr 9, 2024
1 parent 4435e46 commit a6936af
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/scripts/lib/rpc-method-middleware/handlers/watch-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
PendingJsonRpcResponse,
} from '@metamask/utils';
import {
JsonRpcEngineCallbackError,
JsonRpcEngineEndCallback,
JsonRpcEngineNextCallback,
} from '@metamask/json-rpc-engine';
Expand All @@ -26,7 +27,7 @@ type WatchAssetConstraint<Params extends JsonRpcParams = JsonRpcParams> = {
} & HandlerWrapper;

const watchAsset = {
methodNames: [MESSAGE_TYPE.WATCH_ASSET],
methodNames: [MESSAGE_TYPE.WATCH_ASSET, MESSAGE_TYPE.WATCH_ASSET_LEGACY],
implementation: watchAssetHandler,
hookNames: {
handleWatchAssetRequest: true,
Expand All @@ -49,7 +50,7 @@ async function watchAssetHandler<Params extends JsonRpcParams = JsonRpcParams>(
_next: JsonRpcEngineNextCallback,
end: JsonRpcEngineEndCallback,
{ handleWatchAssetRequest }: WatchAssetOptions,
) {
): Promise<void> {
try {
const {
params: { options: asset, type },
Expand All @@ -74,7 +75,7 @@ async function watchAssetHandler<Params extends JsonRpcParams = JsonRpcParams>(
await handleWatchAssetRequest({ asset, type, origin, networkClientId });
res.result = true;
return end();
} catch (error: any) {
return end(error);
} catch (error: unknown) {
return end(error as JsonRpcEngineCallbackError);
}
}

0 comments on commit a6936af

Please sign in to comment.