# Simple 7702 Account (EntryPoint v0.8)

The `Simple7702Account` targets **EntryPoint v0.8** and supports the full feature set including gas sponsorship and ERC-20 gas payments through the Candide paymaster.

Moving to EntryPoint v0.9?

See the [Simple 7702 Account (EntryPoint v0.9)](https://docs.candide.dev/wallet/abstractionkit/simple-7702-account-v09.md) reference and the [`07-migrate-v08-to-v09.ts`](https://github.com/candidelabs/abstractionkit-examples/blob/main/eip-7702/simple-account/07-migrate-v08-to-v09.ts) example for a complete v0.8 to v0.9 migration.

<!-- -->

[EIP-7702 QuickStart](https://docs.candide.dev/wallet/guides/getting-started-eip-7702.md)

[Learn how to upgrade an EOA to a Smart Account with batch transactions and gas sponsorship capabilities](https://docs.candide.dev/wallet/guides/getting-started-eip-7702.md)

## Smart Contracts and Audits[​](#smart-contracts-and-audits "Direct link to Smart Contracts and Audits")

The contracts were developed by the Ethereum Foundation Account Abstraction Team and audited by Spearbit.

* [Smart Contracts](https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/accounts/Simple7702Account.sol)
* [Release](https://github.com/eth-infinitism/account-abstraction/releases/tag/v0.8.0)
* [Audit](https://github.com/eth-infinitism/account-abstraction/blob/develop/audits/SpearBit%20Account%20Abstraction%20Security%20Review%20-%20Mar%202025.pdf)

## How to Use[​](#how-to-use "Direct link to How to Use")

### Prerequisites[​](#prerequisites "Direct link to Prerequisites")

Before using `Simple7702Account`, you must have:

* **Node.js**: Version 18.0 or higher.
* **EIP-7702 Compatible Network**: Ethereum mainnet, Sepolia, Optimism, Base, or other EIP-7702 enabled chains.
* **Private Key Access**: Required for signing authorizations and user operations.

### Installation[​](#installation "Direct link to Installation")

```
npm install abstractionkit
```

### Usage[​](#usage "Direct link to Usage")

```
import { Simple7702Account } from "abstractionkit";



const delegatorPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31"; // EOA public key

const smartAccount = new Simple7702Account(delegatorPublicAddress);
```

**Constructor defaults:**

* `entrypointAddress`: `0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108` (EntryPoint v0.8)
* `delegateeAddress`: `0xe6Cae83BdE06E4c305530e199D7217f42808555B`

Both can be overridden by passing an `overrides` object as the second constructor argument.

```
const simple7702Account = new Simple7702Account(eoaAddress, {

  entrypointAddress: "0x...", // optional

  delegateeAddress: "0x...", // optional

});
```

## Essential Methods[​](#essential-methods "Direct link to Essential Methods")

### createUserOperation[​](#createuseroperation "Direct link to createUserOperation")

Creates a UserOperation for EIP-7702 accounts that can be sent to bundlers for execution.

* example.ts
* Param Types
* Return Type

example.ts

```
import { Simple7702Account } from "abstractionkit";



const delegatorPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31";

const smartAccount = new Simple7702Account(delegatorPublicAddress);



const chainId = 11155111n; // Sepolia



const transactions = [

  {

    to: "0x...",

    value: 0n,

    data: "0x...",

  },

];



const userOperation = await smartAccount.createUserOperation(

  transactions,

  "https://ethereum-sepolia-rpc.publicnode.com", // provider RPC

  "https://api.candide.dev/public/v3/11155111", // bundler RPC

  {

    eip7702Auth: {

      chainId, // chainId at which the account will be authorized

    },

    // Optional overrides

    maxFeePerGas: 20000000000n,

    maxPriorityFeePerGas: 2000000000n,

  }

);
```

| key                                                    | type                      | description                                                                                                                                                                                                                                        |
| :----------------------------------------------------- | :------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `transactions`                                         | `SimpleMetaTransaction[]` | Array of transactions to include in the user operation                                                                                                                                                                                             |
| `providerRpc?`                                         | `string`                  | Optional JSON-RPC provider URL for blockchain queries                                                                                                                                                                                              |
| `bundlerRpc?`                                          | `string`                  | Optional bundler RPC URL for gas estimation                                                                                                                                                                                                        |
| `overrides?`                                           | `object`                  | Optional overrides for user operation creation                                                                                                                                                                                                     |
| `overrides?.eip7702Auth?`                              | `object`                  | EIP-7702 authorization parameters for EOA delegation                                                                                                                                                                                               |
| `overrides?.eip7702Auth?.chainId`                      | `string`                  | Chain ID in hexadecimal format where the authorization is valid                                                                                                                                                                                    |
| `overrides?.eip7702Auth?.address`                      | `string`                  | Address to authorize for the EOA delegation                                                                                                                                                                                                        |
| `overrides?.eip7702Auth?.nonce`                        | `string`                  | Authorization nonce in hexadecimal format                                                                                                                                                                                                          |
| `overrides?.eip7702Auth?.yParity`                      | `string`                  | Y parity of the authorization signature                                                                                                                                                                                                            |
| `overrides?.eip7702Auth?.r`                            | `string`                  | R component of the authorization signature                                                                                                                                                                                                         |
| `overrides?.eip7702Auth?.s`                            | `string`                  | S component of the authorization signature                                                                                                                                                                                                         |
| `overrides?.nonce?`                                    | `string`                  | Anti-replay parameter (see Semi-abstracted Nonce Support)                                                                                                                                                                                          |
| `overrides?.callData?`                                 | `string`                  | The data to pass to the sender during the main execution call                                                                                                                                                                                      |
| `overrides?.callGasLimit?`                             | `bigint`                  | The amount of gas to allocate the main execution call                                                                                                                                                                                              |
| `overrides?.verificationGasLimit?`                     | `bigint`                  | The amount of gas to allocate for the verification step                                                                                                                                                                                            |
| `overrides?.preVerificationGas?`                       | `bigint`                  | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata                                                                                                                                                 |
| `overrides?.maxFeePerGas?`                             | `bigint`                  | Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas)                                                                                                                                                                                       |
| `overrides?.maxPriorityFeePerGas?`                     | `bigint`                  | Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas)                                                                                                                                                                    |
| `overrides?.callGasLimitPercentageMultiplier?`         | `number`                  | Set the callGasLimitPercentageMultiplier instead of estimating gas using the bundler                                                                                                                                                               |
| `overrides?.verificationGasLimitPercentageMultiplier?` | `number`                  | Set the verificationGasLimitPercentageMultiplier instead of estimating gas using the bundler                                                                                                                                                       |
| `overrides?.preVerificationGasPercentageMultiplier?`   | `number`                  | Set the preVerificationGasPercentageMultiplier instead of estimating gas using the bundler                                                                                                                                                         |
| `overrides?.maxFeePerGasPercentageMultiplier?`         | `number`                  | Set the maxFeePerGasPercentageMultiplier instead of querying the current gas price from the RPC node                                                                                                                                               |
| `overrides?.maxPriorityFeePerGasPercentageMultiplier?` | `number`                  | Set the maxPriorityFeePerGasPercentageMultiplier instead of querying the current gas price from the RPC node                                                                                                                                       |
| `overrides?.state_override_set?`                       | `StateOverrideSet`        | Pass state override set for simulation                                                                                                                                                                                                             |
| `overrides?.dummySignature?`                           | `string`                  | Dummy signature for gas estimation                                                                                                                                                                                                                 |
| `overrides?.skipGasEstimation?`                        | `boolean`                 | When true, skip the bundler's eth\_estimateUserOperationGas call. Gas limits fall back to any overrides or 0n. The returned UserOperation is always populated with a dummy signature so it stays valid for downstream paymaster sponsorship calls. |

SimpleMetaTransaction

| key                           | type     | description                                                                   |
| :---------------------------- | :------- | :---------------------------------------------------------------------------- |
| `SimpleMetaTransaction`       | `object` | SimpleMetaTransaction is the type of transaction used with Simple7702Account. |
| `SimpleMetaTransaction.to`    | `string` | Target contract address for the transaction                                   |
| `SimpleMetaTransaction.value` | `bigint` | Value transferred in the transaction (usually 0n for contract interactions)   |
| `SimpleMetaTransaction.data`  | `string` | The call data for the transaction                                             |

| key                                           | type                           | description                                                                                                              |
| :-------------------------------------------- | :----------------------------- | :----------------------------------------------------------------------------------------------------------------------- |
| `userOperation`                               | `object`                       | The constructed user operation for EIP-7702                                                                              |
| `userOperation.sender`                        | `string`                       | The account making the operation                                                                                         |
| `userOperation.nonce`                         | `bigint`                       | Anti-replay parameter (see Semi-abstracted Nonce Support)                                                                |
| `userOperation.factory`                       | `string \| null`               | Account factory address, only for new accounts (null if account already exists)                                          |
| `userOperation.factoryData`                   | `string \| null`               | Data for account factory (null if account already exists)                                                                |
| `userOperation.callData`                      | `string`                       | The data to pass to the sender during the main execution call                                                            |
| `userOperation.callGasLimit`                  | `bigint`                       | The amount of gas to allocate the main execution call                                                                    |
| `userOperation.verificationGasLimit`          | `bigint`                       | The amount of gas to allocate for the verification step                                                                  |
| `userOperation.preVerificationGas`            | `bigint`                       | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata                       |
| `userOperation.maxFeePerGas`                  | `bigint`                       | Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas)                                                             |
| `userOperation.maxPriorityFeePerGas`          | `bigint`                       | Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas)                                          |
| `userOperation.paymaster`                     | `string \| null`               | Address of paymaster contract (null if account pays for itself)                                                          |
| `userOperation.paymasterVerificationGasLimit` | `bigint \| null`               | The amount of gas to allocate for the paymaster verification step (null if no paymaster)                                 |
| `userOperation.paymasterPostOpGasLimit`       | `bigint \| null`               | The amount of gas to allocate for the paymaster post-operation code (null if no paymaster)                               |
| `userOperation.paymasterData`                 | `string \| null`               | Data for paymaster (null if no paymaster)                                                                                |
| `userOperation.eip7702Auth`                   | `Authorization7702Hex \| null` | EIP-7702 authorization data for EOA delegation (null if not using EIP-7702)                                              |
| `userOperation.signature`                     | `string`                       | Data passed into the account to verify authorization. Resolves to '0x' when the user did not provide their signature yet |

### signUserOperation[​](#signuseroperation "Direct link to signUserOperation")

Signs a UserOperation with the provided private key for the EIP-7702 account.

* example.ts
* Param Types
* Return Type

example.ts

```
const signature = smartAccount.signUserOperation(

  userOperation,

  "0x...private-key",

  11155111n // chain ID

);



userOperation.signature = signature;
```

| key                                           | type                           | description                                                                                                              |
| :-------------------------------------------- | :----------------------------- | :----------------------------------------------------------------------------------------------------------------------- |
| `userOperation`                               | `object`                       | The user operation to sign                                                                                               |
| `userOperation.sender`                        | `string`                       | The account making the operation                                                                                         |
| `userOperation.nonce`                         | `bigint`                       | Anti-replay parameter (see Semi-abstracted Nonce Support)                                                                |
| `userOperation.factory`                       | `string \| null`               | Account factory address, only for new accounts (null if account already exists)                                          |
| `userOperation.factoryData`                   | `string \| null`               | Data for account factory (null if account already exists)                                                                |
| `userOperation.callData`                      | `string`                       | The data to pass to the sender during the main execution call                                                            |
| `userOperation.callGasLimit`                  | `bigint`                       | The amount of gas to allocate the main execution call                                                                    |
| `userOperation.verificationGasLimit`          | `bigint`                       | The amount of gas to allocate for the verification step                                                                  |
| `userOperation.preVerificationGas`            | `bigint`                       | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata                       |
| `userOperation.maxFeePerGas`                  | `bigint`                       | Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas)                                                             |
| `userOperation.maxPriorityFeePerGas`          | `bigint`                       | Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas)                                          |
| `userOperation.paymaster`                     | `string \| null`               | Address of paymaster contract (null if account pays for itself)                                                          |
| `userOperation.paymasterVerificationGasLimit` | `bigint \| null`               | The amount of gas to allocate for the paymaster verification step (null if no paymaster)                                 |
| `userOperation.paymasterPostOpGasLimit`       | `bigint \| null`               | The amount of gas to allocate for the paymaster post-operation code (null if no paymaster)                               |
| `userOperation.paymasterData`                 | `string \| null`               | Data for paymaster (null if no paymaster)                                                                                |
| `userOperation.eip7702Auth`                   | `Authorization7702Hex \| null` | EIP-7702 authorization data for EOA delegation (null if not using EIP-7702)                                              |
| `userOperation.signature`                     | `string`                       | Data passed into the account to verify authorization. Resolves to '0x' when the user did not provide their signature yet |
| `privateKey`                                  | `string`                       | Private key to sign the user operation with                                                                              |
| `chainId`                                     | `bigint`                       | Chain ID for the target blockchain                                                                                       |

