UNPKG

@bananahq/banana-sdk-tg-bot-modified

Version:

Smart contract wallet sdk package by Banana Wallet

63 lines 2.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getRequestDataForPaymaster = void 0; const ethers_1 = require("ethers"); const getRequestDataForPaymaster = async (userOp, paymasterOption) => { const preVerificationGasResp = await userOp.preVerificationGas; let preVerificationGas; if (typeof preVerificationGasResp === "object") { preVerificationGas = preVerificationGasResp._hex; } else preVerificationGas = '0x' + preVerificationGasResp.toString(16); console.log('resp ', preVerificationGas); switch (paymasterOption.paymasterProvider) { case "candide": { userOp = { sender: await userOp?.sender, nonce: (await userOp?.nonce)._hex, initCode: userOp?.initCode, callData: userOp?.callData, callGasLimit: (await userOp?.callGasLimit)._hex, verificationGasLimit: ethers_1.ethers.BigNumber.from(userOp?.verificationGasLimit)._hex, preVerificationGas: preVerificationGas, maxFeePerGas: (await userOp?.maxFeePerGas)._hex, maxPriorityFeePerGas: (await userOp?.maxPriorityFeePerGas)._hex, paymasterAndData: "0x", signature: "0x", }; const requestData = [ userOp, "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", {}, ]; console.log('this is request data for candide paymaster ', requestData); return requestData; } case "pimlico": { userOp = { sender: await userOp?.sender, nonce: (await userOp?.nonce)._hex, initCode: userOp?.initCode, callData: userOp?.callData, callGasLimit: (await userOp?.callGasLimit)._hex, verificationGasLimit: ethers_1.ethers.BigNumber.from(userOp?.verificationGasLimit)._hex, preVerificationGas: preVerificationGas, maxFeePerGas: (await userOp?.maxFeePerGas)._hex, maxPriorityFeePerGas: (await userOp?.maxPriorityFeePerGas)._hex, paymasterAndData: "0x", signature: "0x", }; const requestData = [ userOp, { entryPoint: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", }, ]; console.log('this is request data for pimlico paymaster ', requestData); return requestData; } } }; exports.getRequestDataForPaymaster = getRequestDataForPaymaster; //# sourceMappingURL=getRequestData.js.map