Skip to content

Commit 6938ada

Browse files
committed
Merge branch 'master' into patch-1
2 parents 8b5c1db + 233b856 commit 6938ada

21 files changed

+286
-68
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 5.24.0
2+
current_version = 5.25.0
33
commit = True
44
tag = True
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<stage>[^.]*)\.(?P<devnum>\d+))?

docs/contracts.rst

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,54 +1092,54 @@ Event Log Object
10921092

10931093
.. doctest:: createFilter
10941094

1095-
>>> transfer_filter = my_token_contract.events.Transfer.createFilter(fromBlock="0x0", argument_filters={'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf'})
1096-
>>> transfer_filter.get_new_entries()
1097-
[AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1098-
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1099-
'value': 10}),
1100-
'event': 'Transfer',
1101-
'logIndex': 0,
1102-
'transactionIndex': 0,
1103-
'transactionHash': HexBytes('0x0005643c2425552308b4a28814a4dedafb5d340a811b3d2b1c019b290ffd7410'),
1104-
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
1105-
'blockHash': HexBytes('...'),
1106-
'blockNumber': 2})]
1107-
>>> transfer_filter.get_new_entries()
1108-
[]
1109-
>>> tx_hash = contract.functions.transfer(alice, 10).transact({'gas': 899000, 'gasPrice': 200000})
1110-
>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
1111-
>>> transfer_filter.get_new_entries()
1112-
[AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1113-
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1114-
'value': 10}),
1115-
'event': 'Transfer',
1116-
'logIndex': 0,
1117-
'transactionIndex': 0,
1118-
'transactionHash': HexBytes('0xea111a49b82b0a0729d49f9ad924d8f87405d01e3fa87463cf2903848aacf7d9'),
1119-
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
1120-
'blockHash': HexBytes('...'),
1121-
'blockNumber': 3})]
1122-
>>> transfer_filter.get_all_entries()
1095+
>>> transfer_filter = my_token_contract.events.Transfer.createFilter(fromBlock="0x0", argument_filters={'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf'})
1096+
>>> transfer_filter.get_new_entries()
11231097
[AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1124-
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1125-
'value': 10}),
1126-
'event': 'Transfer',
1127-
'logIndex': 0,
1128-
'transactionIndex': 0,
1129-
'transactionHash': HexBytes('0x9da859237e7259832b913d51cb128c8d73d1866056f7a41b52003c953e749678'),
1130-
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
1131-
'blockHash': HexBytes('0xc9c32c3250f77aa3fba2fea1cdeeb0397e7dc68b444747e6eb3db65708aaacd8'),
1132-
'blockNumber': 2}),
1133-
AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1134-
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1135-
'value': 10}),
1136-
'event': 'Transfer',
1137-
'logIndex': 0,
1138-
'transactionIndex': 0,
1139-
'transactionHash': HexBytes('0xea111a49b82b0a0729d49f9ad924d8f87405d01e3fa87463cf2903848aacf7d9'),
1140-
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
1141-
'blockHash': HexBytes('...'),
1142-
'blockNumber': 3})]
1098+
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1099+
'value': 10}),
1100+
'event': 'Transfer',
1101+
'logIndex': 0,
1102+
'transactionIndex': 0,
1103+
'transactionHash': HexBytes('0x9da859237e7259832b913d51cb128c8d73d1866056f7a41b52003c953e749678'),
1104+
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
1105+
'blockHash': HexBytes('...'),
1106+
'blockNumber': 2})]
1107+
>>> transfer_filter.get_new_entries()
1108+
[]
1109+
>>> tx_hash = contract.functions.transfer(alice, 10).transact({'gas': 899000, 'gasPrice': 674302241})
1110+
>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
1111+
>>> transfer_filter.get_new_entries()
1112+
[AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1113+
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1114+
'value': 10}),
1115+
'event': 'Transfer',
1116+
'logIndex': 0,
1117+
'transactionIndex': 0,
1118+
'transactionHash': HexBytes('0xa23e7ef4d2692c5cf34ee99123c9c73099e9c3b68c7850f91c1cbcb91ac327e0'),
1119+
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
1120+
'blockHash': HexBytes('...'),
1121+
'blockNumber': 3})]
1122+
>>> transfer_filter.get_all_entries()
1123+
[AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1124+
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1125+
'value': 10}),
1126+
'event': 'Transfer',
1127+
'logIndex': 0,
1128+
'transactionIndex': 0,
1129+
'transactionHash': HexBytes('0x9da859237e7259832b913d51cb128c8d73d1866056f7a41b52003c953e749678'),
1130+
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
1131+
'blockHash': HexBytes('...'),
1132+
'blockNumber': 2}),
1133+
AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1134+
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
1135+
'value': 10}),
1136+
'event': 'Transfer',
1137+
'logIndex': 0,
1138+
'transactionIndex': 0,
1139+
'transactionHash': HexBytes('0xa23e7ef4d2692c5cf34ee99123c9c73099e9c3b68c7850f91c1cbcb91ac327e0'),
1140+
'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
1141+
'blockHash': HexBytes('...'),
1142+
'blockNumber': 3})]
11431143

