Skip to content

Commit 89fa924

Browse files
Simplify origin handling
1 parent 503050a commit 89fa924

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

packages/snaps-controllers/src/multichain/MultichainRoutingController.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,10 @@ export class MultichainRoutingController extends BaseController<
274274
if (protocolSnap) {
275275
return this.messagingSystem.call('SnapController:handleRequest', {
276276
snapId: protocolSnap.snapId,
277-
origin: 'metamask',
277+
origin,
278278
request: {
279279
method: '',
280280
params: {
281-
// We are overriding the origin here, so that the Snap gets the proper origin
282-
// while the permissions check is skipped due to the requesting origin being metamask.
283-
origin,
284281
request,
285282
scope,
286283
},

packages/snaps-execution-environments/src/common/commands.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,8 @@ export function getHandlerArguments(
7979
case HandlerType.OnProtocolRequest: {
8080
assertIsOnProtocolRequestArguments(request.params);
8181

82-
// For this specific handler we extract the origin from the parameters.
83-
const {
84-
origin: nestedOrigin,
85-
request: nestedRequest,
86-
scope,
87-
} = request.params;
88-
return { origin: nestedOrigin, request: nestedRequest, scope };
82+
const { request: nestedRequest, scope } = request.params;
83+
return { request: nestedRequest, scope };
8984
}
9085

9186
case HandlerType.OnRpcRequest:

packages/snaps-execution-environments/src/common/validation.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ export function assertIsOnUserInputRequestArguments(
245245
}
246246

247247
export const OnProtocolRequestArgumentsStruct = object({
248-
origin: string(),
249248
scope: ChainIdStruct,
250249
request: JsonRpcRequestStruct,
251250
});

0 commit comments

Comments
 (0)