# Safe Account V3

**Safe Account V3** uses the original Safe Singleton and adds ERC-4337 functionality using a module/fallback handler.

The V3 contracts, known as the `SafeAccountV0_3_0` class in AbstractionKit, support **EntryPoint v0.7**.

## Import[​](#import "Direct link to Import")

```
import { SafeAccountV0_3_0 as SafeAccount } from "abstractionkit"; 
```

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

Initialize a new Safe Account and calculate its address:

```
const ownerPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31"; // Safe owner pub address
const smartAccount = SafeAccount.initializeNewAccount([ownerPublicAddress]);

const accountAddress = smartAccount.accountAddress;
```

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

The **Essentials** methods provide all necessary functionalities with support for overrides, offering a streamlined approach.

### initializeNewAccount[​](#initializenewaccount "Direct link to initializeNewAccount")

Initializes a new SafeAccount class given a list of owners' public addresses. Only needs to be called on the first transaction when the account has not been deployed yet.

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

In this example, we initiate a single owner account.

* example.ts
* Param Types
* Return Type

example.ts

```
import { SafeAccountV0_3_0 as SafeAccount } from "abstractionkit";

const ownerPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31";
const smartAccount = SafeAccount.initializeNewAccount([ownerPublicAddress]);

console.log("Account address (sender): " + smartAccount.accountAddress);
```

| key                  | type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | description                                                                                                |
| :------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------------- |
| `owners[]`           | `key	type	descriptionSigner	ECDSAPublicAddress \| WebauthnPublicKey	Signer type which can be either an ECDSA public address or a Webauthn public key`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Pass the owner(s) address(es) of the account. It can be a single owner account, a multi-sig, or a WebAuthn |
| `initCodeOverrides?` | `key	type	descriptionthreshold?	number	Signature threshold, defines how many signatures are required. Default is 1.
c2Nonce?	bigint	Create2 nonce used to generate different sender addresses from the same owners. Default is 0.
entrypointAddress?	string	Address of the entry point for transactions or contracts.
safe4337ModuleAddress?	string	Address of the Safe 4337 module.
safeModuleSetupddress?	string	Address used for setting up the Safe module.
safeAccountSingleton?	SafeAccountSingleton	Safe contract singleton address. Default is "0x29fcB43b46531BcA003ddC8FCB67FFE91900C762".
safeAccountFactoryAddress?	string	Address of the Safe Factory. Default is "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67".
multisendContractAddress?	string	Address of the Safe 4337 multisend contract. Default is "0xa581c4A4DB7175302464fF3C06380BC3270b4037".
webAuthnSharedSigner?	string	Shared signer used for WebAuthn-based authentication.
eip7212WebAuthnPrecompileVerifierForSharedSigner?	string	Verifier contract for WebAuthn precompile, related to the shared signer.
eip7212WebAuthnContractVerifierForSharedSigner?	string	Contract verifier for WebAuthn-based shared signer, compliant with EIP-7212.` | Override values to change the initialization default values                                                |

| key              | type     | description                             |
| :--------------- | :------- | :-------------------------------------- |
| `ECDSASignature` | `string` | ECDSA signature represented as a string |

WebauthnPublicKey

| key                 | type               | description                                                               |
| :------------------ | :----------------- | :------------------------------------------------------------------------ |
| `authenticatorData` | `ArrayBuffer`      | Binary data returned by the authenticator during the Webauthn process     |
| `clientDataFields`  | `string`           | Fields associated with the client's Webauthn request data                 |
| `rs`                | `[bigint, bigint]` | Array of two bigints representing the 'r' and 's' values of the signature |

| key                 | type                | description                                                          |
| :------------------ | :------------------ | :------------------------------------------------------------------- |
| `SafeAccount class` | `SafeAccountV0_3_0` | An instance of the Safe V3 Account and the initialization parameters |

Example Response

```
Account address(sender) : 0x1a02592A3484c2077d2E5D24482497F85e1980C6
```

#### Source code[​](#source-code "Direct link to Source code")

