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

> [tab] JavaScript
>
> ```javascript theme={"system"}
> import {
>   createWaasWalletAccounts,
>   getChainsMissingWaasWalletAccounts
> } from '@dynamic-labs-sdk/client/waas';
>
> const onSignIn = async () => {
>   const missingChains = getChainsMissingWaasWalletAccounts();
>   await createWaasWalletAccounts({ chains: missingChains });
> };
> ```

> [tab] 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]);
> }
> ```

Then you can call this onSignIn function when the authentication process is complete.
See [Signing in with Email](https://docs.dynamic.xyz/docs/javascript/authentication-methods/email.md), [Signing in with SMS](https://docs.dynamic.xyz/docs/javascript/authentication-methods/sms.md) and [Signing in with Social](https://docs.dynamic.xyz/docs/javascript/authentication-methods/social.md) 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 createWallets = async () => {
  await createWaasWalletAccounts({ chains: ['EVM', 'EVM', 'SOL'] });
};

```

## 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](https://docs.dynamic.xyz/docs/javascript/reference/waas/checking-if-waas-is-enabled.md)
* [Exporting WaaS Private Key](https://docs.dynamic.xyz/docs/javascript/reference/waas/exporting-waas-private-key.md)
* [Importing WaaS Private Key](https://docs.dynamic.xyz/docs/javascript/reference/waas/importing-waas-private-key.md)
* [Adding EVM Extensions](https://docs.dynamic.xyz/docs/javascript/reference/evm/adding-evm-extensions.md)
* [Adding Solana Extensions](https://docs.dynamic.xyz/docs/javascript/reference/solana/adding-solana-extensions.md)
* [Signing in with Email](https://docs.dynamic.xyz/docs/javascript/authentication-methods/email.md)
* [Signing in with SMS](https://docs.dynamic.xyz/docs/javascript/authentication-methods/sms.md)
* [Signing in with Social](https://docs.dynamic.xyz/docs/javascript/authentication-methods/social.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.