Balances and History
Retrieve user's shielded funds and activity
Get the Account Balance
Only completed (mined on the pool smart contract) transactions are used to calculate the balance. To include pending txs use thegetOptimisticTotalBalance
method instead.
Parameters
updateState
- update the state before calculating the balance if true
It's recommended to set updateState
to false
in case of sequential operations where we recently updated the state. So you can reduce the sync tyme and the relayer requests count
Returns
Promise
returns the shielded token's balance in the pool dimension (account + all unspent notes)
Example
Get the Balance Including Pending Transactions
Get the balance including transactions owned by the account that have been submitted to the pool contract but not yet mined.
Parameters
updateState
- update the state before calculating the balance if true
Returns
Promise
returns the shielded token's balance (including pending transactions) in the pool dimension (account + all unspent notes).
Example
Get the Balance Components
The customer's balance consists of the account balance and the unspent notes. The notes are produced by incoming transfers. Each user-originated transaction collects the 3 oldest notes to the account and marks them as spent ones. The balance configuration (funds distribution between account and notes) may affect the outgoing transfers and withdrawals. The following method retrieves the total balance as well as the account and notes components.
Parameters
updateState
- update the state before calculating the balance if true
Returns
Promise
returns the tuple [total, account, notes]
where total = account + notes
without pending transactions (all balances are in the pool token dimension).
Example
Get the Transaction History
Parameters
updateState
- update the state before calculating the balance if true
Returns
Promise
returns an array of HistoryRecord
objects
Example
Get the Compliance Report
The compliance report is an extended version of the regular history. It contains transaction details including input notes, decryption keys and other fields needed to show historical integrity.
Parameters
fromTimestamp
- the start time for the compliance report request (seconds since Jan 01 1970)fromTimestamp
- the final time for the compliance report request (seconds since Jan 01 1970)updateState
- update the state before calculating the balance iftrue
Returns
Promise
returns the array of ComplianceHistoryRecord
objects
Example
Last updated