{"version":3,"file":"rpc-request.mjs","sourceRoot":"","sources":["../../../src/types/handlers/rpc-request.ts"],"names":[],"mappings":"","sourcesContent":["import type { Json, JsonRpcParams, JsonRpcRequest } from '@metamask/utils';\n\n/**\n * The `onRpcRequest` handler, which is called when a Snap receives a JSON-RPC\n * request. This can be called from another Snap, or from a website, depending\n * on the Snap's `endowment:rpc` permission.\n *\n * Note that using this handler requires the `endowment:rpc` permission.\n *\n * @param args - The request arguments.\n * @param args.origin - The origin of the request. This can be the ID of another\n * Snap, or the URL of a website.\n * @param args.request - The JSON-RPC request sent to the snap. This includes\n * the method name and parameters.\n * @returns The response to the JSON-RPC request. This must be a\n * JSON-serializable value. In order to return an error, throw a `SnapError`\n * instead.\n */\nexport type OnRpcRequestHandler<Params extends JsonRpcParams = JsonRpcParams> =\n  (args: { origin: string; request: JsonRpcRequest<Params> }) => Promise<Json>;\n"]}