Types
BatchUserOperationCallData
An array of UserOperationCallData
, representing a sequence of UserOperations
to be executed in batch by calling the executeBatch
function on the SmartContractAccount
contract. Check out our guide on How to submit batch transactions to learn more about batching multiple transactions into a single UserOperation
.
BatchUserOperationCallData
BigNumberish
A type that can be a hexadecimal string prefixed with Hex
, a bigint
, or a number
. It is used to represent values that can be converted to or operate as big integers.
BigNumberish
BigNumberishRange
An object type that may contain optional min
and max
fields, each of which accepts a BigNumberish
value. This type is used to specify a numerical range, including both the minimum and maximum bounds.
BigNumberishRange
BundlerAction
Bundler Actions are viem
Actions
that map one-to-one with “public” Bundler
RPC methods (eth_sendUserOperation
, eth_getUserOperationByHash
, etc.) under the EIP-4337 and EIP-6900 standards. They are used with a BundlerClient
. BundlerActions
do not require any special permissions, nor do they provide “signing” capabilities to the user. Examples of BundlerActions
include retrieving the details of a specific user operation, estimating user operation gas, etc.
BundlerAction
BundlerClient
BundlerClient
is a custom viem
Client
we have built our own, where we extended viem’s PublicClient
with BundlerActions
, which are Actions
that provide custom functionalities of EIP-4337 and EIP-6900 standards. BundlerClient
is an intermediary or connector that enables client applications to interact with the Bundler
that you are using. BundlerClient
, because it extends PublicClient
, supports Public Actions
for client applications to connect, query, and interact with the blockchain (i.e., sending transactions, smart contract executions, data retrieval, etc.).
BundlerClient
ClientMiddleware
Middleware represents different operations involved in the SmartAccountClient
pipeline for constructing a user operation given the user inputs by populating the UO with other data, including gas fees, paymaster data, etc.
ClientMiddleware
ClientMiddlewareConfig
Configuration object to configure ClientMiddleware
of the SmartAccountClient
during the client instantiation. You can configure using this object to configure the middleware of your interest selectively.
ClientMiddlewareFn
ClientMiddlewareFn
Each middleware is a function that takes in a user operation object, UserOperationStruct
, performs its job to retrieve or compute the data, and populate different fields of the user operation to pass onto the next middleware in the pipeline before being signed and sent to the network. ClientMiddlewareFn
is the function type that represents each middleware. In optional UserOperationOverrides
, and UserOperationFeeOptions
, and returns a promise that resolves to a modified UserOperationStruct
. This function is what you specify as your overridden middleware value for applying custom logic during the UserOperationStruct
object to be sent to the bundler for on-chain execution.
ClientMiddlewareFn
EntryPointDef
An object type that defines the interface for EntryPoint
functions for packing the user operation to the optimized data structure to enhance performance and reduce gas costs of transactions, and generating the hash of the user operation for the format compatible to the specified Chain
and EntryPointVersion
.
EntryPointDef
Multiplier
An object type with a required multipler
field, which is a number
value with max precision of 4 decimal places.
Multiplier
SmartAccountAuthenticator
An extension of the SmartAccountSigner
interface, this interface contains authentication-related functions in addition to the signing methods of the SmartAccountSigner
. It provides methods to authenticate the signer (authenticate
) as the “authorized” signer, often as the owner, of the SmartContractAccount
. It also has methods to retrieve authentication details (getAuthDetails
) about the signer instance that the user is using to authenticate to one’s account.
SmartAccountAuthenticator
SmartAccountClient
SmartAccountClient
is a custom viem
Client
, like the BundlerClient
, which is an intermediary or connector that enables your client application to interact with the SmartContractAccount
. SmartAccountClient
is analogous to the WalletClient
. The difference is that while WalletClient
has WalletActions
that lets your client application interact with an Externally-owned account (EOA) with a wallet, SmartAccountClient
provides SmartAccountClientActions
for client applications to interact with SmartContractAccounts
.
SmartAccountClient
SmartAccountClientAction
SmartAccountClientActions
are viem
Actions
that map one-to-one with smart contract account-related or “signable” actions, such as constructing user operation requests to be sent to the Bundler
, signing messages or user operation requests, sending user operations to the Bundler
, upgrading accounts to different implementation address, etc. They are used with a SmartAccountClient
. SmartAccountClientActions
require special permissions and provide signing capabilities for SmartContractAccounts
.
SmartAccountClientAction
SmartAccountSigner
An interface representing a signer capable of signing messages and typed data. It provides methods to retrieve the signer’s address (getAddress
), sign a message (signMessage
), and sign typed data (signTypedData
). SmartAccountSigner
refers to the Signer
instance responsible for the signing activities using its private key for smart account activities. Often, the Signer
is referred to as the Owner
of the account as it has the authority to use the smart account on-chain with its signatures.
SmartAccountSigner
SmartContractAccount
As smart contract accounts are essentially the contract codes that operate on the blockchain, SmartContractAccount
defines the interface with different functionalities for managing and interacting with the contract account. It includes different functionalities for creating, managing, and using your smart account. In addition to supporting all functionalities achieved with a basic EOA alone, SmartContractAccount
can have custom capabilities such as automating processes or executing actions based on predefined conditions. Smart contract wallets allow users to customize how they manage their digital assets, offering a more tailored approach to handling funds securely. SmartContractAccount
type extends viem
’s Account
, and instantiation of an account is done using the toSmartContractAccount
action.
SmartContractAccount
StateOverride
A type defining state overrides for eth_call
method. An optional address-to-state mapping, where each entry specifies some state to be ephemerally overridden prior to executing the call.
State overrides allow you to customize the network state for the purpose of the simulation, so this feature is useful when you need to test or simulate scenarios under conditions that aren’t currently present on the live network.
ToSmartContractAccountParams
This type defines the parameters to the SmartContractAccount
instantiation action, toSmartContractAccount
. You can configure this parameter to specify the Transport
, Chain
, EntryPointDef
, and other base functionalities of the smart account that you are creating.
ToSmartContractAccountParams
User
User
is a type that defines the model for the details of a user’s Embedded Account via an Alchemy Signer. It includes the user’s email
, orgId
, userId
, userId
, address
(the EOA signer address corresponding to the user credentials), and credentialId
. You can use the useUser
react hook to look up a user.
User
UserOperationCallData
UserOperationCallData
is a type that represents the user’s “intent” or the desired outcome representing a specific objective a user aims to accomplish. It includes target
(the destination address), data
(the Transaction calldata
), and value
(the amount value of ETH, or the native token to send). It acts as the input to the sendUserOperation
method on SmartAccountClient
.
UserOperationCallData
UserOperationEstimateGasResponse
An interface that defines the structure for the response received from the RPC method eth_estimateUserOperationGas
. This response provides detailed information about the estimated gas usage for a UserOperation
.
UserOperationEstimateGasResponse
UserOperationOverrides
Partial structure for overriding default values in a UserOperationStruct
, such as gas limits and fees. Available fields include maxFeePerGas
, maxPriorityFeePerGas
, callGasLimit
, preVerificationGas
, verificationGasLimit
, paymasterAndData
, or nonceKey
. You can also specify a stateOverride
to be passed into eth_estimateUserOperationGas
during gas estimation. These override values are available from each ClientMiddleware
of the SmartAccountClient
. Check out UserOperationOverrides
page to learn more.
UserOperationOverrides
UserOperationReceipt
An interface that defines the structure for the response received from the RPC method eth_getUserOperationReceipt
. It includes details like sender, nonce, gas cost, and success status of the UserOperation
.
UserOperationReceipt
UserOperationRequest
Interface for the request format required for a JSON-RPC request to eth_sendUserOperation
. It includes sender, nonce, gas limits, fees, and more fields.
UserOperationRequest
UserOperationResponse
An interface that defines the structure for the response received from the RPC method eth_getUserOperationByHash
, detailing the result of executing a UserOperation
. It includes the block number, block hash, transaction hash and more information associated with the UO.
UserOperationResponse
UserOperationStruct
Interface for structuring a UserOperation
, with fields similar to UserOperationRequest
but used for building requests.