@owlprotocol/contracts-account-abstraction
Version:
ERC4337 Account Abstraction support for deploying relevant smart contracts and interacting with UserOps.
95 lines (94 loc) • 4.35 kB
TypeScript
import { Address, Hash, Account, Chain, Client, Transport, TransactionRequest } from "viem";
import { entryPoint07Address } from "viem/account-abstraction";
/**
* Get public ERC4337 contracts.
* @returns
*/
export declare function getERC4337Contracts(): {
deterministicDeployer: `0x${string}`;
entrypoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
simpleAccountFactory: `0x${string}`;
entrypointSimulations: `0x${string}`;
pimlicoEntrypointSimulations: `0x${string}`;
};
export declare const erc4337Contracts: {
deterministicDeployer: `0x${string}`;
entrypoint: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
simpleAccountFactory: `0x${string}`;
entrypointSimulations: `0x${string}`;
pimlicoEntrypointSimulations: `0x${string}`;
};
/**
* Prepare erc4337 deployment transactions. Useful to do gas estimations before sending transaction
* @param client with account
*/
export declare function prepareERC4337Contracts(client: Client<Transport, Chain, Account>): Promise<{
requests: TransactionRequest[];
entrypoint: {
address: typeof entryPoint07Address;
request: TransactionRequest | undefined;
existed: boolean;
};
simpleAccountFactory: import("@owlprotocol/viem-utils").GetOrPrepareDeterministicContractReturnType;
entrypointSimulations: import("@owlprotocol/viem-utils").GetOrPrepareDeterministicContractReturnType;
pimlicoEntrypointSimulations: import("@owlprotocol/viem-utils").GetOrPrepareDeterministicContractReturnType;
}>;
/**
* Deploy public ERC4337 contracts.
* These have no permissions system whatsoever and are shared contract infrastructure.
* These are often pre-deployed on certain frameworks (eg. OPStack) and can be used by anyone.
* This guarantees compatibility on any EVM chain.
* - DeterministicDeployer (0x4e59b44847b379578588920cA78FbF26c0B4956C)
* - EntryPointV07 (0x0000000071727De22E5E9d8BAf0edAc6f37da032)
* - SimpleAccountFactory (0x91E60e0613810449d098b0b5Ec8b51A0FE8c8985)
* @param client Client with account and nonceManager
* @returns contract info
*/
export declare function setupERC4337Contracts(client: Client<Transport, Chain, Account>): Promise<{
transactions: `0x${string}`[];
receipts: import("viem").TransactionReceipt[];
requests: TransactionRequest[];
entrypoint: {
address: "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
request: TransactionRequest | undefined;
existed: boolean;
};
simpleAccountFactory: import("@owlprotocol/viem-utils").GetOrPrepareDeterministicContractReturnType;
entrypointSimulations: import("@owlprotocol/viem-utils").GetOrPrepareDeterministicContractReturnType;
pimlicoEntrypointSimulations: import("@owlprotocol/viem-utils").GetOrPrepareDeterministicContractReturnType;
}>;
/**
* Get VerifyingPaymaster contract.
* @param param0
* @return TODO: <address> (production) | 0x2e23ef1375aA642504bED97676A566F5A3E4ae5A (staging)
*/
export declare function getVerifyingPaymaster(params: {
verifyingSignerAddress: Address;
}): Address;
/**
* Deploy ERC4337 VerifyingPaymaster.
* This contracts stores a balance of ETH to sponsor UserOps (aka "Paymaster").
* It approves UserOp sponsorship if these are signed by the `verifyingSignerAddress` (the "Verifying" part).
* - VerifyingPaymaster () //TODO: TBD after research if we should deploy AA stack.
* @param client Client with chain & account for deploying contracts, verifyingSignerAddress address for paymaster
* @returns contract info
*
*/
export declare function setupVerifyingPaymaster(client: Client<Transport, Chain, Account>, parameters: {
verifyingSignerAddress: Address;
}): Promise<import("@owlprotocol/viem-utils").GetOrDeployDeterministicContractReturnType>;
/**
* Topup Paymaster contract with funds if balance is below `minBalance` (0 = Always topup)
*
* Funds are deposited to reach `targetBalance` (defaults to `minBalance`)
* @param parameters publicClient, walletClient **with funds**, minBalance, targetBalance
* @returns current paymaster balance & transaction hash for topup (if required)
*/
export declare function topupPaymaster(client: Client<Transport, Chain, Account>, parameters: {
paymaster: Address;
minBalance: bigint;
targetBalance?: bigint;
}): Promise<{
balance: bigint;
hash?: Hash;
}>;