|
2 | 2 | {-# LANGUAGE FlexibleContexts #-} |
3 | 3 | {-# LANGUAGE FlexibleInstances #-} |
4 | 4 | {-# LANGUAGE GADTs #-} |
| 5 | +{-# LANGUAGE InstanceSigs #-} |
5 | 6 | {-# LANGUAGE RankNTypes #-} |
6 | 7 | {-# LANGUAGE ScopedTypeVariables #-} |
7 | 8 | {-# LANGUAGE StandaloneDeriving #-} |
|
13 | 14 |
|
14 | 15 | module Cardano.Api.Experimental.Tx.Internal.Certificate |
15 | 16 | ( Certificate (..) |
| 17 | + , AnchorDataFromCertificateError (..) |
| 18 | + , getAnchorDataFromCertificate |
16 | 19 | ) |
17 | 20 | where |
18 | 21 |
|
19 | 22 | import Cardano.Api.Certificate.Internal qualified as Api |
20 | 23 | import Cardano.Api.Era.Internal.Eon.ConwayEraOnwards |
21 | 24 | import Cardano.Api.Era.Internal.Eon.ShelleyBasedEra |
22 | 25 | import Cardano.Api.Era.Internal.Eon.ShelleyToBabbageEra qualified as Api |
| 26 | +import Cardano.Api.Error |
23 | 27 | import Cardano.Api.Experimental.Era |
24 | 28 | import Cardano.Api.HasTypeProxy |
25 | 29 | import Cardano.Api.Ledger qualified as L |
@@ -105,3 +109,12 @@ getAnchorDataFromCertificate ConwayEra (Certificate c) = |
105 | 109 | , Ledger.anchorDataHash = Ledger.unsafeMakeSafeHash hash |
106 | 110 | } |
107 | 111 | ) |
| 112 | + |
| 113 | +data AnchorDataFromCertificateError |
| 114 | + = InvalidPoolMetadataHashError Ledger.Url ByteString |
| 115 | + deriving (Eq, Show) |
| 116 | + |
| 117 | +instance Error AnchorDataFromCertificateError where |
| 118 | + prettyError :: AnchorDataFromCertificateError -> Doc ann |
| 119 | + prettyError (InvalidPoolMetadataHashError url hash) = |
| 120 | + "Invalid pool metadata hash for URL " <> fromString (show url) <> ": " <> fromString (show hash) |
0 commit comments