> ## 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.

# MEE + EIP-7702 (Embedded Wallets)

EIP-7702 enables smart account features to be directly installed on an EOA. This allows orchestration without the user needing to fund or interact with a separate smart account.

<Warning>
  **Only Available on Some Wallets**: As of now, installing the authorization on the EOA is only available for users of Embedded Wallets - such as Privy, Dynamic, Turnkey, ... If your users are using External wallets, such as MetaMask, Rabby, etc... - then you need to use the [Fusion Mode](/new/getting-started/enable-mee-eoa-fusion)
</Warning>

<Steps>
  <Step title="Set Up Wallet Client">
    ```ts theme={null}
    import { createWalletClient, http } from "viem";
    import { privateKeyToAccount } from "viem/accounts";

    const eoa = privateKeyToAccount(Bun.env.PRIVATE_KEY as `0x${string}`);

    const walletClient = createWalletClient({
      transport: http(),
    });
    ```
  </Step>

  <Step title="Sign Authorization">
    ```ts theme={null}
    const nexus120Singleton = '0x000000004F43C49e93C970E84001853a70923B03';

    const authorization = await walletClient.signAuthorization({
      account: eoa,
      contractAddress: nexus120Singleton,

      // Chain ID 0 makes it valid across all chains
      chainId: 0, 

      // Use nonce 0 for fresh embedded wallet accounts
      nonce: 0    
    });
    ```

    <Warning>
      **Note for Embedded Wallets**: Privy, Dynamic, and other embedded wallets may expose their own `signAuthorization()` helper with the same parameters. In that case you can't use the `viem` `signAuthorization` method as it'll throw an error. Our docs have integration guides for every type of embedded wallet. You can follow them.
    </Warning>
  </Step>

  <Step title="Initialize Nexus Account">
    ```ts theme={null}
    import { toMultichainNexusAccount, getMEEVersion, MEEVersion } from "@biconomy/abstractjs";
    import { base, optimism } from "viem/chains";
    import { http } from "viem";

    const orchestrator = await toMultichainNexusAccount({
      chainConfigurations: [
        {
          chain: optimism,
          transport: http(),
          version: getMEEVersion(MEEVersion.V2_1_0),
          // Must be overridden when using EIP-7702
          accountAddress: eoa.address 
        },
        {
          chain: base,
          transport: http(),
          version: getMEEVersion(MEEVersion.V2_1_0),
          // Must be overridden when using EIP-7702
          accountAddress: eoa.address 
        }
      ],
      signer: eoa
    });
    ```
  </Step>

  <Step title="Connect to MEE Relayer">
    ```ts theme={null}
    import { createMeeClient } from "@biconomy/abstractjs";

    const meeClient = await createMeeClient({
      account: orchestrator
    });
    ```
  </Step>

  <Step title="Quote Orchestration">
    ```ts theme={null}
    import { zeroAddress } from "viem";
    import { usdcAddresses } from "../utils/addresses/usdc.addresses";

    const quote = await meeClient.getQuote({
      instructions: [{
        calls: [{
          to: zeroAddress,
          value: 0n
        }],
        chainId: optimism.id
      }],

      // Must be set for EIP-7702-based orchestration
      delegate: true,          
      
      // Can be passed manually or signed by the SDK
      authorization,          

      feeToken: {
        address: usdcAddresses[base.id],
        chainId: base.id
      },
    });

    console.log(quote.paymentInfo.tokenAmount);
    ```

    <Info>
      **Passing Authorizations**: We recommend passing authorizations manually as it gives you more control over signing for different chains and wallet providers. However, if you'd just like our SDK to automatically prompt users to sign authorizations, you can omit the `authorizations` field and just set `delegate: true`
    </Info>
  </Step>

  <Step title="Execute Orchestration">
    ```ts theme={null}
    const { hash } = await meeClient.executeQuote({ quote });

    const receipt = await meeClient.waitForSupertransactionReceipt({ hash });
    ```
  </Step>
</Steps>

## Notes

* `delegate: true` is **mandatory**.
* `authorization` must be passed. You can pass it manually (recommended) or allow the SDK to prompt the user to sign.
* `accountAddress` must be **explicitly overridden** to the EOA address to signal EIP-7702 usage.
* The Nexus smart account logic will be executed directly on the EOA address.
