@owlprotocol/contracts-account-abstraction
Version:
ERC4337 Account Abstraction support for deploying relevant smart contracts and interacting with UserOps.
36 lines (35 loc) • 1.61 kB
TypeScript
import { Address, Chain, Client, Transport } from "viem";
import { EstimateUserOperationGasReturnType, UserOperation } from "viem/account-abstraction";
export type EstimateUserOperationGasParameters07 = Pick<UserOperation<"0.7">, "sender" | "nonce" | "callData" | "factory" | "factoryData" | "paymaster" | "paymasterData" | "maxFeePerGas">;
export declare const entryPointDepositSlot = 0;
export declare const getPaymasterSlot: (paymaster: Address) => `0x${string}`;
/**
* Returns an estimate of gas values necessary to execute the User Operation.
*
* - Docs: https://viem.sh/actions/bundler/estimateUserOperationGas
*
* @param client - Client to use
* @param parameters - {@link EstimateUserOperationGasParameters}
* @returns The gas estimate (in wei). {@link EstimateUserOperationGasReturnType}
*
* @example
* import { createBundlerClient, http, parseEther } from 'viem'
* import { toSmartAccount } from 'viem/accounts'
* import { mainnet } from 'viem/chains'
* import { estimateUserOperationGas } from 'viem/actions'
*
* const account = await toSmartAccount({ ... })
*
* const bundlerClient = createBundlerClient({
* chain: mainnet,
* transport: http(),
* })
*
* const values = await estimateUserOperationGas(bundlerClient, {
* account,
* calls: [{ to: '0x...', value: parseEther('1') }],
* })
*/
export declare function estimateUserOperationGas(client: Client<Transport, Chain | undefined> & {
entryPointSimulationsAddress: Address;
}, parameters: EstimateUserOperationGasParameters07): Promise<EstimateUserOperationGasReturnType<undefined, undefined, undefined, "0.7">>;