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?
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?
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.
© 2022 - 2024 — McMap. All rights reserved.