| key         | type     | description                          |
| :---------- | :------- | :----------------------------------- |
| `signature` | `string` | The signature for the user operation |

### signUserOperationWithSigner[​](#signuseroperationwithsigner "Direct link to signUserOperationWithSigner")

Signs a UserOperation using an [`ExternalSigner`](https://docs.candide.dev/wallet/abstractionkit/external-signers.md) instead of a raw private key. Integrates viem, ethers, browser wallets, hardware wallets, HSMs, and MPC services through the same API.

Since AbstractionKit `v0.3.5`, `Simple7702Account` accepts signers that implement either `signTypedData` or `signHash`. The SDK prefers `signTypedData` when available, so JSON-RPC wallets and viem `WalletClient` instances can sign EntryPoint v0.8 UserOperations without raw-hash signing support. Raw-hash signers continue to work.

example.ts

```
import { fromViemWalletClient } from "abstractionkit";

import { createWalletClient, custom } from "viem";



const walletClient = createWalletClient({

  account: delegatorPublicAddress,

  chain,

  transport: custom(window.ethereum),

});



userOperation.signature = await smartAccount.signUserOperationWithSigner(

  userOperation,

  fromViemWalletClient(walletClient),

  11155111n, // chain ID

);
```

See [External Signers](https://docs.candide.dev/wallet/abstractionkit/external-signers.md) for the full list of adapters and custom-signer integrations.

### getUserOperationEip712Data[​](#getuseroperationeip712data "Direct link to getUserOperationEip712Data")

Builds the EIP-712 typed data payload for a UserOperation under the EntryPoint v0.8 domain. Use this static helper when you need to inspect the wallet prompt payload or drive a custom `signTypedData` primitive directly.

example.ts

```
import { Simple7702Account } from "abstractionkit";



const typedData = Simple7702Account.getUserOperationEip712Data(

  userOperation,

  11155111n,

);



const signature = await walletClient.signTypedData(typedData);

userOperation.signature = signature;
```

`getUserOperationEip712TypedData` was renamed in `v0.3.8` and moved from an instance method to a static helper. Use `getUserOperationEip712Hash(userOperation, chainId, overrides?)` when you only need the digest.

### sendUserOperation[​](#senduseroperation "Direct link to sendUserOperation")

Sends a signed UserOperation to the bundler for execution on-chain.

* example.ts
* Param Types
* Return Type

example.ts

```
const response = await smartAccount.sendUserOperation(

  userOperation,

  "https://api.candide.dev/public/v3/11155111" // bundler URL

);



console.log("UserOperation hash:", response.userOperationHash);



// Wait for the transaction to be included

const receipt = await response.included();

console.log("Transaction receipt:", receipt);
```

| key                                           | type                           | description                                                                                                              |
| :-------------------------------------------- | :----------------------------- | :----------------------------------------------------------------------------------------------------------------------- |
| `userOperation`                               | `object`                       | The signed user operation to send                                                                                        |
| `userOperation.sender`                        | `string`                       | The account making the operation                                                                                         |
| `userOperation.nonce`                         | `bigint`                       | Anti-replay parameter (see Semi-abstracted Nonce Support)                                                                |
| `userOperation.factory`                       | `string \| null`               | Account factory address, only for new accounts (null if account already exists)                                          |
| `userOperation.factoryData`                   | `string \| null`               | Data for account factory (null if account already exists)                                                                |
| `userOperation.callData`                      | `string`                       | The data to pass to the sender during the main execution call                                                            |
| `userOperation.callGasLimit`                  | `bigint`                       | The amount of gas to allocate the main execution call                                                                    |
| `userOperation.verificationGasLimit`          | `bigint`                       | The amount of gas to allocate for the verification step                                                                  |
| `userOperation.preVerificationGas`            | `bigint`                       | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata                       |
| `userOperation.maxFeePerGas`                  | `bigint`                       | Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas)                                                             |
| `userOperation.maxPriorityFeePerGas`          | `bigint`                       | Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas)                                          |
| `userOperation.paymaster`                     | `string \| null`               | Address of paymaster contract (null if account pays for itself)                                                          |
| `userOperation.paymasterVerificationGasLimit` | `bigint \| null`               | The amount of gas to allocate for the paymaster verification step (null if no paymaster)                                 |
| `userOperation.paymasterPostOpGasLimit`       | `bigint \| null`               | The amount of gas to allocate for the paymaster post-operation code (null if no paymaster)                               |
| `userOperation.paymasterData`                 | `string \| null`               | Data for paymaster (null if no paymaster)                                                                                |
| `userOperation.eip7702Auth`                   | `Authorization7702Hex \| null` | EIP-7702 authorization data for EOA delegation (null if not using EIP-7702)                                              |
| `userOperation.signature`                     | `string`                       | Data passed into the account to verify authorization. Resolves to '0x' when the user did not provide their signature yet |
| `bundlerRpc`                                  | `string`                       | Bundler RPC URL to send the user operation to                                                                            |

