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
  • Detecting the providers with getProviders
  • Selecting a provider with getProviderById
  1. Wallet Providers

getProviders & getProviderById

PreviousgetInfoNextConnecting to the wallet

Detecting the providers with getProviders

If the user has multiple browser extension wallets installed, Sats Connect will detect the extensions that inject their provider information under window.btc_providers , following the standard.

Sats Connect will construct a "multiprovider" array at window.btc_providers , containing the injected provider from each wallet. Xverse Wallet can be identified in this array by the following properties:

window: {
  webbtc_providers: [
   {
     id: "BitcoinProvider" || "xverseProviders.BitcoinProvider",
     name: "Xverse Wallet",
     icon: "data:image/svg+xml;base64,PHN2Z..ZnPgo=",
     webUrl: "https://www.xverse.app",
     chromeWebStoreUrl:"https://chromewebstore.google.com/detail/xverse-wallet/idnnbdplmphpflfnlkomgpfbpcgelopg",
     googlePlayStoreUrl:"https://play.google.com/store/apps/details?id=com.secretkeylabs.xverse",
     iOSAppStoreUrl:"https://apps.apple.com/us/app/xverse-bitcoin-wallet/id1552272513",
     methods: ["getAddress", "getInfo", "signMessage", "signPsbt", "sendTransfer", "signMultipleTransactions", "createInscription", "createRepeatInscriptions", "stx_signMessage","stx_transferStx", "stx_signTransaction", "stx_callContract"],		
    }
  ],
}

Your application can detect the user's installed wallet providers with the getProviders method.

No request parameters are required:

import {getProviders} from "sats-connect";

const providers = getProviders()
Property
Description

id

a string representing the path to the wallet provider in the global/window object Xverse provider example:"BitcoinProvider" || "xverseProviders.BitcoinProvider"

name

a string representing the name of the wallet provider to show in the connect wallet UI Xverse provider example: "Xverse Wallet"

icon

a string representing the wallet provider's icon as to show in the connect wallet UI, as data URI (SVG image encoded in base64 format) Xverse provider example:data:image/svg+xml;base64,PHN2Z..ZnPgo=

webUrl

chromeWebStoreUrl

goodlePlayStoreUrl

iOSAppStoreUrl

methods

An array of strings representing the list of methods supported by the wallet provider Xverse provider example: ["getAddress", "getInfo", "signMessage", "signPsbt", "sendTransfer", "signMultipleTransactions", "createInscription", "createRepeatInscriptions", "stx_signMessage","stx_transferStx", "stx_signTransaction", "stx_callContract"]

Selecting a provider with getProviderById

You can use the getProviderById method to select any specific provider from the list of providers injected under window.btc_providers

No request parameters are required:

import {getProviders, getProviderById} from "sats-connect";

const providers = getProviders();

const firstProvider = providers[0];

const providerObject = getProviderById(firstProvider.id);

const response = providerObject.reauest('getInfo', null);

The getProviderById method returns the provider object that the wallets injects in the window object.

The getProviders method returns an array of btcProvider objects with the following properties:

Optional a string representing the url of the wallet provider's website Xverse provider example: "<https://www.xverse.app/>"

Optional a string representing the url of the wallet provider's Chrome Web Store Page Xverse provider example: "<https://chromewebstore.google.com/detail/xverse-wallet/idnnbdplmphpflfnlkomgpfbpcgelopg>"

Optional a string representing the url of the wallet provider's Google Play Store Page Xverse provider example: "<https://play.google.com/store/apps/details?id=com.secretkeylabs.xverse>>"

Optional a string representing the url of the wallet provider's iOS App Store Page Xverse provider example: "<https://apps.apple.com/us/app/xverse-bitcoin-wallet/id1552272513>"

WBIP004
WBIP004
â„šī¸
â„šī¸
â„šī¸
â„šī¸