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), node_switch_timeout=datetime.timedelta(seconds=60))[source]
Watch multiple transactions executed at parallel.
Use simple poll loop to wait all transactions to complete.
If
web3
is configured to useeth_defi.provider.fallback.FallbackProvider
, try to switch between alternative node providers when confirming the transactions, because sometimes low quality nodes (Ankr, LlamaNodes) do not see transactions for several minutes.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.
node_switch_timeout –
Switch to alternative fallback node provider every time we reach this limit.
Sometimes our node is malfunctioning (LlamaNodes, Ankr) and does not report transactions timely. Try with another node.
See
eth_defi.provider.fallback.FallbackProvider
for details.web3 (web3.main.Web3) –
- Returns
Map of transaction hashes -> receipt
- Return type