On this page
getBalance
Get balance of current account.
Method
declare function getBalance(): Promise<BalanceInfo | number>;Response
Returns the account balance. The provider type also permits a numeric result for compatibility; check the result shape before accessing fields.
type BalanceInfo = {
confirmed: number;
unconfirmed: number;
total: number
};Example
const provider = (window.$onekey && window.$onekey.btc) || window.unisat;
const balance = await provider.getBalance();Demo
Last updated on