Module

Network.Ethereum.Web3

Package
purescript-web3
Repository
f-o-a-m/purescript-web3

Re-exports from Network.Ethereum.Web3.Contract

#EventFilter Source

class EventFilter a  where

Members

#call Source

call :: forall selector a b e. CallMethod selector a b => IsSymbol selector => TransactionOptions NoPay -> ChainCursor -> Tagged (SProxy selector) a -> Web3 e (Either CallError b)

Constant call given contract 'Address' in mode and given input data

#sendTx Source

sendTx :: forall selector a u e. TxMethod selector a => EtherUnit (Value u) => IsSymbol selector => TransactionOptions u -> Tagged (SProxy selector) a -> Web3 e HexString

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

#event' Source

event' :: forall ni i a e. DecodeEvent i ni a => Filter a -> Int -> (a -> ReaderT Change (Web3 e) EventAction) -> Web3 e Unit

Takes a Filter and a handler, as well as a windowSize. It runs the handler over the eventLogs using reduceEventStream. If no TerminateEvent is thrown, it then transitions to polling.

#event Source

event :: forall ni i a e. DecodeEvent i ni a => Filter a -> (a -> ReaderT Change (Web3 e) EventAction) -> Web3 e Unit

run event' one block at a time.

#deployContract Source

deployContract :: forall t e rep a. Generic a rep => GenericABIEncode rep => TransactionOptions NoPay -> HexString -> Tagged t a -> Web3 e HexString

Re-exports from Network.Ethereum.Web3.Solidity

#Vector Source

newtype Vector (n :: DigitList) a

Represents a statically sized vector of length n. See module Network.Ethereum.Web3.Solidity.Sizes for some predefined sizes.

Instances

#UIntN Source

newtype UIntN (n :: DigitList)

Represents a statically sized unsigned integer of size n. See module Network.Ethereum.Web3.Solidity.Sizes for some predefined sizes.

Instances

#DOne Source

data DOne :: Digit -> DigitList

Instances

#DLProxy Source

data DLProxy (d :: DigitList)

For types of kind Type there is already Type.Proxy. this is basicity the same thing but for types of kind DigitList. Documentation of Type.Proxy module has motivation for why would one need a Proxy for some type which we will not cover here.

Constructors

#DCons Source

data DCons :: Digit -> DigitList -> DigitList

Instances

#BytesN Source

newtype BytesN (n :: DigitList)

See module Network.Ethereum.Web3.Solidity.Sizes for some predefined sizes.

Instances

#ByteSize Source

class (KnownSize n) <= ByteSize n 

ByteSize is empty class, if there is instance of ByteSize for some number it means there is solidity type bytes of that size specific number in like bytes1, bytes2 ... bytes32

Instances

#Inc Source

class Inc (input :: DigitList) (output :: DigitList) | input -> output

This is like inc but in type-level for DigitList, it computes increment of it's input. It could be used like this for example:

cons :: forall a n nInc. Inc n nInc => a -> Vector n a -> Vector nInc a
uncons :: forall a n nDec. Inc nDec n => Vector n a -> { head :: a, tail :: Vector nDec a }

see Network.Ethereum.Web3.Solidity.Vector

Instances

#IntSize Source

class (KnownSize n) <= IntSize n 

IntSize is empty class, if there is instance of IntSize for some number it means there is solidity type int of that size specific number in like int16, int24 ... int256

Instances

#KnownSize Source

class KnownSize (d :: DigitList)  where

Members

  • sizeVal :: DLProxy d -> Int

    Given proxy of a Digit returns a number it represents

    1995 == sizeVal (DLProxy :: DLProxy (D1 :& D9 :& D9 :% D5))
    

Instances

#vCons Source

vCons :: forall nInc n a. Inc n nInc => a -> Vector n a -> Vector nInc a

Dependently typed cons

#unUIntN Source

unUIntN :: forall n. KnownSize n => UIntN n -> BigNumber

Access the raw underlying unsigned integer

#unIntN Source

unIntN :: forall n. KnownSize n => IntN n -> BigNumber

Access the raw underlying integer

#unBytesN Source

unBytesN :: forall n. KnownSize n => BytesN n -> ByteString

Access the underlying raw bytestring

#uIntNFromBigNumber Source

uIntNFromBigNumber :: forall n. KnownSize n => DLProxy n -> BigNumber -> Maybe (UIntN n)

Attempt to coerce an unsigned integer into a statically sized one. See module Network.Ethereum.Web3.Solidity.Sizes for some predefined sizes.

#toVector Source

toVector :: forall n a. KnownSize n => DLProxy n -> Array a -> Maybe (Vector n a)

Attempt to coerce an array into a statically sized array. See module Network.Ethereum.Web3.Solidity.Sizes for some predefined sizes.

#nilVector Source

nilVector :: forall a. Vector (DOne D0) a

Array of length 0

#intNFromBigNumber Source

