MCPcopy Create free account
hub / github.com/ddimaria/rust-blockchain-tutorial / transaction_receipt

Method transaction_receipt

web3/src/transaction.rs:113–120  ·  view source on GitHub ↗

Retrieve a transaction receipt by transaction hash. See https://eth.wiki/json-rpc/API#eth_getTransactionReceipt # Examples ```ignore use types::transaction::TransactionRequest; let web3 = web3::Web3::new("http://127.0.0.1:8545").unwrap(); let from = web3.get_all_accounts().await.unwrap()[0]; let to = web3.get_all_accounts().await.unwrap()[1]; let gas = U256::from(1_000_000); let gas_price = U2

(&self, tx_hash: H256)

Source from the content-addressed store, hash-verified

111 /// let receipt = web3.transaction_receipt(tx_hash).await;
112 /// ```
113 pub async fn transaction_receipt(&self, tx_hash: H256) -> Result<TransactionReceipt> {
114 let tx_hash = to_value(tx_hash)?;
115 let params = rpc_params![tx_hash];
116 let response = self.send_rpc("eth_getTransactionReceipt", params).await?;
117 let receipt = serde_json::from_value(response)?;
118
119 Ok(receipt)
120 }
121}
122
123#[cfg(test)]

Calls 1

send_rpcMethod · 0.80

Tested by

no test coverage detected