-
Notifications
You must be signed in to change notification settings - Fork 729
JSON output for cardano-cli #3548
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
Conversation
f8082a6
to
fd90892
Compare
the ' |
Voting up! It's a pity it looks stalled. |
7885e10
to
ebfd78c
Compare
30ae7e6
to
2824a1a
Compare
@@ -105,6 +109,52 @@ instance ToCBOR Certificate where | |||
instance FromCBOR Certificate where | |||
fromCBOR = fromShelleyCertificate <$> fromCBOR | |||
|
|||
instance ToJSON Certificate where |
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'm wondering if it would be possible here to change constructors to records and then use genericToJSON with constructorTagModifier
instead of manual instances?
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 prefer explicit instances. @Jimbo4350 do you have an opinion on genericToJSON
?
032ac17
to
a1cb8ac
Compare
* Certificate * MIRTarget * StakePoolParameters * StakePoolRelay * StakePoolMetadataReference
* ProtocolParametersUpdate * UpdateProposal
* WitVKey 'Witness crypto * KeyWitness era
* PlutusScriptVersion lang * Script lang * ScriptInEra era * PlutusScript lang
* TxAuxScripts era * TxBodyContent ViewTx era * TxCertificates ViewTx era * TxExtraKeyWitnesses era * TxFee era * TxInsCollateral era * TxInsReference build era * TxMetadataInEra era * TxMintValue ViewTx era * TxReturnCollateral CtxTx era * TxScriptValidity era * TxTotalCollateral era * TxUpdateProposal era * TxValidityLowerBound era * TxValidityUpperBound era * TxWithdrawals ViewTx era
instance ToJSON ProtocolParametersUpdate where | ||
toJSON ref = | ||
object $ | ||
( ("protocolVersion" ..=? protocolUpdateProtocolVersion ref) |
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.
If we have Generic
instance available here already, why not use genericToJSON
? 😃
@@ -868,6 +898,13 @@ instance FromCBOR UpdateProposal where | |||
<$> fromCBOR | |||
<*> fromCBOR | |||
|
|||
instance ToJSON UpdateProposal where |
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.
why not convert UpdateProposal
to a record and then use genericToJSON
?
{-# LANGUAGE RankNTypes #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE UndecidableInstances #-} |
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'm wondering if there is a way to avoid using Undecidableinstances
here? Maybe this could be solved by OVERLAPPING / OVERLAPPABLE?
@@ -281,6 +280,8 @@ import Cardano.Api.Utils | |||
import Cardano.Api.Value | |||
import Cardano.Api.ValueParser | |||
|
|||
-- import Cardano.Chain.UTxO (Tx (..)) |
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.
leftover comment?
Fixes #3213
Changes (planned)
query utxo
--out-file
writes JSONtransaction view
--out-file
writes JSONtransaction calculate-min-fee
--out-file
writes JSON