# wallet\_addNetwork

## Add a custom to the user's Xverse wallet&#x20;

The `wallet_addNetwork` method prompts the user to add a custom network to their Xverse Wallet.&#x20;

This method allows dApps to onboard users to a **custom network** (typically for **Regtest** or staging environments) without requiring manual wallet setup.

The app must have first [connected to the wallet](/sats-connect/connecting-to-the-wallet/connect-to-xverse-wallet.md) and obtained [account read permissions.](/sats-connect/xverse-wallet-permissions.md)&#x20;

{% hint style="info" %}
You can fetch the networks that the user's wallet is currently connected to, using [`wallet_getNetwork`](/sats-connect/wallet-methods/wallet_getnetwork.md).&#x20;
{% endhint %}

### Parameters

<table><thead><tr><th width="270">Request parameters</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>a string representing the user-visible network label (e.g. <code>"my-custom-regtest"</code>)</td></tr><tr><td><code>chain</code></td><td>Currently only <code>"bitcoin"</code> is supported, to add custom <a href="https://developer.bitcoin.org/examples/testing.html#regtest-mode">Regtest</a> networks</td></tr><tr><td><code>rpcUrl</code></td><td>a string representing the main RPC JSON-RPC endpoint for the added network</td></tr><tr><td><code>rpcFallbackUrl</code><br><span data-gb-custom-inline data-tag="emoji" data-code="2139">ℹ️</span> Optional</td><td>a string representing the fallback RPC URL if primary fails</td></tr><tr><td><code>indexerUrl</code><br><span data-gb-custom-inline data-tag="emoji" data-code="2139">ℹ️</span> Optional</td><td>a string representing the Indexer API used for advanced indexing of the balances and transaction history on the added network</td></tr><tr><td><code>blockExplorerUrl</code><br><span data-gb-custom-inline data-tag="emoji" data-code="2139">ℹ️</span> Optional</td><td>a string representing the transaction explorer base URL for the added network</td></tr></tbody></table>

```typescript
import Wallet from 'sats-connect';

async function example() {
  const res = await Wallet.request('wallet_addNetwork', {
   name: 'my-custom-regtest',
   chain: 'bitcoin',
   rpc_url: 'https://custom-regtest.tech/api/proxy',
   indexer_api: 'https://indexer.my-custom-regtest.app',
   block_explorer_url: 'https://mempool-my-custom-regtest.space',
   rpc_fallback_url: 'https://fallback.custom-regtest.tech/api/proxy' // optional
  });
  if (res.status === 'error') {
    console.error(res.error);
    return;
  }

  console.log(res.result);
}
```

## :white\_check\_mark: addNetwork Result&#x20;

The method will&#x20;

* prompt the user to add the custom network to their Xverse wallet![](/files/fj0pT6Xh6xMYpAdwQcCK)
* return `null` if the user accepts the prompt and adds the network -> **Null response**

The addition of the network to the wallet will emit a [networkAdded](/sats-connect/xverse-wallet-events.md#networkadded-event) event which your app can catch.

{% hint style="info" %}
Your app can then&#x20;

* prompt the user to switch their Xverse wallet to the newly added network with the [wallet\_changeNetwork](/sats-connect/wallet-methods/wallet_changenetwork.md)
* &#x20;fetch the user's active Xverse account under the new network with the [`wallet_getAccount`](/sats-connect/wallet-methods/wallet_getaccount.md) method.
  {% endhint %}


---

# 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/wallet-methods/wallet_addnetwork.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.
