Skip to content

Commit c65354d

Browse files
author
Blinky
committed
fix docks, unexpose mkBlockNumber
1 parent da1aab2 commit c65354d

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

src/Network/Ethereum/Web3.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Network.Ethereum.Web3
66
, module Network.Ethereum.Web3.Types
77
) where
88

9-
import Network.Ethereum.Web3.Contract (EventAction(..), class EventFilter, eventFilter, event, event', mkBlockNumber, call, sendTx)
9+
import Network.Ethereum.Web3.Contract (EventAction(..), class EventFilter, eventFilter, event, event', call, sendTx)
1010
import Network.Ethereum.Web3.Provider (class IsAsyncProvider, Metamask, Provider, forkWeb3, forkWeb3', getAsyncProvider, httpProvider, metamask, runWeb3)
1111
import Network.Ethereum.Web3.Solidity (type (:&), Address, BigNumber, ByteString, BytesN, D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, IntN, N0, N1, N2, N3, N4, N5, N6, N7, N8, N9, UIntN, Vector, fromByteString, intNFromBigNumber, nilVector, toVector, uIntNFromBigNumber, unBytesN, unIntN, vCons, (:<))
1212
import Network.Ethereum.Web3.Types (Address, Babbage, BigNumber, Block(..), ChainCursor(..), Change(..), ETH, Ether, Filter, FilterId, Finney, HexString, KEther, Lovelace, Radix, Shannon, Szabo, Transaction(..), TransactionOptions(..), Value, Web3, Wei, _address, _data, _from, _fromBlock, _gas, _gasPrice, _nonce, _to, _toBlock, _topics, _value, asSigned, binary, convert, decimal, defaultFilter, defaultTransactionOptions, embed, floor, fromAscii, fromHexString, fromHexStringSigned, fromUtf8, fromWei, getPadLength, hexLength, hexadecimal, mkAddress, mkHexString, mkValue, noPay, padLeft, padLeftSigned, padRight, padRightSigned, parseBigNumber, pow, sha3, toAscii, toHexString, toSignedHexString, toString, toTwosComplement, toUtf8, toWei, unHex, unsafeToInt, (*<), (+<), (-<), (>*), (>+), (>-))

src/Network/Ethereum/Web3/Contract.purs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module Network.Ethereum.Web3.Contract
44
, EventAction(..)
55
, event
66
, event'
7-
, mkBlockNumber
87
, class CallMethod
98
, call
109
, class TxMethod
@@ -58,7 +57,7 @@ class EventFilter a where
5857
-- | Event filter structure used by low-level subscription methods
5958
eventFilter :: Proxy a -> Address -> Filter
6059

61-
-- | run 'event'' one block at a time.
60+
-- | run `event'` one block at a time.
6261
event :: forall p e a i ni.
6362
IsAsyncProvider p
6463
=> DecodeEvent i ni a
@@ -67,9 +66,9 @@ event :: forall p e a i ni.
6766
-> Web3 p e Unit
6867
event fltr handler = event' fltr zero handler
6968

70-
-- | 'event'' takes a 'Filter' and a handler, as well as a windowSize.
71-
-- | It runs the handler over the 'eventLogs' using 'reduceEventStream'. If no
72-
-- | 'TerminateEvent' is thrown, it then transitions to polling.
69+
-- | Takes a `Filter` and a handler, as well as a windowSize.
70+
-- | It runs the handler over the `eventLogs` using `reduceEventStream`. If no
71+
-- | `TerminateEvent` is thrown, it then transitions to polling.
7372
event' :: forall p e a i ni.
7473
IsAsyncProvider p
7574
=> DecodeEvent i ni a
@@ -91,9 +90,9 @@ event' fltr w handler = do
9190
filterId <- eth_newFilter $ fltr # _fromBlock .~ BN pollingFromBlock
9291
void $ reduceEventStream (pollFilter filterId (fltr ^. _toBlock)) handler unit
9392

94-
-- | 'reduceEventStream' takes a handler and an initial state and attempts to run
95-
-- | the handler over the event stream. If the machine ends without a 'TerminateEvent'
96-
-- | result, we return the current state. Otherwise we return 'Nothing'.
93+
-- | `reduceEventStream` takes a handler and an initial state and attempts to run
94+
-- | the handler over the event stream. If the machine ends without a `TerminateEvent`
95+
-- | result, we return the current state. Otherwise we return `Nothing`.
9796
reduceEventStream :: forall f s a i ni.
9897
Monad f
9998
=> DecodeEvent i ni a
@@ -111,8 +110,8 @@ reduceEventStream m handler s = do
111110
then reduceEventStream m' handler s
112111
else pure Nothing
113112

114-
-- | 'playLogs' streams the 'filterStream' and calls eth_getLogs on these
115-
-- | 'Filter' objects.
113+
-- | `playLogs` streams the `filterStream` and calls eth_getLogs on these
114+
-- | `Filter` objects.
116115
playLogs :: forall p e a i ni.
117116
IsAsyncProvider p
118117
=> DecodeEvent i ni a
@@ -122,8 +121,8 @@ playLogs = do
122121
changes <- wrapEffect $ eth_getLogs filter
123122
pure $ mkFilterChanges changes
124123

125-
-- | 'pollFilter' takes a 'FilterId' and a max 'ChainCursor' and polls a filter
126-
-- | for changes until the chainHead's 'BlockNumber' exceeds the 'ChainCursor',
124+
-- | `pollFilter` takes a `FilterId` and a max `ChainCursor` and polls a filter
125+
-- | for changes until the chainHead's `BlockNumber` exceeds the `ChainCursor`,
127126
-- | if ever. There is a minimum delay of 1 second between polls.
128127
pollFilter :: forall p e a i ni s.
129128
IsAsyncProvider p
@@ -178,12 +177,12 @@ type FilterStreamState =
178177
, windowSize :: Int
179178
}
180179

181-
-- | 'filterStream' is a machine which represents taking an initial filter
182-
-- | over a range of blocks b1, ... bn (where bn is possibly 'Latest' or 'Pending',
183-
-- | but b1 is an actual 'BlockNumber'), and making a stream of filter objects
184-
-- | which cover this filter in intervals of size 'windowSize'. The machine
185-
-- | halts whenever the 'fromBlock' of a spanning filter either (1) excedes the
186-
-- | initial filter's 'toBlock' or (2) is greater than the chain head's 'BlockNumber'.
180+
-- | `filterStream` is a machine which represents taking an initial filter
181+
-- | over a range of blocks b1, ... bn (where bn is possibly `Latest` or `Pending`,
182+
-- | but b1 is an actual `BlockNumber`), and making a stream of filter objects
183+
-- | which cover this filter in intervals of size `windowSize`. The machine
184+
-- | halts whenever the `fromBlock` of a spanning filter either (1) excedes the
185+
-- | initial filter's `toBlock` or (2) is greater than the chain head's `BlockNumber`.
187186
filterStream :: forall p e.
188187
IsAsyncProvider p
189188
=> MealyT (Web3 p e) FilterStreamState Filter

0 commit comments

Comments
 (0)