11441144
Utils
11451145
-----

docs/providers.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ Eth
409409
- :meth:`web3.eth.get_block() <web3.eth.Eth.get_block>`
410410
- :meth:`web3.eth.get_code() <web3.eth.Eth.get_code>`
411411
- :meth:`web3.eth.get_raw_transaction() <web3.eth.Eth.get_raw_transaction>`
412+
- :meth:`web3.eth.get_raw_transaction_by_block() <web3.eth.Eth.get_raw_transaction_by_block>`
412413
- :meth:`web3.eth.get_transaction() <web3.eth.Eth.get_transaction>`
413414
- :meth:`web3.eth.get_transaction_count() <web3.eth.Eth.get_transaction_count>`
414415
- :meth:`web3.eth.send_transaction() <web3.eth.Eth.send_transaction>`

docs/releases.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,46 @@ Release Notes
33

44
.. towncrier release notes start
55
6+
v5.25.0 (2021-11-19)
7+
--------------------
8+
9+
Features
10+
~~~~~~~~
11+
12+
- Support for ``w3.eth.get_raw_transaction_by_block``, and async support for
13+
``w3.eth.get_raw_transaction_by_block`` (`#2209
14+
<https://github.com/ethereum/web3.py/issues/2209>`__)
15+
16+
17+
Bugfixes
18+
~~~~~~~~
19+
20+
- BadResponseFormat error thrown instead of KeyError when a response gets sent
21+
back without a ``result`` key. (`#2188
22+
<https://github.com/ethereum/web3.py/issues/2188>`__)
23+
24+
25+
Improved Documentation
26+
~~~~~~~~~~~~~~~~~~~~~~
27+
28+
- Correct link to Websocket library documentation (`#2173
29+
<https://github.com/ethereum/web3.py/issues/2173>`__)
30+
- Doc update to make it clearer that enable_unstable_package_management()
31+
method is on the web3 instance (`#2208
32+
<https://github.com/ethereum/web3.py/issues/2208>`__)
33+
34+
35+
Misc
36+
~~~~
37+
38+
- `#2102 <https://github.com/ethereum/web3.py/issues/2102>`__, `#2179
39+
<https://github.com/ethereum/web3.py/issues/2179>`__, `#2191
40+
<https://github.com/ethereum/web3.py/issues/2191>`__, `#2201
41+
<https://github.com/ethereum/web3.py/issues/2201>`__, `#2205
42+
<https://github.com/ethereum/web3.py/issues/2205>`__, `#2212
43+
<https://github.com/ethereum/web3.py/issues/2212>`__
44+
45+
646
v5.24.0 (2021-09-27)
747
--------------------
848

