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 missing Tx receipt info #1931

Merged
merged 12 commits into from
Mar 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add remaining log fields
  • Loading branch information
chirag-bgh committed Mar 23, 2023
commit b0517ec1d9d9909f5f98dc337ceb67034e33d685
3 changes: 2 additions & 1 deletion crates/rpc/rpc/src/eth/api/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ where

/// Handler for: `eth_sendTransaction`
async fn send_transaction(&self, _request: TransactionRequest) -> Result<H256> {
Err(internal_rpc_err("unimplemented"))
trace!(target: "rpc::eth", "Serving eth_sendTransaction");
Ok(EthApi::send_transaction(self, _request).await?)
}

/// Handler for: `eth_sendRawTransaction`
Expand Down
6 changes: 6 additions & 0 deletions crates/rpc/rpc/src/eth/api/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,17 @@ where
None => return Err(EthApiError::Unsupported("Previous receipt not found")),
};

let len = res_receipt.logs.len() as u64;
res_receipt.logs.iter_mut().for_each(|log| {
let mut _index = 0;
chirag-bgh marked this conversation as resolved.
Show resolved Hide resolved
log.transaction_hash = Some(meta.tx_hash);
log.transaction_index = Some(U256::from(meta.index));
log.block_hash = Some(meta.block_hash);
log.block_number = Some(U256::from(meta.block_number));
log.log_index = Some(U256::from(meta.index * (len -1) + _index));
log.transaction_log_index = Some(U256::from(_index));
log.removed = false;
_index += 1;
});

match tx.transaction.kind() {
Expand Down