rework the endpoints used in paima to use pagination based on txs #175
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
About
This is based on the work on #173. Mostly because the slotLimits code is re-used here in order to be able to test it with paima. Potentially the upper limit in the slot range could be removed, but it was simpler to keep it for now. This allows to replicate the current behavior by just consuming the entire range, but allows chunking and skipping empty slots.
Pagination is added to the following endpoints:
/asset/utxos
/projected-nft/range
/delegation/pool
The pagination code is the same as the transaction history endpoint, which is based in transactions. The main breaking change is that the output format is changed in order to group events by transaction. So if previously the endpoints were returning
Now the shape is instead:
The reasoning for this is that otherwise you can skip the second event after seeing the first one and using that tx as the
after
parameter.The only really annoying part about this is that using
json_agg
doesn't really play well withpgtyped
, but it's the simpler way of implementing this, since grouping in js it's most likely not the best idea.Note: I tested the projected nft endpoint only with fake data, since I didn't really have indexed that for it in my carp instance.