> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.openfort.io/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

# Wallet Lifecycle

The embedded wallet goes through several states during initialization. It's crucial to wait for the proper state before performing wallet operations.

## Embedded wallet states

| State                          | Value | Description                      |
| ------------------------------ | ----- | -------------------------------- |
| NONE                           | 0     | Initial SDK state                |
| UNAUTHENTICATED                | 1     | Before user authentication       |
| EMBEDDED\_SIGNER\_NOT\_CONFIGURED | 2     | Before wallet configuration      |
| CREATING\_ACCOUNT               | 3     | Creating new account for chainID |
| READY                          | 4     | Wallet ready for use             |

## State flow

A typical embedded wallet follows this lifecycle:

1. **NONE** — The SDK has been loaded but not yet initialized.
2. **UNAUTHENTICATED** — The SDK is initialized. The user needs to authenticate using one of the supported [authentication methods](https://www.openfort.io/docs/products/embedded-wallet/authentication).
3. **EMBEDDED\_SIGNER\_NOT\_CONFIGURED** — The user is authenticated, but the embedded wallet signer has not been configured yet. This is where wallet creation or recovery happens.
4. **CREATING\_ACCOUNT** — The wallet is being created or recovered for a specific chain.
5. **READY** — The wallet is fully configured and ready for signing transactions and messages.

## Wallet creation

After authentication, the wallet needs to be configured with a [recovery method](https://www.openfort.io/docs/configuration/recovery-methods). This can happen automatically (if `recoverWalletAutomaticallyAfterAuth` is enabled) or manually by calling the create/configure method in your SDK.

The wallet transitions from `EMBEDDED_SIGNER_NOT_CONFIGURED` through `CREATING_ACCOUNT` to `READY`.

## Wallet recovery

When a user logs in on a new device, the wallet needs to be recovered. The recovery method used depends on what was configured during wallet creation:

* **Automatic recovery**: Silent recovery via an encryption session from your backend
* **Password recovery**: User enters their password to recover
* **Passkey recovery**: User authenticates with their passkey (Face ID/Touch ID)

See [Recovery methods](https://www.openfort.io/docs/configuration/recovery-methods) for full details on each option.

## SDK-specific state monitoring

Each SDK provides a way to observe the current wallet state:

* **React**: [`useOpenfort`](https://www.openfort.io/docs/products/embedded-wallet/react/hooks/useOpenfort) hook returns the current state
* **React Native**: [`useEmbeddedEthereumWallet`](https://www.openfort.io/docs/products/embedded-wallet/react-native/hooks/useEmbeddedEthereumWallet) returns `status` field
* **Swift**: [`embeddedStatePublisher`](https://www.openfort.io/docs/products/embedded-wallet/swift/wallet/state) provides a reactive publisher
* **Unity**: [`GetEmbeddedState()`](https://www.openfort.io/docs/products/embedded-wallet/unity/signer/state) returns the current state
* **JavaScript**: [`getEmbeddedState()`](https://www.openfort.io/docs/products/embedded-wallet/javascript/use-openfort) on the Openfort instance
