Skip to content

Commit 18131a1

Browse files
committed
Removes depracated Contract.eventFilter. Fixes #1028.
1 parent baaafca commit 18131a1

File tree

3 files changed

+2
-119
lines changed

3 files changed

+2
-119
lines changed

docs/contracts.rst

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -282,51 +282,6 @@ Each Contract Factory exposes the following methods.
282282
``argument_filters``, optional. Expects a dictionary of argument names and values. When provided event logs are filtered for the event argument values. Event arguments can be both indexed or unindexed. Indexed values with be translated to their corresponding topic arguments. Unindexed arguments will be filtered using a regular expression.
283283
``topics`` optional, accepts the standard JSON-RPC topics argument. See the JSON-RPC documentation for `eth_newFilter <https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter>`_ more information on the ``topics`` parameters.
284284

285-
.. py:classmethod:: Contract.eventFilter(event_name, filter_params=None)
286-
287-
.. warning:: Contract.eventFilter() has been deprecated for :meth:`Contract.events.<event name>.createFilter()`
288-
289-
Creates a new :py:class:`web3.utils.filters.LogFilter` instance.
290-
291-
The ``event_name`` parameter should be the name of the contract event you
292-
want to filter on.
293-
294-
If provided, ``filter_params`` should be a dictionary specifying
295-
additional filters for log entries. The following keys are supported.
296-
297-
* ``filter``: ``dictionary`` - (optional) Dictionary keys should be
298-
argument names for the Event arguments. Dictionary values should be the
299-
value you want to filter on, or a list of values to be filtered on.
300-
Lists of values will match log entries whose argument matches any value
301-
in the list. Indexed and unindexed event arguments are accepted. The
302-
processing of indexed argument values into hex encoded topics is handled
303-
internally when using the ``filter`` parameter.
304-
* ``fromBlock``: ``integer/tag`` - (optional, default: "latest") Integer
305-
block number, or "latest" for the last mined block or "pending",
306-
"earliest" for not yet mined transactions.
307-
* ``toBlock``: ``integer/tag`` - (optional, default: "latest") Integer
308-
block number, or "latest" for the last mined block or "pending",
309-
"earliest" for not yet mined transactions.
310-
* ``address``: ``string`` or list of ``strings``, each 20 Bytes -
311-
(optional) Contract address or a list of addresses from which logs should
312-
originate.
313-
* ``topics``: list of 32 byte ``strings`` or ``null`` - (optional) Array of
314-
topics that should be used for filtering, with the keccak hash of the event
315-
signature as the first item, and the remaining items as hex encoded
316-
argument values. Topics are order-dependent. This parameter can also be a
317-
list of topic lists in which case filtering will match any of the provided
318-
topic arrays. This argument is useful when relying on the internally
319-
generated topic lists via the ``filter`` argument is not desired. If
320-
``topics`` is included with the ``filter`` argument, the ``topics`` list
321-
will be prepended to any topic lists inferred from the ``filter`` arguments.
322-
323-
The event topic for the event specified by ``event_name`` will be added to
324-
the ``filter_params['topics']`` list.
325-
326-
If the :py:attr:`Contract.address` attribute for this contract is
327-
non-null, the contract address will be added to the ``filter_params``.
328-
329-
330285
.. py:classmethod:: Contract.deploy(transaction=None, args=None)
331286
332287
.. warning:: Deprecated: this method is deprecated in favor of
@@ -484,42 +439,6 @@ and the arguments are ambiguous.
484439
1
485440
486441
487-
488-
.. _event-log-object:
489-
490-
Event Log Object
491-
~~~~~~~~~~~~~~~~
492-
493-
The Event Log Object is a python dictionary with the following keys:
494-
495-
* ``args``: Dictionary - The arguments coming from the event.
496-
* ``event``: String - The event name.
497-
* ``logIndex``: Number - integer of the log index position in the block.
498-
* ``transactionIndex``: Number - integer of the transactions index position
499-
log was created from.
500-
* ``transactionHash``: String, 32 Bytes - hash of the transactions this log
501-
was created from.
502-
* ``address``: String, 32 Bytes - address from which this log originated.
503-
* ``blockHash``: String, 32 Bytes - hash of the block where this log was
504-
in. null when its pending.
505-
* ``blockNumber``: Number - the block number where this log was in. null
506-
when its pending.
507-
508-
509-
.. code-block:: python
510-
511-
>>> transfer_filter = my_token_contract.eventFilter('Transfer', {'filter': {'_from': '0xdc3a9db694bcdd55ebae4a89b22ac6d12b3f0c24'}})
512-
>>> transfer_filter.get_new_entries()
513-
[...] # array of Event Log Objects that match the filter.
514-
515-
# wait a while...
516-
517-
>>> transfer_filter.get_new_entries()
518-
[...] # new events since the last call
519-
520-
>>> transfer_filter.get_all_entries()
521-
[...] # all events that match the filter.
522-
523442
Contract Functions
524443
------------------
525444

@@ -784,4 +703,4 @@ Utils
784703
'_transactionData': b'',
785704
'_debatingPeriod': 604800,
786705
'_newCurator': True})
787-
706+

tests/core/filtering/conftest.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,7 @@ def return_filter_by_api(
137137
api_style=None,
138138
contract=None,
139139
args=[]):
140-
if api_style == 'v3':
141-
with pytest.deprecated_call():
142-
return contract.eventFilter(*args)
143-
elif api_style == 'v4':
140+
if api_style == 'v4':
144141
event_name = args[0]
145142
kwargs = apply_key_map({'filter': 'argument_filters'}, args[1])
146143
if 'fromBlock' not in kwargs:

web3/contract.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -366,39 +366,6 @@ def encodeABI(cls, fn_name, args=None, kwargs=None, data=None):
366366

367367
return encode_abi(cls.web3, fn_abi, fn_arguments, data)
368368

369-
@combomethod
370-
@deprecated_for("contract.events.<event name>.createFilter")
371-
def eventFilter(self, event_name, filter_params={}):
372-
"""
373-
Create filter object that tracks events emitted by this contract.
374-
:param event_name: the name of the event to track
375-
:param filter_params: other parameters to limit the events
376-
"""
377-
filter_meta_params = dict(filter_params)
378-
argument_filters = filter_meta_params.pop('filter', {})
379-
380-
argument_filter_names = list(argument_filters.keys())
381-
event_abi = self._find_matching_event_abi(
382-
event_name,
383-
argument_filter_names,
384-
)
385-
386-
data_filter_set, event_filter_params = construct_event_filter_params(
387-
event_abi,
388-
contract_address=self.address,
389-
argument_filters=argument_filters,
390-
**filter_meta_params
391-
)
392-
393-
log_data_extract_fn = functools.partial(get_event_data, event_abi)
394-
395-
log_filter = self.web3.eth.filter(event_filter_params)
396-
397-
log_filter.set_data_filters(data_filter_set)
398-
log_filter.log_entry_formatter = log_data_extract_fn
399-
log_filter.filter_params = event_filter_params
400-
401-
return log_filter
402369

403370
@combomethod
404371
@deprecated_for("contract.functions.<method name>.estimateGas")

0 commit comments

Comments
 (0)