Skip to content

Commit 5d4a3e5

Browse files
committed
Build cardano-api
1 parent 62a3825 commit 5d4a3e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+603
-699
lines changed

cardano-api/cardano-api.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ test-suite cardano-api-golden
394394
cardano-ledger-core:{cardano-ledger-core, testlib} >=1.14,
395395
cardano-ledger-shelley,
396396
cardano-ledger-shelley-test >=1.2.0.1,
397+
cardano-protocol-tpraos,
397398
cardano-slotting ^>=0.2.0.0,
398399
containers,
399400
errors,

cardano-api/src/Cardano/Api/Internal/Address.hs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ import Cardano.Chain.Common qualified as Byron
106106
import Cardano.Ledger.Address qualified as Shelley
107107
import Cardano.Ledger.BaseTypes qualified as Shelley
108108
import Cardano.Ledger.Credential qualified as Shelley
109-
import Cardano.Ledger.Crypto (StandardCrypto)
110109
import Cardano.Ledger.Plutus.TxInfo qualified as Plutus
111110
import PlutusLedgerApi.V1 qualified as PlutusAPI
112111

@@ -188,8 +187,8 @@ data Address addrtype where
188187
-- in Shelley era and are thus supported from the Shelley era onwards
189188
ShelleyAddress
190189
:: Shelley.Network
191-
-> Shelley.PaymentCredential StandardCrypto
192-
-> Shelley.StakeReference StandardCrypto
190+
-> Shelley.PaymentCredential
191+
-> Shelley.StakeReference
193192
-> Address ShelleyAddr
194193

195194
-- Note that the two ledger credential types here are parametrised by
@@ -231,7 +230,7 @@ instance SerialiseAsRawBytes (Address ByronAddr) where
231230
$ addr
232231

233232
deserialiseFromRawBytes (AsAddress AsByronAddr) bs =
234-
case Shelley.decodeAddr bs :: Maybe (Shelley.Addr StandardCrypto) of
233+
case Shelley.decodeAddr bs :: Maybe Shelley.Addr of
235234
Nothing -> Left (SerialiseAsRawBytesError "Unable to deserialise Address ByronAddr")
236235
Just Shelley.Addr{} -> Left (SerialiseAsRawBytesError "Unable to deserialise Address ByronAddr")
237236
Just (Shelley.AddrBootstrap (Shelley.BootstrapAddress addr)) ->
@@ -352,7 +351,7 @@ instance SerialiseAddress AddressAny where
352351
(AddressByron <$> deserialiseAddress (AsAddress AsByronAddr) t)
353352
<|> (AddressShelley <$> deserialiseAddress (AsAddress AsShelleyAddr) t)
354353

355-
fromShelleyAddrToAny :: Shelley.Addr StandardCrypto -> AddressAny
354+
fromShelleyAddrToAny :: Shelley.Addr -> AddressAny
356355
fromShelleyAddrToAny (Shelley.AddrBootstrap (Shelley.BootstrapAddress addr)) =
357356
AddressByron $ ByronAddress addr
358357
fromShelleyAddrToAny (Shelley.Addr nw pc scr) =
@@ -531,7 +530,7 @@ makeShelleyAddressInEra sbe nw pc scr =
531530
data StakeAddress where
532531
StakeAddress
533532
:: Shelley.Network
534-
-> Shelley.StakeCredential StandardCrypto
533+
-> Shelley.StakeCredential
535534
-> StakeAddress
536535
deriving (Eq, Ord, Show)
537536

@@ -634,7 +633,7 @@ shelleyPayAddrToPlutusPubKHash (ShelleyAddress _ payCred _) =
634633
-- Internal conversion functions
635634
--
636635

637-
toShelleyAddr :: AddressInEra era -> Shelley.Addr StandardCrypto
636+
toShelleyAddr :: AddressInEra era -> Shelley.Addr
638637
toShelleyAddr (AddressInEra ByronAddressInAnyEra (ByronAddress addr)) =
639638
Shelley.AddrBootstrap (Shelley.BootstrapAddress addr)
640639
toShelleyAddr
@@ -644,7 +643,7 @@ toShelleyAddr
644643
) =
645644
Shelley.Addr nw pc scr
646645

