1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Fix a few Snap state issues (#14339)

* Fix clearSnapState

* Simplify getSnapState
This commit is contained in:
Frederik Bolding 2022-04-04 16:32:49 +02:00 committed by GitHub
parent 6e73c34e2b
commit e77ff0bce8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,