Skip to content

Commit

Permalink
Labelled purpouse field better
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed Aug 20, 2024
1 parent 2acd4cd commit b42ad1d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
30 changes: 15 additions & 15 deletions cardano-cli/src/Cardano/CLI/Json/Friendly.hs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ getRedeemerDetails aeo tb = do
eitherToWarning (Aeson.Null) $ maybeToEither inputNotFoundError mFriendlyPurposeResult
return $
object
[ "input" .= friendlyPurposeResult
[ "purpose" .= friendlyPurposeResult
, "redeemer" .= friendlyRedeemer redeemerData exUnits
]

Expand All @@ -349,24 +349,24 @@ getRedeemerDetails aeo tb = do
:: AlonzoEraOnwards era -> Ledger.PlutusPurpose AsIxItem (ShelleyLedgerEra era) -> Aeson.Value
friendlyPurpose AlonzoEraOnwardsAlonzo purpose =
case purpose of
Ledger.AlonzoSpending (Ledger.AsIxItem _ sp) -> Aeson.object ["spending" .= friendlyInput sp]
Ledger.AlonzoMinting (Ledger.AsIxItem _ mp) -> Aeson.object ["minting" .= mp]
Ledger.AlonzoCertifying (Ledger.AsIxItem _ cp) -> Aeson.object ["certifying" .= cp]
Ledger.AlonzoRewarding (Ledger.AsIxItem _ rp) -> Aeson.object ["rewarding" .= rp]
Ledger.AlonzoSpending (Ledger.AsIxItem _ sp) -> Aeson.object ["spending script witnessed input" .= friendlyInput sp]
Ledger.AlonzoMinting (Ledger.AsIxItem _ mp) -> Aeson.object ["minting currency with policy id" .= mp]
Ledger.AlonzoCertifying (Ledger.AsIxItem _ cp) -> Aeson.object ["validating certificate with script credentials" .= cp]
Ledger.AlonzoRewarding (Ledger.AsIxItem _ rp) -> Aeson.object ["withdrawing reward from script address" .= rp]
friendlyPurpose AlonzoEraOnwardsBabbage purpose =
case purpose of
Ledger.AlonzoSpending (Ledger.AsIxItem _ sp) -> friendlyInput sp
Ledger.AlonzoMinting (Ledger.AsIxItem _ mp) -> Aeson.object ["minting" .= mp]
Ledger.AlonzoCertifying (Ledger.AsIxItem _ cp) -> Aeson.object ["certifying" .= cp]
Ledger.AlonzoRewarding (Ledger.AsIxItem _ rp) -> Aeson.object ["rewarding" .= rp]
Ledger.AlonzoSpending (Ledger.AsIxItem _ sp) -> Aeson.object ["spending script witnessed input" .= friendlyInput sp]
Ledger.AlonzoMinting (Ledger.AsIxItem _ mp) -> Aeson.object ["minting currency with policy id" .= mp]
Ledger.AlonzoCertifying (Ledger.AsIxItem _ cp) -> Aeson.object ["validating certificate with script credentials" .= cp]
Ledger.AlonzoRewarding (Ledger.AsIxItem _ rp) -> Aeson.object ["withdrawing reward from script address" .= rp]
friendlyPurpose AlonzoEraOnwardsConway purpose =
case purpose of
Ledger.ConwaySpending (Ledger.AsIxItem _ sp) -> friendlyInput sp
Ledger.ConwayMinting (Ledger.AsIxItem _ mp) -> Aeson.object ["minting" .= mp]
Ledger.ConwayCertifying (Ledger.AsIxItem _ cp) -> Aeson.object ["certifying" .= cp]
Ledger.ConwayRewarding (Ledger.AsIxItem _ rp) -> Aeson.object ["rewarding" .= rp]
Ledger.ConwayVoting (Ledger.AsIxItem _ vp) -> Aeson.object ["voting" .= vp]
Ledger.ConwayProposing (Ledger.AsIxItem _ pp) -> Aeson.object ["proposing" .= pp]
Ledger.ConwaySpending (Ledger.AsIxItem _ sp) -> Aeson.object ["spending script witnessed input" .= friendlyInput sp]
Ledger.ConwayMinting (Ledger.AsIxItem _ mp) -> Aeson.object ["minting currency with policy id" .= mp]
Ledger.ConwayCertifying (Ledger.AsIxItem _ cp) -> Aeson.object ["validating certificate with script credentials" .= cp]
Ledger.ConwayRewarding (Ledger.AsIxItem _ rp) -> Aeson.object ["withdrawing reward from script address" .= rp]
Ledger.ConwayVoting (Ledger.AsIxItem _ vp) -> Aeson.object ["voting using script protected voter credentials" .= vp]
Ledger.ConwayProposing (Ledger.AsIxItem _ pp) -> Aeson.object ["submitting a proposal following proposal policy" .= pp]

friendlyInput :: Ledger.TxIn Ledger.StandardCrypto -> Aeson.Value
friendlyInput (Ledger.TxIn (Ledger.TxId txidHash) ix) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ metadata: null
mint: null
outputs: []
redeemers:
- input: ed7c8f68c194cc763ee65ad22ef0973e26481be058c65005fd39fb93f9c43a20#213
- purpose:
spending script witnessed input: ed7c8f68c194cc763ee65ad22ef0973e26481be058c65005fd39fb93f9c43a20#213
redeemer:
data: I 42
execution units:
Expand Down

0 comments on commit b42ad1d

Please sign in to comment.