-
Notifications
You must be signed in to change notification settings - Fork 217
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
Add optional address parameter to listTransaction #4004
Conversation
76d1535
to
012e873
Compare
9db64c6
to
b203b2c
Compare
@@ -604,6 +604,7 @@ type ListTransactions n = "wallets" | |||
:> QueryParam "end" Iso8601Time | |||
:> QueryParam "order" (ApiT SortOrder) | |||
:> QueryParam "max_count" ApiLimit | |||
:> QueryParam "addressId" (ApiAddressIdT n) |
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.
:> QueryParam "addressId" (ApiAddressIdT n) | |
:> QueryParam "address" (ApiAddressIdT n) |
?
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 agree here, but complied with what is in InspectAddress
and PutByronAddress
. Nevertheless, address seems less confusing than addressId. We might want to change the legacy "addressId" in the future.
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.
Independent of which name we prefer (I do prefer "address"), we have to be consistent with the OpenAPI specification, which had specified address
, I believe:
x-parametersAddress: ¶metersAddress
in: query
name: address
Whenever specification and code differ, that's a bug in the code. 🤓
b203b2c
to
fd2f3a0
Compare
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
in: query | ||
name: address | ||
description: | | ||
An optional address. |
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.
Shouldn't we explain the usage 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.
Thank you! 😊
I have two requests:
- Factor out
listTransactionsFilteredByAddress
to make the integration tests easier to read (less vertical space) - Check the
status
of the transaction ID for both wallets instead of comparing balances.
Other than that, I think that this is good to merge.
sendAmtToAddr ctx wSrc wDest a1 2 | ||
sendAmtToAddr ctx wSrc wDest a4 2 | ||
sendAmtToAddr ctx wSrc wDest a5 2 | ||
|
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.
let listTransactionsFilteredByAddress wallet = | |
Link.listTransactions' @'Shared wallet | |
Nothing Nothing Nothing Nothing Nothing |
In order to make the integration tests easier to read, I favor factoring out this common usage pattern.
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.
good suggestion! Refactored this for all styles
let linkList0 = Link.listTransactions' @'Shared wDest | ||
Nothing | ||
Nothing | ||
Nothing | ||
Nothing | ||
Nothing | ||
(Just (apiAddress addr0)) | ||
rl0 <- request @([ApiTransaction n]) ctx linkList0 Default Empty |
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.
let linkList0 = Link.listTransactions' @'Shared wDest | |
Nothing | |
Nothing | |
Nothing | |
Nothing | |
Nothing | |
(Just (apiAddress addr0)) | |
rl0 <- request @([ApiTransaction n]) ctx linkList0 Default Empty | |
let query0 = listTransactionsFilteredByAddress wDest $ Just (apiAddress addr0) | |
rl0 <- request @([ApiTransaction n]) ctx query0 Default Empty |
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.
done
Nothing | ||
Nothing | ||
(Just (apiAddress addr1)) | ||
rl1 <- request @([ApiTransaction n]) ctx linkList1 Default Empty |
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.
rl1 <- request @([ApiTransaction n]) ctx linkList1 Default Empty | |
rl1 <- request @([ApiTransaction n]) ctx query1 Default Empty |
As above, using listTransactionsFilteredByAddress
.
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.
done
Nothing | ||
Nothing | ||
(Just (apiAddress addr2)) | ||
rl2 <- request @([ApiTransaction n]) ctx linkList2 Default Empty |
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.
rl2 <- request @([ApiTransaction n]) ctx linkList2 Default Empty | |
rl2 <- request @([ApiTransaction n]) ctx query2 Default Empty |
As above with listTransactionsFilteredByAddress
.
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.
done
sendAmtToAddr ctx wSrc wDest a3 2 | ||
|
||
eventually "There are exactly 8 transactions for wDest" $ do | ||
let linkList = Link.listTransactions' @'Shared wDest |
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.
listTransactionsFilteredByAddress
as above.
It may be worth putting this function listTransactionsFilteredByAddress
into the where
clause.
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.
listTransactionsFilteredByAddress
now in where
for shelley, shared and byron styles
, expectResponseCode HTTP.status202 | ||
] | ||
eventually "dest wallet balance is higher than before" $ do | ||
rGet <- request @ApiWallet ctx |
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.
👍 This is necessary to make the test robust for execution on an actual Cardano network, where concurrency, consensus, and timing can and will affect the results — typically leading to "flaky" test failure.
However, instead of checking the balances, I prefer checking that for each wallet, the transaction (identified by its transaction ID) has status in_ledger
— this is the correct way to ensure that a transaction has been accommodated in both source and destination wallet.
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.
very reasonable idea! Did it for all styles - byron, shared and shelley!
@@ -604,6 +604,7 @@ type ListTransactions n = "wallets" | |||
:> QueryParam "end" Iso8601Time | |||
:> QueryParam "order" (ApiT SortOrder) | |||
:> QueryParam "max_count" ApiLimit | |||
:> QueryParam "addressId" (ApiAddressIdT n) |
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.
Independent of which name we prefer (I do prefer "address"), we have to be consistent with the OpenAPI specification, which had specified address
, I believe:
x-parametersAddress: ¶metersAddress
in: query
name: address
Whenever specification and code differ, that's a bug in the code. 🤓
79c6ec7
to
212d85d
Compare
…Detail in a few bullet points the work accomplished in this PR. Before you submit, don't forget to: CODE-OF-CONDUCT.md CONTRIBUTING.md LICENSE MAINTAINERS.md README.md bors.toml cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json fourmolu.yaml hie-direnv.yaml lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Make sure the GitHub PR fields are correct: ✓ Set a good Title for your PR. ✓ Assign yourself to the PR. ✓ Assign one or more reviewer(s). ✓ Link to a Jira issue, and/or other GitHub issues or PRs. ✓ In the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages. CODE-OF-CONDUCT.md CONTRIBUTING.md LICENSE MAINTAINERS.md README.md bors.toml cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json fourmolu.yaml hie-direnv.yaml lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Don't waste reviewers' time: ✓ If it's a draft, select the Create Draft PR option. ✓ Self-review your changes to make sure nothing unexpected slipped through. CODE-OF-CONDUCT.md CONTRIBUTING.md LICENSE MAINTAINERS.md README.md bors.toml cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json fourmolu.yaml hie-direnv.yaml lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Try to make your intent clear: ✓ Write a good Description that explains what this PR is meant to do. ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding Jira ticket. ✓ Highlight what Testing you have done. ✓ Acknowledge any changes required to the Documentation. --> - [x] Add support for optional address in api - [x] Handle inputs, outputs, collateral inputs and collateral output - [x] tests for shelley style - [x] tests for byron style - [x] tests for shared style - [x] swagger update ### Comments <!-- Additional comments, links, or screenshots to attach, if any. --> ### Issue Number https://cardanofoundation.atlassian.net/browse/ADP-2817 <!-- Reference the Jira/GitHub issue that this PR relates to, and which requirements it tackles. Note: Jira issues of the form ADP- will be auto-linked. --> Source commit: 1388223
Comments
Issue Number
https://cardanofoundation.atlassian.net/browse/ADP-2817