wait_transactions_to_complete

Documentation for eth_defi.confirmation.wait_transactions_to_complete function.

wait_transactions_to_complete(web3, txs, confirmation_block_count=0, max_timeout=datetime.timedelta(seconds=300), poll_delay=datetime.timedelta(seconds=1))[source]

Watch multiple transactions executed at parallel.

Use simple poll loop to wait all transactions to complete.

Example:

tx_hash1 = web3.eth.send_raw_transaction(signed1.rawTransaction)
tx_hash2 = web3.eth.send_raw_transaction(signed2.rawTransaction)

complete = wait_transactions_to_complete(web3, [tx_hash1, tx_hash2])

# Check both transaction succeeded
for receipt in complete.values():
    assert receipt.status == 1  # tx success
Parameters
  • txs (List[Union[hexbytes.main.HexBytes, str]]) – List of transaction hashes

  • confirmation_block_count (int) – How many blocks wait for the transaction receipt to settle. Set to zero to return as soon as we see the first transaction receipt.

  • web3 (web3.main.Web3) –

Returns

Map of transaction hashes -> receipt

Return type

Dict[hexbytes.main.HexBytes, dict]