Skip to content

Commit 6d6df7b

Browse files
committed
WIP
1 parent a783f74 commit 6d6df7b

File tree

7 files changed

+53
-45
lines changed

7 files changed

+53
-45
lines changed

cabal.project

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ if impl (ghc >= 9.12)
8585
, ouroboros-network:base
8686
, cardano-ping:base
8787

88+
-- TODO: REbase your cip branch on master and update the commit here
8889
source-repository-package
8990
type: git
9091
location: https://github.com/IntersectMBO/cardano-api.git
91-
tag: c8aa79fabf0069d08fb41743beb81dfee8fc8625
92+
tag: baacdf3bc718b9276ae31519f8bd1357975fb178
9293
subdir: cardano-api

cardano-cli/src/Cardano/CLI/EraBased/Query/Run.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ where
4141
import Cardano.Api hiding (QueryInShelleyBasedEra (..))
4242
import Cardano.Api qualified as Api
4343
import Cardano.Api.Consensus qualified as Consensus
44-
import Cardano.Api.Ledger (StandardCrypto, strictMaybeToMaybe)
44+
import Cardano.Api.Ledger (strictMaybeToMaybe)
4545
import Cardano.Api.Ledger qualified as L
4646
import Cardano.Api.Network (LedgerPeerSnapshot, Serialised (..))
4747
import Cardano.Api.Network qualified as Consensus
@@ -1110,7 +1110,7 @@ writePoolState mOutFile serialisedCurrentEpochState = do
11101110
<> Map.keysSet (L.psFutureStakePoolParams poolState)
11111111
<> Map.keysSet (L.psRetiring poolState)
11121112

