UNPKG

@charterlabs/permissionless

Version:

A utility library for working with ERC-4337

38 lines 1.55 kB
import { deepHexlify } from "../../utils/deepHexlify.js"; /** * @deprecated Use `getPaymasterData` instead */ export const sponsorUserOperation = async (client, args) => { const response = await client.request({ method: "pm_sponsorUserOperation", params: args.sponsorshipPolicyId ? [ deepHexlify(args.userOperation), args.entryPoint.address, { sponsorshipPolicyId: args.sponsorshipPolicyId } ] : [deepHexlify(args.userOperation), args.entryPoint.address] }); if (args.entryPoint.version === "0.6") { const responseV06 = response; return { paymasterAndData: responseV06.paymasterAndData, preVerificationGas: BigInt(responseV06.preVerificationGas), verificationGasLimit: BigInt(responseV06.verificationGasLimit), callGasLimit: BigInt(responseV06.callGasLimit) }; } const responseV07 = response; return { callGasLimit: BigInt(responseV07.callGasLimit), verificationGasLimit: BigInt(responseV07.verificationGasLimit), preVerificationGas: BigInt(responseV07.preVerificationGas), paymaster: responseV07.paymaster, paymasterVerificationGasLimit: BigInt(responseV07.paymasterVerificationGasLimit), paymasterPostOpGasLimit: BigInt(responseV07.paymasterPostOpGasLimit), paymasterData: responseV07.paymasterData }; }; //# sourceMappingURL=sponsorUserOperation.js.map