default7702UserOpSigner

Provides 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().

Import

1import { default7702UserOpSigner } from "@aa-sdk/core";

Usage

import {
  
const default7702GasEstimator: (gasEstimator?: ClientMiddlewareFn) => ClientMiddlewareFn

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().

default7702GasEstimator
,
const default7702UserOpSigner: (userOpSigner?: ClientMiddlewareFn) => ClientMiddlewareFn

Provides 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: CreateModularAccountV2ClientParams
config
:
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: CreateModularAccountV2ClientParams
config
,
mode: "7702"
mode
: "7702",
}); return
createSmartAccountClient<Transport, Chain, ModularAccountV2<SmartAccountSigner<any>>, UserOperationContext | undefined>(config: { ...; }): { ...; }
createSmartAccountClient
({
account?: ModularAccountV2<SmartAccountSigner<any>> | undefined
account
:
const sma7702Account: ModularAccountV2<SmartAccountSigner<any>>
sma7702Account
,
gasEstimator?: ClientMiddlewareFn<UserOperationContext | undefined> | undefined
gasEstimator
:
function default7702GasEstimator(gasEstimator?: ClientMiddlewareFn): ClientMiddlewareFn

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().

default7702GasEstimator
(
config: CreateModularAccountV2ClientParams
config
.
gasEstimator?: ClientMiddlewareFn<UserOperationContext | undefined> | undefined
gasEstimator
),
signUserOperation?: ClientMiddlewareFn<UserOperationContext | undefined> | undefined
signUserOperation
:
function default7702UserOpSigner(userOpSigner?: ClientMiddlewareFn): ClientMiddlewareFn

Provides 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: CreateModularAccountV2ClientParams
config
.
signUserOperation?: ClientMiddlewareFn<UserOperationContext | undefined> | undefined
signUserOperation
),
...
config: CreateModularAccountV2ClientParams
config
,
}); }

Parameters

userOpSigner

ClientMiddlewareFn Optional user operation signer function

Returns

ClientMiddlewareFn A middleware function that signs EIP-7702 authorization tuples if necessary, and also uses the provided or default user operation signer to generate the user op signature.