wallet_getNetwork

Get the network the wallet is currently connected to

Fetch your user's Xverse wallet active networks

Your app can fetch the networks that the user's wallet is currently connected to, using wallet_getNetwork.

The app must have first connected to the wallet and obtained account read permissions.

import Wallet from 'sats-connect';

async function example() {
  const res = await Wallet.request('wallet_getNetwork', null);
  if (res.status === 'error') {
    console.error(res.error);
    return;
  }

  console.log(res.result);
}

getNetwork Result

The response contains network information for each of the wallet's supported chains:

An example response:

{
  "bitcoin": {
    "name": "Mainnet"
  },
  "stacks": {
    "name": "Mainnet"
  }
}

Last updated