{-# LANGUAGE OverloadedStrings #-}
module Network.Ethereum.Web3.Eth where
import Network.Ethereum.ABI.Prim.Address (Address)
import Network.Ethereum.ABI.Prim.Bytes (Bytes)
import Network.Ethereum.Web3.Provider (Web3)
import Network.Ethereum.Web3.Types
import Network.JsonRpc.TinyClient (remote)
protocolVersion :: Web3 Int
{-# INLINE protocolVersion #-}
protocolVersion = remote "eth_protocolVersion"
syncing :: Web3 SyncingState
{-# INLINE syncing #-}
syncing = remote "eth_syncing"
coinbase :: Web3 Address
{-# INLINE coinbase #-}
coinbase = remote "eth_coinbase"
mining :: Web3 Bool
{-# INLINE mining #-}
mining = remote "eth_mining"
hashrate :: Web3 Quantity
{-# INLINE hashrate #-}
hashrate = remote "eth_hashrate"
getStorageAt :: Address -> Quantity -> DefaultBlock -> Web3 Bytes
{-# INLINE getStorageAt #-}
getStorageAt = remote "eth_getStorageAt"
getTransactionCount :: Address -> DefaultBlock -> Web3 Quantity
{-# INLINE getTransactionCount #-}
getTransactionCount = remote "eth_getTransactionCount"
getBlockTransactionCountByHash :: Bytes -> Web3 Quantity
{-# INLINE getBlockTransactionCountByHash #-}
getBlockTransactionCountByHash = remote "eth_getBlockTransactionCountByHash"
getBlockTransactionCountByNumber :: Quantity -> Web3 Quantity
{-# INLINE getBlockTransactionCountByNumber #-}
getBlockTransactionCountByNumber = remote "eth_getBlockTransactionCountByNumber"
getUncleCountByBlockHash :: Bytes -> Web3 Quantity
{-# INLINE getUncleCountByBlockHash #-}
getUncleCountByBlockHash = remote "eth_getUncleCountByBlockHash"
getUncleCountByBlockNumber :: Quantity -> Web3 Quantity
{-# INLINE getUncleCountByBlockNumber #-}
getUncleCountByBlockNumber = remote "eth_getUncleCountByBlockNumber"
getCode :: Address -> DefaultBlock -> Web3 Bytes
{-# INLINE getCode #-}
getCode = remote "eth_getCode"
sign :: Address -> Bytes -> Web3 Bytes
{-# INLINE sign #-}
sign = remote "eth_sign"
sendTransaction :: Call -> Web3 Bytes
{-# INLINE sendTransaction #-}
sendTransaction = remote "eth_sendTransaction"
sendRawTransaction :: Bytes -> Web3 Bytes
{-# INLINE sendRawTransaction #-}
sendRawTransaction = remote "eth_sendRawTransaction"
getBalance :: Address -> DefaultBlock -> Web3 Quantity
{-# INLINE getBalance #-}
getBalance = remote "eth_getBalance"
newFilter :: Filter e -> Web3 FilterId
{-# INLINE newFilter #-}
newFilter = remote "eth_newFilter"
getFilterChanges :: FilterId -> Web3 [Change]
{-# INLINE getFilterChanges #-}
getFilterChanges = remote "eth_getFilterChanges"
uninstallFilter :: FilterId -> Web3 Bool
{-# INLINE uninstallFilter #-}
uninstallFilter = remote "eth_uninstallFilter"
getLogs :: Filter e -> Web3 [Change]
{-# INLINE getLogs #-}
getLogs = remote "eth_getLogs"
call :: Call -> DefaultBlock -> Web3 Bytes
{-# INLINE call #-}
call = remote "eth_call"
estimateGas :: Call -> Web3 Quantity
{-# INLINE estimateGas #-}
estimateGas = remote "eth_estimateGas"
getBlockByHash :: Bytes -> Web3 Block
{-# INLINE getBlockByHash #-}
getBlockByHash = flip (remote "eth_getBlockByHash") True
getBlockByNumber :: Quantity -> Web3 Block
{-# INLINE getBlockByNumber #-}
getBlockByNumber = flip (remote "eth_getBlockByNumber") True
getTransactionByHash :: Bytes -> Web3 (Maybe Transaction)
{-# INLINE getTransactionByHash #-}
getTransactionByHash = remote "eth_getTransactionByHash"
getTransactionByBlockHashAndIndex :: Bytes -> Quantity -> Web3 (Maybe Transaction)
{-# INLINE getTransactionByBlockHashAndIndex #-}
getTransactionByBlockHashAndIndex = remote "eth_getTransactionByBlockHashAndIndex"
getTransactionByBlockNumberAndIndex :: DefaultBlock -> Quantity -> Web3 (Maybe Transaction)
{-# INLINE getTransactionByBlockNumberAndIndex #-}
getTransactionByBlockNumberAndIndex = remote "eth_getTransactionByBlockNumberAndIndex"
accounts :: Web3 [Address]
{-# INLINE accounts #-}
accounts = remote "eth_accounts"
newBlockFilter :: Web3 Bytes
{-# INLINE newBlockFilter #-}
newBlockFilter = remote "eth_newBlockFilter"
getBlockFilterChanges :: Quantity -> Web3 [Bytes]
{-# INLINE getBlockFilterChanges #-}
getBlockFilterChanges = remote "eth_getFilterChanges"
blockNumber :: Web3 BlockNumber
{-# INLINE blockNumber #-}
blockNumber = remote "eth_blockNumber"
gasPrice :: Web3 Quantity
{-# INLINE gasPrice #-}
gasPrice = remote "eth_gasPrice"
getUncleByBlockHashAndIndex :: Bytes -> Quantity -> Web3 Block
{-# INLINE getUncleByBlockHashAndIndex #-}
getUncleByBlockHashAndIndex = remote "eth_getUncleByBlockHashAndIndex"
getUncleByBlockNumberAndIndex :: DefaultBlock -> Quantity -> Web3 Block
{-# INLINE getUncleByBlockNumberAndIndex #-}
getUncleByBlockNumberAndIndex = remote "eth_getUncleByBlockNumberAndIndex"
newPendingTransactionFilter :: Web3 Quantity
{-# INLINE newPendingTransactionFilter #-}
newPendingTransactionFilter = remote "eth_newPendingTransactionFilter"
getFilterLogs :: Quantity -> Web3 [Change]
{-# INLINE getFilterLogs #-}
getFilterLogs = remote "eth_getFilterLogs"
getWork :: Web3 [Bytes]
{-# INLINE getWork #-}
getWork = remote "eth_getWork"
submitWork :: Bytes -> Bytes -> Bytes -> Web3 Bool
{-# INLINE submitWork #-}
submitWork = remote "eth_submitWork"
submitHashrate :: Bytes -> Bytes -> Web3 Bool
{-# INLINE submitHashrate #-}
submitHashrate = remote "eth_submitHashrate"