Copyright | Alexander Krupenkin 2016-2018 |
---|---|
License | BSD3 |
Maintainer | mail@akru.me |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Tiny JSON-RPC 2.0 client. Functions for implementing the client side of JSON-RPC 2.0. See http://www.jsonrpc.org/specification.
If you have monad with MonadIO
, MonadThrow
and MonadReader
instances,
it can be used as base for JSON-RPC calls.
Example:
newtype MyMonad a = ... instance JsonRpc MyMonad foo :: Mymonad Text foo = remote "foo"
Arguments of function are stored into params
request array.
Example:
myMethod :: JsonRpc m => Int -> Bool -> m String myMethod = remote "myMethod"
Synopsis
- class JsonRpcM m => JsonRpc m where
- remote :: Remote m a => MethodName -> a
- type MethodName = Text
- data JsonRpcClient
- defaultSettings :: MonadIO m => String -> m JsonRpcClient
- jsonRpcServer :: Lens' JsonRpcClient String
- jsonRpcManager :: Lens' JsonRpcClient Manager
- data JsonRpcException
- data RpcError = RpcError {}
The JSON-RPC remote call monad
class JsonRpcM m => JsonRpc m where Source #
JSON-RPC call monad.
Nothing
remote :: Remote m a => MethodName -> a Source #
Remote call of JSON-RPC method.
Instances
JsonRpc Web3 Source # | |
Defined in Network.Ethereum.Api.Provider remote :: Remote Web3 a => MethodName -> a Source # |
type MethodName = Text Source #
Name of called method.
JSON-RPC client settings
data JsonRpcClient Source #
JSON-RPC client state vars.
Instances
Show JsonRpcClient Source # | |
Defined in Network.JsonRpc.TinyClient showsPrec :: Int -> JsonRpcClient -> ShowS # show :: JsonRpcClient -> String # showList :: [JsonRpcClient] -> ShowS # | |
MonadState JsonRpcClient Web3 Source # | |
Defined in Network.Ethereum.Api.Provider get :: Web3 JsonRpcClient # put :: JsonRpcClient -> Web3 () # state :: (JsonRpcClient -> (a, JsonRpcClient)) -> Web3 a # |
:: MonadIO m | |
=> String | JSON-RPC server URI |
-> m JsonRpcClient |
Create default JsonRpcClient
settings.
Error handling
data JsonRpcException Source #
Instances
Eq JsonRpcException Source # | |
Defined in Network.JsonRpc.TinyClient (==) :: JsonRpcException -> JsonRpcException -> Bool # (/=) :: JsonRpcException -> JsonRpcException -> Bool # | |
Show JsonRpcException Source # | |
Defined in Network.JsonRpc.TinyClient showsPrec :: Int -> JsonRpcException -> ShowS # show :: JsonRpcException -> String # showList :: [JsonRpcException] -> ShowS # | |
Exception JsonRpcException Source # | |
Defined in Network.JsonRpc.TinyClient |