diff --git a/ethers-core/src/types/trace/geth.rs b/ethers-core/src/types/trace/geth.rs index d18632c9c..5762ab16d 100644 --- a/ethers-core/src/types/trace/geth.rs +++ b/ethers-core/src/types/trace/geth.rs @@ -1,7 +1,10 @@ use crate::types::{Bytes, H256, U256}; +use ethabi::Address; use serde::{Deserialize, Serialize, Serializer}; use std::collections::BTreeMap; +use super::Action; + // https://github.com/ethereum/go-ethereum/blob/a9ef135e2dd53682d106c6a2aede9187026cc1de/eth/tracers/logger/logger.go#L406-L411 #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub struct GethTrace { @@ -13,6 +16,30 @@ pub struct GethTrace { pub struct_logs: Vec, } +// https://github.com/ethereum/go-ethereum/blob/a9ef135e2dd53682d106c6a2aede9187026cc1de/eth/tracers/logger/logger.go#L406-L411 +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub struct GethCallTrace { + /// Action + #[serde(rename = "type")] + pub action: String, + pub from: Address, + //pub gas: u64, + //#[serde(rename = "gasUsed")] + //pub gas_used: u64, + #[serde(skip_serializing_if = "Option::is_none")] + pub to: Option
, + #[serde(serialize_with = "serialize_bytes")] + pub input: Bytes, + #[serde(serialize_with = "serialize_bytes")] + pub output: Bytes, + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub revertal: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub calls: Option>, +} + // https://github.com/ethereum/go-ethereum/blob/366d2169fbc0e0f803b68c042b77b6b480836dbc/eth/tracers/logger/logger.go#L413-L426 #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub struct StructLog { diff --git a/ethers-providers/src/lib.rs b/ethers-providers/src/lib.rs index 2427852a0..c3bdfb105 100644 --- a/ethers-providers/src/lib.rs +++ b/ethers-providers/src/lib.rs @@ -522,7 +522,7 @@ pub trait Middleware: Sync + Send + Debug { block: Option, trace_options: GethDebugTracingOptions, state_overrides: spoof::State, - ) -> Result { + ) -> Result { self.inner().debug_trace_call(tx, block, trace_options, state_overrides).await.map_err(FromErr::from) } diff --git a/ethers-providers/src/provider.rs b/ethers-providers/src/provider.rs index b1d5b3ae7..1572c4e19 100644 --- a/ethers-providers/src/provider.rs +++ b/ethers-providers/src/provider.rs @@ -24,7 +24,7 @@ use ethers_core::{ Address, Block, BlockId, BlockNumber, BlockTrace, Bytes, EIP1186ProofResponse, FeeHistory, Filter, FilterBlockOption, GethDebugTracingOptions, GethTrace, Log, NameOrAddress, Selector, Signature, Trace, TraceFilter, TraceType, Transaction, TransactionReceipt, - TransactionRequest, TxHash, TxpoolContent, TxpoolInspect, TxpoolStatus, H256, U256, U64, + TransactionRequest, TxHash, TxpoolContent, TxpoolInspect, TxpoolStatus, H256, U256, U64, GethCallTrace, }, utils, }; @@ -990,7 +990,7 @@ impl Middleware for Provider

{ block: Option, trace_options: GethDebugTracingOptions, state_overrides: spoof::State, - ) -> Result { + ) -> Result { let tx = tx.into(); let tx = utils::serialize(&tx); diff --git a/ethers-providers/src/transports/ws.rs b/ethers-providers/src/transports/ws.rs index e10f1786d..4363efc2e 100644 --- a/ethers-providers/src/transports/ws.rs +++ b/ethers-providers/src/transports/ws.rs @@ -179,16 +179,12 @@ impl JsonRpcClient for Ws { sender, }; - println!("payload: {:#?}", payload); - // send the data self.send(payload)?; // wait for the response (the request itself may have errors as well) let res = receiver.await??; - println!("res: {:?}", res); - // parse it Ok(serde_json::from_str(res.get())?) }