web3-0.3.4.0: Ethereum API for Haskell

CopyrightAlexander Krupenkin 2016
LicenseBSD3
Maintainermail@akru.me
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Network.Ethereum.Web3

Contents

Description

An Ethereum node offers a RPC interface. This interface gives Ðapp’s access to the Ethereum blockchain and functionality that the node provides, such as compiling smart contract code. It uses a subset of the JSON-RPC 2.0 specification (no support for notifications or named parameters) as serialisation protocol and is available over HTTP and IPC (unix domain sockets on linux/OSX and named pipe’s on Windows).

Web3 Haskell library currently use JSON-RPC over HTTP to access node functionality.

Synopsis

Web3 monad & runners

type Web3 = ReaderT Config (ExceptT Error IO) Source #

Any communication with Ethereum node wrapped with Web3 monad

data Config Source #

Ethereum node params

Constructors

Config 

Fields

Instances

data Error Source #

Some peace of error response

Constructors

JsonRpcFail RpcError

JSON-RPC communication error

ParserFail String

Error in parser state

UserFail String

Common head for user errors

Instances

Eq Error Source # 

Methods

(==) :: Error -> Error -> Bool #

(/=) :: Error -> Error -> Bool #

Show Error Source # 

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

runWeb3' :: MonadIO m => Config -> Web3 a -> m (Either Error a) Source #

Run Web3 monad with given configuration

runWeb3 :: MonadIO m => Web3 a -> m (Either Error a) Source #

Run Web3 monad with default config

Contract actions

data EventAction Source #

Event callback control response

Constructors

ContinueEvent

Continue to listen events

TerminateEvent

Terminate event listener

class ABIEncoding a => Event a where Source #

Contract event listener

Minimal complete definition

eventFilter

Methods

eventFilter :: a -> Address -> Filter Source #

Event filter structure used by low-level subscription methods

event :: Address -> (a -> IO EventAction) -> Web3 ThreadId Source #

Start an event listener for given contract Address and callback

class ABIEncoding a => Method a where Source #

Contract method caller

Methods

sendTx :: Unit b => Address -> b -> a -> Web3 TxHash Source #

Send a transaction for given contract Address, value and input data

call :: ABIEncoding b => Address -> CallMode -> a -> Web3 b Source #

Constant call given contract Address in mode and given input data

nopay :: Wei Source #

Zero value is used to send transaction without money

ABI encoding & data types

class ABIEncoding a where Source #

Contract ABI data codec

Minimal complete definition

toDataBuilder, fromDataParser

Methods

toDataBuilder :: a -> Builder Source #

fromDataParser :: Parser a Source #

toData :: a -> Text Source #

Encode value into abi-encoding represenation

fromData :: Text -> Maybe a Source #

Parse encoded value

Instances

ABIEncoding Bool Source # 
ABIEncoding Int Source # 
ABIEncoding Integer Source # 
ABIEncoding Word Source # 
ABIEncoding Text Source # 
ABIEncoding Address Source # 
ABIEncoding BytesD Source # 
ABIEncoding a => ABIEncoding [a] Source # 
KnownNat n => ABIEncoding (BytesN n) Source # 

newtype BytesN n Source #

Fixed length byte array

Constructors

BytesN 

Fields

Instances

Eq (BytesN n) Source # 

Methods

(==) :: BytesN n -> BytesN n -> Bool #

(/=) :: BytesN n -> BytesN n -> Bool #

Ord (BytesN n) Source # 

Methods

compare :: BytesN n -> BytesN n -> Ordering #

(<) :: BytesN n -> BytesN n -> Bool #

(<=) :: BytesN n -> BytesN n -> Bool #

(>) :: BytesN n -> BytesN n -> Bool #

(>=) :: BytesN n -> BytesN n -> Bool #

max :: BytesN n -> BytesN n -> BytesN n #

min :: BytesN n -> BytesN n -> BytesN n #

KnownNat n => Show (BytesN n) Source # 

Methods

showsPrec :: Int -> BytesN n -> ShowS #

show :: BytesN n -> String #

showList :: [BytesN n] -> ShowS #

KnownNat n => ABIEncoding (BytesN n) Source # 

Ethereum unit conversion utils