-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #368 from input-output-hk/smelc/shelley-to-alonzo-…
…move-create-genesis-key-delegation-certificate-to-governance Shelley to Alonzo: add create-genesis-key-delegation-certificate to governance
- Loading branch information
Showing
19 changed files
with
397 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/GenesisKeyDelegationCertificate.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE GADTs #-} | ||
|
||
module Cardano.CLI.EraBased.Run.Governance.GenesisKeyDelegationCertificate | ||
( runGovernanceGenesisKeyDelegationCertificate | ||
) where | ||
|
||
|
||
import Cardano.Api | ||
import Cardano.Api.Shelley | ||
|
||
import Cardano.CLI.Types.Errors.GovernanceCmdError | ||
import Cardano.CLI.Types.Key | ||
|
||
import Control.Monad.Trans.Except (ExceptT) | ||
import Control.Monad.Trans.Except.Extra | ||
|
||
runGovernanceGenesisKeyDelegationCertificate | ||
:: ShelleyToBabbageEra era | ||
-> VerificationKeyOrHashOrFile GenesisKey | ||
-> VerificationKeyOrHashOrFile GenesisDelegateKey | ||
-> VerificationKeyOrHashOrFile VrfKey | ||
-> File () Out | ||
-> ExceptT GovernanceCmdError IO () | ||
runGovernanceGenesisKeyDelegationCertificate stb | ||
genVkOrHashOrFp | ||
genDelVkOrHashOrFp | ||
vrfVkOrHashOrFp | ||
oFp = do | ||
genesisVkHash <- firstExceptT GovernanceCmdKeyReadError | ||
. newExceptT | ||
$ readVerificationKeyOrHashOrTextEnvFile AsGenesisKey genVkOrHashOrFp | ||
genesisDelVkHash <-firstExceptT GovernanceCmdKeyReadError | ||
. newExceptT | ||
$ readVerificationKeyOrHashOrTextEnvFile AsGenesisDelegateKey genDelVkOrHashOrFp | ||
vrfVkHash <- firstExceptT GovernanceCmdKeyReadError | ||
. newExceptT | ||
$ readVerificationKeyOrHashOrFile AsVrfKey vrfVkOrHashOrFp | ||
|
||
let req = GenesisKeyDelegationRequirements stb genesisVkHash genesisDelVkHash vrfVkHash | ||
genKeyDelegCert = makeGenesisKeyDelegationCertificate req | ||
|
||
firstExceptT GovernanceCmdTextEnvWriteError | ||
. newExceptT | ||
$ writeLazyByteStringFile oFp | ||
$ shelleyBasedEraConstraints (shelleyToBabbageEraToShelleyBasedEra stb) | ||
$ textEnvelopeToJSON (Just genKeyDelegCertDesc) genKeyDelegCert | ||
where | ||
genKeyDelegCertDesc :: TextEnvelopeDescr | ||
genKeyDelegCertDesc = "Genesis Key Delegation Certificate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.