# UserOperation.fromPacked

Transforms a "packed" User Operation into a structured [`UserOperation.UserOperation`](/ercs/erc4337/UserOperation/types#useroperation).

## Imports

:::code-group
```ts [Named]
import { UserOperation } from 'ox/erc4337'
```

```ts [Entrypoint]
import * as UserOperation from 'ox/erc4337/UserOperation'
```
:::

## Examples

```ts twoslash
import { UserOperation } from 'ox/erc4337'

const packed: UserOperation.Packed = {
  accountGasLimits: '0x...',
  callData: '0xdeadbeef',
  initCode: '0x...',
  gasFees: '0x...',
  nonce: 69n,
  paymasterAndData: '0x',
  preVerificationGas: 100_000n,
  sender: '0x9f1fdab6458c5fc642fa0f4c5af7473c46837357',
  signature: '0x...'
}

const userOperation = UserOperation.fromPacked(packed)
```

## Definition

```ts
function fromPacked(
  packed: Packed,
): UserOperation<'0.7', true>
```

**Source:** [src/erc4337/UserOperation.ts](https://github.com/wevm/ox/blob/main/src/erc4337/UserOperation.ts#L1098)

## Parameters

### packed

* **Type:** [`Packed`](/ercs/erc4337/UserOperation/types#useroperationpacked)

The packed user operation to transform.

#### packed.accountGasLimits

* **Type:** `0x${string}`

Concatenation of `verificationGasLimit` (16 bytes) and `callGasLimit` (16 bytes)

#### packed.callData

* **Type:** `0x${string}`

The data to pass to the `sender` during the main execution call.

#### packed.gasFees

* **Type:** `0x${string}`

Concatenation of `maxPriorityFee` (16 bytes) and `maxFeePerGas` (16 bytes)

#### packed.initCode

* **Type:** `0x${string}`

Concatenation of `factory` and `factoryData`.

#### packed.nonce

* **Type:** `bigint`

Anti-replay parameter.

#### packed.paymasterAndData

* **Type:** `0x${string}`

Concatenation of paymaster fields (or empty).

#### packed.preVerificationGas

* **Type:** `bigint`

Extra gas to pay the Bundler.

#### packed.sender

* **Type:** `abitype_Address`

The account making the operation.

#### packed.signature

* **Type:** `0x${string}`

Data passed into the account to verify authorization.

## Return Type

The structured user operation.

`UserOperation<'0.7', true>`
