# Xumm.on(event, fn)

<table><thead><tr><th width="202" align="right">Event</th><th width="217.267060720043">Environment</th><th>Meaning</th></tr></thead><tbody><tr><td align="right"><mark style="color:blue;"><strong><code>retrieved</code></strong></mark></td><td>xApp, Web3 (browser)</td><td>A valid signed in Xumm SDK session has been retrieved.</td></tr><tr><td align="right"><mark style="color:blue;"><strong><code>success</code></strong></mark></td><td>xApp, Web3 (browser)</td><td>A user is succesfully identified and signed in</td></tr><tr><td align="right"><mark style="color:blue;"><strong><code>ready</code></strong></mark></td><td>xApp, Web3 (browser)</td><td>The SDK is ready (final state) so your application can render</td></tr><tr><td align="right"><mark style="color:purple;"><strong><code>retrieving</code></strong></mark></td><td>Web3 (browser)</td><td>The SDK is trying to retrieve &#x26; verify an existing session</td></tr><tr><td align="right"><mark style="color:purple;"><strong><code>logout</code></strong></mark></td><td>Web3 (browser)</td><td>The SDK is going to destroy a pending signed in session</td></tr><tr><td align="right"><mark style="color:purple;"><strong><code>loggedout</code></strong></mark></td><td>Web3 (browser)</td><td>The SDK destroyed a signed in session, a user can login again.</td></tr><tr><td align="right"><mark style="color:purple;"><strong><code>error</code></strong></mark></td><td>Web3 (browser)</td><td>An error occurred, see the browser console for more information</td></tr><tr><td align="right"><mark style="color:orange;"><strong><code>qr</code></strong></mark></td><td><a href="/pages/axXGZ8z9tYb7rIDaFbU0">xApp (user event)</a></td><td>The QR code scan dialog in Xumm has been closed (dismissed or a QR code has been scanned)<br>From: <a data-mention href="/pages/qQanVeFbVuzypchR1qm6">/pages/qQanVeFbVuzypchR1qm6</a></td></tr><tr><td align="right"><mark style="color:orange;"><strong><code>payload</code></strong></mark></td><td><a href="/pages/axXGZ8z9tYb7rIDaFbU0">xApp (user event)</a></td><td>A Sign Request (payload) has been resolved (cancelled / signed / ...)<br>From: <a data-mention href="/pages/Leawf7jXdN5Kydh0D80V">/pages/Leawf7jXdN5Kydh0D80V</a></td></tr><tr><td align="right"><mark style="color:orange;"><strong><code>destination</code></strong></mark></td><td><a href="/pages/axXGZ8z9tYb7rIDaFbU0">xApp (user event)</a></td><td>The "Destination Picker" dialog in Xumm has been closed (dismissed or a destination has been selected)<br>From: <a data-mention href="/pages/2z3DHo7zpzDZW7N7LZIR">/pages/2z3DHo7zpzDZW7N7LZIR</a></td></tr><tr><td align="right"><mark style="color:orange;"><strong><code>networkswitch</code></strong></mark></td><td><a href="/pages/axXGZ8z9tYb7rIDaFbU0">xApp (user event)</a></td><td>The user switched the selected <strong>network</strong> in Xumm while present in the xApp, while your xApp settings (Xumm Developer Console) indicate the xApp shouldn't reload but receive an event.<br><code>network</code> contains <a data-mention href="/pages/qpNITw1d5Dd09pTu8CKC">/pages/qpNITw1d5Dd09pTu8CKC</a>key.</td></tr></tbody></table>

## Event order

The following order of events can be expected per environment.

{% hint style="info" %}
Note about the **`ready`** vs the **`success`** event:\
\
The **`ready`** event fires if the **SDK state** is ready for the rendering of your application. This **does not have to mean** the SDK is signed in: it just means the SDK is **ready**.\
\
If you want to know a user
{% endhint %}

### xApp (always auto-signed in)

1. `retrieved` - xApps always auto-resolve
2. `success`- all information is populated to SDK properties (Promises)
3. `ready` - ready to render your application with the correct Xumm SDK state

### Web3 (browser) - Signed out & then signing in

1. `retrieving` - but the user is signed out
2. `ready` - ready to render your application with the correct Xumm SDK state, but the user **must still** log in
3. *<mark style="background-color:yellow;">The user signs in</mark>*
4. `success` - all information is populated to SDK properties (Promises)

### Web3 (browser) - Already signed in

1. `retrieving` - existing session information is being fetched & verified
2. `success` - all information is populated to SDK properties (Promises)
3. `retrieved` - you are dealing with an already signed in user
4. `ready` - ready to render your application with the correct Xumm SDK state


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.xaman.dev/js-ts-sdk/sdk-syntax/xumm.on-event-fn.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
