diff --git a/cabal.project b/cabal.project index c84909c853..e6f70f4074 100644 --- a/cabal.project +++ b/cabal.project @@ -57,3 +57,9 @@ write-ghc-environment-files: always -- IMPORTANT -- Do NOT add more source-repository-package stanzas here unless they are strictly -- temporary! Please read the section in CONTRIBUTING about updating dependencies. + +source-repository-package + type: git + location: https://github.com/IntersectMBO/cardano-api + subdir: cardano-api + tag: 997122eb2a2ef6815bf2fd4757c1b32820833879 diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs index d0c3244542..b08548f0a2 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Governance/Actions.hs @@ -185,11 +185,11 @@ pUpdateProtocolParametersCmd pUpdateProtocolParametersCmd = caseShelleyToBabbageOrConwayEraOnwards ( \shelleyToBab -> - let sbe = inject shelleyToBab + let sbe = convert shelleyToBab in subParser "create-protocol-parameters-update" $ Opt.info ( Cmd.GovernanceActionProtocolParametersUpdateCmdArgs - (inject shelleyToBab) + (convert shelleyToBab) <$> fmap Just (pUpdateProtocolParametersPreConway shelleyToBab) <*> pure Nothing <*> dpGovActionProtocolParametersUpdate sbe @@ -199,11 +199,11 @@ pUpdateProtocolParametersCmd = $ Opt.progDesc "Create a protocol parameters update." ) ( \conwayOnwards -> - let sbe = inject conwayOnwards + let sbe = convert conwayOnwards in subParser "create-protocol-parameters-update" $ Opt.info ( Cmd.GovernanceActionProtocolParametersUpdateCmdArgs - (inject conwayOnwards) + (convert conwayOnwards) Nothing <$> fmap Just (pUpdateProtocolParametersPostConway conwayOnwards) <*> dpGovActionProtocolParametersUpdate sbe diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs index 490e81bd0d..f2d56946a5 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Query.hs @@ -688,5 +688,5 @@ pQueryNoArgCmdArgs w envCli = <$> pSocketPath envCli <*> pConsensusModeParams <*> pNetworkId envCli - <*> pTarget (inject w :: ShelleyBasedEra era) + <*> pTarget (convert w) <*> optional pOutputFile diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs index e8f6f1aceb..65871ffc25 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/StakeAddress.hs @@ -121,7 +121,7 @@ pStakeAddressDeregistrationCertificateCmd = ( \shelleyToBabbage -> subParser "deregistration-certificate" $ Opt.info - ( StakeAddressDeregistrationCertificateCmd (inject shelleyToBabbage) + ( StakeAddressDeregistrationCertificateCmd (convert shelleyToBabbage) <$> pStakeIdentifier Nothing <*> pure Nothing <*> pOutputFile @@ -131,7 +131,7 @@ pStakeAddressDeregistrationCertificateCmd = ( \conwayOnwards -> subParser "deregistration-certificate" $ Opt.info - ( StakeAddressDeregistrationCertificateCmd (inject conwayOnwards) + ( StakeAddressDeregistrationCertificateCmd (convert conwayOnwards) <$> pStakeIdentifier Nothing <*> fmap Just pKeyRegistDeposit <*> pOutputFile diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs index cf07a9f14f..6b4a4d8e74 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs @@ -227,7 +227,7 @@ pTransactionBuildEstimateCmd eon' _envCli = do where pCmd :: Exp.Era era -> Parser (TransactionCmds era) pCmd era' = do - let sbe = inject era' + let sbe = convert era' fmap TransactionBuildEstimateCmd $ TransactionBuildEstimateCmdArgs era' <$> optional pScriptValidity diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs index 07e25a8565..e819fae1c5 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs @@ -332,11 +332,11 @@ generateShelleyNodeSecrets shelleyDelegateKeys shelleyGenesisvkeys = do createOpCert (kesKey, delegateKey) = either (error . show) id eResult where eResult = issueOperationalCertificate kesKey (Right delegateKey) (KESPeriod 0) counter - counter = OperationalCertificateIssueCounter 0 (convert . getVerificationKey $ delegateKey) - convert + counter = OperationalCertificateIssueCounter 0 (convertFun . getVerificationKey $ delegateKey) + convertFun :: VerificationKey GenesisDelegateExtendedKey -> VerificationKey StakePoolKey - convert = + convertFun = ( castVerificationKey :: VerificationKey GenesisDelegateKey -> VerificationKey StakePoolKey diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs index 2b558ec325..e8b803bffd 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance.hs @@ -93,7 +93,7 @@ runGovernanceMIRCertificatePayStakeAddrs w mirPot sAddrs rwdAmts oFp = do makeMIRCertificate $ MirCertificateRequirements w mirPot $ shelleyToBabbageEraConstraints w mirTarget - sbe :: ShelleyBasedEra era = inject w + sbe = convert w firstExceptT GovernanceCmdTextEnvWriteError . newExceptT @@ -115,7 +115,7 @@ runGovernanceCreateMirCertificateTransferToTreasuryCmd w ll oFp = do let mirTarget = L.SendToOppositePotMIR ll let mirCert = makeMIRCertificate $ MirCertificateRequirements w L.ReservesMIR mirTarget - sbe :: ShelleyBasedEra era = inject w + sbe = convert w firstExceptT GovernanceCmdTextEnvWriteError . newExceptT @@ -137,7 +137,7 @@ runGovernanceCreateMirCertificateTransferToReservesCmd w ll oFp = do let mirTarget = L.SendToOppositePotMIR ll let mirCert = makeMIRCertificate $ MirCertificateRequirements w L.TreasuryMIR mirTarget - sbe :: ShelleyBasedEra era = inject w + sbe = convert w firstExceptT GovernanceCmdTextEnvWriteError . newExceptT diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs index 4ad7d309b6..f414df01ed 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Actions.hs @@ -105,7 +105,7 @@ runGovernanceActionInfoCmd carryHashChecks checkProposalHash proposalAnchor ProposalCheck - let sbe :: ShelleyBasedEra era = inject eon + let sbe = convert eon govAction = InfoAct proposalProcedure = createProposalProcedure sbe networkId deposit depositStakeCredential govAction proposalAnchor @@ -147,7 +147,7 @@ runGovernanceActionCreateNoConfidenceCmd carryHashChecks checkProposalHash proposalAnchor ProposalCheck - let sbe :: ShelleyBasedEra era = inject eon + let sbe = convert eon previousGovernanceAction = MotionOfNoConfidence $ L.maybeToStrictMaybe $ @@ -214,7 +214,7 @@ runGovernanceActionCreateConstitutionCmd prevGovActId constitutionAnchor (toShelleyScriptHash <$> L.maybeToStrictMaybe constitutionScript) - sbe :: ShelleyBasedEra era = inject eon + sbe = convert eon proposalProcedure = createProposalProcedure sbe networkId deposit depositStakeCredential govAct proposalAnchor carryHashChecks checkConstitutionHash constitutionAnchor ConstitutionCheck @@ -248,7 +248,7 @@ runGovernanceActionUpdateCommitteeCmd , Cmd.mPrevGovernanceActionId , Cmd.outFile } = do - let sbe :: ShelleyBasedEra era = inject eon + let sbe = convert eon govActIdentifier = L.maybeToStrictMaybe $ shelleyBasedEraConstraints sbe $ @@ -315,7 +315,7 @@ runGovernanceActionCreateProtocolParametersUpdateCmd eraBasedPParams' = do caseShelleyToBabbageOrConwayEraOnwards ( \sToB -> do let oFp = uppFilePath eraBasedPParams' - anyEra = AnyShelleyBasedEra (inject sToB :: ShelleyBasedEra era) + anyEra = AnyShelleyBasedEra (convert sToB) UpdateProtocolParametersPreConway _stB expEpoch genesisVerKeys <- hoistMaybe (GovernanceActionsValueUpdateProtocolParametersNotFound anyEra) $ uppPreConway eraBasedPParams' @@ -341,7 +341,7 @@ runGovernanceActionCreateProtocolParametersUpdateCmd eraBasedPParams' = do ) ( \conwayOnwards -> do let oFp = uppFilePath eraBasedPParams' - anyEra = AnyShelleyBasedEra (inject conwayOnwards :: ShelleyBasedEra era) + anyEra = AnyShelleyBasedEra (convert conwayOnwards) UpdateProtocolParametersConwayOnwards _cOnwards @@ -453,7 +453,7 @@ runGovernanceActionTreasuryWithdrawalCmd firstExceptT GovernanceActionsReadStakeCredErrror $ getStakeCredentialFromIdentifier stakeIdentifier pure (networkId, stakeCredential, lovelace) - let sbe :: ShelleyBasedEra era = inject eon + let sbe = convert eon treasuryWithdrawals = TreasuryWithdrawal withdrawals @@ -501,7 +501,7 @@ runGovernanceActionHardforkInitCmd carryHashChecks checkProposalHash proposalAnchor ProposalCheck - let sbe :: ShelleyBasedEra era = inject eon + let sbe = convert eon govActIdentifier = L.maybeToStrictMaybe $ shelleyBasedEraConstraints sbe $ diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/GenesisKeyDelegationCertificate.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/GenesisKeyDelegationCertificate.hs index b7c1b702b8..27af1be856 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/GenesisKeyDelegationCertificate.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/GenesisKeyDelegationCertificate.hs @@ -44,7 +44,7 @@ runGovernanceGenesisKeyDelegationCertificate firstExceptT GovernanceCmdTextEnvWriteError . newExceptT $ writeLazyByteStringFile oFp - $ shelleyBasedEraConstraints (inject stb :: ShelleyBasedEra era) + $ shelleyBasedEraConstraints (convert stb) $ textEnvelopeToJSON (Just genKeyDelegCertDesc) genKeyDelegCert where genKeyDelegCertDesc :: TextEnvelopeDescr diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs index 4443c46bea..cff860d6c5 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/Vote.hs @@ -55,7 +55,7 @@ runGovernanceVoteCreateCmd , outFile } = do let (govActionTxId, govActionIndex) = governanceAction - sbe :: ShelleyBasedEra era = inject eon -- TODO: Conway era - update vote creation related function to take ConwayEraOnwards + sbe = convert eon -- TODO: Conway era - update vote creation related function to take ConwayEraOnwards mAnchor' = fmap ( \pca@PotentiallyCheckedAnchor{pcaAnchor = (VoteUrl url, voteHash)} -> @@ -104,7 +104,7 @@ runGovernanceVoteViewCmd , voteFile , mOutFile } = do - let sbe :: ShelleyBasedEra era = inject eon + let sbe :: ShelleyBasedEra era = convert eon shelleyBasedEraConstraints sbe $ do voteProcedures <- diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs index 93cc93f889..2ef99b3ac6 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs @@ -139,7 +139,7 @@ runTransactionBuildCmd , treasuryDonation -- Maybe TxTreasuryDonation , buildOutputOptions } = do - let eon = inject currentEra + let eon = convert currentEra era' = toCardanoEra eon -- The user can specify an era prior to the era that the node is currently in. @@ -217,9 +217,9 @@ runTransactionBuildCmd let returnAddrHashes = fromList - [ StakeCredentialByKey returnAddrHash + [ stakeCred | (proposal, _) <- proposals - , let (_, returnAddrHash, _) = fromProposalProcedure eon proposal -- fromProposalProcedure needs to be adjusted so that it works with script hashes. + , let (_, stakeCred, _) = fromProposalProcedure eon proposal -- fromProposalProcedure needs to be adjusted so that it works with script hashes. ] treasuryWithdrawalAddresses = fromList @@ -395,7 +395,7 @@ runTransactionBuildEstimateCmd -- TODO change type , currentTreasuryValueAndDonation , txBodyOutFile } = do - let sbe = inject currentEra + let sbe = convert currentEra meo = inject @(BabbageEraOnwards era) $ inject currentEra ledgerPParams <- @@ -523,7 +523,7 @@ runTransactionBuildEstimateCmd -- TODO change type let noWitTx = makeSignedTransaction [] balancedTxBody lift ( cardanoEraConstraints (toCardanoEra meo) $ - writeTxFileTextEnvelopeCddl (inject meo) txBodyOutFile noWitTx + writeTxFileTextEnvelopeCddl (convert meo) txBodyOutFile noWitTx ) & onLeft (left . TxCmdWriteFileError) diff --git a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs index 70c48ec3d4..874a65caf4 100644 --- a/cardano-cli/src/Cardano/CLI/Json/Friendly.hs +++ b/cardano-cli/src/Cardano/CLI/Json/Friendly.hs @@ -789,7 +789,7 @@ friendlyLovelace value = String $ docToText (pretty value) friendlyMintValue :: forall era. TxMintValue ViewTx era -> Aeson.Value friendlyMintValue = \case TxMintNone -> Null - txMintValue@(TxMintValue w _) -> friendlyValue @era (inject w) $ txMintValueToValue txMintValue + txMintValue@(TxMintValue w _) -> friendlyValue @era (convert w) $ txMintValueToValue txMintValue friendlyTxOutValue :: TxOutValue era -> Aeson.Value friendlyTxOutValue = \case diff --git a/cardano-cli/src/Cardano/CLI/Read.hs b/cardano-cli/src/Cardano/CLI/Read.hs index 8d2a65c085..a31096f5ba 100644 --- a/cardano-cli/src/Cardano/CLI/Read.hs +++ b/cardano-cli/src/Cardano/CLI/Read.hs @@ -985,7 +985,7 @@ readSingleVote w (voteFp, mScriptWitFiles) = do case mScriptWitFiles of Nothing -> pure $ (,Nothing) <$> votProceds sWitFile -> do - let sbe = inject w + let sbe = convert w runExceptT $ do sWits <- firstExceptT VoteErrorScriptWitness $ @@ -1031,7 +1031,7 @@ readProposal w (fp, mScriptWit) = do case mScriptWit of Nothing -> pure $ (,Nothing) <$> prop sWitFile -> do - let sbe = inject w + let sbe = convert w runExceptT $ do sWit <- firstExceptT ProposalErrorScriptWitness $ diff --git a/cardano-cli/src/Cardano/CLI/Run/Key.hs b/cardano-cli/src/Cardano/CLI/Run/Key.hs index 5fe8336002..31cbede324 100644 --- a/cardano-cli/src/Cardano/CLI/Run/Key.hs +++ b/cardano-cli/src/Cardano/CLI/Run/Key.hs @@ -244,35 +244,35 @@ runConvertByronKeyCmd } = case (byronKeyType, inFile) of (ByronPaymentKey format, ASigningKeyFile skeyPathOld) -> - convertByronSigningKey mPwd format convert skeyPathOld outFile + convertByronSigningKey mPwd format toSigningKey skeyPathOld outFile where - convert :: Byron.SigningKey -> SigningKey ByronKey - convert = ByronSigningKey + toSigningKey :: Byron.SigningKey -> SigningKey ByronKey + toSigningKey = ByronSigningKey (ByronGenesisKey format, ASigningKeyFile skeyPathOld) -> - convertByronSigningKey mPwd format convert skeyPathOld outFile + convertByronSigningKey mPwd format toSigningKey skeyPathOld outFile where - convert :: Byron.SigningKey -> SigningKey GenesisExtendedKey - convert (Byron.SigningKey xsk) = GenesisExtendedSigningKey xsk + toSigningKey :: Byron.SigningKey -> SigningKey GenesisExtendedKey + toSigningKey (Byron.SigningKey xsk) = GenesisExtendedSigningKey xsk (ByronDelegateKey format, ASigningKeyFile skeyPathOld) -> - convertByronSigningKey mPwd format convert skeyPathOld outFile + convertByronSigningKey mPwd format toSigningKey skeyPathOld outFile where - convert :: Byron.SigningKey -> SigningKey GenesisDelegateExtendedKey - convert (Byron.SigningKey xsk) = GenesisDelegateExtendedSigningKey xsk + toSigningKey :: Byron.SigningKey -> SigningKey GenesisDelegateExtendedKey + toSigningKey (Byron.SigningKey xsk) = GenesisDelegateExtendedSigningKey xsk (ByronPaymentKey NonLegacyByronKeyFormat, AVerificationKeyFile vkeyPathOld) -> - convertByronVerificationKey convert vkeyPathOld outFile + convertByronVerificationKey toVerificationKey vkeyPathOld outFile where - convert :: Byron.VerificationKey -> VerificationKey ByronKey - convert = ByronVerificationKey + toVerificationKey :: Byron.VerificationKey -> VerificationKey ByronKey + toVerificationKey = ByronVerificationKey (ByronGenesisKey NonLegacyByronKeyFormat, AVerificationKeyFile vkeyPathOld) -> - convertByronVerificationKey convert vkeyPathOld outFile + convertByronVerificationKey toVerificationKey vkeyPathOld outFile where - convert :: Byron.VerificationKey -> VerificationKey GenesisExtendedKey - convert (Byron.VerificationKey xvk) = GenesisExtendedVerificationKey xvk + toVerificationKey :: Byron.VerificationKey -> VerificationKey GenesisExtendedKey + toVerificationKey (Byron.VerificationKey xvk) = GenesisExtendedVerificationKey xvk (ByronDelegateKey NonLegacyByronKeyFormat, AVerificationKeyFile vkeyPathOld) -> - convertByronVerificationKey convert vkeyPathOld outFile + convertByronVerificationKey toVerificationKey vkeyPathOld outFile where - convert :: Byron.VerificationKey -> VerificationKey GenesisDelegateExtendedKey - convert (Byron.VerificationKey xvk) = + toVerificationKey :: Byron.VerificationKey -> VerificationKey GenesisDelegateExtendedKey + toVerificationKey (Byron.VerificationKey xvk) = GenesisDelegateExtendedVerificationKey xvk (ByronPaymentKey LegacyByronKeyFormat, AVerificationKeyFile{}) -> legacyVerificationKeysNotSupported @@ -302,7 +302,7 @@ convertByronSigningKey -> File () Out -- ^ Output file: new format -> ExceptT KeyCmdError IO () -convertByronSigningKey mPwd byronFormat convert skeyPathOld skeyPathNew = do +convertByronSigningKey mPwd byronFormat convertFun skeyPathOld skeyPathNew = do sKey <- firstExceptT KeyCmdByronKeyFailure $ Byron.readByronSigningKey byronFormat skeyPathOld @@ -319,7 +319,7 @@ convertByronSigningKey mPwd byronFormat convert skeyPathOld skeyPathNew = do ByronApi.AByronSigningKey (ByronSigningKey sk) -> return sk let sk' :: SigningKey keyrole - sk' = convert unprotectedSk + sk' = convertFun unprotectedSk firstExceptT KeyCmdWriteFileError . newExceptT $ writeLazyByteStringFile skeyPathNew $ @@ -334,13 +334,13 @@ convertByronVerificationKey -> File () Out -- ^ Output file: new format -> ExceptT KeyCmdError IO () -convertByronVerificationKey convert vkeyPathOld vkeyPathNew = do +convertByronVerificationKey convertFun vkeyPathOld vkeyPathNew = do vk <- firstExceptT KeyCmdByronKeyFailure $ Byron.readPaymentVerificationKey vkeyPathOld let vk' :: VerificationKey keyrole - vk' = convert vk + vk' = convertFun vk firstExceptT KeyCmdWriteFileError . newExceptT $ writeLazyByteStringFile vkeyPathNew $ @@ -362,14 +362,14 @@ runConvertByronGenesisVKeyCmd $ b64ByronVKey let vk' :: VerificationKey GenesisKey - vk' = convert vk + vk' = convertFun vk firstExceptT KeyCmdWriteFileError . newExceptT $ writeLazyByteStringFile vkeyPathNew $ textEnvelopeToJSON Nothing vk' where - convert :: Byron.VerificationKey -> VerificationKey GenesisKey - convert (Byron.VerificationKey xvk) = + convertFun :: Byron.VerificationKey -> VerificationKey GenesisKey + convertFun (Byron.VerificationKey xvk) = castVerificationKey (GenesisExtendedVerificationKey xvk) --------------------------------------------------------------------------------