Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Hide free instances of HashCheckParamInfo into functions
  • Loading branch information
palas committed Oct 2, 2024
commit 7c06325752f65a31bbde7e3b7e5014f53e8ee785
36 changes: 19 additions & 17 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3610,23 +3610,25 @@ pMustCheckHash
]
]

proposalHashCheckInfo :: HashCheckParamInfo ProposalUrl
proposalHashCheckInfo =
HashCheckParamInfo
{ flagSuffix = "anchor-data"
, dataName = "proposal"
, hashParamName = "--anchor-data-hash"
, urlParamName = "--anchor-url"
}

constitutionHashCheckInfo :: HashCheckParamInfo ConstitutionUrl
constitutionHashCheckInfo =
HashCheckParamInfo
{ flagSuffix = "constitution-hash"
, dataName = "constitution"
, hashParamName = "--constitution-hash"
, urlParamName = "--constitution-url"
}
pMustCheckProposalHash :: Parser (MustCheckHash ProposalUrl)
pMustCheckProposalHash =
pMustCheckHash
HashCheckParamInfo
{ flagSuffix = "anchor-data"
, dataName = "proposal"
, hashParamName = "--anchor-data-hash"
, urlParamName = "--anchor-url"
}

pMustCheckConstitutionHash :: Parser (MustCheckHash ConstitutionUrl)
pMustCheckConstitutionHash =
pMustCheckHash
HashCheckParamInfo
{ flagSuffix = "constitution-hash"
, dataName = "constitution"
, hashParamName = "--constitution-hash"
, urlParamName = "--constitution-url"
}

pPreviousGovernanceAction :: Parser (Maybe (TxId, Word16))
pPreviousGovernanceAction =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pGovernanceActionNewInfoCmd era = do
<*> pStakeIdentifier (Just "deposit-return")
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pMustCheckHash proposalHashCheckInfo
<*> pMustCheckProposalHash
<*> pFileOutDirection "out-file" "Path to action file to be used later on with build or build-raw "
)
$ Opt.progDesc "Create an info action."
Expand All @@ -95,10 +95,10 @@ pGovernanceActionNewConstitutionCmd era = do
<*> pPreviousGovernanceAction
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pMustCheckHash proposalHashCheckInfo
<*> pMustCheckProposalHash
<*> pConstitutionUrl
<*> pConstitutionHash
<*> pMustCheckHash constitutionHashCheckInfo
<*> pMustCheckConstitutionHash
<*> optional pConstitutionScriptHash
<*> pFileOutDirection "out-file" "Output filepath of the constitution."
)
Expand Down Expand Up @@ -128,7 +128,7 @@ pUpdateCommitteeCmd eon =
<*> pStakeIdentifier (Just "deposit-return")
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pMustCheckHash proposalHashCheckInfo
<*> pMustCheckProposalHash
<*> many pRemoveCommitteeColdVerificationKeySource
<*> many
( (,)
Expand All @@ -154,7 +154,7 @@ pGovernanceActionNoConfidenceCmd era = do
<*> pStakeIdentifier (Just "deposit-return")
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pMustCheckHash proposalHashCheckInfo
<*> pMustCheckProposalHash
<*> pPreviousGovernanceAction
<*> pFileOutDirection "out-file" "Output filepath of the no confidence proposal."
)
Expand All @@ -176,7 +176,7 @@ pUpdateProtocolParametersPostConway conwayOnwards =
<*> pStakeIdentifier (Just "deposit-return")
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pMustCheckHash proposalHashCheckInfo
<*> pMustCheckProposalHash
<*> pPreviousGovernanceAction
<*> optional pConstitutionScriptHash

Expand Down Expand Up @@ -384,7 +384,7 @@ pGovernanceActionTreasuryWithdrawalCmd era = do
<*> pStakeIdentifier (Just "deposit-return")
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pMustCheckHash proposalHashCheckInfo
<*> pMustCheckProposalHash
<*> some ((,) <$> pStakeIdentifier (Just "funds-receiving") <*> pTreasuryWithdrawalAmt)
<*> optional pConstitutionScriptHash
<*> pFileOutDirection "out-file" "Output filepath of the treasury withdrawal."
Expand Down Expand Up @@ -428,7 +428,7 @@ pGovernanceActionHardforkInitCmd era = do
<*> pPreviousGovernanceAction
<*> pAnchorUrl
<*> pAnchorDataHash
<*> pMustCheckHash proposalHashCheckInfo
<*> pMustCheckProposalHash
<*> pPV
<*> pFileOutDirection "out-file" "Output filepath of the hardfork proposal."
)
Expand Down
Loading