Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transactions ordering ASC or new before param #2622

Open
roccomuso opened this issue Sep 22, 2019 · 2 comments
Open

transactions ordering ASC or new before param #2622

roccomuso opened this issue Sep 22, 2019 · 2 comments
Assignees
Labels

Comments

@roccomuso
Copy link

Аbstract
Ability to paginate using after param having txs ordered ASC and not DESC.
Or in alternative a before param with txs ordered DESC.

Motivation and Purposes
I'd like to use the after param as a cursor to get recent txs. But in order to do that I should have txs returned ASC by timestamp and not DESC by timestamp. Or in alternative have a param like before.

Specification
Return txs before a given txid and not only after or in alternative give a way to list txs ASC by timestamp.

Backwards Compatibility
100% compatible

Examples and Implementation

Ark, Lisk and other coins already implement this.

@phearnot
Copy link
Member

phearnot commented Sep 30, 2019

Hi @roccomuso, thanks for reaching out.
In order to get the most recent transactions, you can use an use the existing API. Suppose tx_id is the most recent transaction you've loaded "the last time". Loading transactions between tx_id and now can be achieved by repeatedly calling /transactions/address/{address}/limit/{limit} and changing after param to the last transaction's id until you get tx_id in the response, and then sorting the resulting list on the client side. This method might be a little less convenient than explicitly requesting transaction ordering, but it can still be used as a workaround.

We'll consider adding sort order parameter (or extending API in some other way) in some of the future releases.

@roccomuso
Copy link
Author

It's a workaround that will require multiple calls (not so convenient for wallets having a lot of txs), I think would be easier to improve api server-side introducing a order param

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants