@@ -272,7 +272,7 @@ parseTxIn = TxIn <$> parseTxId <*> (Parsec.char '#' *> parseTxIx)
272
272
parseTxId :: Parsec. Parser TxId
273
273
parseTxId = do
274
274
str' <- some Parsec. hexDigit <?> " transaction id (hexadecimal)"
275
- case deserialiseFromRawBytesHex AsTxId (BSC. pack str') of
275
+ case deserialiseFromRawBytesHex (BSC. pack str') of
276
276
Right addr -> return addr
277
277
Left e -> fail $ docToString $ " Incorrect transaction id format: " <> prettyError e
278
278
@@ -335,7 +335,7 @@ pScriptFor name (Just deprecated) help' =
335
335
-- | The first argument is the optional prefix.
336
336
pStakeVerificationKey :: Maybe String -> Parser (VerificationKey StakeKey )
337
337
pStakeVerificationKey prefix =
338
- Opt. option ( readVerificationKey AsStakeKey ) $
338
+ Opt. option readVerificationKey $
339
339
mconcat
340
340
[ Opt. long $ prefixFlag prefix " stake-verification-key"
341
341
, Opt. metavar " STRING"
@@ -346,9 +346,8 @@ pStakeVerificationKey prefix =
346
346
readVerificationKey
347
347
:: forall keyrole
348
348
. SerialiseAsBech32 (VerificationKey keyrole )
349
- => AsType keyrole
350
- -> Opt. ReadM (VerificationKey keyrole )
351
- readVerificationKey asType =
349
+ => Opt. ReadM (VerificationKey keyrole )
350
+ readVerificationKey =
352
351
Opt. eitherReader deserialiseFromBech32OrHex
353
352
where
354
353
keyFormats :: NonEmpty (InputFormat (VerificationKey keyrole ))
@@ -359,7 +358,7 @@ readVerificationKey asType =
359
358
-> Either String (VerificationKey keyrole )
360
359
deserialiseFromBech32OrHex str' =
361
360
first (docToString . renderInputDecodeError) $
362
- deserialiseInput ( AsVerificationKey asType) keyFormats (BSC. pack str')
361
+ deserialiseInput keyFormats (BSC. pack str')
363
362
364
363
-- | The first argument is the optional prefix.
365
364
pStakeVerificationKeyFile :: Maybe String -> Parser (VerificationKeyFile In )
@@ -460,7 +459,7 @@ pStakePoolVerificationKeyOrFile prefix =
460
459
pStakePoolVerificationNormalKey
461
460
:: Maybe String -> Parser (VerificationKey StakePoolKey )
462
461
pStakePoolVerificationNormalKey prefix =
463
- Opt. option ( readVerificationKey AsStakePoolKey ) $
462
+ Opt. option readVerificationKey $
464
463
mconcat
465
464
[ Opt. long $ prefixFlag prefix " stake-pool-verification-key"
466
465
, Opt. metavar " STRING"
@@ -471,7 +470,7 @@ pStakePoolVerificationNormalKey prefix =
471
470
pStakePoolVerificationExtendedKey
472
471
:: Maybe String -> Parser (VerificationKey StakePoolExtendedKey )
473
472
pStakePoolVerificationExtendedKey prefix =
474
- Opt. option ( readVerificationKey AsStakePoolExtendedKey ) $
473
+ Opt. option readVerificationKey $
475
474
mconcat
476
475
[ Opt. long $ prefixFlag prefix " stake-pool-verification-extended-key"
477
476
, Opt. metavar " STRING"
@@ -544,23 +543,22 @@ pTreasuryWithdrawalAmt =
544
543
rHexHash
545
544
:: ()
546
545
=> SerialiseAsRawBytes (Hash a )
547
- => AsType a
548
- -> Maybe String
546
+ => Maybe String
549
547
-- ^ Optional prefix to the error message
550
548
-> ReadM (Hash a )
551
- rHexHash a mErrPrefix =
549
+ rHexHash mErrPrefix =
552
550
Opt. eitherReader $
553
551
first (\ e -> errPrefix <> (docToString $ prettyError e))
554
- . deserialiseFromRawBytesHex ( AsHash a)
552
+ . deserialiseFromRawBytesHex
555
553
. BSC. pack
556
554
where
557
555
errPrefix = maybe " " (" : " <> ) mErrPrefix
558
556
559
- rBech32KeyHash :: SerialiseAsBech32 (Hash a ) => AsType a -> ReadM (Hash a )
560
- rBech32KeyHash a =
557
+ rBech32KeyHash :: SerialiseAsBech32 (Hash a ) => ReadM (Hash a )
558
+ rBech32KeyHash =
561
559
Opt. eitherReader $
562
560
first (docToString . prettyError)
563
- . deserialiseFromBech32 ( AsHash a)
561
+ . deserialiseFromBech32
564
562
. Text. pack
565
563
566
564
pGenesisDelegateVerificationKey :: Parser (VerificationKey GenesisDelegateKey )
@@ -573,22 +571,20 @@ pGenesisDelegateVerificationKey =
573
571
]
574
572
where
575
573
deserialiseFromHex =
576
- rVerificationKey AsGenesisDelegateKey ( Just " Invalid genesis delegate verification key" )
574
+ rVerificationKey $ Just " Invalid genesis delegate verification key"
577
575
578
576
-- | Reader for verification keys
579
577
rVerificationKey
580
578
:: ()
581
579
=> SerialiseAsRawBytes (VerificationKey a )
582
- => AsType a
583
- -- ^ Singleton value identifying the kind of verification keys
584
- -> Maybe String
580
+ => Maybe String
585
581
-- ^ Optional prefix to the error message
586
582
-> ReadM (VerificationKey a )
587
- rVerificationKey a mErrPrefix =
583
+ rVerificationKey mErrPrefix =
588
584
Opt. eitherReader $
589
585
first
590
586
(\ e -> errPrefix <> (docToString $ prettyError e))
591
- . deserialiseFromRawBytesHex ( AsVerificationKey a)
587
+ . deserialiseFromRawBytesHex
592
588
. BSC. pack
593
589
where
594
590
errPrefix = maybe " " (" : " <> ) mErrPrefix
@@ -691,7 +687,7 @@ pAddCommitteeColdVerificationKey =
691
687
]
692
688
where
693
689
deserialiseFromHex =
694
- rVerificationKey AsCommitteeColdKey ( Just " Invalid Constitutional Committee cold key" )
690
+ rVerificationKey $ Just " Invalid Constitutional Committee cold key"
695
691
696
692
pAddCommitteeColdVerificationKeyFile :: Parser (File (VerificationKey keyrole ) In )
697
693
pAddCommitteeColdVerificationKeyFile =
@@ -754,11 +750,11 @@ pRemoveCommitteeColdVerificationKey =
754
750
755
751
deserialiseColdCCKeyFromHex :: ReadM (VerificationKey CommitteeColdKey )
756
752
deserialiseColdCCKeyFromHex =
757
- rVerificationKey AsCommitteeColdKey ( Just " Invalid Constitutional Committee cold key" )
753
+ rVerificationKey $ Just " Invalid Constitutional Committee cold key"
758
754
759
755
deserialiseColdCCKeyHashFromHex :: ReadM (Hash CommitteeColdKey )
760
756
deserialiseColdCCKeyHashFromHex =
761
- rHexHash AsCommitteeColdKey ( Just " Invalid Constitutional Committee cold key hash" )
757
+ rHexHash $ Just " Invalid Constitutional Committee cold key hash"
762
758
763
759
pRemoveCommitteeColdVerificationKeyFile :: Parser (File (VerificationKey keyrole ) In )
764
760
pRemoveCommitteeColdVerificationKeyFile =
@@ -861,11 +857,11 @@ pCommitteeHotVerificationKey longFlag =
861
857
862
858
deserialiseHotCCKeyFromHex :: ReadM (VerificationKey CommitteeHotKey )
863
859
deserialiseHotCCKeyFromHex =
864
- rVerificationKey AsCommitteeHotKey ( Just " Invalid Constitutional Committee hot key" )
860
+ rVerificationKey $ Just " Invalid Constitutional Committee hot key"
865
861
866
862
deserialiseHotCCKeyHashFromHex :: ReadM (Hash CommitteeHotKey )
867
863
deserialiseHotCCKeyHashFromHex =
868
- rHexHash AsCommitteeHotKey ( Just " Invalid Constitutional Committee hot key hash" )
864
+ rHexHash $ Just " Invalid Constitutional Committee hot key hash"
869
865
870
866
pCommitteeHotVerificationKeyFile :: String -> Parser (VerificationKeyFile In )
871
867
pCommitteeHotVerificationKeyFile longFlag =
@@ -971,7 +967,7 @@ pStakeVerificationKeyOrHashOrFile prefix =
971
967
-- | First argument is the optional prefix
972
968
pStakeVerificationKeyHash :: Maybe String -> Parser (Hash StakeKey )
973
969
pStakeVerificationKeyHash prefix =
974
- Opt. option (rHexHash AsStakeKey Nothing ) $
970
+ Opt. option (rHexHash Nothing ) $
975
971
mconcat
976
972
[ Opt. long $ prefixFlag prefix " stake-key-hash"
977
973
, Opt. metavar " HASH"
@@ -1685,7 +1681,7 @@ pRequiredSigner =
1685
1681
" Input filepath of the signing key (zero or more) whose signature is required."
1686
1682
sPayKeyHash :: Parser (Hash PaymentKey )
1687
1683
sPayKeyHash =
1688
- Opt. option (readerFromParsecParser $ parseHash ( AsHash AsPaymentKey ) ) $
1684
+ Opt. option (readerFromParsecParser parseHash) $
1689
1685
mconcat
1690
1686
[ Opt. long " required-signer-hash"
1691
1687
, Opt. metavar " HASH"
@@ -1836,10 +1832,9 @@ pMaybeOutputFile =
1836
1832
pVerificationKey
1837
1833
:: forall keyrole
1838
1834
. SerialiseAsBech32 (VerificationKey keyrole )
1839
- => AsType keyrole
1840
- -> Parser (VerificationKey keyrole )
1841
- pVerificationKey asType =
1842
- Opt. option (readVerificationKey asType) $
1835
+ => Parser (VerificationKey keyrole )
1836
+ pVerificationKey =
1837
+ Opt. option readVerificationKey $
1843
1838
mconcat
1844
1839
[ Opt. long " verification-key"
1845
1840
, Opt. metavar " STRING"
@@ -1848,11 +1843,10 @@ pVerificationKey asType =
1848
1843
1849
1844
pVerificationKeyOrFileIn
1850
1845
:: SerialiseAsBech32 (VerificationKey keyrole )
1851
- => AsType keyrole
1852
- -> Parser (VerificationKeyOrFile keyrole )
1853
- pVerificationKeyOrFileIn asType =
1846
+ => Parser (VerificationKeyOrFile keyrole )
1847
+ pVerificationKeyOrFileIn =
1854
1848
asum
1855
- [ VerificationKeyValue <$> pVerificationKey asType
1849
+ [ VerificationKeyValue <$> pVerificationKey
1856
1850
, VerificationKeyFilePath <$> pVerificationKeyFileIn
1857
1851
]
1858
1852
@@ -1878,7 +1872,7 @@ pGenesisVerificationKeyHash =
1878
1872
where
1879
1873
deserialiseFromHex :: ReadM (Hash GenesisKey )
1880
1874
deserialiseFromHex =
1881
- rHexHash AsGenesisKey ( Just " Invalid genesis verification key hash" )
1875
+ rHexHash $ Just " Invalid genesis verification key hash"
1882
1876
1883
1877
pGenesisVerificationKey :: Parser (VerificationKey GenesisKey )
1884
1878
pGenesisVerificationKey =
@@ -1890,7 +1884,7 @@ pGenesisVerificationKey =
1890
1884
]
1891
1885
where
1892
1886
deserialiseFromHex =
1893
- rVerificationKey AsGenesisKey ( Just " Invalid genesis verification key" )
1887
+ rVerificationKey $ Just " Invalid genesis verification key"
1894
1888
1895
1889
pGenesisVerificationKeyOrFile :: Parser (VerificationKeyOrFile GenesisKey )
1896
1890
pGenesisVerificationKeyOrFile =
@@ -1924,7 +1918,7 @@ pGenesisDelegateVerificationKeyHash =
1924
1918
where
1925
1919
deserialiseFromHex :: ReadM (Hash GenesisDelegateKey )
1926
1920
deserialiseFromHex =
1927
- rHexHash AsGenesisDelegateKey ( Just " Invalid genesis delegate verification key hash" )
1921
+ rHexHash $ Just " Invalid genesis delegate verification key hash"
1928
1922
1929
1923
pGenesisDelegateVerificationKeyOrFile
1930
1924
:: Parser (VerificationKeyOrFile GenesisDelegateKey )
@@ -1958,12 +1952,9 @@ pKesVerificationKey =
1958
1952
, Opt. help " A Bech32 or hex-encoded hot KES verification key."
1959
1953
]
1960
1954
where
1961
- asType :: AsType (VerificationKey KesKey )
1962
- asType = AsVerificationKey AsKesKey
1963
-
1964
1955
deserialiseVerKey :: String -> Either String (VerificationKey KesKey )
1965
1956
deserialiseVerKey str =
1966
- case deserialiseFromBech32 asType (Text. pack str) of
1957
+ case deserialiseFromBech32 (Text. pack str) of
1967
1958
Right res -> Right res
1968
1959
-- The input was valid Bech32, but some other error occurred.
1969
1960
Left err@ (Bech32UnexpectedPrefix _ _) -> Left (docToString $ prettyError err)
@@ -1974,7 +1965,7 @@ pKesVerificationKey =
1974
1965
Left (Bech32DecodingError _) ->
1975
1966
first
1976
1967
(\ e -> docToString $ " Invalid stake pool verification key: " <> prettyError e)
1977
- $ deserialiseFromRawBytesHex asType (BSC. pack str)
1968
+ $ deserialiseFromRawBytesHex (BSC. pack str)
1978
1969
1979
1970
pKesVerificationKeyFile :: Parser (VerificationKeyFile In )
1980
1971
pKesVerificationKeyFile =
@@ -2155,7 +2146,7 @@ pTxOutDatum =
2155
2146
where
2156
2147
pTxOutDatumByHashOnly =
2157
2148
fmap TxOutDatumByHashOnly $
2158
- Opt. option (readerFromParsecParser $ parseHash ( AsHash AsScriptData ) ) $
2149
+ Opt. option (readerFromParsecParser parseHash) $
2159
2150
mconcat
2160
2151
[ Opt. long " tx-out-datum-hash"
2161
2152
, Opt. metavar " HASH"
@@ -2516,7 +2507,7 @@ pAddress =
2516
2507
-- | First argument is the prefix for the option's flag to use
2517
2508
pStakePoolVerificationKeyHash :: Maybe String -> Parser (Hash StakePoolKey )
2518
2509
pStakePoolVerificationKeyHash prefix =
2519
- Opt. option (rBech32KeyHash AsStakePoolKey <|> rHexHash AsStakePoolKey Nothing ) $
2510
+ Opt. option (rBech32KeyHash <|> rHexHash Nothing ) $
2520
2511
mconcat
2521
2512
[ Opt. long $ prefixFlag prefix " stake-pool-id"
2522
2513
, Opt. metavar " STAKE_POOL_ID"
@@ -2539,11 +2530,11 @@ pVrfVerificationKeyHash =
2539
2530
where
2540
2531
deserialiseFromHex :: ReadM (Hash VrfKey )
2541
2532
deserialiseFromHex =
2542
- rHexHash AsVrfKey ( Just " Invalid VRF verification key hash" )
2533
+ rHexHash $ Just " Invalid VRF verification key hash"
2543
2534
2544
2535
pVrfVerificationKey :: Parser (VerificationKey VrfKey )
2545
2536
pVrfVerificationKey =
2546
- Opt. option ( readVerificationKey AsVrfKey ) $
2537
+ Opt. option readVerificationKey $
2547
2538
mconcat
2548
2539
[ Opt. long " vrf-verification-key"
2549
2540
, Opt. metavar " STRING"
@@ -2580,7 +2571,7 @@ pRewardAcctVerificationKeyFile =
2580
2571
2581
2572
pRewardAcctVerificationKey :: Parser (VerificationKey StakeKey )
2582
2573
pRewardAcctVerificationKey =
2583
- Opt. option ( readVerificationKey AsStakeKey ) $
2574
+ Opt. option readVerificationKey $
2584
2575
mconcat
2585
2576
[ Opt. long " pool-reward-account-verification-key"
2586
2577
, Opt. metavar " STRING"
@@ -2610,7 +2601,7 @@ pPoolOwnerVerificationKeyFile =
2610
2601
2611
2602
pPoolOwnerVerificationKey :: Parser (VerificationKey StakeKey )
2612
2603
pPoolOwnerVerificationKey =
2613
- Opt. option ( readVerificationKey AsStakeKey ) $
2604
+ Opt. option readVerificationKey $
2614
2605
mconcat
2615
2606
[ Opt. long " pool-owner-verification-key"
2616
2607
, Opt. metavar " STRING"
@@ -2763,8 +2754,7 @@ pStakePoolMetadataHash =
2763
2754
]
2764
2755
where
2765
2756
deserializeFromHex :: ReadM (Hash StakePoolMetadata )
2766
- deserializeFromHex =
2767
- rHexHash AsStakePoolMetadata Nothing
2757
+ deserializeFromHex = rHexHash Nothing
2768
2758
2769
2759
pStakePoolRegistrationParserRequirements
2770
2760
:: EnvCli -> Parser StakePoolRegistrationParserRequirements
@@ -3567,7 +3557,7 @@ pAllOrOnlyGovActionIds = pAll <|> pOnly
3567
3557
3568
3558
pDRepVerificationKeyHash :: Parser (Hash DRepKey )
3569
3559
pDRepVerificationKeyHash =
3570
- Opt. option (rBech32KeyHash AsDRepKey <|> rHexHash AsDRepKey Nothing ) $
3560
+ Opt. option (rBech32KeyHash <|> rHexHash Nothing ) $
3571
3561
mconcat
3572
3562
[ Opt. long " drep-key-hash"
3573
3563
, Opt. metavar " HASH"
@@ -3576,7 +3566,7 @@ pDRepVerificationKeyHash =
3576
3566
3577
3567
pDRepVerificationKey :: Parser (VerificationKey DRepKey )
3578
3568
pDRepVerificationKey =
3579
- Opt. option ( readVerificationKey AsDRepKey ) $
3569
+ Opt. option readVerificationKey $
3580
3570
mconcat
3581
3571
[ Opt. long " drep-verification-key"
3582
3572
, Opt. metavar " STRING"
@@ -3596,7 +3586,7 @@ pDRepVerificationKeyFile =
3596
3586
3597
3587
pSPOVerificationKeyHash :: Parser (Hash StakePoolKey )
3598
3588
pSPOVerificationKeyHash =
3599
- Opt. option (rBech32KeyHash AsStakePoolKey <|> rHexHash AsStakePoolKey Nothing ) $
3589
+ Opt. option (rBech32KeyHash <|> rHexHash Nothing ) $
3600
3590
mconcat
3601
3591
[ Opt. long " spo-key-hash"
3602
3592
, Opt. metavar " HASH"
@@ -3605,7 +3595,7 @@ pSPOVerificationKeyHash =
3605
3595
3606
3596
pSPOVerificationKey :: Parser (VerificationKey StakePoolKey )
3607
3597
pSPOVerificationKey =
3608
- Opt. option ( readVerificationKey AsStakePoolKey ) $
3598
+ Opt. option readVerificationKey $
3609
3599
mconcat
3610
3600
[ Opt. long " spo-verification-key"
3611
3601
, Opt. metavar " STRING"
0 commit comments