Skip to content

Commit 5659fef

Browse files
committed
Add get_transaction_receipt, deprecate getTransactionReceipt
1 parent a8f89a5 commit 5659fef

File tree

16 files changed

+63
-36
lines changed

16 files changed

+63
-36
lines changed

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def _wait_for_transaction(web3, txn_hash, timeout=120):
8585
poll_delay_counter = PollDelayCounter()
8686
with Timeout(timeout) as timeout:
8787
while True:
88-
txn_receipt = web3.eth.getTransactionReceipt(txn_hash)
88+
txn_receipt = web3.eth.get_transaction_receipt(txn_hash)
8989
if txn_receipt is not None:
9090
break
9191
time.sleep(poll_delay_counter())

docs/contracts.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Each Contract Factory exposes the following methods.
237237
.. code-block:: python
238238
239239
>>> deploy_txn = token_contract.constructor(web3.eth.coinbase, 12345).transact()
240-
>>> txn_receipt = web3.eth.getTransactionReceipt(deploy_txn)
240+
>>> txn_receipt = web3.eth.get_transaction_receipt(deploy_txn)
241241
>>> txn_receipt['contractAddress']
242242
'0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318'
243243
@@ -937,7 +937,7 @@ For example:
937937
938938
myContract = web3.eth.contract(address=contract_address, abi=contract_abi)
939939
tx_hash = myContract.functions.myFunction().transact()
940-
receipt = web3.eth.getTransactionReceipt(tx_hash)
940+
receipt = web3.eth.get_transaction_receipt(tx_hash)
941941
myContract.events.myEvent().processReceipt(receipt)
942942
943943
:py:class:`ContractEvent` provides methods to interact with contract events. Positional and keyword arguments supplied to the contract event subclass will be used to find the contract event by signature.
@@ -954,7 +954,7 @@ For example:
954954
.. code-block:: python
955955
956956
>>> tx_hash = contract.functions.myFunction(12345).transact({'to':contract_address})
957-
>>> tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
957+
>>> tx_receipt = w3.eth.get_transaction_receipt(tx_hash)
958958
>>> rich_logs = contract.events.myEvent().processReceipt(tx_receipt)
959959
>>> rich_logs[0]['args']
960960
{'myArg': 12345}
@@ -971,7 +971,7 @@ For example:
971971
.. code-block:: python
972972
973973
>>> tx_hash = contract.functions.myFunction(12345).transact({'to':contract_address})
974-
>>> tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
974+
>>> tx_receipt = w3.eth.get_transaction_receipt(tx_hash)
975975
>>> processed_logs = contract.events.myEvent().processReceipt(tx_receipt)
976976
>>> processed_logs
977977
(
@@ -1020,7 +1020,7 @@ For example:
10201020
.. code-block:: python
10211021
10221022
>>> tx_hash = contract.functions.myFunction(12345).transact({'to':contract_address})
1023-
>>> tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
1023+
>>> tx_receipt = w3.eth.get_transaction_receipt(tx_hash)
10241024
>>> log_to_process = tx_receipt['logs'][0]
10251025
>>> processed_log = contract.events.myEvent().processLog(log_to_process)
10261026
>>> processed_log

docs/examples.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,12 @@ instead return ``None``.
241241
Looking up receipts
242242
-------------------
243243

244-
Transaction receipts can be retrieved using the ``web3.eth.getTransactionReceipt`` API.
244+
Transaction receipts can be retrieved using the ``web3.eth.get_transaction_receipt`` API.
245245

246246

247247
.. code-block:: python
248248
249-
>>> web3.eth.getTransactionReceipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060')
249+
>>> web3.eth.get_transaction_receipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060')
250250
{
251251
'blockHash': '0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd',
252252
'blockNumber': 46147,
@@ -317,7 +317,7 @@ The following example demonstrates a few things:
317317
abi=contract_interface['abi'],
318318
bytecode=contract_interface['bin']).constructor().transact()
319319
320-
address = w3.eth.getTransactionReceipt(tx_hash)['contractAddress']
320+
address = w3.eth.get_transaction_receipt(tx_hash)['contractAddress']
321321
return address
322322
323323

docs/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ API
176176
- :meth:`web3.eth.replace_transaction() <web3.eth.Eth.replace_transaction>`
177177
- :meth:`web3.eth.modifyTransaction() <web3.eth.Eth.modifyTransaction>`
178178
- :meth:`web3.eth.waitForTransactionReceipt() <web3.eth.Eth.waitForTransactionReceipt>`
179-
- :meth:`web3.eth.getTransactionReceipt() <web3.eth.Eth.getTransactionReceipt>`
179+
- :meth:`web3.eth.get_transaction_receipt() <web3.eth.Eth.get_transaction_receipt>`
180180
- :meth:`web3.eth.sign() <web3.eth.Eth.sign>`
181181
- :meth:`web3.eth.signTypedData() <web3.eth.Eth.signTypedData>`
182182
- :meth:`web3.eth.estimateGas() <web3.eth.Eth.estimateGas>`

docs/web3.eth.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ The following methods are available on the ``web3.eth`` namespace.
644644
})
645645
646646
647-
.. py:method:: Eth.getTransactionReceipt(transaction_hash)
647+
.. py:method:: Eth.get_transaction_receipt(transaction_hash)
648648
649649
* Delegates to ``eth_getTransactionReceipt`` RPC Method
650650