| key                          | type                                                         | description                                                                                                                             |
| :--------------------------- | :----------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------- |
| `response`                   | `object`                                                     | Response containing user operation hash and bundler details                                                                             |
| `response.userOperationHash` | `string`                                                     | The hash over the userOp (except signature), entryPoint and chainId                                                                     |
| `response.bundler`           | `Bundler`                                                    | The Bundler class                                                                                                                       |
| `response.entrypointAddress` | `string`                                                     | The entrypoint address where the useroperation got executed                                                                             |
| `response.included()`        | `Promise<UserOperationReceiptResult \| BundlerJsonRpcError>` | Waits for the user operation to be included onchain and returns the user operation receipt on success, or the bundler error on failture |

SendUseroperationResponse

| key                 | type                                                         | description                                                                                                                             |
| :------------------ | :----------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------- |
| `userOperationHash` | `string`                                                     | The hash over the userOp (except signature), entryPoint and chainId                                                                     |
| `bundler`           | `Bundler`                                                    | The Bundler class                                                                                                                       |
| `entrypointAddress` | `string`                                                     | The entrypoint address where the useroperation got executed                                                                             |
| `included()`        | `Promise<UserOperationReceiptResult \| BundlerJsonRpcError>` | Waits for the user operation to be included onchain and returns the user operation receipt on success, or the bundler error on failture |

