-
Notifications
You must be signed in to change notification settings - Fork 214
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
[ADP-2788] add max-count to listTransactions API call #3772
Conversation
b0ccd8e
to
94310e4
Compare
lib/wallet/api/http/Cardano/CLI.hs
Outdated
@@ -1353,6 +1357,14 @@ sortOrderOption = optionT $ mempty | |||
<> help "specifies a sort order, either 'ascending' or 'descending'." | |||
<> showDefaultWith showT | |||
|
|||
-- | [--order=ORDER] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-- | [--order=ORDER] | |
-- | [--max_count=MAX_COUNT] |
w <- fixtureWalletWith @n ctx | ||
(replicate 100 $ minUTxOValue (_mainEra ctx)) | ||
txs <- listLimitedTransactions @n ctx w 9 | ||
length txs `shouldBe` 9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need more detailed testing, in particular showing how max_count
plays with order
, start
and end
query parameters. Expectation would be that max_count
respects constraints of other parameters as well. It is also not clear how max_count
should behave together with order
. Possible scenarios:
max_count = n
=> n most recent txs in descending ordermax_count = n, order = descending
=> n most recent txs in descending ordermax_count = n, order = ascending
=> n most recent txs in ascending order or n oldest transactions in ascending order (requirements are not percise)max_count = n, start = date
=> n most recent txs from start date in descending ordermax_count = n, start = date, order = descending
=> n most recent txs from start date in descending ordermax_count = n, start = date, order = ascending
=> n most recent txs from start date in ascending order or n oldest transactions starting from start date in ascending order (requirements are not percise)max_count = n, end = date
=> n most recent txs not older than end date in descending ordermax_count = n, end = date , order = descending
=> n most recent txs not older than end date in descending ordermax_count = n, end = date , order = ascending
=> n most recent txs not older than end date in descending order or n oldest transactions not older than end date in ascending order (requirements are not percise)max_count = n, start = date1, end=date2
=> n most recent txs from start date, not older than end date in descending ordermax_count = n, start = date1, end=date2, order=descending
=> n most recent txs from start date, not older than end date in descending ordermax_count = n, start = date1, end=date2, order=ascending
=> n most recent txs from start date, not older than end date in ascending order or n oldest transactions starting from start date and not older than end date in ascending order (requirements are not percise)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
covered in unit tests
-> (Maybe UniformTime, Maybe UniformTime) | ||
-> [(Tx, TxMeta)] | ||
-> Property | ||
walletListTransactionsLimited wallet@(wid, _, _) _order (_mstart, _mend) history = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
walletListTransactionsLimited wallet@(wid, _, _) _order (_mstart, _mend) history = | |
walletListTransactionsWithLimit wallet@(wid, _, _) _order (_mstart, _mend) history = |
lib/wallet/api/http/Cardano/CLI.hs
Outdated
@@ -916,6 +916,7 @@ data TransactionListArgs = TransactionListArgs | |||
, _timeRangeEnd :: Maybe Iso8601Time | |||
, _sortOrder :: Maybe SortOrder | |||
, _schema :: TxMetadataSchema | |||
, _limit :: Maybe Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: is the behaviour defined for negative values?
If there's no reason to support negative values, then perhaps we could use Natural
or Word
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we are not offering a negative number of results, this is just a wallet :-)
a5974e1
to
5da3855
Compare
5da3855
to
b981c97
Compare
bors try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I've added a bit more integration tests and benchmark for listTx = 100 to restorationBenchmarks suite such that we can control the expectation that max_count
makes it faster.
tryBuild failed: |
bors retry |
tryBuild failed: |
bors r+ |
Build succeeded: |
-- add an optional max_count parameter to the listTransactions API call
ADP-2788