eigen_testing_utils/
transaction.rs1use alloy::primitives::FixedBytes;
2use alloy::providers::{PendingTransactionBuilder, PendingTransactionError, ProviderBuilder};
3use alloy::rpc::types::eth::TransactionReceipt;
4use alloy::transports::TransportErrorKind;
5use url::Url;
6
7pub async fn wait_transaction(
18 rpc_url: &str,
19 tx_hash: FixedBytes<32>,
20) -> Result<TransactionReceipt, PendingTransactionError> {
21 let url = Url::parse(rpc_url).map_err(|_| TransportErrorKind::custom_str("Invalid RPC URL"))?;
22 let root_provider = ProviderBuilder::new()
23 .disable_recommended_fillers()
24 .connect_http(url);
25 let pending_tx = PendingTransactionBuilder::new(root_provider, tx_hash);
26 pending_tx.get_receipt().await
27}