Skip to main content
Version: v7.1.0

bank_balances/2

Description

bank_balances/2 is a predicate which unifies the given terms with the list of balances (coins) of the given account.

The signature is as follows:

bank_balances(?Account, ?Balances)

where:

  • Account represents the account address (in Bech32 format).
  • Balances represents the balances of the account as a list of pairs of coin denomination and amount.

Examples

# Query the balances of the account.
- bank_balances('okp41ffd5wx65l407yvm478cxzlgygw07h79sq0m3fm', X).

# Query the balances of all accounts. The result is a list of pairs of account address and balances.
- bank_balances(X, Y).

# Query the first balance of the given account by unifying the denomination and amount with the given terms.
- bank_balances('okp41ffd5wx65l407yvm478cxzlgygw07h79sq0m3fm', [-(D, A), _]).