-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.hs
25 lines (20 loc) · 824 Bytes
/
Main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module Main where
import Data.Base58String.Bitcoin (fromText)
import Data.Bitcoin.Types (Address)
import Data.Text (pack)
import Network.Bitcoin.Api.Client (Client, withClient)
import Network.Bitcoin.Api.Misc (getInfo)
import Network.Bitcoin.Api.Wallet (getAccountBalance, getAddressAccount)
localClient :: (Client -> IO a) -> IO a
localClient = withClient "127.0.0.1" 18332 (pack "username") (pack "password")
addr :: Address
addr = fromText $ pack "wallet_address"
main :: IO ()
main = do
localClient $ \client -> do
account <- getAddressAccount client addr
balance <- getAccountBalance client account
info <- getInfo client
putStrLn $ "info: " ++ show info
putStrLn $ "account: " ++ show account
putStrLn $ "balance: " ++ show balance