docs/web3.eth.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,8 @@ The following methods are available on the ``web3.eth`` namespace.
617617
``eth_getTransactionByBlockNumberAndIndex`` if ``block_identifier`` is an
618618
integer or one of the predefined block parameters ``'latest', 'earliest',
619619
'pending'``, otherwise delegates to
620-
``eth_getTransactionByBlockHashAndIndex``. If the transaction has not yet been mined throws :class:`web3.exceptions.TransactionNotFound`.
620+
``eth_getTransactionByBlockHashAndIndex``.
621+
If a transaction is not found at specified arguments, throws :class:`web3.exceptions.TransactionNotFound`.
621622

622623
.. code-block:: python
623624
@@ -659,6 +660,28 @@ The following methods are available on the ``web3.eth`` namespace.
659660
.. warning:: Deprecated: This method is deprecated in favor of
660661
:attr:`~web3.eth.Eth.get_transaction_by_block`
661662

663+
.. py:method:: Eth.get_raw_transaction_by_block(block_identifier, transaction_index)
664+
665+
* Delegates to ``eth_getRawTransactionByBlockNumberAndIndex`` or
666+
``eth_getRawTransactionByBlockHashAndIndex`` RPC Methods
667+
668+
Returns the raw transaction at the index specified by ``transaction_index``
669+
from the block specified by ``block_identifier``. Delegates to
670+
``eth_getRawTransactionByBlockNumberAndIndex`` if ``block_identifier`` is an
671+
integer or one of the predefined block parameters ``'latest', 'earliest',
672+
'pending'``, otherwise delegates to
673+
``eth_getRawTransactionByBlockHashAndIndex``.
674+
If a transaction is not found at specified arguments, throws :class:`web3.exceptions.TransactionNotFound`.
675+
676+
.. code-block:: python
677+
678+
>>> web3.eth.get_raw_transaction_by_block('latest', 0)
679+
HexBytes('0x02f87582053901843b9aca00843b9aca008301d8a894e2dfcfa89a45abdc3de91f7a2844b276b8451d2e888ac7230489e8000080c001a028dcd2e11682288c00237f377280bc6a478a6b27e9c2d745262152add1b1dfcba04e7a33b7ce2a37fc3cd3af7bdc7d7beff721664d56508defa188df35afd77c2c')
680+
>>> web3.eth.get_raw_transaction_by_block(2, 0)
681+
HexBytes('0x02f87582053901843b9aca00843b9aca008301d8a894e2dfcfa89a45abdc3de91f7a2844b276b8451d2e888ac7230489e8000080c001a028dcd2e11682288c00237f377280bc6a478a6b27e9c2d745262152add1b1dfcba04e7a33b7ce2a37fc3cd3af7bdc7d7beff721664d56508defa188df35afd77c2c')
682+
>>> web3.eth.get_raw_transaction_by_block('0xca609fb606a04ce6aaec76415cd0b9d8c2bc83ad2a4d17db7fd403ee7d97bf40', 0)
683+
HexBytes('0x02f87582053901843b9aca00843b9aca008301d8a894e2dfcfa89a45abdc3de91f7a2844b276b8451d2e888ac7230489e8000080c001a028dcd2e11682288c00237f377280bc6a478a6b27e9c2d745262152add1b1dfcba04e7a33b7ce2a37fc3cd3af7bdc7d7beff721664d56508defa188df35afd77c2c')
684+
662685
.. py:method:: Eth.wait_for_transaction_receipt(transaction_hash, timeout=120, poll_latency=0.1)
663686
664687
Waits for the transaction specified by ``transaction_hash`` to be included in a block, then

