Notus API
Smart Wallets

Light Account

LightAccount Factory Compatibility

The Notus API supports a standard Factory implementation called LightAccount (v2.0.0). This implementation adheres to the best practices of ERC-4337 and ensures seamless integration with the Notus API’s suite of tools and features.

Key Features of LightAccount (v2.0.0):

  • Standardized Compatibility: Fully compatible with the ERC-4337 specification, ensuring smooth wallet deployment.

  • Gas Optimization: Uses an efficient design to minimize gas costs during wallet creation.

  • Multi-Chain Consistency: Enables deterministic wallet addresses across all supported chains, providing a unified user experience.

Security and Audits

The LightAccount Factory (v2.0.0) has undergone a thorough security audit to ensure its reliability and robustness. You can review the audit report here.

Factory Deployments

The LightAccount Factory is deployed across multiple chains, ensuring cross-chain compatibility and deterministic wallet addresses. You can find the list of deployed addresses here.

How to create a Light Account with Notus API

Create a directory

mkdir my-smart-wallet
cd my-smart-wallet
touch index.js

Init project

npm init -y
pnpm init -y
yarn init -y
bun init -y

Install viem

We’ll use viem, a library for blockchain interactions, to simplify our integration. Install it by running:

npm i viem
pnpm add viem
yarn add viem
bun add viem

Initialize Wallet Account

Use your private key to initialize a wallet account. This will allow you to sign messages and interact with the blockchain.

import { privateKeyToAccount } from 'viem/accounts'

const BASE_URL = "https://api.notus.team/api/v1"
const API_KEY = "<api-key>"

const privateKey = '0x<private-key>'
const account = privateKeyToAccount(privateKey)

Register a Smart Wallet Address

Register and retrieve the smart wallet address used for Account Abstraction.

async function main() {
  const FACTORY_ADDRESS = "0x0000000000400CdFef5E2714E63d8040b700BC24"
  const externallyOwnedAccount = account.address

  const res = await fetch(`${BASE_URL}/wallets/register`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": API_KEY,
    },
    body: JSON.stringify({
      externallyOwnedAccount: externallyOwnedAccount,
      factory: FACTORY_ADDRESS,
      salt: "0",
    }),
  });

  if (!res?.ok) {
    return
  }

  const response = await res.json();

  const smartWalletAddress = response.wallet.accountAbstraction
}

Note: At this stage, the smart wallet address is not yet deployed onchain. Deployment happens automatically with the user's first onchain transaction (e.g., swap or transfer) via a UserOperation.