File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed
packages/snaps-rpc-methods/src/permitted Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212} from '@metamask/superstruct' ;
1313import type { PendingJsonRpcResponse , JsonRpcRequest } from '@metamask/utils' ;
1414
15+ import { manageStateBuilder } from '../restricted/manageState' ;
1516import type { MethodHooksObject } from '../utils' ;
1617
1718const hookNames : MethodHooksObject < ClearStateHooks > = {
@@ -80,7 +81,7 @@ async function clearStateImplementation(
8081) : Promise < void > {
8182 const { params } = request ;
8283
83- if ( ! hasPermission ( 'snap_manageState' ) ) {
84+ if ( ! hasPermission ( manageStateBuilder . targetName ) ) {
8485 return end ( providerErrors . unauthorized ( ) ) ;
8586 }
8687
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414import type { PendingJsonRpcResponse , JsonRpcRequest } from '@metamask/utils' ;
1515import { hasProperty , isPlainObject , type Json } from '@metamask/utils' ;
1616
17+ import { manageStateBuilder } from '../restricted/manageState' ;
1718import type { MethodHooksObject } from '../utils' ;
1819
1920const hookNames : MethodHooksObject < GetStateHooks > = {
@@ -96,7 +97,7 @@ async function getStateImplementation(
9697) : Promise < void > {
9798 const { params } = request ;
9899
99- if ( ! hasPermission ( 'snap_manageState' ) ) {
100+ if ( ! hasPermission ( manageStateBuilder . targetName ) ) {
100101 return end ( providerErrors . unauthorized ( ) ) ;
101102 }
102103
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414import type { PendingJsonRpcResponse , JsonRpcRequest } from '@metamask/utils' ;
1515import { JsonStruct , isPlainObject , type Json } from '@metamask/utils' ;
1616
17+ import { manageStateBuilder } from '../restricted/manageState' ;
1718import type { MethodHooksObject } from '../utils' ;
1819
1920const hookNames : MethodHooksObject < SetStateHooks > = {
@@ -119,7 +120,7 @@ async function setStateImplementation(
119120) : Promise < void > {
120121 const { params } = request ;
121122
122- if ( ! hasPermission ( 'snap_manageState' ) ) {
123+ if ( ! hasPermission ( manageStateBuilder . targetName ) ) {
123124 return end ( providerErrors . unauthorized ( ) ) ;
124125 }
125126
You can’t perform that action at this time.
0 commit comments