-
Notifications
You must be signed in to change notification settings - Fork 721
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 JSON output support for Shelley tip query command #1365
Conversation
@@ -50,3 +57,13 @@ instance FromJSON Update.ApplicationName where | |||
parseJSON invalid = | |||
panic $ "Parsing of application name failed due to type mismatch. " | |||
<> "Encountered: " <> (Text.pack $ Prelude.show invalid) | |||
|
|||
instance Serialise (HeaderHash blk) => ToJSON (Tip blk) where | |||
toJSON TipGenesis = object [ "genesis" .= True ] |
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 an appropriate output for genesis?
{
"genesis": true
}
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.
What about something like:
{
"currentBlock": "genesis block"
}
226d47e
to
0d9b2f2
Compare
0d9b2f2
to
0251ed5
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.
I made a change to use the underlying ToJson
instance for the hash (under a couple newtype wrappers). This is both simpler and correct. Using serialise
does not give the correct output (since it's not the raw hash but the CBOR encoded value).
bors merge |
Build succeeded |
Closes #1340.
Before:
After: