Created
August 10, 2014 10:17
-
-
Save gislik/b2e1e2adef7496bb2db1 to your computer and use it in GitHub Desktop.
Trying a minimal req/rep after xenog changed the API for Network.Haskoin.Stratum to rely on the json-rpc library.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Data.Functor | |
import Data.Maybe | |
import Control.Monad | |
import Network.Haskoin.Crypto | |
import Network.Haskoin.Stratum | |
import Network.JsonRpc | |
import Data.Conduit.Network | |
import System.Environment | |
main :: IO () | |
main = do | |
req <- StratumReqBalance . fromJust . base58ToAddr . head <$> getArgs | |
res <- tcpClient V2 True (clientSettings 50001 "kirsche.emzy.de") (query V2 [req]) | |
when (null res) $ putStrLn "No response" | |
forM_ res $ \res' -> case res' of | |
IncomingMsg (MsgResponse r) _ -> print (getResult r :: StratumResult) | |
IncomingMsg (MsgError e) _ -> print e | |
IncomingError e -> print e | |
IncomingMsg _ _ -> fail "unexpected response" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment