Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add get raw transaction by hash #1168

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions crates/provider/src/provider/trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,18 @@ pub trait Provider<T: Transport + Clone = BoxTransport, N: Network = Ethereum>:
self.client().request("eth_getTransactionByHash", (hash,)).await
}

/// Returns the EIP-2718 encoded transaction if it exists, see also
/// [Decodable2718](alloy_eips::eip2718::Decodable2718).
///
/// If the transaction is an EIP-4844 transaction that is still in the pool (pending) it will
/// include the sidecar, otherwise it will the consensus variant without the sidecar:
/// [TxEip4844](alloy_consensus::transaction::eip4844::TxEip4844).
///
/// This can be decoded into [TxEnvelope](alloy_consensus::transaction::TxEnvelope).
async fn get_raw_transaction_by_hash(&self, hash: TxHash) -> TransportResult<Option<Bytes>> {
self.client().request("eth_getRawTransactionByHash", (hash,)).await
}

/// Gets the transaction count (AKA "nonce") of the corresponding address.
#[doc(alias = "get_nonce")]
#[doc(alias = "get_account_nonce")]
Expand Down