This commit is contained in:
rnhmjoj 2015-05-12 23:09:23 +02:00
parent 802f3a6a14
commit dc2ae1ef07

View File

@ -1,22 +1,20 @@
{-# Language DeriveGeneric, RecordWildCards #-} {-# Language TemplateHaskell, RecordWildCards #-}
import System.Process import System.Process
import System.Exit import System.Exit
import GHC.Generics
import Data.Aeson import Data.Aeson
import Data.Aeson.TH
import Data.ByteString.Lazy.Char8 (pack) import Data.ByteString.Lazy.Char8 (pack)
readCommand = readProcess "namecoind" ["name_list"] "" readCommand = readProcess "namecoind" ["name_list"] ""
updateCommand n v = readProcessWithExitCode "namecoind" ["name_update", n, v] "" updateCommand n v = readProcessWithExitCode "namecoind" ["name_update", n, v] ""
data Name = data Name = Name { name :: String
Name { name :: String
, value :: String , value :: String
, address :: String
, expires_in :: Int , expires_in :: Int
} deriving (Show, Generic) }
instance FromJSON Name deriveJSON defaultOptions ''Name
updateName :: Name -> IO Int updateName :: Name -> IO Int
updateName Name{..} updateName Name{..}