BundlerJsonRpcError

| key       | type     | description                           |
| :-------- | :------- | :------------------------------------ |
| `code`    | `number` | Bundler RPC error code                |
| `message` | `string` | Bundler RPC error message description |

UserOperationReceiptResult

| key                         | type      | description                                                                                                 |
| :-------------------------- | :-------- | :---------------------------------------------------------------------------------------------------------- |
| `userOpHash`                | `string`  | The hash of the user operation.                                                                             |
| `entryPoint`                | `string`  | The address of the entry point contract that processed the operation.                                       |
| `sender`                    | `string`  | The address of the sender of the user operation.                                                            |
| `nonce`                     | `bigint`  | The nonce of the user operation.                                                                            |
| `paymaster`                 | `string`  | The address of the paymaster that paid for the gas of the user operation.                                   |
| `actualGasCost`             | `bigint`  | The actual gas cost incurred for executing the user operation.                                              |
| `actualGasUsed`             | `bigint`  | The actual amount of gas used for the user operation.                                                       |
| `success`                   | `boolean` | Indicates whether the user operation was successful.                                                        |
| `logs`                      | `string`  | The logs produced during the execution of the user operation.                                               |
| `receipt`                   | `object`  | The detailed receipt of the user operation.                                                                 |
| `receipt.blockHash`         | `string`  | The hash of the block in which the transaction was included.                                                |
| `receipt.blockNumber`       | `bigint`  | The number of the block in which the transaction was included.                                              |
| `receipt.from`              | `string`  | The address that initiated the transaction.                                                                 |
| `receipt.cumulativeGasUsed` | `bigint`  | The total amount of gas used in the block up to and including this transaction.                             |
| `receipt.gasUsed`           | `bigint`  | The amount of gas used by this transaction.                                                                 |
| `receipt.logs`              | `string`  | Logs generated by the transaction.                                                                          |
| `receipt.logsBloom`         | `string`  | The bloom filter for the logs generated by the transaction.                                                 |
| `receipt.transactionHash`   | `string`  | The unique hash of the transaction.                                                                         |
| `receipt.transactionIndex`  | `bigint`  | The index of the transaction within the block.                                                              |
| `receipt.effectiveGasPrice` | `bigint`  | The effective gas price for the transaction. This field is optional and may not be present in all receipts. |

