MultiChain / multichain

Source code for multichaind, multichain-cli and multichain-util.
GNU General Public License v3.0
536 stars 259 forks source link

liststreamitems pagination does not work for descending ordering #123

Closed nflaig closed 4 years ago

nflaig commented 4 years ago

It is currently not possible to have pagination for descending ordering of liststreamitems which is a common cause, for example if you have an audit trail you want to display the newest entries when you load it. The problem is there is no way to know which start value to use if the total item count is not known.

Since ascending ordering is working because the start value 1 can be used a good solution would be to add a new parameter order were ascending or descending could be provided and then for descending the start value of 1 would be the newest entry instead of the oldest.

titusz commented 4 years ago

You can implement descending ordering based on the existing API. As an example see: https://github.com/coblo/mex/blob/master/mex/stream.py#L7

nflaig commented 4 years ago

@titusz thanks for the answer