A JSON-RPC Haskell client for the PegNet API. Each response has special ADT(algebraic data type) that automatically converted from JSON response. Using Remote Monad pattern multiple request can be batched and executed simulatenously, following more robust approach and reducing usage of expensive RPC calls.
Choosing a batching strategy. There are two strategies:
Weak
- a single command or a single procedure, orStrong
- a sequence of commands, optionally terminated by a procedure
You can install package from Hackage and build with Cabal, but we recommend to use Stack tool. Add to you dependencies in stack.yaml and cabal file dependency - api-rpc-factom
.
To run and test fromrepository
- Build with stack
$ stack build
- Load REPL with stack for evaluation
$ stack repl
- execute required methods
for basic daemon functionality
- import with
import PegNet.RPC.Api
or load in REPL.
- build communication session with
weakSession (traceSendAPI "" $ clientSendAPI endpoint)
- run required methods inside
RPC
monad
-- build communication session
let s = weakSession (traceSendAPI "" $ clientSendAPI endpoint)
-- run Remote Monad
h <- send s $ do
-- run specific events by executing exposed
h <- reqGetSyncStatus
return h
-- show converted ADT
print h
-- or use for special business logic