## Advanced Methods[​](#advanced-methods "Direct link to Advanced Methods")

### createAccountCallData[​](#createaccountcalldata "Direct link to createAccountCallData")

Creates call data for a basic transaction with specified target, value, and data.

* example.ts
* Param Types
* Return Type

example.ts

```
const callData = Simple7702Account.createAccountCallData(

  "0x...", // to address

  1000000000000000000n, // value in wei

  "0x..." // transaction data

);
```

| key     | type     | description                          |
| :------ | :------- | :----------------------------------- |
| `to`    | `string` | Target address for the transaction   |
| `value` | `bigint` | Value to transfer in the transaction |
| `data`  | `string` | Call data for the transaction        |

| key        | type     | description                                   |
| :--------- | :------- | :-------------------------------------------- |
| `callData` | `string` | Encoded call data for the account transaction |

### createAccountCallDataSingleTransaction[​](#createaccountcalldatasingletransaction "Direct link to createAccountCallDataSingleTransaction")

Creates call data for a single SimpleMetaTransaction.

* example.ts
* Param Types
* Return Type

example.ts

```
const metaTransaction = {

  to: "0x...",

  value: 0n,

  data: "0x...",

};



const callData = Simple7702Account.createAccountCallDataSingleTransaction(metaTransaction);
```

