@@ -198,97 +198,92 @@ friendlyTxBodyImpl
198198 => CardanoEra era
199199 -> TxBody era
200200 -> m [Aeson. Pair ]
201- friendlyTxBodyImpl
202- era
203- tb@ ( TxBody
204- -- Enumerating the fields, so that we are warned by GHC when we add a new one
205- ( TxBodyContent
206- txIns
207- txInsCollateral
208- txInsReference
209- txOuts
210- txTotalCollateral
211- txReturnCollateral
212- txFee
213- txValidityLowerBound
214- txValidityUpperBound
215- txMetadata
216- txAuxScripts
217- txExtraKeyWits
218- _txProtocolParams
219- txWithdrawals
220- txCertificates
221- txUpdateProposal
222- txMintValue
223- _txScriptValidity
224- txProposalProcedures
225- txVotingProcedures
226- txCurrentTreasuryValue
227- txTreasuryDonation
228- )
229- ) =
230- do
231- return $
232- cardanoEraConstraints
233- era
234- ( [ " auxiliary scripts" .= friendlyAuxScripts txAuxScripts
235- , " certificates" .= forEraInEon era Null (`friendlyCertificates` txCertificates)
236- , " collateral inputs" .= friendlyCollateralInputs txInsCollateral
237- , " era" .= era
238- , " fee" .= friendlyFee txFee
239- , " inputs" .= friendlyInputs txIns
240- , " metadata" .= friendlyMetadata txMetadata
241- , " mint" .= friendlyMintValue txMintValue
242- , " outputs" .= map (friendlyTxOut era) txOuts
243- , " reference inputs" .= friendlyReferenceInputs txInsReference
244- , " total collateral" .= friendlyTotalCollateral txTotalCollateral
245- , " return collateral" .= friendlyReturnCollateral era txReturnCollateral
246- , " required signers (payment key hashes needed for scripts)"
247- .= friendlyExtraKeyWits txExtraKeyWits
248- , " update proposal" .= friendlyUpdateProposal txUpdateProposal
249- , " validity range" .= friendlyValidityRange era (txValidityLowerBound, txValidityUpperBound)
250- , " withdrawals" .= friendlyWithdrawals txWithdrawals
251- ]
252- ++ ( monoidForEraInEon @ AlonzoEraOnwards
253- era
254- (`getScriptWitnessDetails` tb)
255- )
256- ++ ( monoidForEraInEon @ ConwayEraOnwards
257- era
258- ( \ cOnwards ->
259- conwayEraOnwardsConstraints cOnwards $
260- case txProposalProcedures of
261- Nothing -> []
262- Just (Featured _ TxProposalProceduresNone ) -> []
263- Just (Featured _ pp) -> do
264- let lProposals = toList $ convProposalProcedures pp
265- [" governance actions" .= (friendlyLedgerProposals cOnwards lProposals)]
266- )
267- )
268- ++ ( monoidForEraInEon @ ConwayEraOnwards
269- era
270- ( \ cOnwards ->
271- case txVotingProcedures of
272- Nothing -> []
273- Just (Featured _ TxVotingProceduresNone ) -> []
274- Just (Featured _ (TxVotingProcedures votes _witnesses)) ->
275- [" voters" .= friendlyVotingProcedures cOnwards votes]
276- )
277- )
278- ++ ( monoidForEraInEon @ ConwayEraOnwards
279- era
280- (const [" currentTreasuryValue" .= toJSON (unFeatured <$> txCurrentTreasuryValue)])
281- )
282- ++ ( monoidForEraInEon @ ConwayEraOnwards
283- era
284- (const [" treasuryDonation" .= toJSON (unFeatured <$> txTreasuryDonation)])
285- )
286- )
287- where
288- friendlyLedgerProposals
289- :: ConwayEraOnwards era -> [L. ProposalProcedure (ShelleyLedgerEra era )] -> Aeson. Value
290- friendlyLedgerProposals cOnwards proposalProcedures =
291- Array $ fromList $ map (friendlyLedgerProposal cOnwards) proposalProcedures
201+ friendlyTxBodyImpl era tb = do
202+ return $
203+ cardanoEraConstraints
204+ era
205+ ( [ " auxiliary scripts" .= friendlyAuxScripts txAuxScripts
206+ , " certificates" .= forEraInEon era Null (`friendlyCertificates` txCertificates)
207+ , " collateral inputs" .= friendlyCollateralInputs txInsCollateral
208+ , " era" .= era
209+ , " fee" .= friendlyFee txFee
210+ , " inputs" .= friendlyInputs txIns
211+ , " metadata" .= friendlyMetadata txMetadata
212+ , " mint" .= friendlyMintValue txMintValue
213+ , " outputs" .= map (friendlyTxOut era) txOuts
214+ , " reference inputs" .= friendlyReferenceInputs txInsReference
215+ , " total collateral" .= friendlyTotalCollateral txTotalCollateral
216+ , " return collateral" .= friendlyReturnCollateral era txReturnCollateral
217+ , " required signers (payment key hashes needed for scripts)"
218+ .= friendlyExtraKeyWits txExtraKeyWits
219+ , " update proposal" .= friendlyUpdateProposal txUpdateProposal
220+ , " validity range" .= friendlyValidityRange era (txValidityLowerBound, txValidityUpperBound)
221+ , " withdrawals" .= friendlyWithdrawals txWithdrawals
222+ ]
223+ ++ ( monoidForEraInEon @ AlonzoEraOnwards
224+ era
225+ (`getScriptWitnessDetails` tb)
226+ )
227+ ++ ( monoidForEraInEon @ ConwayEraOnwards
228+ era
229+ ( \ cOnwards ->
230+ conwayEraOnwardsConstraints cOnwards $
231+ case txProposalProcedures of
232+ Nothing -> []
233+ Just (Featured _ TxProposalProceduresNone ) -> []
234+ Just (Featured _ pp) -> do
235+ let lProposals = toList $ convProposalProcedures pp
236+ [" governance actions" .= (friendlyLedgerProposals cOnwards lProposals)]
237+ )
238+ )
239+ ++ ( monoidForEraInEon @ ConwayEraOnwards
240+ era
241+ ( \ cOnwards ->
242+ case txVotingProcedures of
243+ Nothing -> []
244+ Just (Featured _ TxVotingProceduresNone ) -> []
245+ Just (Featured _ (TxVotingProcedures votes _witnesses)) ->
246+ [" voters" .= friendlyVotingProcedures cOnwards votes]
247+ )
248+ )
249+ ++ ( monoidForEraInEon @ ConwayEraOnwards
250+ era
251+ (const [" currentTreasuryValue" .= toJSON (unFeatured <$> txCurrentTreasuryValue)])
252+ )
253+ ++ ( monoidForEraInEon @ ConwayEraOnwards
254+ era
255+ (const [" treasuryDonation" .= toJSON (unFeatured <$> txTreasuryDonation)])
256+ )
257+ )
258+ where
259+ -- Enumerating the fields, so that we are warned by GHC when we add a new one
260+ TxBodyContent
261+ txIns
262+ txInsCollateral
263+ txInsReference
264+ txOuts
265+ txTotalCollateral
266+ txReturnCollateral
267+ txFee
268+ txValidityLowerBound
269+ txValidityUpperBound
270+ txMetadata
271+ txAuxScripts
272+ txExtraKeyWits
273+ _txProtocolParams
274+ txWithdrawals
275+ txCertificates
276+ txUpdateProposal
277+ txMintValue
278+ _txScriptValidity
279+ txProposalProcedures
280+ txVotingProcedures
281+ txCurrentTreasuryValue
282+ txTreasuryDonation = getTxBodyContent tb
283+ friendlyLedgerProposals
284+ :: ConwayEraOnwards era -> [L. ProposalProcedure (ShelleyLedgerEra era )] -> Aeson. Value
285+ friendlyLedgerProposals cOnwards proposalProcedures =
286+ Array $ fromList $ map (friendlyLedgerProposal cOnwards) proposalProcedures
292287
293288friendlyLedgerProposal
294289 :: ConwayEraOnwards era -> L. ProposalProcedure (ShelleyLedgerEra era ) -> Aeson. Value
0 commit comments