[initializeNewAccount](https://github.com/candidelabs/abstractionkit/blob/98853f30861382a534abf667ced83d47b6c9da0b/src/account/Safe/SafeAccountV0_3_0.ts#L68)

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

This method determines the nonce, fetches the gas prices, estimates gas limits, and returns a UserOperation to be signed. You can override any of these values using the overrides parameter.

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

This example mints the same NFT twice in a single UserOperation.

* example.ts
* Param Types
* Return Type

example.ts

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

const jsonRpcNodeProvider = "https://rpc2.sepolia.org";
const bundlerUrl = "https://api.candide.dev/public/v3/sepolia";

const transaction: MetaTransaction = {
    to: "0xD9de104e3386d9A45a61BcE269c43E48B534e4E7", // NFT contract address
    value: 0n,
    data: "0x1249c58b", // mint()
}

let userOperation = await smartAccount.createUserOperation(
  [transaction, transaction], // batch transactions to mint 2 NFTs
  jsonRpcNodeProvider,
  bundlerUrl,
)

console.log(userOperation);
```

| Param Name   | Param Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | Description                                                                                              |
| :----------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------- |
| Transactions | MetaTransaction\[]key	type	descriptionMetaTransaction	key	type	descriptionto	string	To address, or the the target contract address for the transaction&#xA;value	BigNumberish	Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens)&#xA;data	BytesLike	The call data for the transaction&#xA;operation	Operation: enum	Default to 0 for a Call. 1 for a Delegate Call. (Optional)	MetaTransaction is the type of transaction to construct a Safe operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | MetaTransaction is the type of a transaction to construct a Safe operation                               |
| Provider RPC | string                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | The node URL. It is used to fetch the current nonce and fetch gas prices                                 |
| Bundler URL  | string                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | The Bundler URL. It is used to fetch the gas limits                                                      |
| Overrides    | CreateUserOperationOverrides, optional objectkey	type	descriptionnonce	string	Anti-replay parameter (see “Semi-abstracted Nonce Support” )&#xA;callData	string	The data to pass to the sender during the main execution call&#xA;callGasLimit	bigint	The amount of gas to allocate the main execution call&#xA;verificationGasLimit	bigint	The amount of gas to allocate for the verification step&#xA;preVerificationGas	bigint	The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata&#xA;maxFeePerGas	bigint	Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas)&#xA;maxPriorityFeePerGas	bigint	Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas)&#xA;callGasLimitPercentageMultiplier	number	Set the callGasLimitPercentageMultiplier instead of estimating gas using the bundler&#xA;verificationGasLimitPercentageMultiplier	number	Set the verificationGasLimitPercentageMultiplier instead of estimating gas using the bundler&#xA;preVerificationGasPercentageMultiplier	number	Set the preVerificationGasPercentageMultiplier instead of estimating gas using the bundler&#xA;maxFeePerGasPercentageMultiplier	number	Set the maxFeePerGasPercentageMultiplier instead of querying the current gas price from the RPC node&#xA;maxPriorityFeePerGasPercentageMultiplier	number	Set the maxPriorityFeePerGasPercentageMultiplier instead of querying the current gas price from the RPC node&#xA;stateOverrideSetType	key	type	description\[address: string]	key	type	descriptionbalance	bigint	Override the balance of the address&#xA;nonce	bigint	Override the nonce of the address&#xA;code	string	Override the code of the address&#xA;state	Dictionary\<string>	Override the storage slots of the address&#xA;stateDiff	Dictionary\<string>	Apply state differences to the storage slots of the address	Overrides for a specific address	Pass state overrides&#xA;dummySignerSignaturePairs\[]	key	type	descriptionSignerSignaturePair\[]	key	type	descriptionSigner	ECDSAPublicAddress \| WebauthnPublicKey	Signer type which can be either an ECDSA public address or a Webauthn public key&#xA;signature	string	signature&#xA;isContractSignature	boolean	isContractSignature	Signature Pair	Provide dummy signatures for the operation&#xA;expectedSigners\[]	key	type	descriptionSigner	ECDSAPublicAddress \| WebauthnPublicKey	Signer type which can be either an ECDSA public address or a Webauthn public key	A array of expected signers that will sign over the transaction. This improves the gas estimates.&#xA;webAuthnSharedSigner	string	Specify the WebAuthn shared signer&#xA;webAuthnSignerFactory	string	Specify the WebAuthn signer factory&#xA;webAuthnSignerSingleton	string	Specify the WebAuthn signer singleton&#xA;eip7212WebAuthnPrecompileVerifier	string	Specify the EIP-7212 WebAuthn precompile verifier&#xA;eip7212WebAuthnContractVerifier	string	Specify the EIP-7212 WebAuthn contract verifier&#xA;safeModuleExecutorFunctionSelector	SafeModuleExecutorFunctionSelector	Specify the function selector for the safe module executor&#xA;multisendContractAddress	string	Specify the multisend contract address&#xA;gasLevel	key	type	descriptionSlow	1	Default Slow Gas&#xA;Medium	1.2	Medium Gas with a 20% increase&#xA;Fast	1.5	Medium Gas with a 50% increase	Multiplier to determine the gas price for the user operation&#xA;polygonGasStation	key	type	descriptionMainnet	v2	Polygon PoS Mainnet&#xA;ZkMainnet	zkevm	Polygon zkEVM Mainnet&#xA;Amoy	amoy	Polygon Amoy PoS Testnet&#xA;Cardona	cardona	Polygon Cardona zkEVM Testnet	To specify the polygon network&#xA;factory	string	Set the factory address instead of using the calculated value&#xA;factoryData	string	Set the factory data instead of using the calculated value | CreateUserOperationOverrides allows you to override any of the default parameters for the user operation |

BundlerJsonRpcError object

| Param Name    | Param Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | Description                                                                                         |                                                                                                           |                                                                          |
| :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------- |
| UserOperation | Promise\<UserOperation \| JsonRpcError \| BundlerJsonRpcError>UserOperation objectkey	type	descriptionsender	string	The account making the operation&#xA;nonce	string	Anti-replay parameter (see “Semi-abstracted Nonce Support” )&#xA;factory	string	account factory, only for new accounts&#xA;factoryData	string	data for account factory (only if account factory exists)&#xA;callData	string	The data to pass to the sender during the main execution call&#xA;callGasLimit	bigint	The amount of gas to allocate the main execution call&#xA;verificationGasLimit	bigint	The amount of gas to allocate for the verification step&#xA;preVerificationGas	bigint	Extra gas to pay the bunder&#xA;maxFeePerGas	bigint	Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas)&#xA;maxPriorityFeePerGas	bigint	Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas)&#xA;paymaster	string	Address of paymaster contract, (or empty, if account pays for itself)&#xA;paymasterVerificationGasLimit	string	The amount of gas to allocate for the paymaster post-operation code&#xA;paymasterPostOpGasLimit	string	The amount of gas to allocate for the paymaster post-operation code&#xA;paymasterData	string	Data for paymaster (only if paymaster exists)&#xA;signature	string	Data passed into the account to verify authorizationJsonRpcError object | key	type	descriptioncode	number	JSON RPC error code&#xA;message	string	JSON RPC error message description | key	type	descriptioncode	number	Bundler RPC error code&#xA;message	string	Bundler RPC error message description | Returns a UserOperation on success, or the RPC/bundler error on failure. |

Example Response

```
{
  sender: '0xd785bb8a95a6a08ace0aa2e54aee5cf04694b1db',
  nonce: 19n,
  callData: '0x541d63c80000000000000000000000009a7af758ae5d7b6aae84fe4c5ba67c041dfe533600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246a627842000000000000000000000000d785bb8a95a6a08ace0aa2e54aee5cf04694b1db00000000000000000000000000000000000000000000000000000000',
  callGasLimit: 58588n,
  verificationGasLimit: 94374n,
  preVerificationGas: 45628n,
  maxFeePerGas: 148180551200n,
  maxPriorityFeePerGas: 161327244n,
  signature: '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000041ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
  factory: null,
  factoryData: null,
  paymaster: null,
  paymasterVerificationGasLimit: null,
  paymasterPostOpGasLimit: null,
  paymasterData: null
}
```

#### Source code[​](#source-code-1 "Direct link to Source code")

[createUserOperation](https://github.com/candidelabs/abstractionkit/blob/98853f30861382a534abf667ced83d47b6c9da0b/src/account/Safe/SafeAccountV0_3_0.ts#L212)

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

This method takes a userOperation, the private keys of the owner of the account, and the chainId and returns the signature field.

* example.ts
* Param Types
* Return Type

example.ts

```
const chainId = BigInt("11155111"); // sepolia chain ID
const privateKey = "0x4cad764980d84fc6684ca839cae2c78be5432e292fa98416e11687ceb9096a03";
const userOperation = {..} 

const signature = smartAccount.signUserOperation(
  userOperation,
  [privateKey],
  chainId,
);

userOperation.signature = signature;

console.log(signature);
```

| key             | type                                                                                                                                         | description                      |
| :-------------- | :------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------- |
| `userOperation` | `UserOperationV7`                                                                                                                            | userOperation to sign            |
| `privateKeys`   | `string[]`                                                                                                                                   | private keys of owners/signers   |
| `chainId`       | `bigint`                                                                                                                                     | target chain id                  |
| `overrides?`    | `key	type	descriptionvalidAfter?	bigint	Timestamp the signature will be valid after
validUntil?	bigint	Timestamp the signature will be valid until` | overrides for the default values |

UserOperationV7

| key                             | type     | description                                                                     |
| :------------------------------ | :------- | :------------------------------------------------------------------------------ |
| `sender`                        | `string` | The account making the operation                                                |
| `nonce`                         | `string` | Anti-replay parameter (see “Semi-abstracted Nonce Support” )                    |
| `factory`                       | `string` | account factory, only for new accounts                                          |
| `factoryData`                   | `string` | data for account factory (only if account factory exists)                       |
| `callData`                      | `string` | The data to pass to the sender during the main execution call                   |
| `callGasLimit`                  | `bigint` | The amount of gas to allocate the main execution call                           |
| `verificationGasLimit`          | `bigint` | The amount of gas to allocate for the verification step                         |
| `preVerificationGas`            | `bigint` | Extra gas to pay the bunder                                                     |
| `maxFeePerGas`                  | `bigint` | Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas)                    |
| `maxPriorityFeePerGas`          | `bigint` | Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas) |
| `paymaster`                     | `string` | Address of paymaster contract, (or empty, if account pays for itself)           |
| `paymasterVerificationGasLimit` | `string` | The amount of gas to allocate for the paymaster post-operation code             |
| `paymasterPostOpGasLimit`       | `string` | The amount of gas to allocate for the paymaster post-operation code             |
| `paymasterData`                 | `string` | Data for paymaster (only if paymaster exists)                                   |
| `signature`                     | `string` | Data passed into the account to verify authorization                            |

| key               | type     | description                                                                                                     |
| :---------------- | :------- | :-------------------------------------------------------------------------------------------------------------- |
| `Signature field` | `string` | UserOperation Signature with the data passed into the account along with the nonce during the verification step |

Example Response

```
0x00000000000000000000000041c6297bd9573e8d979a272db4f6576a98f639a7e6874055a627769401dc46d01143551ccaa473364ace4340ec395c546dccb725e1eac2639ecef443d229f0071b
```

#### Source code[​](#source-code-2 "Direct link to Source code")

[signUserOperation](https://github.com/candidelabs/abstractionkit/blob/98853f30861382a534abf667ced83d47b6c9da0b/src/account/Safe/SafeAccount.ts#L1446)

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

This method sends the UserOperation to the bundler to be executed on-chain. It returns a promise `SendUseroperationResponse` object to confirm the on-chain inclusion of the UserOperation.

* example.ts
* Param Types
* Return Type

example.ts

```
const sendUserOperationResponse = await smartAccount.sendUserOperation(userOperation, bundlerUrl)

console.log("sendUserOperationResponse: ", sendUserOperationResponse);
console.log("UserOperation sent. Waiting to be included...");

const receipt = await sendUserOperationResponse.included()

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

| key             | type              | description                       |
| :-------------- | :---------------- | :-------------------------------- |
| `userOperation` | `UserOperationV7` | userOperation to send             |
| `bundlerRpc`    | `string`          | bundler rpc to send userOperation |

UserOperationV7

| key                             | type     | description                                                                     |
| :------------------------------ | :------- | :------------------------------------------------------------------------------ |
| `sender`                        | `string` | The account making the operation                                                |
| `nonce`                         | `string` | Anti-replay parameter (see “Semi-abstracted Nonce Support” )                    |
| `factory`                       | `string` | account factory, only for new accounts                                          |
| `factoryData`                   | `string` | data for account factory (only if account factory exists)                       |
| `callData`                      | `string` | The data to pass to the sender during the main execution call                   |
| `callGasLimit`                  | `bigint` | The amount of gas to allocate the main execution call                           |
| `verificationGasLimit`          | `bigint` | The amount of gas to allocate for the verification step                         |
| `preVerificationGas`            | `bigint` | Extra gas to pay the bunder                                                     |
| `maxFeePerGas`                  | `bigint` | Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas)                    |
| `maxPriorityFeePerGas`          | `bigint` | Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas) |
| `paymaster`                     | `string` | Address of paymaster contract, (or empty, if account pays for itself)           |
| `paymasterVerificationGasLimit` | `string` | The amount of gas to allocate for the paymaster post-operation code             |
| `paymasterPostOpGasLimit`       | `string` | The amount of gas to allocate for the paymaster post-operation code             |
| `paymasterData`                 | `string` | Data for paymaster (only if paymaster exists)                                   |
| `signature`                     | `string` | Data passed into the account to verify authorization                            |