| key                                           | type     | description                                                                   |
| :-------------------------------------------- | :------- | :---------------------------------------------------------------------------- |
| `metaTransaction`                             | `object` | The SimpleMetaTransaction to create call data for                             |
| `metaTransaction.SimpleMetaTransaction`       | `object` | SimpleMetaTransaction is the type of transaction used with Simple7702Account. |
| `metaTransaction.SimpleMetaTransaction.to`    | `string` | Target contract address for the transaction                                   |
| `metaTransaction.SimpleMetaTransaction.value` | `bigint` | Value transferred in the transaction (usually 0n for contract interactions)   |
| `metaTransaction.SimpleMetaTransaction.data`  | `string` | The call data for the transaction                                             |

| key        | type     | description                                   |
| :--------- | :------- | :-------------------------------------------- |
| `callData` | `string` | Encoded call data for the account transaction |

### createAccountCallDataBatchTransactions[​](#createaccountcalldatabatchtransactions "Direct link to createAccountCallDataBatchTransactions")

Creates call data for batching multiple SimpleMetaTransactions together.

* example.ts
* Param Types
* Return Type

example.ts

```
const transactions = [

  { to: "0x...", value: 0n, data: "0x..." },

  { to: "0x...", value: 0n, data: "0x..." },

];



const callData = Simple7702Account.createAccountCallDataBatchTransactions(transactions);
```

| key            | type                      | description                                       |
| :------------- | :------------------------ | :------------------------------------------------ |
| `transactions` | `SimpleMetaTransaction[]` | Array of SimpleMetaTransactions to batch together |

| key        | type     | description                                   |
| :--------- | :------- | :-------------------------------------------- |
| `callData` | `string` | Encoded call data for the account transaction |

### prependTokenPaymasterApproveToCallDataStatic[​](#prependtokenpaymasterapprovetocalldatastatic "Direct link to prependTokenPaymasterApproveToCallDataStatic")

Prepends a token approval transaction to existing call data for use with token paymasters.

* example.ts
* Param Types
* Return Type

example.ts

```
const callDataWithApproval = Simple7702Account.prependTokenPaymasterApproveToCallDataStatic(

  "0x...", // existing call data

  "0xa0b86a33e6b3e96bb24b8e4b28e80e0fb3a4f4b6", // USDC token address

  "0x...", // paymaster address

  1000000n // approve amount (1 USDC)

);
```

| key                | type     | description                                   |
| :----------------- | :------- | :-------------------------------------------- |
| `callData`         | `string` | Existing call data to prepend the approval to |
| `tokenAddress`     | `string` | Address of the ERC-20 token to approve        |
| `paymasterAddress` | `string` | Address of the paymaster contract             |
| `approveAmount`    | `bigint` | Amount of tokens to approve for the paymaster |

| key        | type     | description                             |
| :--------- | :------- | :-------------------------------------- |
| `callData` | `string` | Call data with token approval prepended |

### prependTokenPaymasterApproveToCallData[​](#prependtokenpaymasterapprovetocalldata "Direct link to prependTokenPaymasterApproveToCallData")

Instance method to prepend token approval to call data for paymaster usage.

* example.ts
* Param Types
* Return Type

example.ts

```
const callDataWithApproval = smartAccount.prependTokenPaymasterApproveToCallData(

  "0x...", // existing call data

  "0xa0b86a33e6b3e96bb24b8e4b28e80e0fb3a4f4b6", // USDC token address

  "0x...", // paymaster address

  1000000n // approve amount

);
```

| key                | type     | description                                   |
| :----------------- | :------- | :-------------------------------------------- |
| `callData`         | `string` | Existing call data to prepend the approval to |
| `tokenAddress`     | `string` | Address of the ERC-20 token to approve        |
| `paymasterAddress` | `string` | Address of the paymaster contract             |
| `approveAmount`    | `bigint` | Amount of tokens to approve for the paymaster |

| key        | type     | description                             |
| :--------- | :------- | :-------------------------------------- |
| `callData` | `string` | Call data with token approval prepended |

### estimateUserOperationGas[​](#estimateuseroperationgas "Direct link to estimateUserOperationGas")

Estimates gas limits for a UserOperation using the bundler.

* example.ts
* Param Types
* Return Type

example.ts

