module Main where

import Network.Krist.Address
import Network.Krist.Node
import Network.Krist.Work
import Network.Krist.Block

import Data.Krist.PrivateKey
import Data.Krist.Address

main :: IO ()
main = do x <- getAddress defaultNode "khugepoopy"
          print x
          y <- getAddresses defaultNode 10
          print y
          let pkey = makeKWPrivateKey "0000"
          putStrLn pkey
          putStrLn $ makeV2Address pkey
          work <- getWork defaultNode
          putStrLn $ "Work is: " ++ show work
          lastBlock <- getLastBlock defaultNode
          putStrLn $ "Last block is: " ++ show lastBlock
          block4 <- getBlock defaultNode 4
          putStrLn $ "Block #4 is: " ++ show block4
          let testNonce = "3431241"
          resp <- submitBlock defaultNode "khugepoopy" testNonce
          case resp of
             Left e -> print e
             Right s ->  if s then putStrLn "Submitted block!"
                              else putStrLn "Block rejected."
