Skip to content

Add function w3.eth.waitForTransactionReceipt(tx_hash) #574

Closed
@carver

Description

@carver
  • Version: 4

What was wrong?

It's a bit cumbersome to wait for a transaction to be mined. For example, after deploying a transaction, example code typically involves a small while loop, like in #573

This is a very common need, and should have an easy one-liner.

How can it be fixed?

Something like:

receipt = w3.eth.waitForTransactionReceipt(tx_hash)
contract = MyContract(receipt['contractAddress'])

# or

with w3.waitFor(lambda: w3.eth.getTransactionReceipt(tx_hash)) as receipt:
    contract = MyContract(receipt['contractAddress'])

Very open to alternative API suggestions.

This could potentially let us do cool things eventually, like use pubsub under the hood. Note that pubsub integration would be significantly easier in the first API than the second. But the first API implies adding other new functions that start with waitFor at some point in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions