@alchemy/aa-core
Version:
viem based SDK that enables interactions with ERC-4337 Smart Accounts. ABIs are based off the definitions generated in @account-abstraction/contracts
42 lines (41 loc) • 1.94 kB
TypeScript
import type { Address, Chain, Client, Hash, PublicRpcSchema, RpcStateOverride, StateOverride, Transport } from "viem";
import type { EntryPointVersion } from "../../entrypoint/types.js";
import type { UserOperationEstimateGasResponse, UserOperationReceipt, UserOperationRequest, UserOperationResponse } from "../../types.js";
export type BundlerRpcSchema = [
{
Method: "eth_sendUserOperation";
Parameters: [UserOperationRequest, Address];
ReturnType: Hash;
},
{
Method: "eth_estimateUserOperationGas";
Parameters: [UserOperationRequest, Address, RpcStateOverride?];
ReturnType: UserOperationEstimateGasResponse;
},
{
Method: "eth_getUserOperationReceipt";
Parameters: [Hash];
ReturnType: UserOperationReceipt | null;
},
{
Method: "eth_getUserOperationByHash";
Parameters: [Hash];
ReturnType: UserOperationResponse | null;
},
{
Method: "eth_supportedEntryPoints";
Parameters: [];
ReturnType: Address[];
}
];
export type BundlerActions = {
estimateUserOperationGas<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationRequest<TEntryPointVersion>, entryPoint: Address, stateOverride?: StateOverride): Promise<UserOperationEstimateGasResponse<TEntryPointVersion>>;
sendRawUserOperation<TEntryPointVersion extends EntryPointVersion = EntryPointVersion>(request: UserOperationRequest<TEntryPointVersion>, entryPoint: Address): Promise<Hash>;
getUserOperationByHash(hash: Hash): Promise<UserOperationResponse | null>;
getUserOperationReceipt(hash: Hash): Promise<UserOperationReceipt | null>;
getSupportedEntryPoints(): Promise<Address[]>;
};
export declare const bundlerActions: <TClient extends Client<Transport, Chain | undefined, any, [
...PublicRpcSchema,
...BundlerRpcSchema
]>>(client: TClient) => BundlerActions;