File tree Expand file tree Collapse file tree 15 files changed +495
-128
lines changed
cardano-api/src/Cardano/Api
proto/utxorpc/v1alpha/cardano
src/Cardano/Rpc/Server/Internal Expand file tree Collapse file tree 15 files changed +495
-128
lines changed Original file line number Diff line number Diff line change 9292import Cardano.Api.Byron.Internal.Key
9393import Cardano.Api.Era
9494import Cardano.Api.HasTypeProxy
95- import Cardano.Api.Internal.Utils
9695import Cardano.Api.Key.Internal
96+ import Cardano.Api.Monad.Error
9797import Cardano.Api.Network.Internal.NetworkId
9898import Cardano.Api.Parser.Text qualified as P
9999import Cardano.Api.Plutus.Internal.Script
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ module Cardano.Api.Experimental.Era
2121 , IsEra (.. )
2222 , Some (.. )
2323 , Inject (.. )
24+ , Convert (.. )
2425 , LedgerEra
2526 , DeprecatedEra (.. )
2627 , EraCommonConstraints
Original file line number Diff line number Diff line change 55
66-- | Internal utils for the other Api modules
77module Cardano.Api.Internal.Utils
8- ( (?!)
9- , (?!.)
10- , (<<$>>)
8+ ( (<<$>>)
119 , (<<<$>>>)
1210 , noInlineMaybeToStrictMaybe
1311 )
1412where
1513
1614import Cardano.Ledger.BaseTypes
17- import Cardano.Ledger.Shelley ()
18-
19- (?!) :: Maybe a -> e -> Either e a
20- Nothing ?! e = Left e
21- Just x ?! _ = Right x
22-
23- (?!.) :: Either e a -> (e -> e' ) -> Either e' a
24- Left e ?!. f = Left (f e)
25- Right x ?!. _ = Right x
2615
2716infixl 4 <<$>>
2817
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ module Cardano.Api.Monad.Error
1515 , liftMaybe
1616 , failEither
1717 , failEitherWith
18+ , (?!)
19+ , (?!&)
1820 , module Control.Monad.Except
1921 , module Control.Monad.IO.Class
2022 , module Control.Monad.Trans.Class
@@ -118,6 +120,18 @@ liftMaybe
118120 -> m a
119121liftMaybe e = maybe (throwError e) pure
120122
123+ -- | Infix 'liftMaybe', with arguments flipped
124+ (?!) :: MonadError e m => Maybe a -> e -> m a
125+ (?!) = flip liftMaybe
126+
127+ infixl 8 ?!
128+
129+ -- | Map over the 'Left' value of 'Either e a'. Infix 'first' with its arguments flipped.
130+ (?!&) :: Either e a -> (e -> e' ) -> Either e' a
131+ (?!&) = flip first
132+
133+ infixl 8 ?!&
134+
121135-- | Lift 'Either' to `MonadFail`
122136failEither
123137 :: MonadFail m
Original file line number Diff line number Diff line change 1818import Cardano.Api.Error
1919import Cardano.Api.HasTypeProxy
2020import Cardano.Api.Internal.Orphans.Misc ()
21- import Cardano.Api.Internal.Utils
21+ import Cardano.Api.Monad.Error
2222import Cardano.Api.Pretty
2323import Cardano.Api.Serialise.Raw
2424
@@ -52,7 +52,7 @@ deserialiseFromBech32
5252deserialiseFromBech32 bech32Str = do
5353 (prefix, dataPart) <-
5454 Bech32. decodeLenient bech32Str
55- ?!. Bech32DecodingError
55+ ?!& Bech32DecodingError
5656
5757 let actualPrefix = Bech32. humanReadablePartToText prefix
5858 permittedPrefixes = bech32PrefixesPermitted (asType @ a )
@@ -83,7 +83,7 @@ deserialiseAnyOfFromBech32
8383deserialiseAnyOfFromBech32 types bech32Str = do
8484 (prefix, dataPart) <-
8585 Bech32. decodeLenient bech32Str
86- ?!. Bech32DecodingError
86+ ?!& Bech32DecodingError
8787
8888 let actualPrefix = Bech32. humanReadablePartToText prefix
8989
Original file line number Diff line number Diff line change 2020import Cardano.Api.Governance.Internal.Action.ProposalProcedure
2121import Cardano.Api.HasTypeProxy
2222import Cardano.Api.Internal.Orphans (AsType (.. ))
23- import Cardano.Api.Internal.Utils
23+ import Cardano.Api.Monad.Error
2424import Cardano.Api.Serialise.Bech32
2525import Cardano.Api.Serialise.Raw
2626import Cardano.Api.Tx.Internal.TxIn
@@ -98,7 +98,7 @@ deserialiseFromBech32Cip129
9898deserialiseFromBech32Cip129 bech32Str = do
9999 (prefix, dataPart) <-
100100 Bech32. decodeLenient bech32Str
101- ?!. Bech32DecodingError
101+ ?!& Bech32DecodingError
102102
103103 let actualPrefix = Bech32. humanReadablePartToText prefix
104104 permittedPrefixes = cip129Bech32PrefixesPermitted (asType @ a )
@@ -160,7 +160,7 @@ deserialiseGovActionIdFromBech32Cip129 bech32Str = do
160160 let permittedPrefixes = [" gov_action" ]
161161 (prefix, dataPart) <-
162162 Bech32. decodeLenient bech32Str
163- ?!. Bech32DecodingError
163+ ?!& Bech32DecodingError
164164 let actualPrefix = Bech32. humanReadablePartToText prefix
165165 guard (actualPrefix `elem` permittedPrefixes)
166166 ?! Bech32UnexpectedPrefix actualPrefix (fromList permittedPrefixes)
Original file line number Diff line number Diff line change @@ -248,9 +248,9 @@ import Cardano.Api.Experimental.Plutus.Internal.Shim.LegacyScripts
248248import Cardano.Api.Experimental.Tx.Internal.TxScriptWitnessRequirements
249249import Cardano.Api.Governance.Internal.Action.ProposalProcedure
250250import Cardano.Api.Governance.Internal.Action.VotingProcedure
251- import Cardano.Api.Internal.Utils
252251import Cardano.Api.Key.Internal
253252import Cardano.Api.Ledger.Internal.Reexport qualified as Ledger
253+ import Cardano.Api.Monad.Error
254254import Cardano.Api.Network.Internal.NetworkId
255255import Cardano.Api.Plutus.Internal.Script
256256import Cardano.Api.Plutus.Internal.ScriptData
Original file line number Diff line number Diff line change @@ -63,8 +63,8 @@ import Cardano.Api.Era.Internal.Eon.Convert
6363import Cardano.Api.Era.Internal.Eon.ShelleyBasedEra
6464import Cardano.Api.Error (Error (.. ), displayError )
6565import Cardano.Api.Hash
66- import Cardano.Api.Internal.Utils
6766import Cardano.Api.Ledger.Internal.Reexport qualified as Ledger
67+ import Cardano.Api.Monad.Error
6868import Cardano.Api.Parser.Text qualified as P
6969import Cardano.Api.Plutus.Internal.Script
7070import Cardano.Api.Plutus.Internal.ScriptData
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ library
6161 Cardano.Rpc.Server.Internal.Error
6262 Cardano.Rpc.Server.Internal.Monad
6363 Cardano.Rpc.Server.Internal.UtxoRpc.Query
64+ Cardano.Rpc.Server.Internal.UtxoRpc.Type
6465 Proto.Cardano.Rpc.Node
6566 Proto.Cardano.Rpc.Node_Fields
6667 Proto.Utxorpc.V1alpha.Cardano.Cardano
@@ -91,6 +92,7 @@ library
9192 cardano-ledger-core,
9293 containers,
9394 contra-tracer,
95+ data-default,
9496 filepath,
9597 generic-data,
9698 grapesy,
@@ -100,3 +102,30 @@ library
100102 proto-lens-runtime,
101103 rio,
102104 text,
105+
106+ test-suite cardano-rpc-test
107+ import : project-config
108+ hs-source-dirs : test/cardano-rpc-test
109+ main-is : cardano-rpc-test.hs
110+ type : exitcode-stdio-1.0
111+ build-depends :
112+ cardano-api,
113+ cardano-api :gen,
114+ cardano-ledger-api,
115+ cardano-ledger-conway,
116+ cardano-ledger-core,
117+ cardano-rpc,
118+ containers,
119+ hedgehog >= 1.1 ,
120+ rio,
121+ tasty,
122+ tasty-hedgehog,
123+
124+ ghc-options :
125+ -threaded
126+ -rtsopts
127+ "-with-rtsopts=-N -T"
128+
129+ build-tool-depends : tasty-discover :tasty-discover
130+ other-modules :
131+ Test.Cardano.Rpc.ProtocolParameters
Original file line number Diff line number Diff line change @@ -44,9 +44,10 @@ message Script {
4444}
4545
4646// Represents a rational number as a fraction.
47+ // TODO u5c increased precision to 64 bits
4748message RationalNumber {
48- int32 numerator = 1 ;
49- uint32 denominator = 2 ;
49+ int64 numerator = 1 ;
50+ uint64 denominator = 2 ;
5051}
5152
5253// PARAMS
You can’t perform that action at this time.
0 commit comments