default7702GasEstimator
A middleware function to estimate the gas usage of a user operation when using an EIP-7702 delegated account. Has an optional custom gas estimator.
This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in getImplementationAddress()
.
Import
Usage
import {
const default7702GasEstimator: (gasEstimator?: ClientMiddlewareFn) => ClientMiddlewareFnA middleware function to estimate the gas usage of a user operation when using an EIP-7702 delegated account. Has an optional custom gas estimator. This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in getImplementationAddress()
.
default7702GasEstimator,
const default7702UserOpSigner: (userOpSigner?: ClientMiddlewareFn) => ClientMiddlewareFnProvides a default middleware function for signing user operations with a client account when using EIP-7702 delegated accounts. If the signer doesn't support signAuthorization
, then this just runs the provided signUserOperation
middleware. This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in getImplementationAddress()
.
default7702UserOpSigner,
function createSmartAccountClient<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined, TContext extends UserOperationContext | undefined = UserOperationContext | undefined>(config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>): SmartAccountClient<TTransport, TChain, TAccount>createSmartAccountClient,
type type SmartAccountClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, actions extends Record<string, unknown> = Record<...>, rpcSchema extends RpcSchema = [...], context extends UserOperationContext | undefined = UserOperationContext | undefined> = { [K in keyof Client<transport, chain, account, rpcSchema, actions & {
buildUserOperation: (args: BuildUserOperationParameters<account, context>) => Promise<...>;
... 11 more ...;
signTypedData: <const TTypedData extends {
...;
} | {
...;
}, TPrimaryType extends string = string>(args: SignTypedDataParameters<...>) => Promise<Hex>;
} & (IsUndefined<...> extends false ? {
...;
} : {
...;
}) & BundlerActions & PublicActions>]: Client<...>[K]; }SmartAccountClient,
} from "@aa-sdk/core";
import {
function createModularAccountV2<TTransport extends Transport = Transport, TSigner extends SmartAccountSigner = SmartAccountSigner<any>>(config: CreateModularAccountV2Params<TTransport, TSigner>): Promise<ModularAccountV2<TSigner>>createModularAccountV2,
type type CreateModularAccountV2ClientParams<TTransport extends Transport = Transport, TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner<any>> = CreateModularAccountV2Params<TTransport, TSigner> & Omit<{
type?: string | undefined | undefined;
cacheTime?: number | undefined | undefined;
chain?: Chain | ... 1 more ... | undefined;
... 13 more ...;
signUserOperation?: ClientMiddlewareFn<...> | undefined;
}, "chain" | ... 1 more ... | "account">CreateModularAccountV2ClientParams,
} from "@account-kit/smart-contracts";
async function function createSMA7702AccountClient(config: CreateModularAccountV2ClientParams): Promise<SmartAccountClient>createSMA7702AccountClient(
config: CreateModularAccountV2ClientParamsconfig: type CreateModularAccountV2ClientParams<TTransport extends Transport = Transport, TChain extends Chain = Chain, TSigner extends SmartAccountSigner = SmartAccountSigner<any>> = CreateModularAccountV2Params<TTransport, TSigner> & Omit<{
type?: string | undefined | undefined;
cacheTime?: number | undefined | undefined;
chain?: Chain | ... 1 more ... | undefined;
... 13 more ...;
signUserOperation?: ClientMiddlewareFn<...> | undefined;
}, "chain" | ... 1 more ... | "account">CreateModularAccountV2ClientParams,
): interface Promise<T>Represents the completion of an asynchronous operation
Promise<type SmartAccountClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends SmartContractAccount | undefined = SmartContractAccount | undefined, actions extends Record<string, unknown> = Record<...>, rpcSchema extends RpcSchema = [...], context extends UserOperationContext | undefined = UserOperationContext | undefined> = { [K in keyof Client<transport, chain, account, rpcSchema, actions & {
buildUserOperation: (args: BuildUserOperationParameters<account, context>) => Promise<...>;
... 11 more ...;
signTypedData: <const TTypedData extends {
...;
} | {
...;
}, TPrimaryType extends string = string>(args: SignTypedDataParameters<...>) => Promise<Hex>;
} & (IsUndefined<...> extends false ? {
...;
} : {
...;
}) & BundlerActions & PublicActions>]: Client<...>[K]; }SmartAccountClient> {
const const sma7702Account: ModularAccountV2<SmartAccountSigner<any>>sma7702Account = await createModularAccountV2<Transport, SmartAccountSigner<any>>(config: CreateModularAccountV2Params<Transport, SmartAccountSigner<any>>): Promise<...>createModularAccountV2({
...config: CreateModularAccountV2ClientParamsconfig,
mode: "7702"mode: "7702",
});
return createSmartAccountClient<Transport, Chain, ModularAccountV2<SmartAccountSigner<any>>, UserOperationContext | undefined>(config: {
...;
}): {
...;
}createSmartAccountClient({
account?: ModularAccountV2<SmartAccountSigner<any>> | undefinedaccount: const sma7702Account: ModularAccountV2<SmartAccountSigner<any>>sma7702Account,
gasEstimator?: ClientMiddlewareFn<UserOperationContext | undefined> | undefinedgasEstimator: function default7702GasEstimator(gasEstimator?: ClientMiddlewareFn): ClientMiddlewareFnA middleware function to estimate the gas usage of a user operation when using an EIP-7702 delegated account. Has an optional custom gas estimator. This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in getImplementationAddress()
.
default7702GasEstimator(config: CreateModularAccountV2ClientParamsconfig.gasEstimator?: ClientMiddlewareFn<UserOperationContext | undefined> | undefinedgasEstimator),
signUserOperation?: ClientMiddlewareFn<UserOperationContext | undefined> | undefinedsignUserOperation: function default7702UserOpSigner(userOpSigner?: ClientMiddlewareFn): ClientMiddlewareFnProvides a default middleware function for signing user operations with a client account when using EIP-7702 delegated accounts. If the signer doesn't support signAuthorization
, then this just runs the provided signUserOperation
middleware. This function is only compatible with accounts using EntryPoint v0.7.0, and the account must have an implementation address defined in getImplementationAddress()
.
default7702UserOpSigner(config: CreateModularAccountV2ClientParamsconfig.signUserOperation?: ClientMiddlewareFn<UserOperationContext | undefined> | undefinedsignUserOperation),
...config: CreateModularAccountV2ClientParamsconfig,
});
}
Parameters
gasEstimator
ClientMiddlewareFn
Optional custom gas estimator function
Returns
ClientMiddlewareFn
A function that takes user operation struct and parameters, estimates gas usage, and returns the user operation with gas limits.