# createModularAccountV2Client | @account-kit/smart-contracts

> Creates a Modular Account V2 client using the provided configuration parameters.

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

{/* This file is auto-generated by TypeDoc. Do not edit manually. */}

Creates a Modular Account V2 client using the provided configuration parameters.

## Example

```ts twoslash
import { createModularAccountV2Client } from "@account-kit/smart-contracts";
import { LocalAccountSigner } from "@aa-sdk/core";
import { alchemy, sepolia } from "@account-kit/infra";

const MNEMONIC = "...";
const RPC_URL = "...";

const signer = LocalAccountSigner.mnemonicToAccountSigner(MNEMONIC);

const chain = sepolia;

const transport = alchemy({ rpcUrl: RPC_URL });

const policyId = "...";

const modularAccountV2Client = await createModularAccountV2Client({
  chain,
  signer,
  transport,
  policyId, // NOTE: you may only pass in a gas policy ID if you provide an Alchemy transport!
});
```

## Param

The configuration parameters required to create the Modular Account v2 account client

## Call Signature

```ts
function createModularAccountV2Client<TChain, TSigner>(
  args,
): Promise<AlchemySmartAccountClient<TChain, ModularAccountV2<TSigner>>>;
```

Defined in: [account-kit/smart-contracts/src/ma-v2/client/client.ts:86](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/smart-contracts/src/ma-v2/client/client.ts#L86)

### Type Parameters

<table>
  <thead>
    <tr>
      <th align="left">Type Parameter</th>
      <th align="left">Default type</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `TChain` *extends* [`Chain`](https://viem.sh)
      </td>

      <td>
        [`Chain`](https://viem.sh)
      </td>
    </tr>

    <tr>
      <td>
        `TSigner` *extends* `SmartAccountSigner`\<`any`>
      </td>

      <td>
        `SmartAccountSigner`\<`any`>
      </td>
    </tr>

  </tbody>
</table>

### Parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `args`
      </td>

      <td>
        [`CreateModularAccountV2AlchemyClientParams`](../type-aliases/CreateModularAccountV2AlchemyClientParams)\<`AlchemyTransport`, `TChain`, `TSigner`>
      </td>
    </tr>

  </tbody>
</table>

### Returns

`Promise`\<`AlchemySmartAccountClient`\<`TChain`, [`ModularAccountV2`](../type-aliases/ModularAccountV2)\<`TSigner`>>>

## Call Signature

```ts
function createModularAccountV2Client<TTransport, TChain, TSigner>(
  args,
): Promise<ModularAccountV2Client<TSigner, TChain, TTransport>>;
```

Defined in: [account-kit/smart-contracts/src/ma-v2/client/client.ts:97](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/smart-contracts/src/ma-v2/client/client.ts#L97)

### Type Parameters

<table>
  <thead>
    <tr>
      <th align="left">Type Parameter</th>
      <th align="left">Default type</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `TTransport` *extends* [`Transport`](https://viem.sh)
      </td>

      <td>
        [`Transport`](https://viem.sh)
      </td>
    </tr>

    <tr>
      <td>
        `TChain` *extends* [`Chain`](https://viem.sh)
      </td>

      <td>
        [`Chain`](https://viem.sh)
      </td>
    </tr>

    <tr>
      <td>
        `TSigner` *extends* `SmartAccountSigner`\<`any`>
      </td>

      <td>
        `SmartAccountSigner`\<`any`>
      </td>
    </tr>

  </tbody>
</table>

### Parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `args`
      </td>

      <td>
        [`CreateModularAccountV2ClientParams`](../type-aliases/CreateModularAccountV2ClientParams)\<`TTransport`, `TChain`, `TSigner`>
      </td>
    </tr>

  </tbody>
</table>

### Returns

`Promise`\<[`ModularAccountV2Client`](../type-aliases/ModularAccountV2Client)\<`TSigner`, `TChain`, `TTransport`>>

## Call Signature

```ts
function createModularAccountV2Client<TTransport, TChain>(
  args,
): Promise<WebauthnModularAccountV2Client<TChain, TTransport>>;
```

Defined in: [account-kit/smart-contracts/src/ma-v2/client/client.ts:105](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/smart-contracts/src/ma-v2/client/client.ts#L105)

### Type Parameters

<table>
  <thead>
    <tr>
      <th align="left">Type Parameter</th>
      <th align="left">Default type</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `TTransport` *extends* [`Transport`](https://viem.sh)
      </td>

      <td>
        [`Transport`](https://viem.sh)
      </td>
    </tr>

    <tr>
      <td>
        `TChain` *extends* [`Chain`](https://viem.sh)
      </td>

      <td>
        [`Chain`](https://viem.sh)
      </td>
    </tr>

  </tbody>
</table>

### Parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `args`
      </td>

      <td>
        [`CreateWebauthnModularAccountV2ClientParams`](../type-aliases/CreateWebauthnModularAccountV2ClientParams)\<`TTransport`, `TChain`>
      </td>
    </tr>

  </tbody>
</table>

### Returns

`Promise`\<[`WebauthnModularAccountV2Client`](../type-aliases/WebauthnModularAccountV2Client)\<`TChain`, `TTransport`>>