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

20 lines 819 B
import { rpcErrors } from "@metamask/rpc-errors"; import { GetCallsStatusStruct } from "../types.mjs"; import { validateParams } from "../utils.mjs"; /** * The RPC method handler middleware for `wallet_getCallStatus` * * @param req - The JSON RPC request's end callback. * @param res - The JSON RPC request's pending response object. * @param hooks - The hooks object. * @param hooks.getCallsStatus - Function that retrieves the status of a transaction batch by its ID. */ export async function walletGetCallsStatus(req, res, { getCallsStatus, }) { if (!getCallsStatus) { throw rpcErrors.methodNotSupported(); } validateParams(req.params, GetCallsStatusStruct); const id = req.params[0]; res.result = await getCallsStatus(id, req); } //# sourceMappingURL=wallet_getCallsStatus.mjs.map