File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
packages/snaps-rpc-methods/src/permitted Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -136,13 +136,15 @@ async function setStateImplementation(
136136 const { origin } = request as JsonRpcRequest & { origin : string } ;
137137 const state = await getSnapState ( origin , encrypted ) ;
138138
139- const newState = set ( state , key , value ) ;
140- if ( ! isPlainObject ( newState ) ) {
139+ if ( key === undefined && ! isPlainObject ( value ) ) {
141140 return end (
142- rpcErrors . invalidParams ( 'Invalid state: Root must be an object.' ) ,
141+ rpcErrors . invalidParams (
142+ 'Invalid params: Value must be an object if key is not provided.' ,
143+ ) ,
143144 ) ;
144145 }
145146
147+ const newState = set ( state , key , value ) ;
146148 await updateSnapState ( origin , newState , encrypted ) ;
147149 response . result = null ;
148150 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments