3

The dapp I'm building can not rely on the paging mechanism described here, since after a short amount of time I will have a lot of transactions for a given account. Retrieving them all to only select a few more recent ones is very time consuming.

1

If I understand your question correctly, I believe you're looking for something like this:

https://horizon.stellar.org/accounts/{ACCOUNT_ID}/transactions?order=desc&limit={N}

Where ACCOUNT_ID the account public key and N is the number of transactions you want to retrieve. Also note the order is descending (&order=desc)

See the page reference.

  • 1
    Richard is right. If you need only the latest transactions, just use the "transactions for account" endpoint. You can retrieve up to 200 entries at a time (request with limit > 200 will return an error). To fetch more than 200 entries, you'll need to make a few subsequent requests using a cursor query parameter. – Orbit Lens Jul 19 '18 at 12:29
  • 1
    It works, I unintentionally ignored some parts of documentation, so for example in JS it would be: server.transactions().forAccount(account).limit(200).order('desc').call().then( ... ); – Maxim Gaina Jul 19 '18 at 12:50
  • It's easily done... – Richard Dunn Jul 19 '18 at 12:52
0

did you try using the .cursor(), something like:

server. transactions() .forAccount(accountId) .cursor(timestamp) ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.