File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/multichain-api-middleware/src/handlers Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import type {
99 JsonRpcEngineEndCallback ,
1010} from '@metamask/json-rpc-engine' ;
1111import {
12+ CaveatMutatorOperation ,
1213 PermissionDoesNotExistError ,
1314 UnrecognizedSubjectError ,
1415} from '@metamask/permission-controller' ;
@@ -37,10 +38,17 @@ function partialRevokePermissions(
3738 ) . value ;
3839
3940 for ( const scopeString of scopes ) {
40- updatedCaveatValue = Caip25CaveatMutators [ Caip25CaveatType ] . removeScope (
41+ const result = Caip25CaveatMutators [ Caip25CaveatType ] . removeScope (
4142 updatedCaveatValue ,
4243 scopeString ,
43- ) ?. value ?? {
44+ ) ;
45+
46+ // If operation is a Noop, it means a scope was passed that was not present in the permission, so we proceed with the loop
47+ if ( result . operation === CaveatMutatorOperation . Noop ) {
48+ continue ;
49+ }
50+
51+ updatedCaveatValue = result ?. value ?? {
4452 requiredScopes : { } ,
4553 optionalScopes : { } ,
4654 sessionProperties : { } ,
You can’t perform that action at this time.
0 commit comments