🟠getBalance

You can use the getBalance method to retrieve your user's Bitcoin balance, i.e. the amount of BTC that their connected wallet's Bitcoin payment address owns.

Be sure to request permissions before requesting the balance No query parameters are required for the method:

import { Wallet } from 'sats-connect';

const response = await Wallet.request('getBalance', undefined);

if (response.status === 'success') {
  console.log(response.result);
} else {
  console.error(response.error);
}

The getBalance method will not trigger any operation or prompt your user to sign any transaction. It will return an object representing the connected wallet's payment address BTC holdings:

Last updated