> ## Documentation Index
> Fetch the complete documentation index at: https://docs.biconomy.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup AbstractJS

> Install and configure the AbstractJS SDK

## Installation

```bash theme={null}
npm install @biconomy/abstractjs viem
```

## Basic Setup

```typescript theme={null}
import { 
  createMeeClient, 
  toMultichainNexusAccount,
  getMEEVersion,
  MEEVersion 
} from "@biconomy/abstractjs";
import { http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base, optimism } from "viem/chains";

// 1. Create a signer (user's wallet)
const signer = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);

// 2. Create multichain account
const account = await toMultichainNexusAccount({
  signer,
  chainConfigurations: [
    { chain: optimism, transport: http(), version: getMEEVersion(MEEVersion.V2_1_0) },
    { chain: base, transport: http(), version: getMEEVersion(MEEVersion.V2_1_0) }
  ]
});

// 3. Create MEE client
const meeClient = await createMeeClient({ account });
```

<Info>
  **Lazy Deployment**: Accounts aren't deployed until the first transaction on each chain. Only addresses are calculated upfront.
</Info>

## Configuration Options

### Account Parameters

| Parameter                              | Description                             | Required |
| -------------------------------------- | --------------------------------------- | -------- |
| `signer`                               | User wallet (EOA) that owns the account | Yes      |
| `chainConfigurations`                  | Array of chain configs                  | Yes      |
| `chainConfigurations[].chain`          | Viem chain object                       | Yes      |
| `chainConfigurations[].transport`      | RPC transport                           | Yes      |
| `chainConfigurations[].version`        | MEE version                             | Yes      |
| `chainConfigurations[].accountAddress` | Override for EIP-7702                   | No       |

### MEE Client Parameters

| Parameter | Description             | Required |
| --------- | ----------------------- | -------- |
| `account` | The multichain account  | Yes      |
| `apiKey`  | API key for sponsorship | No       |

## EIP-7702 Mode

For embedded wallets (Privy, Dynamic, Turnkey), use EIP-7702 by setting `accountAddress` to the EOA:

```typescript theme={null}
const account = await toMultichainNexusAccount({
  signer,
  chainConfigurations: [
    { 
      chain: base, 
      transport: http(), 
      version: getMEEVersion(MEEVersion.V2_1_0),
      accountAddress: signer.address  // Use EOA directly
    }
  ]
});
```

This enables smart account features on the EOA itself via delegation.

## Get Account Addresses

```typescript theme={null}
// Get address on a specific chain
const baseAddress = account.addressOn(base.id);

// Get address with strict mode (throws if chain is not defined in chainConfigurations)
const strictAddress = account.addressOn(base.id, true);
```

<Info>
  Both calls return the **same address**. The `true` flag enables **strict mode**, which throws an error if the chain is not defined in your `chainConfigurations`. This helps catch configuration mistakes early.
</Info>

## Next Steps

<CardGroup cols={2}>
  <Card title="Pay Gas in Tokens" icon="coins" href="/overview/abstractjs/gas-tokens">
    Configure gas payment options
  </Card>

  <Card title="Sponsor Gas" icon="gift" href="/overview/abstractjs/sponsor-gas">
    Cover gas for your users
  </Card>
</CardGroup>