@@ -654,12 +654,12 @@ The following methods are available on the ``web3.eth`` namespace.
654654

655655
.. code-block:: python
656656
657-
>>> web3.eth.getTransactionReceipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060') # not yet mined
657+
>>> web3.eth.get_transaction_receipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060') # not yet mined
658658
Traceback # ... etc ...
659659
TransactionNotFound: Transaction with hash: 0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060 not found.
660660
661661
# wait for it to be mined....
662-
>>> web3.eth.getTransactionReceipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060')
662+
>>> web3.eth.get_transaction_receipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060')
663663
AttributeDict({
664664
'blockHash': '0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd',
665665
'blockNumber': 46147,
@@ -675,6 +675,10 @@ The following methods are available on the ``web3.eth`` namespace.
675675
'transactionIndex': 0,
676676
})
677677
678+
.. py:method:: Eth.getTransactionReceipt(transaction_hash)
679+
680+
.. warning:: Deprecated: This method is deprecated in favor of
681+
:meth:`~web3.eth.Eth.get_transaction_receipt()`
678682

679683
.. py:method:: Eth.get_transaction_count(account, block_identifier=web3.eth.default_block)
680684

ethpm/_utils/deployments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def validate_deployments_tx_receipt(
9898
for name, data in deployments.items():
9999
if "transaction" in data:
100100
tx_hash = data["transaction"]
101-
tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
101+
tx_receipt = w3.eth.get_transaction_receipt(tx_hash)
102102
# tx_address will be None if contract created via contract factory
103103
tx_address = tx_receipt["contractAddress"]
104104

tests/core/eth-module/test_transactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def test_unmined_transaction_wait_for_receipt(web3):
101101
'value': 123457
102102
})
103103
with pytest.raises(TransactionNotFound):
104-
web3.eth.getTransactionReceipt(txn_hash)
104+
web3.eth.get_transaction_receipt(txn_hash)
105105

106106
txn_receipt = web3.eth.waitForTransactionReceipt(txn_hash)
107107
assert txn_receipt['transactionHash'] == txn_hash

tests/core/filtering/test_filters_against_many_blocks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def deploy_contracts(web3, contract, wait_for_transaction):
1111
for i in range(25):
1212
tx_hash = contract.constructor().transact()
1313
wait_for_transaction(web3, tx_hash)
14-
yield web3.eth.getTransactionReceipt(tx_hash)['contractAddress']
14+
yield web3.eth.get_transaction_receipt(tx_hash)['contractAddress']
1515

1616

1717
def pad_with_transactions(w3):

tests/core/pm-module/test_pm_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_deploy_a_standalone_package_integration(w3):
7676
ERC20 = token_package.get_contract_factory('StandardToken')
7777
# totalSupply = 100
7878
tx_hash = ERC20.constructor(100).transact()
79-
tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
79+
tx_receipt = w3.eth.get_transaction_receipt(tx_hash)
8080
address = tx_receipt["contractAddress"]
8181
erc20 = w3.eth.contract(address=address, abi=ERC20.abi)
8282
total_supply = erc20.functions.totalSupply().call()

tests/ethpm/integration/test_escrow_manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_deployed_escrow_and_safe_send(escrow_manifest, w3):
2525
bytecode=safe_send_contract_type["deploymentBytecode"]["bytecode"],
2626
)
2727
tx_hash = SafeSend.constructor().transact()
28-
tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
28+
tx_receipt = w3.eth.get_transaction_receipt(tx_hash)
2929
safe_send_address = to_canonical_address(tx_receipt["contractAddress"])
3030

3131
EscrowPackage = Package(escrow_manifest, w3)

0 commit comments

Comments
 (0)