File tree Expand file tree Collapse file tree 5 files changed +12
-10
lines changed
cardano-api/src/Cardano/Api/Internal Expand file tree Collapse file tree 5 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -386,10 +386,10 @@ instance IsShelleyBasedEra era => FromJSON (AddressInEra era) where
386
386
addressAny <- runParsecParser parseAddressAny txt
387
387
pure $ anyAddressInShelleyBasedEra sbe addressAny
388
388
389
- parseAddressAny :: Parsec. Parser AddressAny
389
+ parseAddressAny :: SerialiseAddress addr => Parsec. Parser addr
390
390
parseAddressAny = do
391
391
str <- lexPlausibleAddressString
392
- case deserialiseAddress AsAddressAny str of
392
+ case deserialiseAddress asType str of
393
393
Nothing -> fail $ " invalid address: " <> Text. unpack str
394
394
Just addr -> pure addr
395
395
Original file line number Diff line number Diff line change 4
4
5
5
module Cardano.Api.Internal.HasTypeProxy
6
6
( HasTypeProxy (AsType , proxyToAsType )
7
+ , asType
7
8
, Proxy (.. )
8
9
, FromSomeType (.. )
9
10
)
@@ -24,3 +25,7 @@ class Typeable t => HasTypeProxy t where
24
25
25
26
data FromSomeType (c :: Type -> Constraint ) b where
26
27
FromSomeType :: c a => AsType a -> (a -> b ) -> FromSomeType c b
28
+
29
+ -- | Provide type proxy from the already existing 'HasTypeProxy' instance
30
+ asType :: HasTypeProxy t => AsType t
31
+ asType = proxyToAsType Proxy
Original file line number Diff line number Diff line change @@ -32,12 +32,12 @@ readKeyFile
32
32
-> NonEmpty (InputFormat a )
33
33
-> FilePath
34
34
-> IO (Either (FileError InputDecodeError ) a )
35
- readKeyFile asType acceptedFormats path = do
35
+ readKeyFile asType' acceptedFormats path = do
36
36
eContent <- runExceptT $ fileIOExceptT path readFileBlocking
37
37
case eContent of
38
38
Left e -> return $ Left e
39
39
Right content ->
40
- return . first (FileError path) $ deserialiseInput asType acceptedFormats content
40
+ return . first (FileError path) $ deserialiseInput asType' acceptedFormats content
41
41
42
42
-- | Read a cryptographic key from a file.
43
43
--
@@ -47,7 +47,7 @@ readKeyFileTextEnvelope
47
47
=> AsType a
48
48
-> File content In
49
49
-> IO (Either (FileError InputDecodeError ) a )
50
- readKeyFileTextEnvelope asType fp =
50
+ readKeyFileTextEnvelope _ fp =
51
51
first (fmap InputTextEnvelopeError ) <$> readFileTextEnvelope asType fp
52
52
53
53
-- | Read a cryptographic key from a file given that it is one of the provided
Original file line number Diff line number Diff line change @@ -1039,7 +1039,7 @@ instance HasTypeProxy lang => HasTypeProxy (PlutusScript lang) where
1039
1039
-- do any additional transformation on Plutus script bytes.
1040
1040
instance HasTypeProxy lang => SerialiseAsRawBytes (PlutusScript lang ) where
1041
1041
serialiseToRawBytes = serialiseToCBOR
1042
- deserialiseFromRawBytes asType bs =
1042
+ deserialiseFromRawBytes _ bs =
1043
1043
first (SerialiseAsRawBytesError . show . B. sformat B. build) $
1044
1044
deserialiseFromCBOR asType bs
1045
1045
Original file line number Diff line number Diff line change @@ -177,10 +177,7 @@ deserialiseWitnessLedgerCddl sbe te =
177
177
mapLeft textEnvelopeErrorToTextEnvelopeCddlError $
178
178
deserialiseFromTextEnvelope asType te
179
179
where
180
- asType :: AsType (KeyWitness era )
181
- asType = shelleyBasedEraConstraints sbe $ proxyToAsType Proxy
182
-
183
- -- \| This wrapper ensures that we can still decode the key witness
180
+ -- This wrapper ensures that we can still decode the key witness
184
181
-- that were serialized before we migrated to using 'serialiseToTextEnvelope'
185
182
legacyDecoding
186
183
:: TextEnvelope
You can’t perform that action at this time.
0 commit comments