| 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`       | `key	type	descriptionblockHash	string	The hash of the block in which the transaction was included.
blockNumber	bigint	The number of the block in which the transaction was included.
from	string	The address that initiated the transaction.
cumulativeGasUsed	bigint	The total amount of gas used in the block up to and including this transaction.
gasUsed	bigint	The amount of gas used by this transaction.
logs	string	Logs generated by the transaction.
logsBloom	string	The bloom filter for the logs generated by the transaction.
transactionHash	string	The unique hash of the transaction.
transactionIndex	bigint	The index of the transaction within the block.
effectiveGasPrice	bigint	The effective gas price for the transaction. This field is optional and may not be present in all receipts.` | The detailed receipt of the user operation.                               |

Example Response

```
sendUserOperationResponse: {
  userOperationHash: '0x61b3e2c57ad7ad1ae788f0ac84c79b28aab8aeaf872be173cadc72ab8b3d4418',
  bundler: { rpcUrl: 'https://api.candide.dev/public/v3/sepolia' },
  entrypointAddress: '0x0000000071727De22E5E9d8BAf0edAc6f37da032'
}

UserOperation sent. Waiting to be included...

receipt: {
  userOpHash: '0x395ddb51c0b76fd72796878d1008c8c9af897e944092bbc741b0a8def1a29984',
  entryPoint: '0x0000000071727De22E5E9d8BAf0edAc6f37da032',
  sender: '0xd785bb8a95a6a08ace0aa2e54aee5cf04694b1db',
  nonce: 19n,
  paymaster: '0x8b1f6cb5d062aa2ce8d581942bbb960420d875ba',
  actualGasCost: 16706333689468320n,
  actualGasUsed: 185340n,
  success: true,
  logs: '[{"address":"0x0000000071727de22e5e9d8baf0edac6f37da032","topics":["0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f","0x395ddb51c0b76fd72796878d1008c8c9af897e944092bbc741b0a8def1a29984","0x000000000000000000000000d785bb8a95a6a08ace0aa2e54aee5cf04694b1db","0x0000000000000000000000008b1f6cb5d062aa2ce8d581942bbb960420d875ba"],"data":"0x00000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000003b5a526d0f55a0000000000000000000000000000000000000000000000000000000000002d3fc","blockNumber":"0x65e483","transactionHash":"0xdf4f976eb8148d14ded74c3f1b21666250be9ae836aa42fb97a3e5ba23f6bf8e","transactionIndex":"0x5d","blockHash":"0x0f306649579021da8b4447bdfcf24b050bacc162ddb756c1d003ab2dd7a0ad9f","logIndex":"0x79","removed":false}]',
  receipt: {
    blockHash: '0x0f306649579021da8b4447bdfcf24b050bacc162ddb756c1d003ab2dd7a0ad9f',
    blockNumber: 6677635n,
    from: '0x3cfdc212769c890907bce93d3d8c2c53de6a7a89',
    cumulativeGasUsed: 10239342n,
    gasUsed: 175887n,
    logs: '[{"address":"0x0000000071727de22e5e9d8baf0edac6f37da032","topics":["0xbb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972"],"data":"0x","blockNumber":"0x65e483","transactionHash":"0xdf4f976eb8148d14ded74c3f1b21666250be9ae836aa42fb97a3e5ba23f6bf8e","transactionIndex":"0x5d","blockHash":"0x0f306649579021da8b4447bdfcf24b050bacc162ddb756c1d003ab2dd7a0ad9f","logIndex":"0x74","removed":false},{"address":"0xd785bb8a95a6a08ace0aa2e54aee5cf04694b1db","topics":["0xb648d3644f584ed1c2232d53c46d87e693586486ad0d1175f8656013110b714e"],"data":"0x00000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c2260000000000000000000000009a7af758ae5d7b6aae84fe4c5ba67c041dfe5336000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000246a627842000000000000000000000000d785bb8a95a6a08ace0aa2e54aee5cf04694b1db00000000000000000000000000000000000000000000000000000000","blockNumber":"0x65e483","transactionHash":"0xdf4f976eb8148d14ded74c3f1b21666250be9ae836aa42fb97a3e5ba23f6bf8e","transactionIndex":"0x5d","blockHash":"0x0f306649579021da8b4447bdfcf24b050bacc162ddb756c1d003ab2dd7a0ad9f","logIndex":"0x75","removed":false},{"address":"0x9a7af758ae5d7b6aae84fe4c5ba67c041dfe5336","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000d785bb8a95a6a08ace0aa2e54aee5cf04694b1db","0x0000000000000000000000000000000000000000000000000000000000000508"],"data":"0x","blockNumber":"0x65e483","transactionHash":"0xdf4f976eb8148d14ded74c3f1b21666250be9ae836aa42fb97a3e5ba23f6bf8e","transactionIndex":"0x5d","blockHash":"0x0f306649579021da8b4447bdfcf24b050bacc162ddb756c1d003ab2dd7a0ad9f","logIndex":"0x76","removed":false},{"address":"0xd785bb8a95a6a08ace0aa2e54aee5cf04694b1db","topics":["0x6895c13664aa4f67288b25d7a21d7aaa34916e355fb9b6fae0a139a9085becb8","0x00000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c226"],"data":"0x","blockNumber":"0x65e483","transactionHash":"0xdf4f976eb8148d14ded74c3f1b21666250be9ae836aa42fb97a3e5ba23f6bf8e","transactionIndex":"0x5d","blockHash":"0x0f306649579021da8b4447bdfcf24b050bacc162ddb756c1d003ab2dd7a0ad9f","logIndex":"0x77","removed":false},{"address":"0x8b1f6cb5d062aa2ce8d581942bbb960420d875ba","topics":["0xa050a122b4c0e369e3385eb6b7cccd8019638b2764de67bec0af99130ddf8471","0x395ddb51c0b76fd72796878d1008c8c9af897e944092bbc741b0a8def1a29984","0x000000000000000000000000d785bb8a95a6a08ace0aa2e54aee5cf04694b1db","0x0000000000000000000000000000000000000000000000000000000000000000"],"data":"0x0000000000000000000000000000000000000000000000000000000000000000","blockNumber":"0x65e483","transactionHash":"0xdf4f976eb8148d14ded74c3f1b21666250be9ae836aa42fb97a3e5ba23f6bf8e","transactionIndex":"0x5d","blockHash":"0x0f306649579021da8b4447bdfcf24b050bacc162ddb756c1d003ab2dd7a0ad9f","logIndex":"0x78","removed":false},{"address":"0x0000000071727de22e5e9d8baf0edac6f37da032","topics":["0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f","0x395ddb51c0b76fd72796878d1008c8c9af897e944092bbc741b0a8def1a29984","0x000000000000000000000000d785bb8a95a6a08ace0aa2e54aee5cf04694b1db","0x0000000000000000000000008b1f6cb5d062aa2ce8d581942bbb960420d875ba"],"data":"0x00000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000003b5a526d0f55a0000000000000000000000000000000000000000000000000000000000002d3fc","blockNumber":"0x65e483","transactionHash":"0xdf4f976eb8148d14ded74c3f1b21666250be9ae836aa42fb97a3e5ba23f6bf8e","transactionIndex":"0x5d","blockHash":"0x0f306649579021da8b4447bdfcf24b050bacc162ddb756c1d003ab2dd7a0ad9f","logIndex":"0x79","removed":false}]',
    logsBloom: '0x0000000000111000000010000000000000200000000000000000000002000000000800040000020000000001000040000000000000000000800002000000000020000000020000000000000c000000000040000010000000000000000000000000000000020800000000000000000800000000000000200000000010000000000000000020100000000000000800000020000000000000008000000004000000000040100000000800400080000000000200000040000000000002000000000000000002000000400001000000000000000000000020000000100000000020000000200000000000000200000000000200000000000000000000000010000000',
    transactionHash: '0xdf4f976eb8148d14ded74c3f1b21666250be9ae836aa42fb97a3e5ba23f6bf8e',
    transactionIndex: 93n,
    effectiveGasPrice: 50000149713n
  }
}
```

#### Source code[​](#source-code-3 "Direct link to Source code")

[sendUserOperation](https://github.com/candidelabs/abstractionkit/blob/98853f30861382a534abf667ced83d47b6c9da0b/src/account/Safe/SafeAccount.ts#L681)

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

The **Advanced** methods offer fine control and customization, catering to developers who require detailed configurations for their specific requirements.

### createAccountAddress[​](#createaccountaddress "Direct link to createAccountAddress")

Calculates the Account address from the initial owners

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

In this example, we initiate a single owner account.

* example.ts
* Param Types
* Return Type

example.ts

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

const ownerPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31";
const safeAddress = SafeAccount.createAccountAddress(
    [ownerPublicAddress],
);

console.log("Account address (sender): " + safeAddress);
```

