Sats Connect - Wallet API for Bitcoin & Stacks
  • Introduction
  • Wallet Providers
    • getInfo
    • getProviders & getProviderById
  • Connecting to the wallet
    • Connect to Xverse Wallet
    • Disconnect from Xverse Wallet
    • Connect to other wallets
      • Manage a user's default wallet
    • [Legacy ⚠️] getAccounts
  • Wallet Methods
    • request methods
    • wallet_getAccount
    • wallet_getNetwork
    • wallet_changeNetwork
    • Xverse Custom Methods
  • Xverse Wallet Permissions
  • Xverse Wallet events
  • BITCOIN METHODS
    • 🟠getAddresses
    • 🟠signMessage
    • 🟠signPsbt
    • 🟠sendTransfer
    • 🟠signMultipleTransactions
    • 🟠getBalance
    • 🎨createInscription
    • 🎨createRepeatInscriptions
    • 🎨ord_getInscriptions
    • 🎨ord_sendInscriptions
    • 🔲runes_getBalance
    • 🔲runes_transfer
    • 🔲Mint Runes
      • runes_estimateMint
      • runes_mint
    • 🔲Etch Runes
      • runes_estimateEtch
      • runes_etch
    • 🔲runes_getOrder
    • 🔲Speed up a Rune Mint or Etch order
      • 🔲runes_estimateRbfOrder
      • 🔲runes_rbfOrder
  • STACKS METHODS
    • 🔴stx_getAccounts
    • 🔴stx_signMessage
    • 🔴stx_signStructuredMessage
    • 🔴stx_transferStx
    • 🔴stx_signTransaction
    • 🔴stx_callContract
    • 🔴stx_deployContract
  • GUIDES
    • Verify Bitcoin message signatures
    • Creating Bitcoin PSBTs
    • 📱Mobile Integration
    • Next.js support
  • RESOURCES
    • App Template
    • Demo App
    • Changelog
    • Github Issues
    • Developer forum
    • BIP322
Powered by GitBook
On this page
  • Fetch the user's Xverse wallet active networks
  • getNetwork Result
  1. Wallet Methods

wallet_getNetwork

Get the network the wallet is currently connected to

Previouswallet_getAccountNextwallet_changeNetwork

Last updated 2 months ago

Fetch the 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 and obtained

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"
  }
}

✅
connected to the wallet
account read permissions.