-
Notifications
You must be signed in to change notification settings - Fork 213
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
Implement filtering and sorting for the listTransactions
endpoint.
#466
Comments
*review acceptance criteria 3 -> use previous range |
I'm not sure I like using the Range header to define sort direction. It's a bit too implicit, and if the client has a bug that requests incorrect ranges, this will amplify their problems. Also, there is no way to set the sort order for an (half-) open range. I think we should use a query parameter to provide sort field and direction. |
A decision was made to implement the proposal outlined here: As a result of this decision, we created PR #580, which uses the However, we still need to define what behaviour we expect when Obvious CasesIn the following cases, it seems reasonable to choose
Less Obvious CaseHowever, if both We have three clear options: Option 1Treat Examples:
Option 2Use the implied order, if none is specified. Examples:
Option 3Disallow Question@KtorZ @Anviking @rvl Which of these options would you prefer? Whichever way we choose, our documentation and testing should be explicit and consistent. |
Decision from team discussion: use Option #3 from above. In addition:
|
listTransactions
endpointlistTransactions
endpoint
@jonathanknowles As mentioned on slack, this story has taken way more time than originally. A reason for this has been the change from header to query parameters, but also, the introduction of a Yet, the initial requirements said nothing about the ability to limit the number of items in the response, and also this would be practical for a particular client and, something we are looking forward to implementing in the future, it is rather out-of-scope here. Hence, trying to manage a bit this story, let's not yet do anything about the limit and pagination and allocate more time in a different story to do so. I'll add a U/S on the roadmap regarding this. This also removes the need for any |
listTransactions
endpointlistTransactions
endpoint.
I've now removed the part of the design relating to paging. I've created a new issue here to capture the discussion on how to provide a paging solution: https://github.com/input-output-hk/cardano-wallet-adr/issues/1 |
Overview
This task will make it possible for callers of the
listTransactions
API endpoint:to specify a time range, so that the endpoint will return only transactions that fall within the given range.
to specify a sort order, so that returned transactions can be returned in either ascending or descending order of time.
Equivalent filtering and sorting functionality will also be provided through the
transaction list
CLI command.Acceptance Criteria
listTransactions
endpoint (andtransaction list
CLI command) must provide a way to specify a range of times, that when specified will restrict the list of transactions returned to just those transactions whose times are within the range. The range can be open or closed at either end.listTransactions
endpoint (andtransaction list
CLI command) must provide a way to specify a sort order (either ascending or descending).Design
Input
The
listTransactions
endpoint will accept the following query parameters, all optional:start
end
order
ascending
ordescending
.The
transaction list
CLI command will accept the same parameter names prefixed with--
, with the same definitions.Notes
start
andend
parameters, if both are provided, are expected to be ordered so thatstart ≤ end
. Ifstart > end
, the endpoint must return a400
error.start
andend
parameters should be inclusive bounds.start
is not provided, the endpoint should use the time of the earliest available historical transaction as a start time.end
is not provided, the endpoint should use the time of the latest available historical transaction as an end time.order
is not provided, the endpoint should usedescending
order by default.Output
Queries in ascending order
The endpoint should return a list of all available transactions in the range
start
(inclusively) toend
(inclusively) in ascending order of time.Queries in descending order
The endpoint should return a list of all available transactions in the range
end
(inclusively) tostart
(inclusively) in descending order of time.QA
Range Boundary Conditions
We should provide tests to confirm that:
The endpoint doesn't return transactions that lie outside the range:
The endpoint doesn't omit transactions that lie within the range:
If
start
is not specified by the caller, then the time of the earliest historical transaction is used as a starting point.If
end
is not specified by the caller, then the time of the latest historical transaction is used as an ending point.Development Plan
start
,end
, andorder
query parameters to the API.start > end
.start > end
.readTxHistory
of the DB layer (perhaps dealing with SlotIds instead of UTCTimes)descending
.start
must not be later thanend
.start
orend
are not provided.PRs
master
master
master
master
master
master
master
master
master
master
master
master
master
master
master
The text was updated successfully, but these errors were encountered: