Skip to content
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

Expose collateral selection errors in the API #2939

Merged
merged 6 commits into from
Oct 1, 2021

Conversation

jonathanknowles
Copy link
Contributor

@jonathanknowles jonathanknowles commented Oct 1, 2021

Issue Number

ADP-1039

Summary

This PR exposes collateral selection errors in the API, and adds descriptions of these errors to the API specification.

It also makes a couple of small tweaks to the internal coin selection API, to make the naming more consistent.

Not included in this PR

API integration tests that verify collateral selection errors.

We can't write these yet, as the collateral selection algorithm is not fully integrated into coin selection. (Though it soon will be, as part of ADP-1037.)

We now have the following set of names:

- `certificateDepositAmount`.
- `certificateDepositsTaken`.
- `certificateDepositsReturned`.

Since these all share the same prefix, it's more obvious that they refer
to the same thing.
This allows us to remove quite a bit of nesting.
This will allow the minimum selection amount to be reported as part of
the API error response.
instance IsServerError (Collateral.SelectionError) where
toServerError e =
apiError err403 InsufficientCollateral $ T.unwords
[ "I'm unable to create this transaction because the balance"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent message!

@jonathanknowles
Copy link
Contributor Author

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Oct 1, 2021

Build succeeded:

@iohk-bors iohk-bors bot merged commit 1ee1408 into master Oct 1, 2021
@iohk-bors iohk-bors bot deleted the jonathanknowles/adp-1039/collateral-api branch October 1, 2021 03:49
WilliamKingNoel-Bot pushed a commit that referenced this pull request Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants