Skip to content
Alchemy Logo

createModularAccountV2Client

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

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!
});

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

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

Defined in: account-kit/smart-contracts/src/ma-v2/client/client.ts:86

Type ParameterDefault type

TChain extends Chain

Chain

TSigner extends SmartAccountSigner<any>

SmartAccountSigner<any>

ParameterType

args

CreateModularAccountV2AlchemyClientParams<AlchemyTransport, TChain, TSigner>

Promise<AlchemySmartAccountClient<TChain, ModularAccountV2<TSigner>>>

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

Defined in: account-kit/smart-contracts/src/ma-v2/client/client.ts:97

Type ParameterDefault type

TTransport extends Transport

Transport

TChain extends Chain

Chain

TSigner extends SmartAccountSigner<any>

SmartAccountSigner<any>

ParameterType

args

CreateModularAccountV2ClientParams<TTransport, TChain, TSigner>

Promise<ModularAccountV2Client<TSigner, TChain, TTransport>>

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

Defined in: account-kit/smart-contracts/src/ma-v2/client/client.ts:105

Type ParameterDefault type

TTransport extends Transport

Transport

TChain extends Chain

Chain

ParameterType

args

CreateWebauthnModularAccountV2ClientParams<TTransport, TChain>

Promise<WebauthnModularAccountV2Client<TChain, TTransport>>

Was this page helpful?