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
Implement ots_getInternalOperations
#7332
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ use alloy_primitives::Bytes; | |
use async_trait::async_trait; | ||
use jsonrpsee::core::RpcResult; | ||
use revm::inspectors::NoOpInspector; | ||
use revm_inspectors::transfer::TransferInspector; | ||
use revm_primitives::ExecutionResult; | ||
|
||
use reth_primitives::{Address, BlockId, BlockNumberOrTag, TxHash, B256}; | ||
|
@@ -44,8 +45,16 @@ where | |
} | ||
|
||
/// Handler for `ots_getInternalOperations` | ||
async fn get_internal_operations(&self, _tx_hash: TxHash) -> RpcResult<Vec<InternalOperation>> { | ||
Err(internal_rpc_err("unimplemented")) | ||
async fn get_internal_operations(&self, tx_hash: TxHash) -> RpcResult<Vec<InternalOperation>> { | ||
self.eth | ||
.spawn_trace_transaction_in_block_with_inspector( | ||
tx_hash, | ||
TransferInspector::new(false), | ||
|_tx_info, inspector, _, _| Ok(inspector.into_transfers()), | ||
) | ||
.await? | ||
.map(|transfer_operations| transfer_operations.into_iter().map(Into::into).collect()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's move the conversion in here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
.ok_or_else(|| internal_rpc_err("failed to inspect transaction")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not required, can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't use |
||
} | ||
|
||
/// Handler for `ots_getTransactionError` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want the dep here we can convert this in the request impl, because we only really need it there
and eventually we will move the otterscan types to alloy and then can do the conversion natively in revm-inspectors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.