mirror of
https://github.com/airalab/hs-web3.git
synced 2024-10-04 04:07:20 +03:00
cdcb666b23
The library becomes to have a lot of source files, in my point of view, is better to split it for multiple packages. Some packages may have not so many dependencies and could be used separately.
27 lines
872 B
Haskell
27 lines
872 B
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
module Main where
|
|
|
|
import Data.Default (def)
|
|
import Data.Text (unpack)
|
|
import Lens.Micro ((.~))
|
|
import Network.Ethereum hiding (name)
|
|
import Network.Ethereum.Account
|
|
import Network.Web3
|
|
import Text.Printf (printf)
|
|
|
|
import ERC20
|
|
|
|
main :: IO ()
|
|
main = do
|
|
result <- runWeb3 $
|
|
withAccount () $
|
|
withParam (to .~ "0xA2f4FCb0FDe2dD59f7a1873e121bc5623e3164Eb") $ do
|
|
n <- name
|
|
s <- symbol
|
|
d <- decimals
|
|
return $ printf "Token %s with symbol %s and decimals %d"
|
|
(unpack n) (unpack s) (fromIntegral d :: Int)
|
|
case result of
|
|
Left err -> error (show err)
|
|
Right info -> putStrLn info
|