wallet_getNetwork

Get the network the wallet is currently connected to

An app can get the network the wallet is currently connected to using wallet_getNetwork. The response contains network information for each of the wallet's supported chains:

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);
}

The result object looks like:

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

Last updated