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

# Creating WaaS Wallet Accounts

You can choose when and which chains to create WaaS wallet accounts for, at any time (as long as the user is already authenticated).

## Creating WaaS wallet accounts when user signs up

We provide a helper method for you to check which chains are missing WaaS wallet accounts and create them if needed.

### Usage

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={"system"}
    import {
      createWaasWalletAccounts,
      getChainsMissingWaasWalletAccounts
    } from '@dynamic-labs-sdk/client/waas';

    const onSignIn = async () => {
      const missingChains = getChainsMissingWaasWalletAccounts();
      await createWaasWalletAccounts({ chains: missingChains });
    };
    ```
  </Tab>

  <Tab title="React">
    Subscribe to `userChanged` so wallet creation fires once the user is authenticated:

    ```tsx theme={"system"}
    import {
      createWaasWalletAccounts,
      getChainsMissingWaasWalletAccounts,
    } from '@dynamic-labs-sdk/client/waas';
    import { useUser } from '@dynamic-labs-sdk/react-hooks';
    import { useEffect } from 'react';

    function useAutoCreateWaasWallets() {
      const { data: user } = useUser(); // re-renders on userChanged

      useEffect(() => {
        if (!user) return;

        const missingChains = getChainsMissingWaasWalletAccounts();
        if (missingChains.length > 0) {
          createWaasWalletAccounts({ chains: missingChains });
        }
      }, [user]);
    }
    ```
  </Tab>
</Tabs>

Then you can call this onSignIn function when the authentication process is complete
See [Signing in with Email](/javascript/authentication-methods/email), [Signing in with SMS](/javascript/authentication-methods/sms) and [Signing in with Social](/javascript/authentication-methods/social) for more information.

## Creating WaaS wallet accounts once user already has WaaS wallet accounts

You can pass an array of chains to the `createWaasWalletAccounts` method to create wallet accounts for those chains.
If the same chain is passed multiple times, just as many wallet accounts will be created for that chain

### Usage

In this example, we are creating 2 EVM wallet accounts and 1 SOL wallet account,
no matter what other WaaS wallet accounts the user already has.

```javascript theme={"system"}
import {
  createWaasWalletAccounts,
  getChainsMissingWaasWalletAccounts
} from '@dynamic-labs-sdk/client/waas';

const createWaasWalletAccounts = async () => {
  const chains = ['EVM', 'EVM', 'SOL'];
  await createWaasWalletAccounts({ chains });
};

```

## Error Handling

* If you didn't add the required WaaS extensions for the chains that you are trying to create wallet accounts for, it will throw a `NoWalletProviderFoundError`.

## Related functions

* [Checking if WaaS is enabled](/javascript/reference/waas/checking-if-waas-is-enabled)
* [Exporting WaaS Private Key](/javascript/reference/waas/exporting-waas-private-key)
* [Importing WaaS Private Key](/javascript/reference/waas/importing-waas-private-key)
* [Adding EVM Extensions](/javascript/reference/evm/adding-evm-extensions)
* [Adding Solana Extensions](/javascript/reference/solana/adding-solana-extensions)
* [Signing in with Email](/javascript/authentication-methods/email)
* [Signing in with SMS](/javascript/authentication-methods/sms)
* [Signing in with Social](/javascript/authentication-methods/social)
