# Types

> Glossary of types in aa-sdk

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

## `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 the [batch transactions guide](/docs/wallets/transactions/send-batch-transactions) to learn more about batching multiple transactions into a single `UserOperation`.

<Accordion title="BatchUserOperationCallData">

```ts
export type BatchUserOperationCallData = Exclude<UserOperationCallData, Hex>[];
```

</Accordion>

## `BigNumberish`

A type that can be a hexadecimal string prefixed with [`Hex`](https://viem.sh/docs/glossary/types#hex), a `bigint`, or a `number`. It is used to represent values that can be converted to or operate as big integers.

<Accordion title="BigNumberish">

```ts
export const BigNumberishSchema = z.union([HexSchema, z.number(), z.bigint()]);
```

</Accordion>

## `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.

<Accordion title="BigNumberishRange">

```ts
export const BigNumberishRangeSchema = z
  .object({
    min: BigNumberishSchema.optional(),
    max: BigNumberishSchema.optional(),
  })
  .strict();
```

</Accordion>

## `BundlerAction`

Bundler Actions are `viem` [`Actions`](https://viem.sh/docs/actions/public/introduction) that map one-to-one with "public" [`Bundler`](/docs/wallets/resources/terms#bundler) RPC methods (`eth_sendUserOperation`, `eth_getUserOperationByHash`, etc.) under the [EIP-4337](https://eips.ethereum.org/EIPS/eip-4337) and [EIP-6900](https://eips.ethereum.org/EIPS/eip-6900) standards. They are used with a [`BundlerClient`](#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.

<Accordion title="BundlerAction">

```ts
export type BundlerActions = {
  /**
   * calls `eth_estimateUserOperationGas` and  returns the result
   *
   * @param request - the UserOperationRequest to estimate gas for
   * @param entryPoint - the entry point address the op will be sent to
   * @param stateOverride - the state override to use for the estimation
   * @returns the gas estimates for the given response
   */
  estimateUserOperationGas<
    TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
  >(
    request: UserOperationRequest<TEntryPointVersion>,
    entryPoint: Address,
    stateOverride?: StateOverride,
  ): Promise<UserOperationEstimateGasResponse<TEntryPointVersion>>;

  /**
   * calls `eth_sendUserOperation` and returns the hash of the sent UserOperation
   *
   * @param request - the UserOperationRequest to send
   * @param entryPoint - the entry point address the op will be sent to
   * @returns the hash of the sent UserOperation
   */
  sendRawUserOperation<
    TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
  >(
    request: UserOperationRequest<TEntryPointVersion>,
    entryPoint: Address,
  ): Promise<Hash>;

  /**
   * calls `eth_getUserOperationByHash` and returns the UserOperationResponse
   *
   * @param hash - the hash of the UserOperation to fetch
   * @returns - the user operation if found or null
   */
  getUserOperationByHash(hash: Hash): Promise<UserOperationResponse | null>;

  /**
   * calls `eth_getUserOperationReceipt` and returns the UserOperationReceipt
   *
   * @param hash - the hash of the UserOperation to get the receipt for
   * @param tag - if client want to get receipt for different block tag.
   * @returns - a user operation receipt or null if not found
   */
  getUserOperationReceipt(
    hash: Hash,
    tag?: "pending" | "latest",
  ): Promise<UserOperationReceipt | null>;

  /**
   * calls `eth_supportedEntryPoints` and returns the entry points the RPC supports
   *
   * @returns - an array of the entrypoint addresses supported
   */
  getSupportedEntryPoints(): Promise<Address[]>;
};
```

</Accordion>

## `BundlerClient`

`BundlerClient` is a custom `viem` [`Client`](https://viem.sh/docs/clients/custom) that extends viem's [`PublicClient`](https://viem.sh/docs/clients/public) with bundler-specific actions for [EIP-4337](https://eips.ethereum.org/EIPS/eip-4337) operations and [EIP-6900](https://eips.ethereum.org/EIPS/eip-6900) standards. The actions are defined in [`@aa-sdk/core`](/docs/wallets/reference/aa-sdk/core). It's account agnostic and only exposes methods for interacting directly with Bundler RPC and ETH RPC methods.
`BundlerClient` also supports [`Public Actions`](https://viem.sh/docs/actions/public/introduction) for client applications to connect, query, and interact with the blockchain (i.e., sending transactions, smart contract executions, data retrieval, etc.). Additionally, it is EIP-1193 compliant, so it can be swapped out in place of other web3 providers (eg. `window.ethereum`).
In the vast majority of cases, you will not use this client directly. Use the [`SmartAccountClient`](/docs/wallets/concepts/smart-account-client) instead, which wraps the Bundler Client and provides the same actions plus account-specific functionality.

<Accordion title="BundlerClient">

````ts
export type BundlerClient<T extends Transport = Transport> = Client<
  T,
  Chain,
  undefined,
  [...PublicRpcSchema, ...BundlerRpcSchema],
  PublicActions<T, Chain> & BundlerActions
>;

/**
 * Creates a bundler client from an existing public client with the provided transport and chain.
 *
 * @example
 * ```ts
 * import { createPublicClient } from "viem";
 * import { createBundlerClientFromExisting } from "@aa-sdk/core";
 *
 * const publicClient = createPublicClient(...);
 * const bundlerClient = createBundlerClientFromExisting(publicClient);
 * ```
 *
 * @param {PublicClient<T, Chain>} client The existing public client to be extended with bundler actions
 * @returns {BundlerClient<T>} A bundler client that extends the functionality of the provided public client
 */
export const createBundlerClientFromExisting: <
  T extends Transport | FallbackTransport = Transport,
>(
  client: PublicClient<T, Chain>,
) => BundlerClient<T> = <T extends Transport | FallbackTransport = Transport>(
  client: PublicClient<T, Chain>,
): BundlerClient<T> => {
  return client.extend(bundlerActions);
};
````

</Accordion>

## `ClientMiddleware`

Middleware represents different operations involved in the [`SmartAccountClient`](/docs/wallets/concepts/smart-account-client) pipeline for constructing a user operation given the user inputs by populating the UO with other data, including gas fees, paymaster data, etc.

<Accordion title="ClientMiddleware">

```ts
export type ClientMiddleware<
  TContext extends UserOperationContext | undefined =
    | UserOperationContext
    | undefined,
> = {
  dummyPaymasterAndData: ClientMiddlewareFn<TContext>;
  feeEstimator: ClientMiddlewareFn<TContext>;
  gasEstimator: ClientMiddlewareFn<TContext>;
  customMiddleware: ClientMiddlewareFn<TContext>;
  paymasterAndData: ClientMiddlewareFn<TContext>;
  userOperationSimulator: ClientMiddlewareFn<TContext>;
  signUserOperation: ClientMiddlewareFn<TContext>;
};
```

</Accordion>

## `ClientMiddlewareConfig`

Configuration object to configure `ClientMiddleware` of the [`SmartAccountClient`](/docs/wallets/concepts/smart-account-client) during the client instantiation. You can configure using this object to configure the middleware of your interest selectively.

<Accordion title="ClientMiddlewareFn">

```ts
export type ClientMiddlewareConfig<
  TContext extends UserOperationContext | undefined =
    | UserOperationContext
    | undefined,
> = Partial<ClientMiddleware<TContext>>;
```

</Accordion>

## `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`](#useroperationoverrides), and [`UserOperationFeeOptions`](https://github.com/alchemyplatform/aa-sdk/blob/v4.x.x/aa-sdk/core/src/types.ts#L55), 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 onchain execution.

<Accordion title="ClientMiddlewareFn">

```ts
export type ClientMiddlewareFn<
  TContext extends UserOperationContext | undefined =
    | UserOperationContext
    | undefined,
> = <
  TAccount extends SmartContractAccount,
  C extends MiddlewareClient,
  TEntryPointVersion extends
    GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,
>(
  struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,
  args: ClientMiddlewareArgs<TAccount, C, TContext, TEntryPointVersion>,
) => Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>;
```

</Accordion>

## `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`.

<Accordion title="EntryPointDef">

```ts
export type EntryPointDef<
  TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
  TChain extends Chain = Chain,
  TAbi extends Abi | readonly unknown[] = Abi,
> = {
  version: TEntryPointVersion;
  address: Address;
  chain: TChain;
  abi: GetContractParameters<Transport, TChain, Account, TAbi>["abi"];
  getUserOperationHash: (
    request: UserOperationRequest<TEntryPointVersion>,
  ) => Hex;
  packUserOperation: (
    userOperation: UserOperationRequest<TEntryPointVersion>,
  ) => Hex;
};
```

</Accordion>

## `Multiplier`

An object type with a required `multipler` field, which is a `number` value with max precision of 4 decimal places.

<Accordion title="Multiplier">

```ts
export const MultiplierSchema = z
  .object({
    /**
     * Multiplier value with max precision of 4 decimal places
     */
    multiplier: z.number().refine(
      (n) => {
        return (n.toString().split(".")[1]?.length ?? 0) <= 4;
      },
      { message: "Max precision is 4 decimal places" },
    ),
  })
  .strict();
```

</Accordion>

## `SmartAccountAuthenticator`

An extension of the [`SmartAccountSigner`](#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.

<Accordion title="SmartAccountAuthenticator">

```ts
/**
 * Extends the @interface SmartAccountSigner interface with authentication.
 *
 * @template AuthParams - the generic type of the authentication parameters
 * @template AuthDetails - the generic type of the authentication details
 * @template Inner - the generic type of the inner client that the signer wraps to provide functionality such as signing, etc.
 */
export interface SmartAccountAuthenticator<AuthParams, AuthDetails, Inner = any>
  extends SmartAccountSigner<Inner> {
  authenticate: (params: AuthParams) => Promise<AuthDetails>;

  getAuthDetails: () => Promise<AuthDetails>;
}
```

</Accordion>

## `SmartAccountClient`

`SmartAccountClient` is a custom `viem` `Client`, like the [`BundlerClient`](#bundlerclient), which is an intermediary or connector that enables your client application to interact with the `SmartContractAccount`. `SmartAccountClient` is analogous to the [`WalletClient`](https://viem.sh/docs/clients/wallet). The difference is that while `WalletClient` has [`WalletActions`](https://viem.sh/docs/actions/wallet/introduction) that lets your client application interact with an [Externally-owned account (EOA)](https://ethereum.org/developers/docs/accounts) with a [wallet](/docs/wallets/resources/terms#wallet), `SmartAccountClient` provides [`SmartAccountClientActions`](#smartaccountclientaction) for client applications to interact with `SmartContractAccounts`.

<Accordion title="SmartAccountClient">

```ts
export type SmartAccountClient<
  transport extends Transport = Transport,
  chain extends Chain | undefined = Chain | undefined,
  account extends SmartContractAccount | undefined =
    | SmartContractAccount
    | undefined,
  actions extends Record<string, unknown> = Record<string, unknown>,
  rpcSchema extends RpcSchema = SmartAccountClientRpcSchema,
  context extends UserOperationContext | undefined =
    | UserOperationContext
    | undefined,
> = Prettify<
  Client<
    transport,
    chain,
    account,
    rpcSchema,
    actions & SmartAccountClientActions<chain, account, context>
  >
>;
```

</Accordion>

## `SmartAccountClientAction`

`SmartAccountClientActions` are `viem` [`Actions`](https://viem.sh/docs/actions/wallet/introduction) that map one-to-one with smart wallet-related or "signable" actions, such as constructing user operation requests to be sent to the [`Bundler`](/docs/wallets/resources/terms/#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`.

<Accordion title="SmartAccountClientAction">

```ts
export type SmartAccountClientActions<
  chain extends Chain | undefined = Chain | undefined,
  account extends SmartContractAccount | undefined =
    | SmartContractAccount
    | undefined,
  context extends UserOperationContext | undefined =
    | UserOperationContext
    | undefined,
> = BaseSmartAccountClientActions<chain, account, context> &
  BundlerActions &
  PublicActions;
```

</Accordion>

## `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`](/docs/wallets/resources/terms#signer) instance responsible for the signing activities using its private key for smart wallet activities. Often, the `Signer` is referred to as the `Owner` of the account as it has the authority to use the smart wallet onchain with its signatures.

<Accordion title="SmartAccountSigner">

```ts
// TODO: This is a temporary type to be removed when viem is updated
export type AuthorizationRequest<uint32 = number> = OneOf<
  | {
      address: Address;
    }
  | {
      contractAddress: Address;
    }
> & {
  /** Chain ID. */
  chainId: uint32;
  /** Nonce of the EOA to delegate to. */
  nonce: uint32;
};

/**
 * A signer that can sign messages and typed data.
 *
 * @template Inner - the generic type of the inner client that the signer wraps to provide functionality such as signing, etc.
 */
export interface SmartAccountSigner<Inner = any> {
  signerType: string;
  inner: Inner;

  getAddress: () => Promise<Address>;

  signMessage: (message: SignableMessage) => Promise<Hex>;

  signTypedData: <
    const TTypedData extends TypedData | Record<string, unknown>,
    TPrimaryType extends keyof TTypedData | "EIP712Domain" = keyof TTypedData,
  >(
    params: TypedDataDefinition<TTypedData, TPrimaryType>,
  ) => Promise<Hex>;

  signAuthorization?: (
    unsignedAuthorization: AuthorizationRequest<number>,
  ) => Promise<SignedAuthorization<number>>;
}
```

</Accordion>

## `SmartContractAccount`

`SmartContractAccount` is the client-side interface for creating, managing, and interacting with smart wallets in a type-safe manner. It extends `viem`'s [`Account`](https://v1.viem.sh/docs/accounts/custom.html) interface with smart wallet functionality.
Within Wallet APIs, implementations for Light Account and Modular Account are exported from `@account-kit/smart-contracts`. These implementations handle the logic for generating the deployment data, encoding
single and batch UO execution, and signing of messages, typed data, and UOs.

Wallets are rarely used on their own, and are typically passed in to [Smart Account Client](/docs/wallets/reference/aa-sdk/core/type-aliases/SmartAccountClient) implementations.
When using either the [React](/docs/wallets/react/quickstart) or [Core](/docs/wallets/core/overview) libraries, the connection of an account and a client is handled for you.

It's also possible to use a custom account when using the [Infra](/docs/wallets/reference/account-kit/infra) library.
Within `@aa-sdk/core`, a method [`toSmartContractAccount`](/docs/wallets/reference/aa-sdk/core/functions/toSmartContractAccount) is provided so you can create an instance of your smart wallet.

<Accordion title="SmartContractAccount">

```ts
export type SmartContractAccount<
  Name extends string = string,
  TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
> = LocalAccount<Name> & {
  source: Name;
  getDummySignature: () => Hex | Promise<Hex>;
  encodeExecute: (tx: AccountOp) => Promise<Hex>;
  encodeBatchExecute: (txs: AccountOp[]) => Promise<Hex>;
  signUserOperationHash: (uoHash: Hex) => Promise<Hex>;
  signMessageWith6492: (params: { message: SignableMessage }) => Promise<Hex>;
  signTypedDataWith6492: <
    const typedData extends TypedData | Record<string, unknown>,
    primaryType extends keyof typedData | "EIP712Domain" = keyof typedData,
  >(
    typedDataDefinition: TypedDataDefinition<typedData, primaryType>,
  ) => Promise<Hex>;
  encodeUpgradeToAndCall: (params: UpgradeToAndCallParams) => Promise<Hex>;
  getAccountNonce(nonceKey?: bigint): Promise<bigint>;
  getInitCode: () => Promise<Hex>;
  isAccountDeployed: () => Promise<boolean>;
  getFactoryAddress: () => Promise<Address>;
  getFactoryData: () => Promise<Hex>;
  getEntryPoint: () => EntryPointDef<TEntryPointVersion>;
  getImplementationAddress: () => Promise<NullAddress | Address>;
} & SigningMethods;
```

</Accordion>

## `StateOverride`

A type defining state overrides for [`eth_call`](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-eth#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`](/docs/wallets/reference/aa-sdk/core/functions/toSmartContractAccount). You can configure this parameter to specify the [`Transport`](https://viem.sh/docs/clients/intro#transports), [`Chain`](https://viem.sh/docs/glossary/types#chain), [`EntryPointDef`](#entrypointdef), and other base functionalities of the smart wallet that you are creating.

<Accordion title="ToSmartContractAccountParams">

```ts
export type ToSmartContractAccountParams<
  Name extends string = string,
  TTransport extends Transport = Transport,
  TChain extends Chain = Chain,
  TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
> = {
  source: Name;
  transport: TTransport;
  chain: TChain;
  entryPoint: EntryPointDef<TEntryPointVersion, TChain>;
  accountAddress?: Address;
  getAccountInitCode: () => Promise<Hex>;
  getDummySignature: () => Hex | Promise<Hex>;
  encodeExecute: (tx: AccountOp) => Promise<Hex>;
  encodeBatchExecute?: (txs: AccountOp[]) => Promise<Hex>;
  getNonce?: (nonceKey?: bigint) => Promise<bigint>;
  // if not provided, will default to just using signMessage over the Hex
  signUserOperationHash?: (uoHash: Hex) => Promise<Hex>;
  encodeUpgradeToAndCall?: (params: UpgradeToAndCallParams) => Promise<Hex>;
  getImplementationAddress?: () => Promise<NullAddress | Address>;
} & Omit<CustomSource, "signTransaction" | "address"> &
  (SigningMethods | Never<SigningMethods>);
```

</Accordion>

## `User`

`User` is a type that defines the model for the details of a user's embedded account. It includes the user's `email`, `orgId`, `userId`, `address` (the EOA address corresponding to the user credentials), and `credentialId`. You can use the [`useUser`](/docs/wallets/reference/account-kit/react/hooks/useUser) React hook to look up a user.

<Accordion title="User">

```ts
export type User = {
  email?: string;
  phone?: string;
  orgId: string;
  userId: string;
  address: Address;
  solanaAddress?: string;
  credentialId?: string;
  idToken?: string;
  accessToken?: string;
  claims?: Record<string, unknown>;
};
```

</Accordion>

## `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`](/docs/wallets/resources/terms#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`](#smartaccountclient).

<Accordion title="UserOperationCallData">

```ts
export type UserOperationCallData =
  | {
      /* the target of the call */
      target: Address;
      /* the data passed to the target */
      data: Hex;
      /* the amount of native token to send to the target (default: 0) */
      value?: bigint;
    }
  | Hex;
```

</Accordion>

## `UserOperationEstimateGasResponse`

An interface that defines the structure for the response received from the RPC method [`eth_estimateUserOperationGas`](https://www.alchemy.com/docs/wallets/api-reference/bundler-api/bundler-api-endpoints/eth-estimate-user-operation-gas). This response provides detailed information about the estimated gas usage for a `UserOperation`.

<Accordion title="UserOperationEstimateGasResponse">

```ts
export interface UserOperationEstimateGasResponse<
  TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
> {
  /* Gas overhead of this UserOperation */
  preVerificationGas: BigNumberish;
  /* Actual gas used by the validation of this UserOperation */
  verificationGasLimit: BigNumberish;
  /* Value used by inner account execution */
  callGasLimit: BigNumberish;
  /*
   * EntryPoint v0.7.0 and v0.8.0 operations only.
   * The amount of gas to allocate for the paymaster validation code.
   * Note: `eth_estimateUserOperationGas` does not return paymasterPostOpGasLimit.
   */
  paymasterVerificationGasLimit: TEntryPointVersion extends "0.7.0" | "0.8.0"
    ? BigNumberish | undefined
    : never;
}
```

</Accordion>

## `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`](#clientmiddleware) of the `SmartAccountClient`. Check out [`UserOperationOverrides`](https://github.com/alchemyplatform/aa-sdk/blob/v4.x.x/aa-sdk/core/src/types.ts#L97) page to learn more.

<Accordion title="UserOperationOverrides">

```ts
export type UserOperationOverrides<
  TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
> = Partial<
  {
    callGasLimit:
      | UserOperationStruct<TEntryPointVersion>["callGasLimit"]
      | Multiplier;
    maxFeePerGas:
      | UserOperationStruct<TEntryPointVersion>["maxFeePerGas"]
      | Multiplier;
    maxPriorityFeePerGas:
      | UserOperationStruct<TEntryPointVersion>["maxPriorityFeePerGas"]
      | Multiplier;
    preVerificationGas:
      | UserOperationStruct<TEntryPointVersion>["preVerificationGas"]
      | Multiplier;
    verificationGasLimit:
      | UserOperationStruct<TEntryPointVersion>["verificationGasLimit"]
      | Multiplier;

    /**
     * The same state overrides for
     * [`eth_call`](https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-eth#eth-call) method.
     * An 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 estimate gas
     * for user operation scenarios under conditions that aren’t currently present on the live network.
     */
    stateOverride: StateOverride;
  } & UserOperationPaymasterOverrides<TEntryPointVersion>
> &
  /**
   * This can be used to override the nonce or nonce key used when calling `entryPoint.getNonce`
   * It is useful when you want to use parallel nonces for user operations
   *
   * NOTE: not all bundlers fully support this feature and it could be that your bundler will still only include
   * one user operation for your account in a bundle
   */
  Partial<
    | {
        nonceKey: bigint;
        nonce: never;
      }
    | { nonceKey: never; nonce: bigint }
  >;
```

</Accordion>

## `UserOperationReceipt`

An interface that defines the structure for the response received from the RPC method [`eth_getUserOperationReceipt`](https://www.alchemy.com/docs/wallets/api-reference/bundler-api/bundler-api-endpoints/eth-get-user-operation-receipt). It includes details like sender, nonce, gas cost, and success status of the `UserOperation`.

<Accordion title="UserOperationReceipt">

```ts
export interface UserOperationReceipt {
  /* The request hash of the UserOperation. */
  userOpHash: Hash;
  /* The entry point address used for the UserOperation. */
  entryPoint: Address;
  /* The account initiating the UserOperation. */
  sender: Address;
  /* The nonce used in the UserOperation. */
  nonce: BigNumberish;
  /* The paymaster used for this UserOperation (or empty). */
  paymaster?: Address;
  /* The actual amount paid (by account or paymaster) for this UserOperation. */
  actualGasCost: BigNumberish;
  /* The total gas used by this UserOperation (including preVerification, creation, validation, and execution). */
  actualGasUsed: BigNumberish;
  /* Indicates whether the execution completed without reverting. */
  success: boolean;
  /* In case of revert, this is the revert reason. */
  reason?: string;
  /* The logs generated by this UserOperation (not including logs of other UserOperations in the same bundle). */
  logs: string[];
  /* The TransactionReceipt object for the entire bundle, not only for this UserOperation. */
  receipt: TransactionReceipt;
  /* The status of the useroperation. Could be "Mined" or "Preconfirmed". */
  status: string;
}
```

</Accordion>

## `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.

<Accordion title="UserOperationRequest">

```ts
// Reference: https://eips.ethereum.org/EIPS/eip-4337#definitions
export type UserOperationRequest<
  TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
> = (TEntryPointVersion extends "0.6.0"
  ? UserOperationRequest_v6
  : TEntryPointVersion extends "0.7.0"
    ? UserOperationRequest_v7
    : never) &
  Eip7702ExtendedFields;
```

</Accordion>

## `UserOperationResponse`

An interface that defines the structure for the response received from the RPC method [`eth_getUserOperationByHash`](https://www.alchemy.com/docs/wallets/api-reference/bundler-api/bundler-api-endpoints/eth-get-user-operation-by-hash), detailing the result of executing a `UserOperation`. It includes the block number, block hash, transaction hash and more information associated with the UO.

<Accordion title="UserOperationResponse">

```ts
export interface UserOperationResponse<
  TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
> {
  /* the User Operation */
  userOperation: UserOperationRequest<TEntryPointVersion>;
  /* the address of the entry point contract that executed the user operation */
  entryPoint: Address;
  /* the block number the user operation was included in */
  blockNumber: BigNumberish;
  /* the hash of the block the user operation was included in */
  blockHash: Hash;
  /* the hash of the transaction that included the user operation */
  transactionHash: Hash;
}
```

</Accordion>

## `UserOperationStruct`

Interface for structuring a `UserOperation`, with fields similar to `UserOperationRequest` but used for building requests.

<Accordion title="UserOperationStruct">

```ts
export type UserOperationStruct<
  TEntryPointVersion extends EntryPointVersion = EntryPointVersion,
> = (TEntryPointVersion extends "0.6.0"
  ? UserOperationStruct_v6
  : TEntryPointVersion extends "0.7.0"
    ? UserOperationStruct_v7
    : never) &
  Eip7702ExtendedFields;
```

</Accordion>