647-
toShelleyStakeAddr :: StakeAddress -> Shelley.RewardAccount StandardCrypto
646+
toShelleyStakeAddr :: StakeAddress -> Shelley.RewardAccount
648647
toShelleyStakeAddr (StakeAddress nw sc) =
649648
Shelley.RewardAccount
650649
{ Shelley.raNetwork = nw
@@ -653,23 +652,23 @@ toShelleyStakeAddr (StakeAddress nw sc) =
653652

654653
toShelleyPaymentCredential
655654
:: PaymentCredential
656-
-> Shelley.PaymentCredential StandardCrypto
655+
-> Shelley.PaymentCredential
657656
toShelleyPaymentCredential (PaymentCredentialByKey (PaymentKeyHash kh)) =
658657
Shelley.KeyHashObj kh
659658
toShelleyPaymentCredential (PaymentCredentialByScript sh) =
660659
Shelley.ScriptHashObj (toShelleyScriptHash sh)
661660

662661
toShelleyStakeCredential
663662
:: StakeCredential
664-
-> Shelley.StakeCredential StandardCrypto
663+
-> Shelley.StakeCredential
665664
toShelleyStakeCredential (StakeCredentialByKey (StakeKeyHash kh)) =
666665
Shelley.KeyHashObj kh
667666
toShelleyStakeCredential (StakeCredentialByScript sh) =
668667
Shelley.ScriptHashObj (toShelleyScriptHash sh)
669668

670669
toShelleyStakeReference
671670
:: StakeAddressReference
672-
-> Shelley.StakeReference StandardCrypto
671+
-> Shelley.StakeReference
673672
toShelleyStakeReference (StakeAddressByValue stakecred) =
674673
Shelley.StakeRefBase (toShelleyStakeCredential stakecred)
675674
toShelleyStakeReference (StakeAddressByPointer ptr) =
@@ -680,7 +679,7 @@ toShelleyStakeReference NoStakeAddress =
680679
fromShelleyAddrIsSbe
681680
:: ()
682681
=> ShelleyBasedEra era
683-
-> Shelley.Addr StandardCrypto
682+
-> Shelley.Addr
684683
-> AddressInEra era
685684
fromShelleyAddrIsSbe sbe = \case
686685
Shelley.AddrBootstrap (Shelley.BootstrapAddress addr) ->
@@ -690,7 +689,7 @@ fromShelleyAddrIsSbe sbe = \case
690689

691690
fromShelleyAddr
692691
:: ShelleyBasedEra era
693-
-> Shelley.Addr StandardCrypto
692+
-> Shelley.Addr
694693
-> AddressInEra era
695694
fromShelleyAddr _ (Shelley.AddrBootstrap (Shelley.BootstrapAddress addr)) =
696695
AddressInEra ByronAddressInAnyEra (ByronAddress addr)
@@ -699,27 +698,27 @@ fromShelleyAddr sBasedEra (Shelley.Addr nw pc scr) =
699698
(ShelleyAddressInEra sBasedEra)
700699
(ShelleyAddress nw pc scr)
701700

702-
fromShelleyStakeAddr :: Shelley.RewardAccount StandardCrypto -> StakeAddress
701+
fromShelleyStakeAddr :: Shelley.RewardAccount -> StakeAddress
703702
fromShelleyStakeAddr (Shelley.RewardAccount nw sc) = StakeAddress nw sc
704703

705704
fromShelleyStakeCredential
706-
:: Shelley.StakeCredential StandardCrypto
705+
:: Shelley.StakeCredential
707706
-> StakeCredential
708707
fromShelleyStakeCredential (Shelley.KeyHashObj kh) =
709708
StakeCredentialByKey (StakeKeyHash kh)
710709
fromShelleyStakeCredential (Shelley.ScriptHashObj sh) =
711710
StakeCredentialByScript (fromShelleyScriptHash sh)
712711

713712
fromShelleyPaymentCredential
714-
:: Shelley.PaymentCredential StandardCrypto
713+
:: Shelley.PaymentCredential
715714
-> PaymentCredential
716715
fromShelleyPaymentCredential (Shelley.KeyHashObj kh) =
717716
PaymentCredentialByKey (PaymentKeyHash kh)
718717
fromShelleyPaymentCredential (Shelley.ScriptHashObj sh) =
719718
PaymentCredentialByScript (ScriptHash sh)
720719

721720
fromShelleyStakeReference
722-
:: Shelley.StakeReference StandardCrypto
721+
:: Shelley.StakeReference
723722
-> StakeAddressReference
724723
fromShelleyStakeReference (Shelley.StakeRefBase stakecred) =
725724
StakeAddressByValue (fromShelleyStakeCredential stakecred)

cardano-api/src/Cardano/Api/Internal/Anchor.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ module Cardano.Api.Internal.Anchor
55
where
66

77
import Cardano.Ledger.BaseTypes qualified as L
8-
import Cardano.Ledger.Crypto qualified as Crypto
9-
import Cardano.Ledger.SafeHash qualified as L
8+
import Cardano.Ledger.Hashes qualified as L
109

1110
-- | The URL to build the anchor to pass to DRep registration certificate
1211
newtype AnchorUrl = AnchorUrl
@@ -16,6 +15,6 @@ newtype AnchorUrl = AnchorUrl
1615

1716
-- | The hash to build the anchor to pass to DRep registration certificate
1817
newtype AnchorDataHash = AnchorDataHash
19-
{ unAnchorDataHash :: L.SafeHash Crypto.StandardCrypto L.AnchorData
18+
{ unAnchorDataHash :: L.SafeHash L.AnchorData
2019
}
2120
deriving (Eq, Show)

cardano-api/src/Cardano/Api/Internal/Block.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ import Cardano.Api.Internal.Tx.Sign
6363

6464
import Cardano.Crypto.Hash.Class qualified as Crypto
6565
import Cardano.Crypto.Hashing qualified
66-
import Cardano.Ledger.Api qualified as L
6766
import Cardano.Ledger.Block qualified as Ledger
6867
import Cardano.Ledger.Core qualified as Ledger
68+
import Cardano.Protocol.Crypto qualified as L
6969
import Cardano.Slotting.Block (BlockNo)
7070
import Cardano.Slotting.Slot (EpochNo, SlotNo, WithOrigin (..))
7171
import Ouroboros.Consensus.Block qualified as Consensus

cardano-api/src/Cardano/Api/Internal/Certificate.hs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ import Cardano.Api.Internal.HasTypeProxy
9090
import Cardano.Api.Internal.Keys.Praos
9191
import Cardano.Api.Internal.Keys.Shelley
9292
import Cardano.Api.Internal.Pretty (Doc)
93-
import Cardano.Api.Internal.ReexposeLedger (EraCrypto, StandardCrypto)
9493
import Cardano.Api.Internal.ReexposeLedger qualified as Ledger
9594
import Cardano.Api.Internal.Script
9695
import Cardano.Api.Internal.SerialiseCBOR
@@ -295,7 +294,7 @@ data StakeDelegationRequirements era where
295294
StakeDelegationRequirementsConwayOnwards
296295
:: ConwayEraOnwards era
297296
-> StakeCredential
298-
-> Ledger.Delegatee (EraCrypto (ShelleyLedgerEra era))
297+
-> Ledger.Delegatee
299298
-> StakeDelegationRequirements era
300299
StakeDelegationRequirementsPreConway
301300
:: ShelleyToBabbageEra era
@@ -317,11 +316,11 @@ makeStakeAddressDelegationCertificate = \case
317316
data StakePoolRegistrationRequirements era where
318317
StakePoolRegistrationRequirementsConwayOnwards
319318
:: ConwayEraOnwards era
320-
-> Ledger.PoolParams (EraCrypto (ShelleyLedgerEra era))
319+
-> Ledger.PoolParams
321320
-> StakePoolRegistrationRequirements era
322321
StakePoolRegistrationRequirementsPreConway
323322
:: ShelleyToBabbageEra era
324-
-> Ledger.PoolParams (EraCrypto (ShelleyLedgerEra era))
323+
-> Ledger.PoolParams
325324
-> StakePoolRegistrationRequirements era
326325

327326
makeStakePoolRegistrationCertificate
@@ -390,7 +389,7 @@ data MirCertificateRequirements era where
390389
MirCertificateRequirements
391390
:: ShelleyToBabbageEra era
392391
-> Ledger.MIRPot
393-
-> Ledger.MIRTarget (EraCrypto (ShelleyLedgerEra era))
392+
-> Ledger.MIRTarget
394393
-> MirCertificateRequirements era
395394

396395
makeMIRCertificate
@@ -405,14 +404,14 @@ makeMIRCertificate (MirCertificateRequirements atMostEra mirPot mirTarget) =
405404
data DRepRegistrationRequirements era where
406405
DRepRegistrationRequirements
407406
:: ConwayEraOnwards era
408-
-> (Ledger.Credential Ledger.DRepRole (EraCrypto (ShelleyLedgerEra era)))
407+
-> (Ledger.Credential Ledger.DRepRole)
409408
-> L.Coin
410409
-> DRepRegistrationRequirements era
411410

412411
makeDrepRegistrationCertificate
413412
:: ()
414413
=> DRepRegistrationRequirements era
415-
-> Maybe (Ledger.Anchor (EraCrypto (ShelleyLedgerEra era)))
414+
-> Maybe Ledger.Anchor
416415
-> Certificate era
417416
makeDrepRegistrationCertificate (DRepRegistrationRequirements conwayOnwards vcred deposit) anchor =
418417
ConwayCertificate conwayOnwards
@@ -422,8 +421,8 @@ makeDrepRegistrationCertificate (DRepRegistrationRequirements conwayOnwards vcre
422421
data CommitteeHotKeyAuthorizationRequirements era where
423422
CommitteeHotKeyAuthorizationRequirements
424423
:: ConwayEraOnwards era
425-
-> Ledger.Credential Ledger.ColdCommitteeRole (EraCrypto (ShelleyLedgerEra era))
426-
-> Ledger.Credential Ledger.HotCommitteeRole (EraCrypto (ShelleyLedgerEra era))
424+
-> Ledger.Credential Ledger.ColdCommitteeRole
425+
-> Ledger.Credential Ledger.HotCommitteeRole
427426
-> CommitteeHotKeyAuthorizationRequirements era
428427

429428
makeCommitteeHotKeyAuthorizationCertificate
@@ -438,8 +437,8 @@ makeCommitteeHotKeyAuthorizationCertificate (CommitteeHotKeyAuthorizationRequire
438437
data CommitteeColdkeyResignationRequirements era where
439438
CommitteeColdkeyResignationRequirements
440439
:: ConwayEraOnwards era
441-
-> Ledger.Credential Ledger.ColdCommitteeRole (EraCrypto (ShelleyLedgerEra era))
442-
-> Maybe (Ledger.Anchor (EraCrypto (ShelleyLedgerEra era)))
440+
-> Ledger.Credential Ledger.ColdCommitteeRole
441+
-> Maybe Ledger.Anchor
443442
-> CommitteeColdkeyResignationRequirements era
444443

445444
makeCommitteeColdkeyResignationCertificate
@@ -456,7 +455,7 @@ makeCommitteeColdkeyResignationCertificate (CommitteeColdkeyResignationRequireme
456455
data DRepUnregistrationRequirements era where
457456
DRepUnregistrationRequirements
458457
:: ConwayEraOnwards era
459-
-> (Ledger.Credential Ledger.DRepRole (EraCrypto (ShelleyLedgerEra era)))
458+
-> (Ledger.Credential Ledger.DRepRole)
460459
-> L.Coin
461460
-> DRepUnregistrationRequirements era
462461

@@ -473,7 +472,7 @@ makeStakeAddressAndDRepDelegationCertificate
473472
:: ()
474473
=> ConwayEraOnwards era
475474
-> StakeCredential
476-
-> Ledger.Delegatee (EraCrypto (ShelleyLedgerEra era))
475+
-> Ledger.Delegatee
477476
-> L.Coin
478477
-> Certificate era
479478
makeStakeAddressAndDRepDelegationCertificate w cred delegatee deposit =
@@ -484,12 +483,12 @@ makeStakeAddressAndDRepDelegationCertificate w cred delegatee deposit =
484483
data DRepUpdateRequirements era where
485484
DRepUpdateRequirements
486485
:: ConwayEraOnwards era
487-
-> Ledger.Credential Ledger.DRepRole (EraCrypto (ShelleyLedgerEra era))
486+
-> Ledger.Credential Ledger.DRepRole
488487
-> DRepUpdateRequirements era
489488

490489
makeDrepUpdateCertificate
491490
:: DRepUpdateRequirements era
492-
-> Maybe (Ledger.Anchor (EraCrypto (ShelleyLedgerEra era)))
491+
-> Maybe Ledger.Anchor
493492
-> Certificate era
494493
makeDrepUpdateCertificate (DRepUpdateRequirements conwayOnwards vcred) mAnchor =
495494
ConwayCertificate conwayOnwards
@@ -556,7 +555,7 @@ filterUnRegCreds =
556555
Ledger.UnRegTxCert cred -> Just cred
557556

558557
filterUnRegDRepCreds
559-
:: Certificate era -> Maybe (Ledger.Credential Ledger.DRepRole Ledger.StandardCrypto)
558+
:: Certificate era -> Maybe (Ledger.Credential Ledger.DRepRole)
560559
filterUnRegDRepCreds = \case
561560
ShelleyRelatedCertificate _ _ -> Nothing
562561
ConwayCertificate cEra conwayCert -> conwayEraOnwardsConstraints cEra $
@@ -599,7 +598,7 @@ fromShelleyCertificate
599598
fromShelleyCertificate =
600599
caseShelleyToBabbageOrConwayEraOnwards ShelleyRelatedCertificate ConwayCertificate
601600

602-
toShelleyPoolParams :: StakePoolParameters -> Ledger.PoolParams StandardCrypto
601+
toShelleyPoolParams :: StakePoolParameters -> Ledger.PoolParams
603602
toShelleyPoolParams
604603
StakePoolParameters
605604
{ stakePoolId = StakePoolKeyHash poolkh
@@ -672,7 +671,7 @@ toShelleyPoolParams
672671
Ledger.textToUrl (Text.length url) url
673672

674673
fromShelleyPoolParams
675-
:: Ledger.PoolParams StandardCrypto
674+
:: Ledger.PoolParams
676675
-> StakePoolParameters
677676
fromShelleyPoolParams
678677
Ledger.PoolParams
@@ -751,7 +750,7 @@ instance Error AnchorDataFromCertificateError where
751750
-- means that the certificate does not contain anchor data.
752751
getAnchorDataFromCertificate
753752
:: Certificate era
754-
-> Either AnchorDataFromCertificateError (Maybe (Ledger.Anchor StandardCrypto))
753+
-> Either AnchorDataFromCertificateError (Maybe Ledger.Anchor)
755754
getAnchorDataFromCertificate c =
756755
case c of
757756
ShelleyRelatedCertificate stbe scert ->
@@ -784,7 +783,7 @@ getAnchorDataFromCertificate c =
784783
anchorDataFromPoolMetadata
785784
:: MonadError AnchorDataFromCertificateError m
786785
=> Ledger.PoolMetadata
787-
-> m (Maybe (Ledger.Anchor StandardCrypto))
786+
-> m (Maybe Ledger.Anchor)
788787
anchorDataFromPoolMetadata (Ledger.PoolMetadata{Ledger.pmUrl = url, Ledger.pmHash = hashBytes}) = do
789788
hash <-
790789
maybe (throwError $ InvalidPoolMetadataHashError url hashBytes) return $

cardano-api/src/Cardano/Api/Internal/Compatible/Tx.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ addWitnesses witnesses (ShelleyTx sbe tx) =
225225
txCommon
226226
:: forall ledgerera
227227
. ShelleyLedgerEra era ~ ledgerera
228-
=> L.EraCrypto ledgerera ~ L.StandardCrypto
229228
=> L.EraTx ledgerera
230229
=> L.Tx ledgerera
231230
txCommon =

cardano-api/src/Cardano/Api/Internal/Convenience/Construction.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import Cardano.Api.Internal.Tx.Sign
2525
import Cardano.Api.Internal.Tx.UTxO (UTxO (..))
2626
import Cardano.Api.Internal.Utils
2727

28-
import Cardano.Ledger.Api qualified as L
2928
import Cardano.Ledger.Coin qualified as L
3029
import Cardano.Ledger.Credential qualified as L
3130
import Cardano.Ledger.Keys qualified as L
@@ -57,7 +56,7 @@ constructBalancedTx
5756
-> Set PoolId
5857
-- ^ The set of registered stake pools
5958
-> Map.Map StakeCredential L.Coin
60-
-> Map.Map (L.Credential L.DRepRole L.StandardCrypto) L.Coin
59+
-> Map.Map (L.Credential L.DRepRole) L.Coin
6160
-> [ShelleyWitnessSigningKey]
6261
-> Either (TxBodyErrorAutoBalance era) (Tx era)
6362
constructBalancedTx

cardano-api/src/Cardano/Api/Internal/Convenience/Query.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import Cardano.Api.Internal.Tx.Body
3838
import Cardano.Api.Internal.Tx.UTxO
3939
import Cardano.Api.Internal.Utils
4040

41-
import Cardano.Ledger.Api qualified as L
4241
import Cardano.Ledger.CertState (DRepState (..))
4342
import Cardano.Ledger.Coin qualified as L
4443
import Cardano.Ledger.Credential qualified as L
@@ -113,7 +112,7 @@ queryStateForBalancedTx
113112
, SystemStart
114113
, Set PoolId
115114
, Map StakeCredential L.Coin
116-
, Map (L.Credential L.DRepRole L.StandardCrypto) L.Coin
115+
, Map (L.Credential L.DRepRole) L.Coin
117116
, Maybe (Featured ConwayEraOnwards era TxCurrentTreasuryValue)
118117
)
119118
)

cardano-api/src/Cardano/Api/Internal/DRepMetadata.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ import Cardano.Api.Internal.Script
2323
import Cardano.Api.Internal.SerialiseRaw
2424

2525
import Cardano.Crypto.Hash.Class qualified as Crypto
26-
import Cardano.Ledger.Crypto (StandardCrypto)
27-
import Cardano.Ledger.Keys qualified as Shelley
26+
import Cardano.Ledger.Hashes (HASH)
2827

2928
import Data.ByteString (ByteString)
3029
import Data.Either.Combinators (maybeToRight)
@@ -39,7 +38,7 @@ newtype DRepMetadata = DRepMetadata
3938
}
4039
deriving (Eq, Show)
4140

42-
newtype instance Hash DRepMetadata = DRepMetadataHash (Shelley.Hash StandardCrypto ByteString)
41+
newtype instance Hash DRepMetadata = DRepMetadataHash (Crypto.Hash HASH ByteString)
4342
deriving (Eq, Show)
4443

4544
instance HasTypeProxy DRepMetadata where

0 commit comments

Comments
 (0)