Fetching the balance
Once connected, the balance can be retrieved at any time.
Rust
let info = sdk.get_info().await?;
let balance_sat = info.balance_sat;
let pending_send_sat = info.pending_send_sat;
let pending_receive_sat = info.pending_receive_sat;
Swift
if let info = try? sdk.getInfo() {
let balanceSat = info.balanceSat
let pendingSendSat = info.pendingSendSat
let pendingReceiveSat = info.pendingReceiveSat
print(balanceSat)
print(pendingSendSat)
print(pendingReceiveSat)
}
Kotlin
try {
val info = sdk.getInfo()
val balanceSat = info?.balanceSat
val pendingSendSat = info?.pendingSendSat
val pendingReceiveSat = info?.pendingReceiveSat
} catch (e: Exception) {
// handle error
}
React Native
const info = await getInfo()
const balanceSat = info.balanceSat
const pendingSendSat = info.pendingSendSat
const pendingReceiveSat = info.pendingReceiveSat
Dart
GetInfoResponse? info = await breezSDKLiquid.instance!.getInfo();
BigInt balanceSat = info.balanceSat;
BigInt pendingSendSat = info.pendingSendSat;
BigInt pendingReceiveSat = info.pendingReceiveSat;
Python
try:
info = sdk.get_info()
balance_sat = info.balance_sat
pending_send_sat = info.pending_send_sat
pending_receive_sat = info.pending_receive_sat
except Exception as error:
logging.error(error)
raise
Go
if info, err := sdk.GetInfo(); err == nil {
balanceSat := info.BalanceSat
pendingSendSat := info.PendingSendSat
pendingReceiveSat := info.PendingReceiveSat
log.Printf("Balance: %v sats", balanceSat)
log.Printf("Pending: send %v sats, receive %v sats", pendingSendSat, pendingReceiveSat)
}
C#
try
{
var info = sdk.GetInfo();
var balanceSat = info?.balanceSat;
var pendingSendSat = info?.pendingSendSat;
var pendingReceiveSat = info?.pendingReceiveSat;
}
catch (Exception)
{
// Handle error
}
You are now ready to receive a Lightning payment.