💰Balances And History


Reading balances using an instance of SDK is simply calling getBalances() method of it.

const balances = await zkfi.getBalances();

The resulting balances in this case is a mapping of asset id to amount of that asset. E.g.

// balances (assetId -> amount)
    65537: 5000n,
    65538: 4n, 
    65539: 10203n,

Transaction History

Reading the transaction history of a user is also as simple as calling getHistory() method:

const txHistory = await zkfi.getHistory();

The txHistory is a list of history items with multiple fields:

  • hash: The transaction hash identifying the transaction.

  • action: A string denoting the type of transaction like deposit, withdraw, receive, etc.

  • assets: The assets involved in the transaction.

  • timestamp: The timestamp of the transaction.

Last updated