jsonrpc-tinyclient-1.0.0.0: Tiny JSON-RPC client for Haskell Web3 library.
CopyrightAleksandr Krupenkin 2016-2018
LicenseApache-2.0
Maintainermail@akru.me
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Network.JsonRpc.TinyClient

Description

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

The JSON-RPC remote call monad

class JsonRpcM m => JsonRpc m where Source #

JSON-RPC call monad.

Minimal complete definition

Nothing

Methods

remote :: Remote m a => MethodName -> a Source #

Remote call of JSON-RPC method.

type MethodName = Text Source #

Name of called method.

JSON-RPC client settings

data JsonRpcClient Source #

JSON-RPC client state vars.

Constructors

JsonRpcHttpClient 

Fields

JsonRpcWsClient 

Fields

Instances

Instances details
Show JsonRpcClient Source # 
Instance details

Defined in Network.JsonRpc.TinyClient

defaultSettings Source #

Arguments

:: MonadIO m 
=> String

JSON-RPC server URI

-> m JsonRpcClient 

Create default JsonRpcClient settings.

Error handling

data RpcError Source #

JSON-RPC error message

Constructors

RpcError 

Fields

Instances

Instances details
Eq RpcError Source # 
Instance details

Defined in Network.JsonRpc.TinyClient

Show RpcError Source # 
Instance details

Defined in Network.JsonRpc.TinyClient

FromJSON RpcError Source # 
Instance details

Defined in Network.JsonRpc.TinyClient