UNPKG

@metamask/eip-5792-middleware

Version:

Implements the JSON-RPC methods for sending multiple calls from the user's wallet, and checking their status, as referenced in EIP-5792

1 lines 1.57 kB
{"version":3,"file":"wallet_getCallsStatus.cjs","sourceRoot":"","sources":["../../src/methods/wallet_getCallsStatus.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAGjD,wCAAyE;AACzE,wCAA0C;AAE1C;;;;;;;GAOG;AACI,KAAK,UAAU,oBAAoB,CACxC,GAAmB,EACnB,GAA2B,EAC3B,EACE,cAAc,GAGf;IAED,IAAI,CAAC,cAAc,EAAE;QACnB,MAAM,sBAAS,CAAC,kBAAkB,EAAE,CAAC;KACtC;IAED,IAAA,sBAAc,EAAC,GAAG,CAAC,MAAM,EAAE,4BAAoB,CAAC,CAAC;IAEjD,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEzB,GAAG,CAAC,MAAM,GAAG,MAAM,cAAc,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC;AAlBD,oDAkBC","sourcesContent":["import { rpcErrors } from '@metamask/rpc-errors';\nimport type { JsonRpcRequest, PendingJsonRpcResponse } from '@metamask/utils';\n\nimport { type GetCallsStatusHook, GetCallsStatusStruct } from '../types';\nimport { validateParams } from '../utils';\n\n/**\n * The RPC method handler middleware for `wallet_getCallStatus`\n *\n * @param req - The JSON RPC request's end callback.\n * @param res - The JSON RPC request's pending response object.\n * @param hooks - The hooks object.\n * @param hooks.getCallsStatus - Function that retrieves the status of a transaction batch by its ID.\n */\nexport async function walletGetCallsStatus(\n req: JsonRpcRequest,\n res: PendingJsonRpcResponse,\n {\n getCallsStatus,\n }: {\n getCallsStatus?: GetCallsStatusHook;\n },\n): Promise<void> {\n if (!getCallsStatus) {\n throw rpcErrors.methodNotSupported();\n }\n\n validateParams(req.params, GetCallsStatusStruct);\n\n const id = req.params[0];\n\n res.result = await getCallsStatus(id, req);\n}\n"]}