```
const [preVerificationGas, verificationGasLimit, callGasLimit] =

  await smartAccount.estimateUserOperationGas(

    userOperation,

    "https://api.candide.dev/public/v3/11155111",

    {

      // Optional overrides

      stateOverrideSet: {...},

      dummySignature: "0x...",

    }

  );
```

| key                                           | type                           | description                                                                                                              |
| :-------------------------------------------- | :----------------------------- | :----------------------------------------------------------------------------------------------------------------------- |
| `userOperation`                               | `object`                       | The user operation to estimate gas for                                                                                   |
| `userOperation.sender`                        | `string`                       | The account making the operation                                                                                         |
| `userOperation.nonce`                         | `bigint`                       | Anti-replay parameter (see Semi-abstracted Nonce Support)                                                                |
| `userOperation.factory`                       | `string \| null`               | Account factory address, only for new accounts (null if account already exists)                                          |
| `userOperation.factoryData`                   | `string \| null`               | Data for account factory (null if account already exists)                                                                |
| `userOperation.callData`                      | `string`                       | The data to pass to the sender during the main execution call                                                            |
| `userOperation.callGasLimit`                  | `bigint`                       | The amount of gas to allocate the main execution call                                                                    |
| `userOperation.verificationGasLimit`          | `bigint`                       | The amount of gas to allocate for the verification step                                                                  |
| `userOperation.preVerificationGas`            | `bigint`                       | The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata                       |
| `userOperation.maxFeePerGas`                  | `bigint`                       | Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas)                                                             |
| `userOperation.maxPriorityFeePerGas`          | `bigint`                       | Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas)                                          |
| `userOperation.paymaster`                     | `string \| null`               | Address of paymaster contract (null if account pays for itself)                                                          |
| `userOperation.paymasterVerificationGasLimit` | `bigint \| null`               | The amount of gas to allocate for the paymaster verification step (null if no paymaster)                                 |
| `userOperation.paymasterPostOpGasLimit`       | `bigint \| null`               | The amount of gas to allocate for the paymaster post-operation code (null if no paymaster)                               |
| `userOperation.paymasterData`                 | `string \| null`               | Data for paymaster (null if no paymaster)                                                                                |
| `userOperation.eip7702Auth`                   | `Authorization7702Hex \| null` | EIP-7702 authorization data for EOA delegation (null if not using EIP-7702)                                              |
| `userOperation.signature`                     | `string`                       | Data passed into the account to verify authorization. Resolves to '0x' when the user did not provide their signature yet |
| `bundlerRpc`                                  | `string`                       | Bundler RPC URL for gas estimation                                                                                       |
| `overrides?`                                  | `object`                       | Optional overrides for gas estimation                                                                                    |
| `overrides?.state_override_set?`              | `StateOverrideSet`             | State override set for simulation                                                                                        |
| `overrides?.dummySignature?`                  | `string`                       | Dummy signature for gas estimation                                                                                       |

| key         | type                       | description                                                        |
| :---------- | :------------------------- | :----------------------------------------------------------------- |
| `gasLimits` | `[bigint, bigint, bigint]` | Tuple of \[preVerificationGas, verificationGasLimit, callGasLimit] |

## Delegation Methods[​](#delegation-methods "Direct link to Delegation Methods")

### isDelegatedToThisAccount[​](#isdelegatedtothisaccount "Direct link to isDelegatedToThisAccount")

Checks if the EOA is currently delegated to the expected smart account address via EIP-7702. Returns `true` only when delegated to the account's `delegateeAddress`.

* example.ts
* Param Types
* Return Type

example.ts

```
const isDelegated = await smartAccount.isDelegatedToThisAccount(

  "https://ethereum-sepolia-rpc.publicnode.com"

);



if (isDelegated) {

  console.log("EOA is delegated to this smart account");

} else {

  console.log("EOA is not delegated");

}
```

| key           | type     | description                |
| :------------ | :------- | :------------------------- |
| `providerRpc` | `string` | Ethereum JSON-RPC node URL |

| key           | type      | description                                                           |
| :------------ | :-------- | :-------------------------------------------------------------------- |
| `isDelegated` | `boolean` | true if the EOA is delegated to the expected address, false otherwise |

### createRevokeDelegationTransaction[​](#createrevokedelegationtransaction "Direct link to createRevokeDelegationTransaction")

Creates a signed EIP-7702 transaction that revokes the delegation, restoring the EOA to a regular account. The transaction delegates to `address(0)`, removing the smart account code from the EOA.

This is a regular Ethereum transaction (type `0x04`), not a UserOperation. The EOA needs native tokens to pay for gas.

note

Revocation cannot be done via a UserOperation because the authorization list is processed before execution, which would remove the account's code mid-transaction.

