2

How do i fetch all the transactions in a specific NEAR accounts without going through all the blocks like the example here : https://docs.near.org/docs/api/naj-cookbook#recent-transaction-details

I'm trying to show the transactions in react and fetching all the blocks takes too much time

Amine
  • 31
  • 4
  • 1
    you can check out https://stats.gallery source code here: https://github.com/NEAR-Edu/stats.gallery for some ideas – amgando Jan 26 '22 at 12:15

1 Answers1

2

It's impossible to do through the API. It is possible to get with SQL query from public PostgreSQL database of the Indexer for Explorer

https://github.com/near/near-indexer-for-explorer#shared-public-access

However, the access is shared across everyone and has a very limited number of connections. So it's not the most reliable solution if you're building some project and need to do such queries regularly.

So if you need to get all transactions for the account regularly you will need to write and run your own indexer that stores data you need in some database so you can access it on regular basis.

Useful links:

khorolets
  • 666
  • 3
  • 8
  • I guess using an indexer is how the NEAR Wallet fetches all the collectibles for an account. – John Jan 29 '22 at 06:51
  • I guess so, they probably index collectibles when they appear and later query the database to get them quickly – khorolets Jan 31 '22 at 17:22