Skip to content

Commit

Permalink
updating the requesttype
Browse files Browse the repository at this point in the history
  • Loading branch information
NiranjanaBinoy committed Sep 3, 2024
1 parent cb7ad5d commit 855fab5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import type {
JsonRpcEngineNextCallback,
JsonRpcEngineEndCallback,
} from '@metamask/json-rpc-engine';
import type {
JsonRpcRequest,
JsonRpcParams,
PendingJsonRpcResponse,
} from '@metamask/utils';
import type { JsonRpcParams, PendingJsonRpcResponse } from '@metamask/utils';
import { OriginString } from '@metamask/permission-controller';
import { MESSAGE_TYPE } from '../../../../../shared/constants/app';
import { HandlerWrapper } from './types';
import {
HandlerWrapper,
HandlerRequestType as LogWeb3ShimUsageHandlerRequest,
} from './types';

type LogWeb3ShimUsageOptions = {
getWeb3ShimUsageState: (origin: OriginString) => undefined | 1 | 2;
Expand All @@ -18,7 +17,7 @@ type LogWeb3ShimUsageOptions = {
type LogWeb3ShimUsageConstraint<Params extends JsonRpcParams = JsonRpcParams> =
{
implementation: (
req: JsonRpcRequest<Params>,
req: LogWeb3ShimUsageHandlerRequest<Params>,
res: PendingJsonRpcResponse<true>,
_next: JsonRpcEngineNextCallback,
end: JsonRpcEngineEndCallback,
Expand Down Expand Up @@ -57,7 +56,7 @@ export default logWeb3ShimUsage;
* usage for a particular origin.
*/
function logWeb3ShimUsageHandler<Params extends JsonRpcParams = JsonRpcParams>(
req: JsonRpcRequest<Params>,
req: LogWeb3ShimUsageHandlerRequest<Params>,
res: PendingJsonRpcResponse<true>,
_next: JsonRpcEngineNextCallback,
end: JsonRpcEngineEndCallback,
Expand Down
8 changes: 8 additions & 0 deletions app/scripts/lib/rpc-method-middleware/handlers/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { OriginString } from '@metamask/permission-controller';
import { JsonRpcParams, JsonRpcRequest } from '@metamask/utils';

export type HandlerWrapper = {
methodNames: [string] | string[];
hookNames: Record<string, boolean>;
};

export type HandlerRequestType<Params extends JsonRpcParams = JsonRpcParams> =
Required<JsonRpcRequest<Params>> & {
origin: OriginString;
};

0 comments on commit 855fab5

Please sign in to comment.