| key                 | type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | description                                                                                                |
| :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------------- |
| `owners[]`          | `key	type	descriptionSigner	ECDSAPublicAddress \| WebauthnPublicKey	Signer type which can be either an ECDSA public address or a Webauthn public key`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Pass the owner(s) address(es) of the account. It can be a single owner account, a multi-sig, or a WebAuthn |
| `initCodeOverrides` | `key	type	descriptionthreshold?	number	Signature threshold, defines how many signatures are required. Default is 1.
c2Nonce?	bigint	Create2 nonce used to generate different sender addresses from the same owners. Default is 0.
entrypointAddress?	string	Address of the entry point for transactions or contracts.
safe4337ModuleAddress?	string	Address of the Safe 4337 module.
safeModuleSetupddress?	string	Address used for setting up the Safe module.
safeAccountSingleton?	SafeAccountSingleton	Safe contract singleton address. Default is "0x29fcB43b46531BcA003ddC8FCB67FFE91900C762".
safeAccountFactoryAddress?	string	Address of the Safe Factory. Default is "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67".
multisendContractAddress?	string	Address of the Safe 4337 multisend contract. Default is "0xa581c4A4DB7175302464fF3C06380BC3270b4037".
webAuthnSharedSigner?	string	Shared signer used for WebAuthn-based authentication.
eip7212WebAuthnPrecompileVerifierForSharedSigner?	string	Verifier contract for WebAuthn precompile, related to the shared signer.
eip7212WebAuthnContractVerifierForSharedSigner?	string	Contract verifier for WebAuthn-based shared signer, compliant with EIP-7212.` | Override values to change the initialization default values                                                |

| key              | type     | description                             |
| :--------------- | :------- | :-------------------------------------- |
| `ECDSASignature` | `string` | ECDSA signature represented as a string |

WebauthnPublicKey

| key                 | type               | description                                                               |
| :------------------ | :----------------- | :------------------------------------------------------------------------ |
| `authenticatorData` | `ArrayBuffer`      | Binary data returned by the authenticator during the Webauthn process     |
| `clientDataFields`  | `string`           | Fields associated with the client's Webauthn request data                 |
| `rs`                | `[bigint, bigint]` | Array of two bigints representing the 'r' and 's' values of the signature |

| key                     | type     | description           |
| :---------------------- | :------- | :-------------------- |
| `Smart Account Address` | `string` | Smart Account Address |

Example Response

```
Account address(sender) : 0x1a02592A3484c2077d2E5D24482497F85e1980C6
```

#### Source code[​](#source-code-4 "Direct link to Source code")