docs/web3.pm.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The ``web3.pm`` object exposes methods to interact with Packages as defined by `
2727

2828
.. code-block:: python
2929
30-
>>> web3.enable_unstable_package_management_api()
30+
>>> w3.enable_unstable_package_management_api()
3131
>>> w3.pm
3232
<web3.pm.PM at 0x....>
3333

newsfragments/2102.misc.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/2173.doc.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/2179.misc.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/2188.bugfix.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/2191.misc.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/2197.misc.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/2201.misc.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/2205.misc.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

newsfragments/2213.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed doctest that wasn't running in ``docs/contracts.rst``

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
extras_require = {
99
'tester': [
10-
"eth-tester[py-evm]==v0.6.0-beta.2",
10+
"eth-tester[py-evm]==v0.6.0-beta.4",
1111
"py-geth>=3.6.0,<4",
1212
],
1313
'linter': [
@@ -63,7 +63,7 @@
6363
setup(
6464
name='web3',
6565
# *IMPORTANT*: Don't manually change the version here. Use the 'bumpversion' utility.
66-
version='5.24.0',
66+
version='5.25.0',
6767
description="""Web3.py""",
6868
long_description_content_type='text/markdown',
6969
long_description=long_description,

tests/integration/test_ethereum_tester.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,12 @@ class TestEthereumTesterEthModule(EthModuleTest):
276276
EthModuleTest.test_eth_get_raw_transaction, ValueError)
277277
test_eth_get_raw_transaction_raises_error = not_implemented(
278278
EthModuleTest.test_eth_get_raw_transaction, ValueError)
279+
test_eth_get_raw_transaction_by_block = not_implemented(
280+
EthModuleTest.test_eth_get_raw_transaction_by_block, ValueError
281+
)
282+
test_eth_get_raw_transaction_by_block_raises_error = not_implemented(
283+
EthModuleTest.test_eth_get_raw_transaction_by_block, ValueError
284+
)
279285
test_eth_replace_transaction_already_mined = not_implemented(
280286
EthModuleTest.test_eth_replace_transaction_already_mined, ValueError
281287
)

web3/_utils/method_formatters.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,11 @@ def apply_list_to_array_formatter(formatter: Any) -> Callable[..., Any]:
409409
apply_formatter_at_index(to_hex_if_integer, 1),
410410
),
411411
RPC.eth_getTransactionCount: apply_formatter_at_index(to_hex_if_integer, 1),
412+
RPC.eth_getRawTransactionByBlockNumberAndIndex: compose(
413+
apply_formatter_at_index(to_hex_if_integer, 0),
414+
apply_formatter_at_index(to_hex_if_integer, 1),
415+
),
416+
RPC.eth_getRawTransactionByBlockHashAndIndex: apply_formatter_at_index(to_hex_if_integer, 1),
412417
RPC.eth_getUncleCountByBlockNumber: apply_formatter_at_index(to_hex_if_integer, 0),
413418
RPC.eth_getUncleByBlockNumberAndIndex: compose(
414419
apply_formatter_at_index(to_hex_if_integer, 0),
@@ -468,6 +473,8 @@ def apply_list_to_array_formatter(formatter: Any) -> Callable[..., Any]:
468473
RPC.eth_getFilterLogs: filter_result_formatter,
469474
RPC.eth_getLogs: filter_result_formatter,
470475
RPC.eth_getProof: apply_formatter_if(is_not_null, proof_formatter),
476+
RPC.eth_getRawTransactionByBlockHashAndIndex: HexBytes,
477+
RPC.eth_getRawTransactionByBlockNumberAndIndex: HexBytes,
471478
RPC.eth_getRawTransactionByHash: HexBytes,
472479
RPC.eth_getStorageAt: HexBytes,
473480
RPC.eth_getTransactionByBlockHashAndIndex: apply_formatter_if(
@@ -676,6 +683,8 @@ def raise_transaction_not_found_with_index(params: Tuple[BlockIdentifier, int])
676683
RPC.eth_getTransactionByBlockHashAndIndex: raise_transaction_not_found_with_index,
677684
RPC.eth_getTransactionByBlockNumberAndIndex: raise_transaction_not_found_with_index,
678685
RPC.eth_getTransactionReceipt: raise_transaction_not_found,
686+
RPC.eth_getRawTransactionByBlockHashAndIndex: raise_transaction_not_found_with_index,
687+
RPC.eth_getRawTransactionByBlockNumberAndIndex: raise_transaction_not_found_with_index,
679688
RPC.eth_getRawTransactionByHash: raise_transaction_not_found,
680689
}
681690

0 commit comments

Comments
 (0)