getBalances
Get an account's shielded balances from storage, optionally refreshing first.
Import
ts
import { getBalances } from "@0xcurvy/curvy-sdk/actions";Usage
ts
await getBalances(); // active account, cached
await getBalances({ accountId }); // explicit account
await getBalances({ cached: false }); // refresh from chain firstSignature
ts
function getBalances(parameters?: GetBalancesParameters): Promise<BalanceEntry[]>Returns
Promise<BalanceEntry[]>
The action resolves or returns the value shown in the signature.
Parameters
cached
- Type:
boolean - Required: no
When false, refresh from chain first. Defaults to true (cached).
ts
const result = await getBalances({
cached: false,
});accountId
- Type:
string - Required: no
Target a specific account; defaults to the active account.
ts
const result = await getBalances({
accountId,
});inputFinalityPolicy
- Type:
InputFinalityPolicy - Required: no
Override account preference for this read.
ts
const result = await getBalances({
inputFinalityPolicy: "finalized",
});config
- Type:
CurvyConfig - Required: no
Curvy config to use. Defaults to the ambient config.
ts
const result = await getBalances({
config,
});Errors
NoActiveAccountErrorwhen noaccountIdis given and no account is active.
Related
- Querying balances guide
refreshBalances— Re-sync and persist an account's shielded balances.getScanProgress— Read the current balance-scan progress from 0 to 100.pauseBalanceRefresh— Pause new balance refreshes for an account.resumeBalanceRefresh— Allow balance refreshes for an account after a matching pause.