[createAccountAddress](https://github.com/candidelabs/abstractionkit/blob/98853f30861382a534abf667ced83d47b6c9da0b/src/account/Safe/SafeAccountV0_3_0.ts#L41)

### createFactoryAddressAndData[​](#createfactoryaddressanddata "Direct link to createFactoryAddressAndData")

Create an account factory address and factory data

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

In this example, we initiate a single owner account.

* example.ts
* Param Types
* Return Type

example.ts

```
import { SafeAccountV0_3_0 as SafeAccount } from "abstractionkit";

const ownerPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31";
let [factoryAddress, factoryData] = SafeAccount.createFactoryAddressAndData(
    [ownerPublicAddress],
);

console.log("factoryAddress: " + factoryAddress);
console.log("factoryData: ", factoryData);
```

| key                  | type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | description                                                                                                |
| :------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------------- |
| `owners[]`           | `key	type	descriptionSigner	ECDSAPublicAddress \| WebauthnPublicKey	Signer type which can be either an ECDSA public address or a Webauthn public key`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Pass the owner(s) address(es) of the account. It can be a single owner account, a multi-sig, or a WebAuthn |
| `initCodeOverrides?` | `key	type	descriptionthreshold?	number	Signature threshold, defines how many signatures are required. Default is 1.
c2Nonce?	bigint	Create2 nonce used to generate different sender addresses from the same owners. Default is 0.
entrypointAddress?	string	Address of the entry point for transactions or contracts.
safe4337ModuleAddress?	string	Address of the Safe 4337 module.
safeModuleSetupddress?	string	Address used for setting up the Safe module.
safeAccountSingleton?	SafeAccountSingleton	Safe contract singleton address. Default is "0x29fcB43b46531BcA003ddC8FCB67FFE91900C762".
safeAccountFactoryAddress?	string	Address of the Safe Factory. Default is "0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67".
multisendContractAddress?	string	Address of the Safe 4337 multisend contract. Default is "0xa581c4A4DB7175302464fF3C06380BC3270b4037".
webAuthnSharedSigner?	string	Shared signer used for WebAuthn-based authentication.
eip7212WebAuthnPrecompileVerifierForSharedSigner?	string	Verifier contract for WebAuthn precompile, related to the shared signer.
eip7212WebAuthnContractVerifierForSharedSigner?	string	Contract verifier for WebAuthn-based shared signer, compliant with EIP-7212.` | Override values to change the initialization default values                                                |

| key              | type     | description                             |
| :--------------- | :------- | :-------------------------------------- |
| `ECDSASignature` | `string` | ECDSA signature represented as a string |

WebauthnPublicKey

| key                 | type               | description                                                               |
| :------------------ | :----------------- | :------------------------------------------------------------------------ |
| `authenticatorData` | `ArrayBuffer`      | Binary data returned by the authenticator during the Webauthn process     |
| `clientDataFields`  | `string`           | Fields associated with the client's Webauthn request data                 |
| `rs`                | `[bigint, bigint]` | Array of two bigints representing the 'r' and 's' values of the signature |

| key               | type     | description              |
| :---------------- | :------- | :----------------------- |
| `factory address` | `string` | The Safe factory address |
| `factory data`    | `string` | The factory data         |

Example Response

```
factoryAddress: 0x4e1DCf7AD4e460CfD30791CCC4F9c8a4f820ec67
factoryData:  0x1688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c7620000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e4b63e800d000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b47000000000000000000000000000000000000000000000000000000000000014000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c2260000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000bdbc5fbc9ca8c3f514d073ec3de840ac84fc6d3100000000000000000000000000000000000000000000000000000000000000648d0dc49f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c2260000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
```

#### Source code[​](#source-code-5 "Direct link to Source code")

[createFactoryAddressAndData](https://github.com/candidelabs/abstractionkit/blob/98853f30861382a534abf667ced83d47b6c9da0b/src/account/Safe/SafeAccountV0_3_0.ts#L188)

### createInitializerCallData[​](#createinitializercalldata "Direct link to createInitializerCallData")

Creates the initializer calldata

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

* Example
* Param Types
* Return Types

```
import { SafeAccountV0_3_0 as SafeAccount } from "abstractionkit";

const initializeCallData = SafeAccount.createInitializerCallData(
  [ownerPublicAddress], // owners
  1, //threshold
);
console.log("initializeCallData: " + initializeCallData);
```

| key          | type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | description                                                                                                |
| :----------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------- |
| `owners[]`   | `key	type	descriptionSigner	ECDSAPublicAddress \| WebauthnPublicKey	Signer type which can be either an ECDSA public address or a Webauthn public key`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Pass the owner(s) address(es) of the account. It can be a single owner account, a multi-sig, or a WebAuthn |
| `threshold`  | `number`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Pass the owner(s) address(es) of the account. It can be a single owner account, a multi-sig, or a WebAuthn |
| `overrides?` | `key	type	descriptionsafe4337ModuleAddress?	string	Address of the Safe 4337 module.
safeModuleSetupddress?	string	Address used for setting up the Safe module.
multisendContractAddress?	string	Address of the Safe 4337 multisend contract. Default is "0xa581c4A4DB7175302464fF3C06380BC3270b4037".
webAuthnSharedSigner?	string	Shared signer used for WebAuthn-based authentication.
eip7212WebAuthnPrecompileVerifierForSharedSigner?	string	Verifier contract for WebAuthn precompile, related to the shared signer.
eip7212WebAuthnContractVerifierForSharedSigner?	string	Contract verifier for WebAuthn-based shared signer, compliant with EIP-7212.` | Override values to change the initialization default values                                                |

| key              | type     | description                             |
| :--------------- | :------- | :-------------------------------------- |
| `ECDSASignature` | `string` | ECDSA signature represented as a string |

WebauthnPublicKey

| key                 | type               | description                                                               |
| :------------------ | :----------------- | :------------------------------------------------------------------------ |
| `authenticatorData` | `ArrayBuffer`      | Binary data returned by the authenticator during the Webauthn process     |
| `clientDataFields`  | `string`           | Fields associated with the client's Webauthn request data                 |
| `rs`                | `[bigint, bigint]` | Array of two bigints representing the 'r' and 's' values of the signature |

| key        | type     | description              |
| :--------- | :------- | :----------------------- |
| `calldata` | `string` | The initializer calldata |

Example Response

```
initializeCallData: 0xb63e800d000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002dd68b007b46fbe91b9a7c3eda5a7a1063cb5b47000000000000000000000000000000000000000000000000000000000000014000000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c2260000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000bdbc5fbc9ca8c3f514d073ec3de840ac84fc6d3100000000000000000000000000000000000000000000000000000000000000648d0dc49f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000075cf11467937ce3f2f357ce24ffc3dbf8fd5c22600000000000000000000000000000000000000000000000000000000
```

#### Source[​](#source "Direct link to Source")

[createInitializerCallData](https://github.com/candidelabs/abstractionkit/blob/98853f30861382a534abf667ced83d47b6c9da0b/src/account/Safe/SafeAccountV0_3_0.ts#L151)

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

Encode calldata for a single MetaTransaction to be executed by Safe account

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

In this example, we make a transfer of 1 wei to a random address.

* example.ts
* Param Types
* Return Type

example.ts

```
import { SafeAccountV0_3_0 as SafeAccount } from "abstractionkit";

const ownerPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31";
const smartAccount = SafeAccount.initializeNewAccount([ownerPublicAddress]);

const callData = smartAccount.createAccountCallDataSingleTransaction({
  to: "0x1a02592A3484c2077d2E5D24482497F85e1980C6",
  value: 1,
  data: "0x",
});

console.log("callData: " + callData);
```

| key                                  | type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | description                                                                    |
| :----------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------- |
| `metaTransaction`                    | `key	type	descriptionMetaTransaction	key	type	descriptionto	string	To address, or the the target contract address for the transaction
value	BigNumberish	Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens)
data	BytesLike	The call data for the transaction
operation	Operation: enum	Default to 0 for a Call. 1 for a Delegate Call. (Optional)	MetaTransaction is the type of transaction to construct a Safe operation.` | The MetaTransaction to create calldata for                                     |
| `safeModuleExecutorFunctionSelector` | `key	type	descriptionexecuteUserOpWithErrorString	0x541d63c8	The MetaTransaction to create calldata for
executeUserOp	0x7bb37428	The MetaTransaction to create calldata for`                                                                                                                                                                                                                                                                                                                        | Safe has two executor functions executeUserOpWithErrorString and executeUserOp |

| key        | type     | description                                                                |
| :--------- | :------- | :------------------------------------------------------------------------- |
| `callData` | `string` | CallData to be includes in the user operation to send a single transaction |

Example Response

```
callData : 0xf34308ef000000000000000000000000b4fbf271143f4fbf7b91a5ded31805e42b2208d6000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
```

#### Source code[​](#source-code-6 "Direct link to Source code")

[createAccountCallDataSingleTransaction](https://github.com/candidelabs/abstractionkit/blob/98853f30861382a534abf667ced83d47b6c9da0b/src/account/Safe/SafeAccount.ts#L174)

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

Encode calldata for a list of MetaTransactions to be executed by Safe account

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

In this example, we make a transfer to 2 different random addresses, 1 wei each.

* example.ts
* Param Types
* Return Type

example.ts

```
import {
  SafeAccountV0_3_0 as SafeAccount,
  MetaTransaction,
} from "abstractionkit";

const ownerPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31";
const smartAccount = SafeAccount.initializeNewAccount([ownerPublicAddress]);

const tx1: MetaTransaction = {
  to: "0x1a02592A3484c2077d2E5D24482497F85e1980C6",
  value: 1,
  data: "0x",
};
const tx2: MetaTransaction = {
  to: "0x3fe285dcd76bcce4ac92d38a6f2f8e964041e020",
  value: 1,
  data: "0x",
};

const callData = SafeAccount.createAccountCallDataBatchTransactions([tx1, tx2]);

console.log("callData: " + callData);
```

| key                                  | type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | description                                                                    |
| :----------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------- |
| `metaTransaction[]`                  | `key	type	descriptionMetaTransaction	key	type	descriptionto	string	To address, or the the target contract address for the transaction
value	BigNumberish	Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens)
data	BytesLike	The call data for the transaction
operation	Operation: enum	Default to 0 for a Call. 1 for a Delegate Call. (Optional)	MetaTransaction is the type of transaction to construct a Safe operation.` | The MetaTransaction to create calldata for                                     |
| `safeModuleExecutorFunctionSelector` | `key	type	descriptionexecuteUserOpWithErrorString	0x541d63c8	The MetaTransaction to create calldata for
executeUserOp	0x7bb37428	The MetaTransaction to create calldata for`                                                                                                                                                                                                                                                                                                                        | Safe has two executor functions executeUserOpWithErrorString and executeUserOp |

| key        | type     | description                                                                |
| :--------- | :------- | :------------------------------------------------------------------------- |
| `callData` | `string` | CallData to be includes in the user operation to send a single transaction |

Example Response

```
callData : 0xf34308ef000000000000000000000000b4fbf271143f4fbf7b91a5ded31805e42b2208d6000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
```

#### Source code[​](#source-code-7 "Direct link to Source code")

[createAccountCallDataBatchTransactions](https://github.com/candidelabs/abstractionkit/blob/98853f30861382a534abf667ced83d47b6c9da0b/src/account/Safe/SafeAccount.ts#L209C16-L209C54)

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

Estimate gas limits for a userOperation

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

* example.ts
* Param Types
* Response Type

```
import { 
  SafeAccountV0_3_0 as SafeAccount, 
  UserOperationV7
} from "abstractionkit";

const bundlerRPC = "https://api.candide.dev/public/v3/sepolia";

const ownerPublicAddress = "0xBdbc5FBC9cA8C3F514D073eC3de840Ac84FC6D31";
const smartAccount = SafeAccount.initializeNewAccount([ownerPublicAddress])

// Use createUserOperation() to help you construct the userOp below
const userOperation:UserOperationV7 = {..}

const [preVerificationGas, verificationGasLimit, callGasLimit] = await estimateUserOperationGas(userOperation, bundlerRPC);
```

| key             | type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | description                       |
| :-------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------- |
| `userOperation` | `UserOperationV7`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | userOperation to send             |
| `bundlerRpc`    | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | bundler rpc to send userOperation |
| `overrides?`    | `key	type	descriptionstateOverrideSet?	key	type	description[address: string]	key	type	descriptionbalance	bigint	Override the balance of the address
nonce	bigint	Override the nonce of the address
code	string	Override the code of the address
state	Dictionary<string>	Override the storage slots of the address
stateDiff	Dictionary<string>	Apply state differences to the storage slots of the address	Overrides for a specific address	Timestamp the signature will be valid after
dummySignerSignaturePairs?	key	type	descriptionSignerSignaturePair[]	key	type	descriptionSigner	ECDSAPublicAddress \| WebauthnPublicKey	Signer type which can be either an ECDSA public address or a Webauthn public key
signature	string	signature
isContractSignature	boolean	isContractSignature	Signature Pair	Provide dummy signatures for the operation
expectedSigners?	key	type	descriptionSigner	ECDSAPublicAddress \| WebauthnPublicKey	Signer type which can be either an ECDSA public address or a Webauthn public key	The expected signers that will sign over the transaction. This improves the gas estimates.` | overrides for the default values  |

UserOperationV7

| key                             | type     | description                                                                     |
| :------------------------------ | :------- | :------------------------------------------------------------------------------ |
| `sender`                        | `string` | The account making the operation                                                |
| `nonce`                         | `string` | Anti-replay parameter (see “Semi-abstracted Nonce Support” )                    |
| `factory`                       | `string` | account factory, only for new accounts                                          |
| `factoryData`                   | `string` | data for account factory (only if account factory exists)                       |
| `callData`                      | `string` | The data to pass to the sender during the main execution call                   |
| `callGasLimit`                  | `bigint` | The amount of gas to allocate the main execution call                           |
| `verificationGasLimit`          | `bigint` | The amount of gas to allocate for the verification step                         |
| `preVerificationGas`            | `bigint` | Extra gas to pay the bunder                                                     |
| `maxFeePerGas`                  | `bigint` | Maximum fee per gas (similar to EIP-1559 max\_fee\_per\_gas)                    |
| `maxPriorityFeePerGas`          | `bigint` | Maximum priority fee per gas (similar to EIP-1559 max\_priority\_fee\_per\_gas) |
| `paymaster`                     | `string` | Address of paymaster contract, (or empty, if account pays for itself)           |
| `paymasterVerificationGasLimit` | `string` | The amount of gas to allocate for the paymaster post-operation code             |
| `paymasterPostOpGasLimit`       | `string` | The amount of gas to allocate for the paymaster post-operation code             |
| `paymasterData`                 | `string` | Data for paymaster (only if paymaster exists)                                   |
| `signature`                     | `string` | Data passed into the account to verify authorization                            |

| key              | type     | description                             |
| :--------------- | :------- | :-------------------------------------- |
| `ECDSASignature` | `string` | ECDSA signature represented as a string |

WebauthnPublicKey

| key                 | type               | description                                                               |
| :------------------ | :----------------- | :------------------------------------------------------------------------ |
| `authenticatorData` | `ArrayBuffer`      | Binary data returned by the authenticator during the Webauthn process     |
| `clientDataFields`  | `string`           | Fields associated with the client's Webauthn request data                 |
| `rs`                | `[bigint, bigint]` | Array of two bigints representing the 'r' and 's' values of the signature |

| Parameter     | Type                               | Description                                                                         |
| :------------ | :--------------------------------- | :---------------------------------------------------------------------------------- |
| gas estimates | Promise<\[bigint, bigint, bigint]> | Returns the gas estimates of preVerificationGas, verificationGasLimit, callGasLimit |

Example Response

```
[ 46840n, 64545n, 102761n ]
```

#### Source code[​](#source-code-8 "Direct link to Source code")

[estimateUserOperationGas](https://github.com/candidelabs/abstractionkit/blob/98853f30861382a534abf667ced83d47b6c9da0b/src/account/Safe/SafeAccount.ts#L1002)

### getUserOperationEip712Hash[​](#getuseroperationeip712hash "Direct link to getUserOperationEip712Hash")

Create a userOperation eip712 hash

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

* example
* Param Types
* Return Types

example

```
import { 
  SafeAccountV0_3_0 as SafeAccount, 
  UserOperationV7
} from "abstractionkit";

const userOperation: UserOperationV7 = smartAccount.createUserOperation(..)

const safeUserOpHash = SafeAccount.getUserOperationEip712Hash(userOperation, chainId);

console.log(safeUserOpHash);
```

| key             | type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | description                      |
| :-------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------- |
| `userOperation` | `key	type	descriptionsender	string	The account making the operation
nonce	string	Anti-replay parameter (see “Semi-abstracted Nonce Support” )
factory	string	account factory, only for new accounts
factoryData	string	data for account factory (only if account factory exists)
callData	string	The data to pass to the sender during the main execution call
callGasLimit	bigint	The amount of gas to allocate the main execution call
verificationGasLimit	bigint	The amount of gas to allocate for the verification step
preVerificationGas	bigint	Extra gas to pay the bunder
maxFeePerGas	bigint	Maximum fee per gas (similar to EIP-1559 max_fee_per_gas)
maxPriorityFeePerGas	bigint	Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas)
paymaster	string	Address of paymaster contract, (or empty, if account pays for itself)
paymasterVerificationGasLimit	string	The amount of gas to allocate for the paymaster post-operation code
paymasterPostOpGasLimit	string	The amount of gas to allocate for the paymaster post-operation code
paymasterData	string	Data for paymaster (only if paymaster exists)
signature	string	Data passed into the account to verify authorization` | UserOperation to hash            |
| `chainId`       | `bigint`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | target chain id                  |
| `overrides?`    | `key	type	descriptionvalidAfter?	bigint	Timestamp the signature will be valid after
validUntil?	bigint	Timestamp the signature will be valid until
entrypointAddress?	string	Target entrypoint. Defaults to EP v0.6
safe4337ModuleAddress?	string	Defaults to official 4337 safe module address`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Overrides for the default values |

| key             | type     | description        |
| :-------------- | :------- | :----------------- |
| `userOperation` | `string` | userOperation hash |

Example Response

```
0xec030c825b12b398c10f1b552004e43ec753fdf001e1c1daa1ceffe4f7ff5056
```

#### Source[​](#source-1 "Direct link to Source")

[getUserOperationEip712Hash](https://github.com/candidelabs/abstractionkit/blob/98853f30861382a534abf667ced83d47b6c9da0b/src/account/Safe/SafeAccountV0_3_0.ts#L124)

### formatEip712SignaturesToUseroperationSignature[​](#formateip712signaturestouseroperationsignature "Direct link to formatEip712SignaturesToUseroperationSignature")

A static method to format a list of eip712 signatures to a userOperation signature.

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

* ethers example
* viem example
* Param Types
* Response Type

```
import { SafeAccountV0_3_0 as SafeAccount } from "abstractionkit";
import { Wallet } from "ethers";

const ownerPrivateKey = process.env.PRIVATE_KEY as string;
const signer = new Wallet(ownerPrivateKey);
const ownerPublicAddress = signer.address;

const smartAccount = SafeAccount.initializeNewAccount([ownerPublicAddress]);

let userOperation = ... // smartAccount.createUserOperation(..)

const safeUserOpHash = SafeAccount.getUserOperationEip712Hash(userOperation, chainId);
const signature = signer.signingKey.sign(safeUserOpHash).serialized;

const formatedSig = SafeAccount.formatEip712SignaturesToUseroperationSignature([ownerPublicAddress], [signature]);
userOperation.signature = formatedSig;
```

```
import { SafeAccountV0_3_0 as SafeAccount } from "abstractionkit";
import { privateKeyToAccount } from "viem";

const ownerPrivateKey = process.env.PRIVATE_KEY as string;
const signer = privateKeyToAccount(process.env.PRIVATE_KEY1 as `0x${string}`);
const ownerPublicAddress = signer.address;

const smartAccount = SafeAccount.initializeNewAccount([ownerPublicAddress]);

let userOperation = ... // smartAccount.createUserOperation(..)

const chainId = BigInt(process.env.CHAIN_ID as string);
const safeUserOpHash = SafeAccount.getUserOperationEip712Hash(
  userOperation,
  chainId
) as `0x${string}`;

const signature = await signer.sign({ hash: safeUserOpHash });

const formatedSig = SafeAccount.formatEip712SignaturesToUseroperationSignature([ownerPublicAddress], [signature]);
userOperation.signature = formatedSig;
```

| key                | type                                                                                                                                         | description                                |
| :----------------- | :------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------- |
| `signersAddresses` | `string[]`                                                                                                                                   | Provide dummy signatures for the operation |
| `signatures`       | `string[]`                                                                                                                                   | Provide dummy signatures for the operation |
| `overrides?`       | `key	type	descriptionvalidAfter?	bigint	Timestamp the signature will be valid after
validUntil?	bigint	Timestamp the signature will be valid until` | overrides for the default values           |

| key         | type     | description           |
| :---------- | :------- | :-------------------- |
| `signature` | `string` | The EIP-712 Signature |

Example Response

```
0x0000000000000000000000006da39f6f7b0d2c0035084d3c313350697b3167ff591a84bf0b4bb4741224b5d226682ec306544c091e2b6535042c900b459282edfe98e393d552963ca8db11731c
```

#### Source code[​](#source-code-9 "Direct link to Source code")

[formatEip712SignaturesToUseroperationSignature](https://github.com/candidelabs/abstractionkit/blob/98853f30861382a534abf667ced83d47b6c9da0b/src/account/Safe/SafeAccount.ts#L436)

### isModuleEnabled[​](#ismoduleenabled "Direct link to isModuleEnabled")

Checks if a specified module is enabled for a given Safe account. This function returns a boolean indicating the module's status.

* Param Types
* Return Types

| key             | type     | description                                |
| :-------------- | :------- | :----------------------------------------- |
| `nodeRpcUrl`    | `string` | The JSON-RPC API url for the target chain. |
| `moduleAddress` | `string` | The module address to check if enabled.    |

| key         | type      | description                                        |
| :---------- | :-------- | :------------------------------------------------- |
| `isEnabled` | `boolean` | Indicates whether the specified module is enabled. |

### createAddOwnerWithThresholdMetaTransactions[​](#createaddownerwiththresholdmetatransactions "Direct link to createAddOwnerWithThresholdMetaTransactions")

Creates a meta-transaction to add a new owner to the Safe account with a specified threshold. This function returns an object containing the meta-transaction details, including the target address, encoded data, and transaction value.

* Param Types
* Return Types

| key         | type                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | description                                                        |
| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------------- |
| `newOwner`  | `key	type	descriptionSigner	ECDSAPublicAddress \| WebauthnPublicKey	Signer type which can be either an ECDSA public address or a Webauthn public key`                                                                                                                                                                                                                                                                                                                         | The public address of the new owner to be added                    |
| `threshold` | `number`                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | The new threshold value for owner confirmations.                   |
| `overrides` | `key	type	descriptionnodeRpcUrl	string?	The JSON-RPC API url for the target chain, to check if the new webauthn owner is deployed or not
eip7212WebAuthnPrecompileVerifier	string?	Address for the EIP-7212 WebAuthn precompile verifier.
eip7212WebAuthnContractVerifier	string?	Address for the EIP-7212 WebAuthn contract verifier.
webAuthnSignerFactory	string?	Address for the WebAuthn signer factory.
webAuthnSignerSingleton	string?	Address for the WebAuthn signer singleton.` | Optional Overrides for the default values used in the transaction. |

| key                          | type                                                                                                                                                                                                                                                  | description                                                                      |
| :--------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------- |
| `Promise<MetaTransaction[]>` | `key	type	descriptionto	string	The target address for the meta-transaction (Safe account address).
data	string	The encoded function call data for adding an owner.
value	bigint	The value to be sent with the meta-transaction, set to zero for this function.` | The meta-transaction object for adding a new owner with the specified threshold. |

### createSwapOwnerMetaTransactions[​](#createswapownermetatransactions "Direct link to createSwapOwnerMetaTransactions")

Creates a meta-transaction to swap an owner in the Safe account. If a new owner verifier is not already deployed, it will deploy one and fetch the previous owner automatically. This function returns a promise that resolves to a list of meta-transactions containing the necessary details for the swap and deployment.

* Param Types
* Return Types

| key          | type                                                                                                                                                                                                                                                                                                                                                                                                                                     | description                                                            |
| :----------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------- |
| `nodeRpcUrl` | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                 | The JSON-RPC API URL for the target chain to fetch the previous owner. |
| `newOwner`   | `key	type	descriptionSigner	ECDSAPublicAddress \| WebauthnPublicKey	Signer type which can be either an ECDSA public address or a Webauthn public key`                                                                                                                                                                                                                                                                                        | The public address of the new owner to be added.                       |
| `oldOwner`   | `Signer`                                                                                                                                                                                                                                                                                                                                                                                                                                 | The public address of the owner to be replaced.                        |
| `overrides`  | `key	type	descriptionprevOwner	string	If set, it will be used as the previous owner instead of fetching it.
eip7212WebAuthnPrecompileVerifier	string	Address for the EIP-7212 WebAuthn precompile verifier.
eip7212WebAuthnContractVerifier	string	Address for the EIP-7212 WebAuthn contract verifier.
webAuthnSignerFactory	string	Address for the WebAuthn signer factory.
webAuthnSignerSingleton	string	Address for the WebAuthn signer singleton.` | Overrides for the default values used in the transaction.              |

| key                 | type                                                                                                                                                                                                                                                                | description                                                                                                                      |
| :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------- |
| `MetaTransaction[]` | `key	type	descriptionto	string	The target address for each meta-transaction (Safe account address).
data	string	The encoded function call data for the swap owner transaction.
value	bigint	The value to be sent with the meta-transaction, set to zero for these functions.` | A promise that resolves to a list of meta-transactions for swapping the specified owner and deploying the verifier if necessary. |

### createRemoveOwnerMetaTransaction[​](#createremoveownermetatransaction "Direct link to createRemoveOwnerMetaTransaction")

Creates a meta-transaction to remove an owner from the Safe account, fetching the previous owner if not provided. This function returns a promise that resolves to a meta-transaction object containing the necessary details for the removal.

* Param Types
* Return Types

| key             | type                                                                                                                                                                                                                                                                                                                                                                                                                                     | description                                                            |
| :-------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------- |
| `nodeRpcUrl`    | `string`                                                                                                                                                                                                                                                                                                                                                                                                                                 | The JSON-RPC API URL for the target chain to fetch the previous owner. |
| `ownerToDelete` | `key	type	descriptionSigner	ECDSAPublicAddress \| WebauthnPublicKey	Signer type which can be either an ECDSA public address or a Webauthn public key`                                                                                                                                                                                                                                                                                        | The public address of the owner to be deleted.                         |
| `threshold`     | `number`                                                                                                                                                                                                                                                                                                                                                                                                                                 | The new threshold value for owner confirmations after removal.         |
| `overrides`     | `key	type	descriptionprevOwner	string	If set, it will be used as the previous owner instead of fetching it.
eip7212WebAuthnPrecompileVerifier	string	Address for the EIP-7212 WebAuthn precompile verifier.
eip7212WebAuthnContractVerifier	string	Address for the EIP-7212 WebAuthn contract verifier.
webAuthnSignerFactory	string	Address for the WebAuthn signer factory.
webAuthnSignerSingleton	string	Address for the WebAuthn signer singleton.` | Optional Overrides for the default values used in the transaction.     |

| key               | type                                                                                                                                                                                                                                                     | description                                                                              |
| :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------- |
| `MetaTransaction` | `key	type	descriptionto	string	The target address for the meta-transaction (Safe account address).
data	string	The encoded function call data for removing the owner.
value	bigint	The value to be sent with the meta-transaction, set to zero for this function.` | A promise that resolves to the meta-transaction object for removing the specified owner. |

### createDisableModuleMetaTransaction[​](#createdisablemodulemetatransaction "Direct link to createDisableModuleMetaTransaction")

Creates a meta-transaction to disable a module from the Safe account. The function automatically fetches the previous module address in the linked list if not provided in the overrides. This function returns a promise that resolves to a meta-transaction object containing the necessary details for disabling the module.

* Param Types
* Return Types

| key                      | type                                                                                                                                                                                                                                                        | description                                                                     |
| :----------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------ |
| `nodeRpcUrl`             | `string`                                                                                                                                                                                                                                                    | The JSON-RPC API URL for the target chain to fetch the previous module address. |
| `moduleToDisableAddress` | `string`                                                                                                                                                                                                                                                    | The address of the module to be disabled.                                       |
| `accountAddress`         | `string`                                                                                                                                                                                                                                                    | The Safe account address for which to disable the module.                       |
| `overrides`              | `key	type	descriptionprevModuleAddress	string	If set, it will be used as the previous module address instead of fetching it.
modulesStart	string	Starting address for the module pagination query.
modulesPageSize	bigint	Page size for the module pagination query.` | Optional overrides for the default values used in the transaction.              |

| key               | type                                                                                                                                                                                                                                                       | description                                                                                |
| :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------- |
| `MetaTransaction` | `key	type	descriptionto	string	The target address for the meta-transaction (Safe account address).
data	string	The encoded function call data for disabling the module.
value	bigint	The value to be sent with the meta-transaction, set to zero for this function.` | A promise that resolves to the meta-transaction object for disabling the specified module. |

### verifyWebAuthnSignatureForMessageHash[​](#verifywebauthnsignatureformessagehash "Direct link to verifyWebAuthnSignatureForMessageHash")

A static method that verifies a webAuthn signed hash message for Passkeys, and can be also used even if the safe account hasn't been deployed yet.

* Param Types
* Return Types

| key                 | type                                                                                                                                                                                                                                                               | description                                              |
| :------------------ | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------- |
| `nodeRpcUrl`        | `string`                                                                                                                                                                                                                                                           | The JSON-RPC API url for the target chain.               |
| `webAuthnPublicKey` | `key	type	descriptionx	bigint	The x coordinate of the webAuthn public key
y	bigint	The y coordinate of the webAuthn public key`                                                                                                                                           | The x and y coordinates of the webAuthn public key       |
| `message`           | `string`                                                                                                                                                                                                                                                           | The hashed message to verify                             |
| `signature`         | `string`                                                                                                                                                                                                                                                           | The signed message                                       |
| `overrides`         | `key	type	descriptionwebAuthnSignerSingleton	string	Specify the WebAuthn signer singleton
eip7212WebAuthnPrecompileVerifier	string	Specify the EIP-7212 WebAuthn precompile verifier
eip7212WebAuthnContractVerifier	string	Specify the EIP-7212 WebAuthn contract verifier` | Optional overrides for webAuthn verify signature message |

| key       | type               | description                                    |
| :-------- | :----------------- | :--------------------------------------------- |
| `isValid` | `Promise<boolean>` | Returns true if the message is valid signature |

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

A static method that returns the EIP-712 domain data for a userOp

* Param Types
* Return Types

| key             | type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | description        |
| :-------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------- |
| `userOperation` | `key	type	descriptionsender	string	The account making the operation
nonce	string	Anti-replay parameter (see “Semi-abstracted Nonce Support” )
factory	string	account factory, only for new accounts
factoryData	string	data for account factory (only if account factory exists)
callData	string	The data to pass to the sender during the main execution call
callGasLimit	bigint	The amount of gas to allocate the main execution call
verificationGasLimit	bigint	The amount of gas to allocate for the verification step
preVerificationGas	bigint	Extra gas to pay the bunder
maxFeePerGas	bigint	Maximum fee per gas (similar to EIP-1559 max_fee_per_gas)
maxPriorityFeePerGas	bigint	Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas)
paymaster	string	Address of paymaster contract, (or empty, if account pays for itself)
paymasterVerificationGasLimit	string	The amount of gas to allocate for the paymaster post-operation code
paymasterPostOpGasLimit	string	The amount of gas to allocate for the paymaster post-operation code
paymasterData	string	Data for paymaster (only if paymaster exists)
signature	string	Data passed into the account to verify authorization` | UserOp to hash     |
| `chainId`       | `bigint`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | target chain id    |
| `overrides?`    | `key	type	descriptionvalidAfter?	bigint	Timestamp the signature will be valid after
validUntil?	bigint	Timestamp the signature will be valid until
entrypointAddress?	string	Address of the entrypoint contract
safe4337ModuleAddress?	string	Address of the Safe 4337 module.`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | optional overrides |

| key            | type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | description                                 |
| :------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------ |
| `domain`       | `key	type	descriptionchainId	number	target chain id
verifyingContract	string	safe 4337 module contract on traget entrypoint`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | Safe userOperation typed data domain        |
| `types`        | `Record<string, {name: string;type: string;}[]>`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | The Safe Typed structured data to be signed |
| `messageValue` | `key	type	descriptionsafe	string	the userop sender address of the safe account
nonce	string	Anti-replay parameter (see “Semi-abstracted Nonce Support” )
initCode	string	The initCode of the account (needed if and only if the account is not yet on-chain and needs to be created)
callData	string	The data to pass to the sender during the main execution call
callGasLimit	bigint	The amount of gas to allocate the main execution call
verificationGasLimit	bigint	The amount of gas to allocate for the verification step
preVerificationGas	bigint	The amount of gas to pay for to compensate the bundler for pre-verification execution and calldata
maxFeePerGas	bigint	Maximum fee per gas (similar to EIP-1559 max_fee_per_gas)
maxPriorityFeePerGas	bigint	Maximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas)
paymasterAndData	string	Address of paymaster sponsoring the transaction, followed by extra data to send to the paymaster (empty for self-sponsored transaction). Revolves to '0x' if not using a paymaster, and a paymasterDummyData when estimating gas
signature	string	The signature for the userOperation. It is the data passed into the account along with the nonce during the verification step. Resolves to '0x' when the user did not provide their signature yet` | Safe userOperation typed message value      |

## Audits[​](#audits "Direct link to Audits")

* [Audits by Ackee](https://github.com/safe-global/safe-modules/blob/main/modules/4337/docs/v0.3.0/audit.md)
* [Contracts developed by the Safe Protocol Team](https://github.com/safe-global/safe-modules/tree/main/modules/4337)
