mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: populate tx meta fields in tx by hash (#1884)
This commit is contained in:
@ -216,7 +216,7 @@ pub struct LocalizedTransactionTrace {
|
||||
#[serde(flatten)]
|
||||
pub trace: TransactionTrace,
|
||||
/// Transaction index within the block, None if pending.
|
||||
pub transaction_position: Option<usize>,
|
||||
pub transaction_position: Option<u64>,
|
||||
/// Hash of the transaction
|
||||
pub transaction_hash: Option<H256>,
|
||||
/// Block number the transaction is included in, None if pending.
|
||||
|
||||
@ -9,7 +9,7 @@ pub struct TransactionInfo {
|
||||
/// Hash of the transaction.
|
||||
pub hash: Option<TxHash>,
|
||||
/// Index of the transaction in the block
|
||||
pub index: Option<usize>,
|
||||
pub index: Option<u64>,
|
||||
/// Hash of the block.
|
||||
pub block_hash: Option<H256>,
|
||||
/// Number of the block.
|
||||
|
||||
@ -92,19 +92,17 @@ where
|
||||
return Ok(Some(TransactionSource::Pool(tx)))
|
||||
}
|
||||
|
||||
match self.client().transaction_by_hash(hash)? {
|
||||
match self.client().transaction_by_hash_with_meta(hash)? {
|
||||
None => Ok(None),
|
||||
Some(tx) => {
|
||||
Some((tx, meta)) => {
|
||||
let transaction =
|
||||
tx.into_ecrecovered().ok_or(EthApiError::InvalidTransactionSignature)?;
|
||||
|
||||
let tx = TransactionSource::Database {
|
||||
transaction,
|
||||
// TODO: this is just stubbed out for now still need to fully implement tx =>
|
||||
// block
|
||||
index: 0,
|
||||
block_hash: Default::default(),
|
||||
block_number: 0,
|
||||
index: meta.index,
|
||||
block_hash: meta.block_hash,
|
||||
block_number: meta.block_number,
|
||||
};
|
||||
Ok(Some(tx))
|
||||
}
|
||||
@ -210,7 +208,7 @@ pub enum TransactionSource {
|
||||
/// Transaction fetched via provider
|
||||
transaction: TransactionSignedEcRecovered,
|
||||
/// Index of the transaction in the block
|
||||
index: usize,
|
||||
index: u64,
|
||||
/// Hash of the block.
|
||||
block_hash: H256,
|
||||
/// Number of the block.
|
||||
|
||||
Reference in New Issue
Block a user