Deploy ERC-4337 smart accounts using Para’s secure infrastructure with your preferred AA provider.

Prerequisites

You need a Para-enabled smart account client from your AA provider.

Setup Smart Account Libraries

Create Smart Account

import { watchSmartAccountClient } from "@account-kit/core";
import { config } from "./config";  // Config with Para wallet client

async function createSmartAccount() {
  let clientState;
  
  const clientSubscription = watchSmartAccountClient(
    { type: "LightAccount" },
    config
  )((clientState_) => {
    clientState = clientState_;
  });
  
  if (clientState == null || clientState.isLoadingClient) {
    console.log("Loading...");
    return;
  }
  
  const client = clientState.client;
  const address = await client.getAddress();
  
  console.log("Smart Account Address:", address);
  
  const isDeployed = await client.account.isDeployed();
  console.log("Is Deployed:", isDeployed);
  
  return {
    client,
    address,
    isDeployed
  };
}

Deploy Account On-Chain

async function deployAccount(alchemyClient: any) {  // Para-enabled Alchemy client
  try {
    const hash = await alchemyClient.sendUserOperation({
      uo: {
        target: "0x0000000000000000000000000000000000000000",
        data: "0x",
        value: 0n
      }
    });
    
    console.log("Deployment UserOp Hash:", hash);
    
    const receipt = await alchemyClient.waitForUserOperationReceipt({
      hash
    });
    
    console.log("Account deployed!", receipt.receipt.transactionHash);
    
    return receipt;
  } catch (error) {
    console.error("Deployment failed:", error);
    throw error;
  }
}

Next Steps