@hackage api-rpc-pegnet0.1.0.0

simple json-rpc client for PegNet

Haskell JSON-RPC client for PegNet

Build Status License

A JSON-RPC Haskell client for the PegNet API. Each response has special ADT(algebraic data type) that automatically converted from JSON response.

Installation

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

  1. Build with stack
$ stack build
  1. Load REPL with stack for evaluation
$ stack repl
  1. execute required methods

Usage

for basic daemon functionality

  1. import with
import PegNet.RPC.Api

or load in REPL.

  1. build communication session with
weakSession (traceSendAPI "" $ clientSendAPI endpoint)
  1. run required methods inside RPC monad

Retreiving a sync status

-- 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