1113-
let poolStates :: Map (L.KeyHash 'L.StakePool) (Params StandardCrypto)
1113+
let poolStates :: Map (L.KeyHash 'L.StakePool) (Params)
11141114
poolStates =
11151115
fromList $
11161116
hks

cardano-cli/src/Cardano/CLI/EraIndependent/Cip/Cip129/Conversion.hs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module Cardano.CLI.EraIndependent.Cip.Cip129.Conversion
88
)
99
where
1010

11-
import Cardano.Api.Ledger (StandardCrypto)
1211
import Cardano.Api.Ledger qualified as L
1312
import Cardano.Api.Shelley
1413

@@ -22,7 +21,7 @@ encodeCip129DrepVerficationKeyText :: AnyDrepVerificationKey -> Text
2221
encodeCip129DrepVerficationKeyText = serialiseToBech32CIP129 . anyDrepVerificationKeyToCredential
2322

2423
anyDrepVerificationKeyToCredential
25-
:: AnyDrepVerificationKey -> L.Credential L.DRepRole StandardCrypto
24+
:: AnyDrepVerificationKey -> L.Credential L.DRepRole
2625
anyDrepVerificationKeyToCredential drepKey =
2726
case drepKey of
2827
AnyDrepVerificationKey vk ->
@@ -36,7 +35,7 @@ encodeCip129CommitteeHotVerficationKeyText :: AnyCommitteeHotVerificationKey ->
3635
encodeCip129CommitteeHotVerficationKeyText = serialiseToBech32CIP129 . anyCommitteeHotVerificationKeyToCredential
3736

3837
anyCommitteeHotVerificationKeyToCredential
39-
:: AnyCommitteeHotVerificationKey -> L.Credential L.HotCommitteeRole StandardCrypto
38+
:: AnyCommitteeHotVerificationKey -> L.Credential L.HotCommitteeRole
4039
anyCommitteeHotVerificationKeyToCredential committeeHotKey =
4140
case committeeHotKey of
4241
AnyCommitteeHotVerificationKey vk ->
@@ -50,7 +49,7 @@ encodeCip129CommitteeColdVerficationKeyText :: AnyCommitteeColdVerificationKey -
5049
encodeCip129CommitteeColdVerficationKeyText = serialiseToBech32CIP129 . anyCommitteeColdVerificationKeyToCredential
5150

5251
anyCommitteeColdVerificationKeyToCredential
53-
:: AnyCommitteeColdVerificationKey -> L.Credential L.ColdCommitteeRole StandardCrypto
52+
:: AnyCommitteeColdVerificationKey -> L.Credential L.ColdCommitteeRole
5453
anyCommitteeColdVerificationKeyToCredential committeeColdKey =
5554
case committeeColdKey of
5655
AnyCommitteeColdVerificationKey vk ->
@@ -60,5 +59,5 @@ anyCommitteeColdVerificationKeyToCredential committeeColdKey =
6059
let CommitteeColdExtendedKeyHash hash = verificationKeyHash vk
6160
in L.KeyHashObj hash
6261

63-
encodeCip129GovernanceActionIdText :: L.GovActionId StandardCrypto -> Text
62+
encodeCip129GovernanceActionIdText :: L.GovActionId -> Text
6463
encodeCip129GovernanceActionIdText = serialiseToBech32CIP129

cardano-cli/src/Cardano/CLI/EraIndependent/Cip/Cip129/Options.hs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,22 @@ pCip129 :: Opt.Parser CipFormatCmds
1515
pCip129 =
1616
Cip129
1717
<$> asum
18-
[ subParser "drep" $
19-
(Opt.info pCip129Drep) $
20-
Opt.progDesc "Convert drep verification key to the cip-129 compliant format"
21-
, subParser "committee-hot-key" $
22-
(Opt.info pCip129CommitteeHotKey) $
23-
Opt.progDesc "Convert committee hot key to the cip-129 compliant format"
24-
, subParser "committee-cold-key" $
25-
(Opt.info pCip129CommitteeColdKey) $
26-
Opt.progDesc "Convert committee cold key to the cip-129 compliant format"
27-
, subParser "governance-action-id" $
28-
(Opt.info pCip129GovernanceAction) $
29-
Opt.progDesc "Convert governance action id to the cip-129 compliant format"
18+
[ Opt.hsubparser $
19+
commandWithMetavar "drep" $
20+
(Opt.info pCip129Drep) $
21+
Opt.progDesc "Convert drep verification key to the cip-129 compliant format"
22+
, Opt.hsubparser $
23+
commandWithMetavar "committee-hot-key" $
24+
(Opt.info pCip129CommitteeHotKey) $
25+
Opt.progDesc "Convert committee hot key to the cip-129 compliant format"
26+
, Opt.hsubparser $
27+
commandWithMetavar "committee-cold-key" $
28+
(Opt.info pCip129CommitteeColdKey) $
29+
Opt.progDesc "Convert committee cold key to the cip-129 compliant format"
30+
, Opt.hsubparser $
31+
commandWithMetavar "governance-action-id" $
32+
(Opt.info pCip129GovernanceAction) $
33+
Opt.progDesc "Convert governance action id to the cip-129 compliant format"
3034
]
3135

3236
pCip129Drep :: Opt.Parser Cip129

cardano-cli/src/Cardano/CLI/EraIndependent/Cip/Options.hs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,21 @@ import Options.Applicative qualified as Opt
1414

1515
parseCipCmd :: Opt.Parser ClientCommand
1616
parseCipCmd =
17-
subParser "cip-format" $
18-
Opt.info (CipFormatCmds <$> pCipFormat) $
19-
Opt.progDesc $
20-
mconcat
21-
[ "Group of commands related to CIP changes."
22-
]
17+
Opt.hsubparser $
18+
commandWithMetavar "cip-format" $
19+
Opt.info (CipFormatCmds <$> pCipFormat) $
20+
Opt.progDesc $
21+
mconcat
22+
[ "Group of commands related to CIP changes."
23+
]
2324

2425
pCipFormat :: Opt.Parser CipFormatCmds
2526
pCipFormat =
26-
subParser "cip-129" $
27-
Opt.info pCip129 $
28-
Opt.progDesc $
29-
mconcat
30-
[ "Modified binary encoding of drep keys, constitutional committee cold and hot keys, governance actions."
31-
, "https://github.com/cardano-foundation/CIPs/tree/master/CIP-0129"
32-
]
27+
Opt.hsubparser $
28+
commandWithMetavar "cip-129" $
29+
Opt.info pCip129 $
30+
Opt.progDesc $
31+
mconcat
32+
[ "Modified binary encoding of drep keys, constitutional committee cold and hot keys, governance actions."
33+
, "https://github.com/cardano-foundation/CIPs/tree/master/CIP-0129"
34+
]
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
module Cardano.CLI.Read.GovernanceActionId
22
( readGoveranceActionIdHexText
3-
) where
4-
3+
)
4+
where
5+
6+
import Cardano.Api.Ledger qualified as L
57
import Cardano.Api.Shelley
6-
import qualified Cardano.Api.Ledger as L
7-
import Cardano.CLI.EraBased.Common.Option ( parseTxIn )
8-
import qualified Text.Parsec as Text
9-
import qualified Data.Text as Text
10-
import Data.Text (Text)
118

9+
import Cardano.CLI.EraBased.Common.Option (parseTxIn)
10+
11+
import Data.Text (Text)
12+
import Data.Text qualified as Text
13+
import Text.Parsec qualified as Text
1214

13-
readGoveranceActionIdHexText :: Text -> Either Text.ParseError (L.GovActionId L.StandardCrypto)
15+
readGoveranceActionIdHexText :: Text -> Either Text.ParseError L.GovActionId
1416
readGoveranceActionIdHexText hexText = do
15-
TxIn txid (TxIx index) <- Text.parse parseTxIn "" $ Text.unpack hexText
16-
return $ createGovernanceActionId txid $ fromIntegral index
17+
TxIn txid (TxIx index) <- Text.parse parseTxIn "" $ Text.unpack hexText
18+
return $ createGovernanceActionId txid $ fromIntegral index

cardano-cli/src/Cardano/CLI/Type/Common.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,15 @@ data AllOrOnly a = All | Only [a] deriving (Eq, Show)
356356
-- | This data structure is used to allow nicely formatted output in the query pool-params command.
357357
-- params are the current pool parameter settings, futureparams are new parameters, retiringEpoch is the
358358
-- epoch that has been set for pool retirement. Any of these may be Nothing.
359-
data Params crypto = Params
359+
data Params = Params
360360
{ poolParameters :: Maybe L.PoolParams
361361
, futurePoolParameters :: Maybe L.PoolParams
362362
, retiringEpoch :: Maybe EpochNo
363363
}
364364
deriving Show
365365

366366
-- | Pretty printing for pool parameters
367-
instance L.Crypto crypto => ToJSON (Params crypto) where
367+
instance ToJSON Params where
368368
toJSON (Params p fp r) =
369369
object
370370
[ "poolParams" .= p

0 commit comments

Comments
 (0)