UNPKG

@abstraxn/bundler

Version:

Abstraxn Bundler package to interact with any bundler node as per ERC4337 standard

104 lines (103 loc) 2.61 kB
import { ethers, BigNumber } from "ethers"; import { ChainId, UserOperation } from "@abstraxn/core-types"; export type Bundlerconfig = { bundlerUrl: string; entryPointAddress?: string; chainId: ChainId; userOpReceiptIntervals?: { [key in ChainId]?: number; }; userOpWaitForTxHashIntervals?: { [key in ChainId]?: number; }; userOpReceiptMaxDurationIntervals?: { [key in ChainId]?: number; }; userOpWaitForTxHashMaxDurationIntervals?: { [key in ChainId]?: number; }; }; export type UserOpReceipt = { userOpHash: string; entryPoint: string; sender: string; nonce: number; paymaster: string; actualGasCost: BigNumber; actualGasUsed: BigNumber; success: boolean; reason: string; logs: Array<ethers.providers.Log>; receipt: ethers.providers.TransactionReceipt; }; export type UserOpStatus = { state: string; transactionHash?: string; userOperationReceipt?: UserOpReceipt; }; export type SimulationType = "validation" | "validation_and_execution"; export type GetUserOperationReceiptResponse = { jsonrpc: string; id: number; result: UserOpReceipt; error?: JsonRpcError; }; export type GetUserOperationStatusResponse = { jsonrpc: string; id: number; result: UserOpStatus; error?: JsonRpcError; }; export type SendUserOpResponse = { jsonrpc: string; id: number; message: string; result: string; error?: JsonRpcError; }; export type UserOpResponse = { message: string; userOpHash: string; wait(_confirmations?: number): Promise<UserOpReceipt>; waitForTxHash(): Promise<UserOpStatus>; }; export type EstimateUserOpGasResponse = { jsonrpc: string; id: number; result: UserOpGasResponse; error?: JsonRpcError; }; export type UserOpGasResponse = { preVerificationGas: string; verificationGasLimit: string; callGasLimit: string; maxPriorityFeePerGas: string; maxFeePerGas: string; }; export type GetUserOpByHashResponse = { jsonrpc: string; id: number; result: UserOpByHashResponse; error?: JsonRpcError; }; export type UserOpByHashResponse = UserOperation & { transactionHash: string; blockNumber: number; blockHash: string; entryPoint: string; }; export type JsonRpcError = { code: string; message: string; data: any; }; export type GetGasFeeValuesResponse = { jsonrpc: string; id: number; result: GasFeeValues; error?: JsonRpcError; }; export type GasFeeValues = { maxPriorityFeePerGas: string; maxFeePerGas: string; };