* example.ts
* Param Types
* Return Type

example.ts

```
const signedTransaction = await smartAccount.createRevokeDelegationTransaction(

  "0x...private-key",

  "https://ethereum-sepolia-rpc.publicnode.com",

);



// Send using your preferred method (e.g., viem, ethers)

// const txHash = await client.request({

//   method: 'eth_sendRawTransaction',

//   params: [signedTransaction],

// });
```

| key                                | type     | description                                                              |
| :--------------------------------- | :------- | :----------------------------------------------------------------------- |
| `eoaPrivateKey`                    | `string` | The EOA's private key (signs both the authorization and the transaction) |
| `providerRpc`                      | `string` | JSON-RPC endpoint for nonce, gas price, and chain ID queries             |
| `overrides?`                       | `object` | Optional overrides for transaction fields                                |
| `overrides?.nonce?`                | `bigint` | Transaction nonce override                                               |
| `overrides?.authorizationNonce?`   | `bigint` | EIP-7702 authorization nonce override                                    |
| `overrides?.maxFeePerGas?`         | `bigint` | Maximum fee per gas (EIP-1559)                                           |
| `overrides?.maxPriorityFeePerGas?` | `bigint` | Maximum priority fee per gas (EIP-1559)                                  |
| `overrides?.gasLimit?`             | `bigint` | Gas limit for the transaction                                            |
| `overrides?.chainId?`              | `bigint` | Chain ID override                                                        |

| key                 | type     | description                                                   |
| :------------------ | :------- | :------------------------------------------------------------ |
| `signedTransaction` | `string` | Signed raw transaction hex, ready for eth\_sendRawTransaction |

## Error Handling & Common Issues[​](#error-handling--common-issues "Direct link to Error Handling & Common Issues")

### Common Errors[​](#common-errors "Direct link to Common Errors")

* Authorization Errors
* Gas Estimation Issues
* Network Mismatches

```
// Missing eip7702Auth on the first UserOperation authorization

const userOperation = await smartAccount.createUserOperation(

  transactions,

  providerRpc,

  bundlerRpc

  // Missing eip7702Auth causes delegation failure

);



// Correct usage

const userOperation = await smartAccount.createUserOperation(

  transactions,

  providerRpc,

  bundlerRpc,

  {

    eip7702Auth: { chainId: 11155111n }, // Required for EIP-7702

  }

);
```

```
// Insufficient gas prices

const userOperation = await smartAccount.createUserOperation(

  transactions,

  providerRpc,

  bundlerRpc,

  {

    eip7702Auth: { chainId: 11155111n },

    maxFeePerGas: 1000000000n, // Too low for current network conditions

    maxPriorityFeePerGas: 100000000n, // Too low for current network conditions

  }

);



// Add multipliers to the node

const userOperation = await smartAccount.createUserOperation(

  transactions,

  providerRpc,

  bundlerRpc,

  {

    eip7702Auth: { chainId: 11155111n },

    // Use higher gas prices

    maxFeePerGasPercentageMultiplier: 120, // 20% higher than current network conditions

    maxPriorityFeePerGasPercentageMultiplier: 150, // 50% higher than current network conditions

  }

);
```

```
// ChainId mismatch

const userOperation = await smartAccount.createUserOperation(

  transactions,

  "https://ethereum-sepolia-rpc.publicnode.com", // Sepolia RPC

  "https://api.candide.dev/public/v3/11155111", // Sepolia bundler

  {

    eip7702Auth: { chainId: 1n }, // Mainnet chainId

  }

);



// Matching network configuration

const userOperation = await smartAccount.createUserOperation(

  transactions,

  "https://ethereum-sepolia-rpc.publicnode.com", // Sepolia RPC

  "https://api.candide.dev/public/v3/11155111", // Sepolia bundler

  {

    eip7702Auth: { chainId: 11155111n }, // Sepolia chainId

  }

);
```

### Error Recovery[​](#error-recovery "Direct link to Error Recovery")

```
async function robustTransactionExecution() {

  try {

    const response = await smartAccount.sendUserOperation(userOperation, bundlerRpc);

    const receipt = await response.included();



    if (!receipt.success) {

      console.error("Transaction failed:", receipt.logs);

      // Handle transaction failure

    }



    return receipt;

  } catch (error) {

    if (error.code === -32500) {

      // Transaction rejected by entrypoint simulation

      console.error("Simulation failed, check transaction data");

    } else if (error.code === -32501) {

      // Paymaster rejection

      console.error("Paymaster rejected transaction");

    }

    throw error;

  }

}
```
