How to query history of the balances
Asked Answered
A

1

6

For various use cases it's valuable to display historical data of the balance on some account.

What is the best way to query this data from NEAR protocol?

Anoxia answered 25/1, 2021 at 4:55 Comment(1)
Did you solve this problem? Struggling with this right now, can't connect to the indexer, it says available connection slots are full...Vestibule
D
0

You'll get the account transaction history from this url:

https://helper.mainnet.near.org/account/<ACCOUNT_NAME>/activity?offset=<TIME_STAMP_NANOS>&limit=<NUMBER_OF_TRANSACTIONS>

Use the block timestamp of the latest transaction in the result to ask for the previous chunk of transactions (given you set the limit to a number that doesn't include all the trasaction). when you've found the initial transaction. Accumulate deposit (look at the signer_id to determine direction) and gas amounts to get the balance after each transaction.

Doggett answered 13/3, 2021 at 16:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.