From e77ff0bce8e9e531c33a99c9de511b3afa5168f7 Mon Sep 17 00:00:00 2001 From: Frederik Bolding Date: Mon, 4 Apr 2022 16:32:49 +0200 Subject: [PATCH] Fix a few Snap state issues (#14339) * Fix clearSnapState * Simplify getSnapState --- app/scripts/metamask-controller.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 3a55881d8..9f5311d05 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -1034,10 +1034,10 @@ export default class MetamaskController extends EventEmitter { 'SnapController:add', ), clearSnapState: (fromSubject) => - this.controllerMessenger( - 'SnapController:updateSnap', + this.controllerMessenger.call( + 'SnapController:updateSnapState', fromSubject, - {}, + null, ), getMnemonic: this.getPrimaryKeyringMnemonic.bind(this), getSnap: this.controllerMessenger.call.bind( @@ -1048,16 +1048,10 @@ export default class MetamaskController extends EventEmitter { this.controllerMessenger, 'SnapController:getRpcMessageHandler', ), - getSnapState: async (...args) => { - // TODO:flask Just return the action result directly in the next - // @metamask/snap-controllers update. - return ( - (await this.controllerMessenger.call( - 'SnapController:getSnapState', - ...args, - )) ?? null - ); - }, + getSnapState: this.controllerMessenger.call.bind( + this.controllerMessenger, + 'SnapController:getSnapState', + ), showConfirmation: (origin, confirmationData) => this.approvalController.addAndShowApprovalRequest({ origin,