# Xverse Wallet events

Sats Connect lets your app listen to key Xverse wallet events to provide a smooth user experience when your users change accounts or networks, or disconnect their account from your app.&#x20;

Xverse wallet will emit dedicated events that your app can use to update the UI or request new permissions when required.

## Listen to wallet events

To be notified of events, apps need to first [connect to the wallet](/sats-connect/connecting-to-the-wallet/connect-to-xverse-wallet.md) to receive [account read permissions.](/sats-connect/xverse-wallet-permissions.md) Listeners registered using `Wallet.addListener()` will be notified of events for authorised accounts.

```typescript
const removeListener = Wallet.addListener('accountChange', (event) => {
  console.log('The account has changed.', event);

  exampleUpdateUi();
  exampleRequestPermissionsForCurrentAccount();
});

// When no longer needed, the listener can be removed by calling the function
// returned by `addListener`.
removeListener();
```

The `addListener` method is typed to include all currently available events. They currently include:

* `accountChange`
* `accountDisconnected`
* `networkChange`&#x20;

## accountChange event

the `accountChange` event is emitted when your connected user switches their Xverse wallet to another account.

The event will pass the below event payload object to a listener callback:

<table><thead><tr><th width="198">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code></td><td>the event type -> <code>"accountChange"</code></td></tr><tr><td><code>addresses</code></td><td><p>The array of address objects for the new account the user has switched to. <br>-> See <a href="/pages/2dsMTr3ckRbH0zzw4vCK">getAccount</a> for the detailed format. </p><p></p><p>ℹ️ This will only be returned if your app is <a href="/pages/M4z59meDSpj3bIMspaBr">connected</a> to the new account the user has switched to, and already has <a href="/pages/msBkjAI2eX51d1zSqE7H">read permission</a> on the new account's data. Your app can request to connect to the new account if required.</p></td></tr></tbody></table>

## accountDisconnected event

the `accountDisconnected` event is emitted when when your user revokes the connection with your app from their Xverse wallet, or when your app [renounces its wallet permissions](/sats-connect/connecting-to-the-wallet/disconnect-from-xverse-wallet.md).

The event will pass the below event payload object to a listener callback:

<table><thead><tr><th width="198">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code></td><td>the event type -> <code>"accountDisconnected"</code></td></tr></tbody></table>

## networkChange event

the `networkChange` event is emitted when when your user switches between the Mainnet, Testnet & Signet networks in their Xverse wallet.

The event will pass the below event payload object to a listener callback:

<table><thead><tr><th width="221">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code></td><td>the event type: <code>"networkChange"</code></td></tr><tr><td><code>bitcoin</code></td><td>the name of the Bitcoin network the user has just switched to: <code>Mainnet</code>, <code>Testnet</code>, <code>Signet</code> or <code>Regtest</code><br>Example:<br><code>{"name": "Signet"}</code></td></tr><tr><td><code>stacks</code></td><td>the name of the Stacks network the user has just switched to: Mainnet or Testnet<br>Example:<br><code>{"name": "Testnet"}</code></td></tr><tr><td><code>spark</code></td><td>the name of the Spark network the user has just switched to: Mainnet or Regtest<br>Example:<br><code>{"name": "Regtest"}</code></td></tr><tr><td><code>addresses</code></td><td>The array of address objects for the connected account on the new network the user has switched to. <br>-> See <a href="/pages/2dsMTr3ckRbH0zzw4vCK">getAccount</a> for the detailed format. <br><br>ℹ️ This will only be returned if your app is <a href="/pages/M4z59meDSpj3bIMspaBr">connected</a> to the new account the user has switched to, and already has <a href="/pages/msBkjAI2eX51d1zSqE7H">read permission</a> on the new account's data. Your app can request to connect to the new account if required.</td></tr></tbody></table>

## :soon: networkAdded event

{% hint style="info" %}
This event is coming soon
{% endhint %}

the `networkAdded` event is emitted when when your user adds a custom network to their Xverse wallet.

The event will pass the below event payload object to a listener callback:

<table><thead><tr><th width="221">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code></td><td>the event type: <code>"networkAdded"</code></td></tr><tr><td><code>bitcoin</code></td><td>the name of the Bitcoin custom network the user has just added: <code>=</code><br>Example:<br><code>{"name": "custom_regtest_network"}</code></td></tr></tbody></table>


---

# 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.xverse.app/sats-connect/xverse-wallet-events.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.
