-
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
API: Pass TokenMetadataError through to API #2670
Conversation
a9de669
to
f2e4721
Compare
@@ -356,6 +355,9 @@ data TokenMetadataError | |||
-- ^ Error from aeson decoding of JSON | |||
deriving (Generic, Show, Eq) | |||
|
|||
instance NFData TokenMetadataError where | |||
rnf = rnf . show |
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.
Is this show
right? 🤔
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.
Yes it's a cheap trick to make NFData
instances, where some of the fields don't have NFData
.
In this case the problem was SomeException
.
show
usually works well enough for the purpose of deeply evaluating some data.
@@ -480,7 +480,8 @@ data ApiAsset = ApiAsset | |||
, assetName :: ApiT W.TokenName | |||
, fingerprint :: ApiT W.TokenFingerprint | |||
, metadata :: Maybe ApiAssetMetadata | |||
} deriving (Eq, Generic, Ord, Show) | |||
, metadataError :: Maybe Text |
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.
Replaced with a proper sum-type
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
Testing this seems a bit cumbersome, as I think our mock metadata server would refuse to serve invalid JSON.
23e359e
to
4e66cd4
Compare
bors r+ |
2662: Basic migration plans e2e tests r=rvl a=piotr-iohk # Issue Number ADP-680 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [ ] e2e tests on testnet for creating migration plans for Byron/Icarus/Shelley wallets. # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding ticket ✓ Acknowledge any changes required to the Wiki ✓ Finally, in the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages. --> 2669: Bump version to v2021-05-26 r=Anviking a=rvl ### Overview As per the [Release Checklist](https://github.com/input-output-hk/cardano-wallet/wiki/Release-Checklist). 2670: API: Pass TokenMetadataError through to API r=Anviking a=rvl ### Issue Number ADP-925 ### Overview If there was an error fetching metadata in the listMetadata or getMetadata endpoints, tell the user, rather than just returning "no metadata". ### Comments Could someone please pick this up and merge for v2021-05-26. 2673: Testing additional account pub key endpoints r=piotr-iohk a=piotr-iohk # Issue Number ADP-934 # Overview - 55b2fa4 Tests for get acc pub key for shelley and shared wallets - a388e30 Add assertions for shared wallet status - 9ab8eaf Cannot create acc pub key for wallets from acc pub key tests - 42dab09 Re-shuffle order and extend summary of key eps in swagger for clarity # Comments I've also improved a bit key endpoints summary in swagger for better clarity: ![Screenshot from 2021-05-26 16-08-47](https://user-images.githubusercontent.com/42900201/119674720-b80b5e00-be3c-11eb-81e5-38d95f88131f.png) ![Screenshot from 2021-05-26 16-09-01](https://user-images.githubusercontent.com/42900201/119674734-bcd01200-be3c-11eb-824e-c104bf1b927b.png) Co-authored-by: Piotr Stachyra <[email protected]> Co-authored-by: Rodney Lorrimar <[email protected]> Co-authored-by: Johannes Lund <[email protected]>
Build failed (retrying...): |
2662: Basic migration plans e2e tests r=rvl a=piotr-iohk # Issue Number ADP-680 # Overview <!-- Detail in a few bullet points the work accomplished in this PR --> - [ ] e2e tests on testnet for creating migration plans for Byron/Icarus/Shelley wallets. # Comments <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding ticket ✓ Acknowledge any changes required to the Wiki ✓ Finally, in the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages. --> 2670: API: Pass TokenMetadataError through to API r=Anviking a=rvl ### Issue Number ADP-925 ### Overview If there was an error fetching metadata in the listMetadata or getMetadata endpoints, tell the user, rather than just returning "no metadata". ### Comments Could someone please pick this up and merge for v2021-05-26. Co-authored-by: Piotr Stachyra <[email protected]> Co-authored-by: Rodney Lorrimar <[email protected]> Co-authored-by: Johannes Lund <[email protected]>
Build failed (retrying...): |
This commit adds very basic generators for token metadata (better than the not generating at all), and re-regnerates the golden. Now we see the new metadata_error field in some goldens.
4e66cd4
to
94b859d
Compare
Canceled. |
Oops - having hlint passing is probably a good idea before borsing 🙈 |
bors r+ |
Build succeeded: |
2670: API: Pass TokenMetadataError through to API r=Anviking a=rvl ### Issue Number ADP-925 ### Overview If there was an error fetching metadata in the listMetadata or getMetadata endpoints, tell the user, rather than just returning "no metadata". ### Comments Could someone please pick this up and merge for v2021-05-26. Co-authored-by: Rodney Lorrimar <[email protected]> Co-authored-by: Johannes Lund <[email protected]> 2de1910
arbitrary = AssetDecimals <$> choose (1, 19) | ||
|
||
instance Arbitrary AssetMetadata where | ||
-- TODO: We should add a proper arbitrary instance |
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.
Thanks, yes we should.
<*> (pure "An asset") | ||
<*> (oneof [pure Nothing, pure $ Just "AST"]) | ||
<*> genMaybe (pure $ AssetURL $ fromJust $ | ||
parseURI "https://asset.url") |
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.
FYI - I first tried using an existing Aribitrary URI
instance, but it failed, because it generated http
urls despite the swagger api promising it to be https
.
I'm not sure what the metadata server promises, but if it allows http
urls, then our swagger spec promises too much...
Issue Number
ADP-925
Overview
If there was an error fetching metadata in the listMetadata or getMetadata endpoints, tell the user, rather than just returning "no metadata".
Comments
Could someone please pick this up and merge for v2021-05-26.