> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# primitives/UserOperation

> Auto-generated API documentation

[**@tevm/voltaire**](../index.mdx)

***

[@tevm/voltaire](../index.mdx) / primitives/UserOperation

# primitives/UserOperation

## Type Aliases

### UserOperationType

> **UserOperationType** = `object` & `object`

Defined in: [src/primitives/UserOperation/UserOperationType.ts:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/UserOperation/UserOperationType.ts#L16)

UserOperation type - ERC-4337 v0.6 format

User operations enable account abstraction by separating transaction validation
from execution. Bundlers aggregate user operations and submit them to the
EntryPoint contract for execution.

#### Type Declaration

##### callData

> `readonly` **callData**: `Uint8Array`

Calldata to execute on the account

##### callGasLimit

> `readonly` **callGasLimit**: [`Type`](Uint.mdx#type)

Gas limit for the execution phase

##### initCode

> `readonly` **initCode**: `Uint8Array`

Account factory and initialization code for first-time deployment

##### maxFeePerGas

> `readonly` **maxFeePerGas**: [`Type`](Uint.mdx#type)

Maximum total fee per gas (EIP-1559)

##### maxPriorityFeePerGas

> `readonly` **maxPriorityFeePerGas**: [`Type`](Uint.mdx#type)

Maximum priority fee per gas (EIP-1559)

##### nonce

> `readonly` **nonce**: [`Type`](Uint.mdx#type)

Anti-replay nonce (key + sequence)

##### paymasterAndData

> `readonly` **paymasterAndData**: `Uint8Array`

Paymaster address and data (empty if self-paying)

##### preVerificationGas

> `readonly` **preVerificationGas**: [`Type`](Uint.mdx#type)

Fixed gas overhead for bundler compensation

##### sender

> `readonly` **sender**: [`AddressType`](Address.mdx#addresstype)

Smart account address initiating the operation

##### signature

> `readonly` **signature**: `Uint8Array`

Account signature over userOpHash

##### verificationGasLimit

> `readonly` **verificationGasLimit**: [`Type`](Uint.mdx#type)

Gas limit for the verification phase

#### Type Declaration

##### \[brand]

> `readonly` **\[brand]**: `"UserOperation"`

#### See

* [https://eips.ethereum.org/EIPS/eip-4337](https://eips.ethereum.org/EIPS/eip-4337)
* [https://voltaire.tevm.sh/primitives/user-operation](https://voltaire.tevm.sh/primitives/user-operation) for UserOperation documentation

#### Since

0.0.0

## Variables

### UserOperation

> `const` **UserOperation**: `object`

Defined in: [src/primitives/UserOperation/index.ts:32](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/UserOperation/index.ts#L32)

#### Type Declaration

##### from()

> **from**: (`params`) => [`UserOperationType`](#useroperationtype)

Create UserOperation from input object

###### Parameters

###### params

UserOperation parameters

###### callData

`string` | `Uint8Array`\<`ArrayBufferLike`>

Calldata to execute

###### callGasLimit

`string` | `number` | `bigint` | [`Type`](Uint.mdx#type)

Gas for execution

###### initCode

`string` | `Uint8Array`\<`ArrayBufferLike`>

Account initialization code

###### maxFeePerGas

`string` | `number` | `bigint` | [`Type`](Uint.mdx#type)

Max total fee per gas

###### maxPriorityFeePerGas

`string` | `number` | `bigint` | [`Type`](Uint.mdx#type)

Max priority fee per gas

###### nonce

`string` | `number` | `bigint` | [`Type`](Uint.mdx#type)

Anti-replay nonce

###### paymasterAndData

`string` | `Uint8Array`\<`ArrayBufferLike`>

Paymaster address and data

###### preVerificationGas

`string` | `number` | `bigint` | [`Type`](Uint.mdx#type)

Fixed gas overhead

###### sender

`string` | `number` | `bigint` | `Uint8Array`\<`ArrayBufferLike`> | [`AddressType`](Address.mdx#addresstype)

Smart account address

###### signature

`string` | `Uint8Array`\<`ArrayBufferLike`>

Account signature

###### verificationGasLimit

`string` | `number` | `bigint` | [`Type`](Uint.mdx#type)

Gas for verification

###### Returns

[`UserOperationType`](#useroperationtype)

UserOperation

###### Example

```typescript theme={null}
const userOp = UserOperation.from({
  sender: "0x742d35Cc6634C0532925a3b844Bc9e7595f251e3",
  nonce: 0n,
  initCode: "0x",
  callData: "0x",
  callGasLimit: 100000n,
  verificationGasLimit: 200000n,
  preVerificationGas: 50000n,
  maxFeePerGas: 1000000000n,
  maxPriorityFeePerGas: 1000000000n,
  paymasterAndData: "0x",
  signature: "0x",
});
```

##### hash()

> **hash**: (`userOp`, `entryPoint`, `chainId`) => `Uint8Array`

###### Parameters

###### userOp

[`UserOperationType`](#useroperationtype)

###### entryPoint

`string` | `number` | `bigint` | `Uint8Array`\<`ArrayBufferLike`> | [`AddressType`](Address.mdx#addresstype)

###### chainId

`number` | `bigint`

###### Returns

`Uint8Array`

##### pack()

> **pack**: (`userOp`) => [`PackedUserOperationType`](PackedUserOperation.mdx#packeduseroperationtype)

###### Parameters

###### userOp

[`UserOperationType`](#useroperationtype)

###### Returns

[`PackedUserOperationType`](PackedUserOperation.mdx#packeduseroperationtype)

## Functions

### \_hash()

> **\_hash**(`userOp`, `entryPoint`, `chainId`): `Uint8Array`\<`ArrayBufferLike`>

Defined in: [src/primitives/UserOperation/hash.js:21](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/UserOperation/hash.js#L21)

Compute userOpHash for signing

userOpHash = keccak256(abi.encode(userOp, entryPoint, chainId))

#### Parameters

##### userOp

[`UserOperationType`](#useroperationtype)

User operation

##### entryPoint

EntryPoint contract address

`string` | `number` | `bigint` | `Uint8Array`\<`ArrayBufferLike`> | [`AddressType`](Address.mdx#addresstype)

##### chainId

Chain ID

`number` | `bigint`

#### Returns

`Uint8Array`\<`ArrayBufferLike`>

32-byte hash for signing

#### Example

```typescript theme={null}
const hash = UserOperation.hash(userOp, ENTRYPOINT_V06, 1n);
const signature = await account.signMessage(hash);
```

***

### \_pack()

> **\_pack**(`userOp`): [`PackedUserOperationType`](PackedUserOperation.mdx#packeduseroperationtype)

Defined in: [src/primitives/UserOperation/pack.js:14](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/UserOperation/pack.js#L14)

Pack UserOperation (v0.6) to PackedUserOperation (v0.7)

Packs gas limits and fees into bytes32 for v0.7 entry point.

#### Parameters

##### userOp

[`UserOperationType`](#useroperationtype)

User operation v0.6

#### Returns

[`PackedUserOperationType`](PackedUserOperation.mdx#packeduseroperationtype)

Packed user operation v0.7

#### Example

```typescript theme={null}
const packedUserOp = UserOperation.pack(userOp);
```

***

### from()

> **from**(`params`): [`UserOperationType`](#useroperationtype)

Defined in: [src/primitives/UserOperation/from.js:38](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/UserOperation/from.js#L38)

Create UserOperation from input object

#### Parameters

##### params

UserOperation parameters

###### callData

`string` | `Uint8Array`\<`ArrayBufferLike`>

Calldata to execute

###### callGasLimit

`string` | `number` | `bigint` | [`Type`](Uint.mdx#type)

Gas for execution

###### initCode

`string` | `Uint8Array`\<`ArrayBufferLike`>

Account initialization code

###### maxFeePerGas

`string` | `number` | `bigint` | [`Type`](Uint.mdx#type)

Max total fee per gas

###### maxPriorityFeePerGas

`string` | `number` | `bigint` | [`Type`](Uint.mdx#type)

Max priority fee per gas

###### nonce

`string` | `number` | `bigint` | [`Type`](Uint.mdx#type)

Anti-replay nonce

###### paymasterAndData

`string` | `Uint8Array`\<`ArrayBufferLike`>

Paymaster address and data

###### preVerificationGas

`string` | `number` | `bigint` | [`Type`](Uint.mdx#type)

Fixed gas overhead

###### sender

`string` | `number` | `bigint` | `Uint8Array`\<`ArrayBufferLike`> | [`AddressType`](Address.mdx#addresstype)

Smart account address

###### signature

`string` | `Uint8Array`\<`ArrayBufferLike`>

Account signature

###### verificationGasLimit

`string` | `number` | `bigint` | [`Type`](Uint.mdx#type)

Gas for verification

#### Returns

[`UserOperationType`](#useroperationtype)

UserOperation

#### Example

```typescript theme={null}
const userOp = UserOperation.from({
  sender: "0x742d35Cc6634C0532925a3b844Bc9e7595f251e3",
  nonce: 0n,
  initCode: "0x",
  callData: "0x",
  callGasLimit: 100000n,
  verificationGasLimit: 200000n,
  preVerificationGas: 50000n,
  maxFeePerGas: 1000000000n,
  maxPriorityFeePerGas: 1000000000n,
  paymasterAndData: "0x",
  signature: "0x",
});
```

***

### hash()

> **hash**(`userOp`, `entryPoint`, `chainId`): `Uint8Array`

Defined in: [src/primitives/UserOperation/index.ts:16](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/UserOperation/index.ts#L16)

#### Parameters

##### userOp

[`UserOperationType`](#useroperationtype)

##### entryPoint

`string` | `number` | `bigint` | `Uint8Array`\<`ArrayBufferLike`> | [`AddressType`](Address.mdx#addresstype)

##### chainId

`number` | `bigint`

#### Returns

`Uint8Array`

***

### pack()

> **pack**(`userOp`): [`PackedUserOperationType`](PackedUserOperation.mdx#packeduseroperationtype)

Defined in: [src/primitives/UserOperation/index.ts:24](https://github.com/evmts/voltaire/blob/bd6ec34405c15ad8cd51d11579d495dc53813482/src/primitives/UserOperation/index.ts#L24)

#### Parameters

##### userOp

[`UserOperationType`](#useroperationtype)

#### Returns

[`PackedUserOperationType`](PackedUserOperation.mdx#packeduseroperationtype)