intNFromBigNumber :: forall n. KnownSize n => DLProxy n -> BigNumber -> Maybe (IntN n)

Attempt to coerce an signed BigNumber into a statically sized one. See module Network.Ethereum.Web3.Solidity.Sizes for some predefined sizes.

#fromData Source

fromData :: forall a. ABIDecode a => HexString -> Either ParseError a

Parse encoded value, droping the leading 0x

#fromByteString Source

fromByteString :: forall n. KnownSize n => DLProxy n -> ByteString -> Maybe (BytesN n)

Attempt to coerce a bytestring into one of the appropriate size. See module Network.Ethereum.Web3.Solidity.Sizes for some predefined sizes.

#(:<) Source

Operator alias for Network.Ethereum.Web3.Solidity.Vector.vCons (right-associative / precedence 6)

#type (:&) Source

Operator alias for Network.Ethereum.Web3.Solidity.Size.DCons (right-associative / precedence 6)

#type (:%) Source

Operator alias for Network.Ethereum.Web3.Solidity.Size.DTwo (right-associative / precedence 6)

Re-exports from Network.Ethereum.Web3.Types

#Wei Source

data Wei

Instances

#Web3 Source

newtype Web3 e a

A monad for asynchronous Web3 actions

Instances

#Value Source

newtype Value a

Ether value in denomination a

Instances

#TransactionReceipt Source

newtype TransactionReceipt

Constructors

Instances

#TransactionOptions Source

#Transaction Source

newtype Transaction

Constructors

Instances

#Szabo Source

data Szabo

Szabo unit type

Instances

#Shannon Source

data Shannon

Shannon unit type

Instances

#Lovelace Source

data Lovelace

Lovelace unit type

Instances

#KEther Source

data KEther

KEther unit type

Instances

#Finney Source

data Finney

Finney unit type

Instances

#FilterId Source

newtype FilterId

Used by the ethereum client to identify the filter you are querying

Instances

#Filter Source

newtype Filter a

Low-level event filter data structure

Instances

#EventAction Source

data EventAction

EventAction Represents a flag to continue or discontinue listening to the filter

Constructors

Instances

#Ether Source

data Ether

Ether unit type

Instances

#ETH Source

data ETH :: Effect

Instances

#Change Source

newtype Change

Changes pulled by low-level call 'eth_getFilterChanges', 'eth_getLogs', and 'eth_getFilterLogs'

Constructors

Instances

#ChainCursor Source

data ChainCursor

Refers to a particular block time, used when making calls, transactions, or watching for events.

Constructors

Instances

#CallError Source

data CallError

Constructors

Instances

#Block Source

newtype Block

Constructors

Instances

#Babbage Source

data Babbage

Babbage unit type

Instances

#Address Source

#fromWei Source

fromWei :: forall a. EtherUnit a => BigNumber -> a

#toWei Source

toWei :: forall a. EtherUnit a => a -> BigNumber

#throwWeb3 Source

throwWeb3 :: forall a e. Error -> Web3 e a

#runWeb3 Source

runWeb3 :: forall a e. Provider -> Web3 e a -> Aff (eth :: ETH | e) (Either Web3Error a)

Run an asynchronous ETH action

#mkValue Source

mkValue :: forall a. EtherUnitSpec a => BigNumber -> Value a

Convert a big number into value, first using floor function to take the integer part

#formatValue Source

formatValue :: forall a. EtherUnitSpec a => Value a -> String

#forkWeb3' Source

forkWeb3' :: forall a e. Web3 e a -> Web3 e (Fiber (eth :: ETH | e) (Either Web3Error a))

Fork an asynchronous ETH action inside Web3 monad

#forkWeb3 Source

forkWeb3 :: forall a e. Provider -> Web3 e a -> Aff (eth :: ETH | e) (Fiber (eth :: ETH | e) (Either Web3Error a))

Fork an asynchronous ETH action

#embed Source

embed :: forall a r. Algebra a r => r -> a

#defaultFilter Source

defaultFilter :: forall a. Filter a

#convert Source

convert :: forall b a. EtherUnit a => EtherUnit b => a -> b

Convert between two denominations

#_topics Source

_topics :: forall a. Lens' (Filter a) (Maybe (Array (Maybe HexString)))

#_toBlock Source

_toBlock :: forall a. Lens' (Filter a) ChainCursor

#_fromBlock Source

#_address Source

_address :: forall a. Lens' (Filter a) (Maybe Address)

Re-exports from Network.Ethereum.Web3.Types.Provider

#Provider Source

data Provider :: Type

Represents a connection to an ethereum client

#metamaskProvider Source

metamaskProvider :: forall e. Eff (exception :: EXCEPTION | e) Provider

Produces reference to Metamas provider

#httpProvider Source

httpProvider :: forall e. String -> Eff e Provider

Connect to an ethereum client at a given address, eg "http://localhost:8545"