mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat: use alloy_network::Network::ReceiptResponse instead of AnyTransactionReceipt in RPC (#10621)
This commit is contained in:
@ -791,7 +791,11 @@ where
|
||||
/// If called outside of the tokio runtime. See also [`Self::eth_api`]
|
||||
pub fn register_eth(&mut self) -> &mut Self
|
||||
where
|
||||
EthApi: EthApiServer<reth_rpc_types::Transaction, reth_rpc_types::Block>,
|
||||
EthApi: EthApiServer<
|
||||
reth_rpc_types::Transaction,
|
||||
reth_rpc_types::Block,
|
||||
reth_rpc_types::AnyTransactionReceipt,
|
||||
>,
|
||||
{
|
||||
let eth_api = self.eth_api().clone();
|
||||
self.modules.insert(RethRpcModule::Eth, eth_api.into_rpc().into());
|
||||
@ -808,6 +812,7 @@ where
|
||||
EthApi: EthApiServer<
|
||||
WithOtherFields<reth_rpc_types::Transaction>,
|
||||
reth_rpc_types::Block<WithOtherFields<reth_rpc_types::Transaction>>,
|
||||
reth_rpc_types::AnyTransactionReceipt,
|
||||
> + TraceExt,
|
||||
{
|
||||
let otterscan_api = self.otterscan_api();
|
||||
@ -911,6 +916,7 @@ where
|
||||
EthApi: EthApiServer<
|
||||
WithOtherFields<reth_rpc_types::Transaction>,
|
||||
reth_rpc_types::Block<WithOtherFields<reth_rpc_types::Transaction>>,
|
||||
reth_rpc_types::AnyTransactionReceipt,
|
||||
> + TraceExt,
|
||||
{
|
||||
let eth_api = self.eth_api().clone();
|
||||
|
||||
@ -13,7 +13,8 @@ use jsonrpsee::{
|
||||
};
|
||||
use reth_network_peers::NodeRecord;
|
||||
use reth_primitives::{
|
||||
hex_literal::hex, Address, BlockId, BlockNumberOrTag, Bytes, TxHash, B256, B64, U256, U64,
|
||||
hex_literal::hex, Address, BlockId, BlockNumberOrTag, Bytes, Receipt, TxHash, B256, B64, U256,
|
||||
U64,
|
||||
};
|
||||
use reth_rpc_api::{
|
||||
clients::{AdminApiClient, EthApiClient},
|
||||
@ -173,68 +174,93 @@ where
|
||||
.unwrap();
|
||||
|
||||
// Implemented
|
||||
EthApiClient::<Transaction, Block>::protocol_version(client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::chain_id(client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::accounts(client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::get_account(client, address, block_number.into())
|
||||
EthApiClient::<Transaction, Block, Receipt>::protocol_version(client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::chain_id(client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::accounts(client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::get_account(client, address, block_number.into())
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::block_number(client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::get_code(client, address, None).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::send_raw_transaction(client, tx).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::fee_history(client, U64::from(0), block_number, None)
|
||||
EthApiClient::<Transaction, Block, Receipt>::block_number(client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::get_code(client, address, None).await.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::send_raw_transaction(client, tx).await.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::fee_history(
|
||||
client,
|
||||
U64::from(0),
|
||||
block_number,
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::balance(client, address, None).await.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::transaction_count(client, address, None)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::balance(client, address, None).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::transaction_count(client, address, None).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::storage_at(client, address, U256::default().into(), None)
|
||||
EthApiClient::<Transaction, Block, Receipt>::storage_at(
|
||||
client,
|
||||
address,
|
||||
U256::default().into(),
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::block_by_hash(client, hash, false).await.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::block_by_number(client, block_number, false)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::block_by_hash(client, hash, false).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::block_by_number(client, block_number, false).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::block_transaction_count_by_number(client, block_number)
|
||||
EthApiClient::<Transaction, Block, Receipt>::block_transaction_count_by_number(
|
||||
client,
|
||||
block_number,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::block_transaction_count_by_hash(client, hash)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::block_transaction_count_by_hash(client, hash)
|
||||
EthApiClient::<Transaction, Block, Receipt>::block_uncles_count_by_hash(client, hash)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::block_uncles_count_by_hash(client, hash).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::block_uncles_count_by_number(client, block_number)
|
||||
EthApiClient::<Transaction, Block, Receipt>::block_uncles_count_by_number(client, block_number)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::uncle_by_block_hash_and_index(client, hash, index)
|
||||
EthApiClient::<Transaction, Block, Receipt>::uncle_by_block_hash_and_index(client, hash, index)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::uncle_by_block_number_and_index(
|
||||
EthApiClient::<Transaction, Block, Receipt>::uncle_by_block_number_and_index(
|
||||
client,
|
||||
block_number,
|
||||
index,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::sign(client, address, bytes.clone()).await.unwrap_err();
|
||||
EthApiClient::<Transaction, Block>::sign_typed_data(client, address, typed_data)
|
||||
EthApiClient::<Transaction, Block, Receipt>::sign(client, address, bytes.clone())
|
||||
.await
|
||||
.unwrap_err();
|
||||
EthApiClient::<Transaction, Block>::transaction_by_hash(client, tx_hash).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::transaction_by_block_hash_and_index(client, hash, index)
|
||||
EthApiClient::<Transaction, Block, Receipt>::sign_typed_data(client, address, typed_data)
|
||||
.await
|
||||
.unwrap_err();
|
||||
EthApiClient::<Transaction, Block, Receipt>::transaction_by_hash(client, tx_hash)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::transaction_by_block_number_and_index(
|
||||
EthApiClient::<Transaction, Block, Receipt>::transaction_by_block_hash_and_index(
|
||||
client, hash, index,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::transaction_by_block_number_and_index(
|
||||
client,
|
||||
block_number,
|
||||
index,
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::create_access_list(
|
||||
EthApiClient::<Transaction, Block, Receipt>::create_access_list(
|
||||
client,
|
||||
call_request.clone(),
|
||||
Some(block_number.into()),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::estimate_gas(
|
||||
EthApiClient::<Transaction, Block, Receipt>::estimate_gas(
|
||||
client,
|
||||
call_request.clone(),
|
||||
Some(block_number.into()),
|
||||
@ -242,7 +268,7 @@ where
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::call(
|
||||
EthApiClient::<Transaction, Block, Receipt>::call(
|
||||
client,
|
||||
call_request.clone(),
|
||||
Some(block_number.into()),
|
||||
@ -251,30 +277,38 @@ where
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::syncing(client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::send_transaction(client, transaction_request)
|
||||
EthApiClient::<Transaction, Block, Receipt>::syncing(client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::send_transaction(client, transaction_request)
|
||||
.await
|
||||
.unwrap_err();
|
||||
EthApiClient::<Transaction, Block>::hashrate(client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block>::submit_hashrate(client, U256::default(), B256::default())
|
||||
EthApiClient::<Transaction, Block, Receipt>::hashrate(client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::submit_hashrate(
|
||||
client,
|
||||
U256::default(),
|
||||
B256::default(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::gas_price(client).await.unwrap_err();
|
||||
EthApiClient::<Transaction, Block, Receipt>::max_priority_fee_per_gas(client)
|
||||
.await
|
||||
.unwrap_err();
|
||||
EthApiClient::<Transaction, Block, Receipt>::get_proof(client, address, vec![], None)
|
||||
.await
|
||||
.unwrap();
|
||||
EthApiClient::<Transaction, Block>::gas_price(client).await.unwrap_err();
|
||||
EthApiClient::<Transaction, Block>::max_priority_fee_per_gas(client).await.unwrap_err();
|
||||
EthApiClient::<Transaction, Block>::get_proof(client, address, vec![], None).await.unwrap();
|
||||
|
||||
// Unimplemented
|
||||
assert!(is_unimplemented(
|
||||
EthApiClient::<Transaction, Block>::author(client).await.err().unwrap()
|
||||
EthApiClient::<Transaction, Block, Receipt>::author(client).await.err().unwrap()
|
||||
));
|
||||
assert!(is_unimplemented(
|
||||
EthApiClient::<Transaction, Block>::is_mining(client).await.err().unwrap()
|
||||
EthApiClient::<Transaction, Block, Receipt>::is_mining(client).await.err().unwrap()
|
||||
));
|
||||
assert!(is_unimplemented(
|
||||
EthApiClient::<Transaction, Block>::get_work(client).await.err().unwrap()
|
||||
EthApiClient::<Transaction, Block, Receipt>::get_work(client).await.err().unwrap()
|
||||
));
|
||||
assert!(is_unimplemented(
|
||||
EthApiClient::<Transaction, Block>::submit_work(
|
||||
EthApiClient::<Transaction, Block, Receipt>::submit_work(
|
||||
client,
|
||||
B64::default(),
|
||||
B256::default(),
|
||||
@ -285,7 +319,7 @@ where
|
||||
.unwrap()
|
||||
));
|
||||
assert!(is_unimplemented(
|
||||
EthApiClient::<Transaction, Block>::sign_transaction(client, call_request.clone())
|
||||
EthApiClient::<Transaction, Block, Receipt>::sign_transaction(client, call_request.clone())
|
||||
.await
|
||||
.err()
|
||||
.unwrap()
|
||||
|
||||
@ -8,7 +8,7 @@ use reth_rpc::EthApi;
|
||||
use reth_rpc_builder::{RpcServerConfig, TransportRpcModuleConfig};
|
||||
use reth_rpc_eth_api::EthApiClient;
|
||||
use reth_rpc_server_types::RpcModuleSelection;
|
||||
use reth_rpc_types::{Block, Transaction};
|
||||
use reth_rpc_types::{Block, Receipt, Transaction};
|
||||
use std::{
|
||||
future::Future,
|
||||
pin::Pin,
|
||||
@ -75,7 +75,7 @@ async fn test_rpc_middleware() {
|
||||
.unwrap();
|
||||
|
||||
let client = handle.http_client().unwrap();
|
||||
EthApiClient::<Transaction, Block>::protocol_version(&client).await.unwrap();
|
||||
EthApiClient::<Transaction, Block, Receipt>::protocol_version(&client).await.unwrap();
|
||||
let count = mylayer.count.load(Ordering::Relaxed);
|
||||
assert_eq!(count, 1);
|
||||
}
|
||||
|
||||
@ -13,8 +13,8 @@ use reth_rpc_types::{
|
||||
serde_helpers::JsonStorageKey,
|
||||
simulate::{SimBlock, SimulatedBlock},
|
||||
state::{EvmOverrides, StateOverride},
|
||||
AnyTransactionReceipt, BlockOverrides, BlockTransactions, Bundle, EIP1186AccountProofResponse,
|
||||
EthCallResponse, FeeHistory, Header, Index, StateContext, SyncStatus, TransactionRequest, Work,
|
||||
BlockOverrides, BlockTransactions, Bundle, EIP1186AccountProofResponse, EthCallResponse,
|
||||
FeeHistory, Header, Index, StateContext, SyncStatus, TransactionRequest, Work,
|
||||
};
|
||||
use reth_transaction_pool::{PoolTransaction, TransactionPool};
|
||||
use tracing::trace;
|
||||
@ -23,19 +23,27 @@ use crate::{
|
||||
helpers::{
|
||||
EthApiSpec, EthBlocks, EthCall, EthFees, EthState, EthTransactions, FullEthApi, LoadState,
|
||||
},
|
||||
RpcBlock, RpcTransaction,
|
||||
RpcBlock, RpcReceipt, RpcTransaction,
|
||||
};
|
||||
|
||||
/// Helper trait, unifies functionality that must be supported to implement all RPC methods for
|
||||
/// server.
|
||||
pub trait FullEthApiServer:
|
||||
EthApiServer<RpcTransaction<Self::NetworkTypes>, RpcBlock<Self::NetworkTypes>> + FullEthApi + Clone
|
||||
EthApiServer<
|
||||
RpcTransaction<Self::NetworkTypes>,
|
||||
RpcBlock<Self::NetworkTypes>,
|
||||
RpcReceipt<Self::NetworkTypes>,
|
||||
> + FullEthApi
|
||||
+ Clone
|
||||
{
|
||||
}
|
||||
|
||||
impl<T> FullEthApiServer for T where
|
||||
T: EthApiServer<RpcTransaction<T::NetworkTypes>, RpcBlock<T::NetworkTypes>>
|
||||
+ FullEthApi
|
||||
T: EthApiServer<
|
||||
RpcTransaction<T::NetworkTypes>,
|
||||
RpcBlock<T::NetworkTypes>,
|
||||
RpcReceipt<T::NetworkTypes>,
|
||||
> + FullEthApi
|
||||
+ Clone
|
||||
{
|
||||
}
|
||||
@ -43,7 +51,7 @@ impl<T> FullEthApiServer for T where
|
||||
/// Eth rpc interface: <https://ethereum.github.io/execution-apis/api-documentation/>
|
||||
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "eth"))]
|
||||
#[cfg_attr(feature = "client", rpc(server, client, namespace = "eth"))]
|
||||
pub trait EthApi<T: RpcObject, B: RpcObject> {
|
||||
pub trait EthApi<T: RpcObject, B: RpcObject, R: RpcObject> {
|
||||
/// Returns the protocol version encoded as a string.
|
||||
#[method(name = "protocolVersion")]
|
||||
async fn protocol_version(&self) -> RpcResult<U64>;
|
||||
@ -100,10 +108,7 @@ pub trait EthApi<T: RpcObject, B: RpcObject> {
|
||||
|
||||
/// Returns all transaction receipts for a given block.
|
||||
#[method(name = "getBlockReceipts")]
|
||||
async fn block_receipts(
|
||||
&self,
|
||||
block_id: BlockId,
|
||||
) -> RpcResult<Option<Vec<AnyTransactionReceipt>>>;
|
||||
async fn block_receipts(&self, block_id: BlockId) -> RpcResult<Option<Vec<R>>>;
|
||||
|
||||
/// Returns an uncle block of the given block and index.
|
||||
#[method(name = "getUncleByBlockHashAndIndex")]
|
||||
@ -171,7 +176,7 @@ pub trait EthApi<T: RpcObject, B: RpcObject> {
|
||||
|
||||
/// Returns the receipt of a transaction by transaction hash.
|
||||
#[method(name = "getTransactionReceipt")]
|
||||
async fn transaction_receipt(&self, hash: B256) -> RpcResult<Option<AnyTransactionReceipt>>;
|
||||
async fn transaction_receipt(&self, hash: B256) -> RpcResult<Option<R>>;
|
||||
|
||||
/// Returns the balance of the account of given address.
|
||||
#[method(name = "getBalance")]
|
||||
@ -361,7 +366,12 @@ pub trait EthApi<T: RpcObject, B: RpcObject> {
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl<T> EthApiServer<RpcTransaction<T::NetworkTypes>, RpcBlock<T::NetworkTypes>> for T
|
||||
impl<T>
|
||||
EthApiServer<
|
||||
RpcTransaction<T::NetworkTypes>,
|
||||
RpcBlock<T::NetworkTypes>,
|
||||
RpcReceipt<T::NetworkTypes>,
|
||||
> for T
|
||||
where
|
||||
T: FullEthApi,
|
||||
jsonrpsee_types::error::ErrorObject<'static>: From<T::Error>,
|
||||
@ -457,7 +467,7 @@ where
|
||||
async fn block_receipts(
|
||||
&self,
|
||||
block_id: BlockId,
|
||||
) -> RpcResult<Option<Vec<AnyTransactionReceipt>>> {
|
||||
) -> RpcResult<Option<Vec<RpcReceipt<T::NetworkTypes>>>> {
|
||||
trace!(target: "rpc::eth", ?block_id, "Serving eth_getBlockReceipts");
|
||||
Ok(EthBlocks::block_receipts(self, block_id).await?)
|
||||
}
|
||||
@ -604,7 +614,10 @@ where
|
||||
}
|
||||
|
||||
/// Handler for: `eth_getTransactionReceipt`
|
||||
async fn transaction_receipt(&self, hash: B256) -> RpcResult<Option<AnyTransactionReceipt>> {
|
||||
async fn transaction_receipt(
|
||||
&self,
|
||||
hash: B256,
|
||||
) -> RpcResult<Option<RpcReceipt<T::NetworkTypes>>> {
|
||||
trace!(target: "rpc::eth", ?hash, "Serving eth_getTransactionReceipt");
|
||||
Ok(EthTransactions::transaction_receipt(self, hash).await?)
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ pub use core::{EthApiServer, FullEthApiServer};
|
||||
pub use filter::EthFilterApiServer;
|
||||
pub use helpers::error::{AsEthApiError, FromEthApiError, FromEvmError, IntoEthApiError};
|
||||
pub use pubsub::EthPubSubApiServer;
|
||||
pub use types::{EthApiTypes, RpcBlock, RpcTransaction};
|
||||
pub use types::{EthApiTypes, RpcBlock, RpcReceipt, RpcTransaction};
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
pub use bundle::{EthBundleApiClient, EthCallBundleApiClient};
|
||||
|
||||
@ -4,7 +4,7 @@ use std::error::Error;
|
||||
|
||||
use alloy_network::{AnyNetwork, Network};
|
||||
use reth_rpc_eth_types::EthApiError;
|
||||
use reth_rpc_types::{Block, Transaction, WithOtherFields};
|
||||
use reth_rpc_types::{AnyTransactionReceipt, Block, Transaction, WithOtherFields};
|
||||
|
||||
use crate::{AsEthApiError, FromEthApiError, FromEvmError};
|
||||
|
||||
@ -19,10 +19,12 @@ pub trait EthApiTypes: Send + Sync + Clone {
|
||||
+ Send
|
||||
+ Sync;
|
||||
/// Blockchain primitive types, specific to network, e.g. block and transaction.
|
||||
// todo: remove restriction `reth_rpc_types::Transaction`
|
||||
// todo: remove restriction [`reth_rpc_types::Transaction`]
|
||||
// todo: remove restriction [`reth_rpc_types::AnyTransactionReceipt`]
|
||||
type NetworkTypes: Network<
|
||||
TransactionResponse = WithOtherFields<Transaction>,
|
||||
HeaderResponse = reth_rpc_types::Header,
|
||||
ReceiptResponse = AnyTransactionReceipt,
|
||||
>;
|
||||
}
|
||||
|
||||
@ -36,3 +38,6 @@ pub type RpcTransaction<T> = <T as Network>::TransactionResponse;
|
||||
|
||||
/// Adapter for network specific block type.
|
||||
pub type RpcBlock<T> = Block<RpcTransaction<T>, <T as Network>::HeaderResponse>;
|
||||
|
||||
/// Adapter for network specific receipt type.
|
||||
pub type RpcReceipt<T> = <T as Network>::ReceiptResponse;
|
||||
|
||||
@ -8,7 +8,7 @@ use std::{
|
||||
|
||||
use futures::{Stream, StreamExt};
|
||||
use jsonrpsee::core::client::Error as RpcError;
|
||||
use reth_primitives::{BlockId, TxHash, B256};
|
||||
use reth_primitives::{BlockId, Receipt, TxHash, B256};
|
||||
use reth_rpc_api::{clients::DebugApiClient, EthApiClient};
|
||||
use reth_rpc_types::{
|
||||
trace::{
|
||||
@ -77,7 +77,7 @@ pub trait DebugApiExt {
|
||||
|
||||
impl<T> DebugApiExt for T
|
||||
where
|
||||
T: EthApiClient<Transaction, Block> + DebugApiClient + Sync,
|
||||
T: EthApiClient<Transaction, Block, Receipt> + DebugApiClient + Sync,
|
||||
{
|
||||
type Provider = T;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ use std::{collections::HashSet, time::Instant};
|
||||
use futures::StreamExt;
|
||||
use jsonrpsee::http_client::HttpClientBuilder;
|
||||
use jsonrpsee_http_client::HttpClient;
|
||||
use reth_primitives::Receipt;
|
||||
use reth_rpc_api_testing_util::{debug::DebugApiExt, trace::TraceApiExt, utils::parse_env_url};
|
||||
use reth_rpc_eth_api::EthApiClient;
|
||||
use reth_rpc_types::{
|
||||
@ -110,7 +111,7 @@ async fn debug_trace_block_entire_chain() {
|
||||
|
||||
let client = HttpClientBuilder::default().build(url).unwrap();
|
||||
let current_block: u64 =
|
||||
<HttpClient as EthApiClient<Transaction, Block>>::block_number(&client)
|
||||
<HttpClient as EthApiClient<Transaction, Block, Receipt>>::block_number(&client)
|
||||
.await
|
||||
.unwrap()
|
||||
.try_into()
|
||||
|
||||
@ -4,7 +4,7 @@ use reth_primitives::{Address, BlockId, BlockNumberOrTag, Bytes, B256, U256, U64
|
||||
use reth_rpc_api::{EngineEthApiServer, EthApiServer, EthFilterApiServer};
|
||||
/// Re-export for convenience
|
||||
pub use reth_rpc_engine_api::EngineApi;
|
||||
use reth_rpc_eth_api::{EthApiTypes, RpcBlock, RpcTransaction};
|
||||
use reth_rpc_eth_api::{EthApiTypes, RpcBlock, RpcReceipt, RpcTransaction};
|
||||
use reth_rpc_types::{
|
||||
state::StateOverride, BlockOverrides, EIP1186AccountProofResponse, Filter, JsonStorageKey, Log,
|
||||
SyncStatus, TransactionRequest, WithOtherFields,
|
||||
@ -36,8 +36,11 @@ impl<Eth, EthFilter> EngineEthApi<Eth, EthFilter> {
|
||||
impl<Eth, EthFilter> EngineEthApiServer<RpcBlock<Eth::NetworkTypes>>
|
||||
for EngineEthApi<Eth, EthFilter>
|
||||
where
|
||||
Eth: EthApiServer<RpcTransaction<Eth::NetworkTypes>, RpcBlock<Eth::NetworkTypes>>
|
||||
+ EthApiTypes<
|
||||
Eth: EthApiServer<
|
||||
RpcTransaction<Eth::NetworkTypes>,
|
||||
RpcBlock<Eth::NetworkTypes>,
|
||||
RpcReceipt<Eth::NetworkTypes>,
|
||||
> + EthApiTypes<
|
||||
NetworkTypes: Network<
|
||||
TransactionResponse = WithOtherFields<reth_rpc_types::Transaction>,
|
||||
>,
|
||||
|
||||
@ -490,7 +490,7 @@ mod tests {
|
||||
/// Invalid block range
|
||||
#[tokio::test]
|
||||
async fn test_fee_history_empty() {
|
||||
let response = <EthApi<_, _, _, _> as EthApiServer<_, _>>::fee_history(
|
||||
let response = <EthApi<_, _, _, _> as EthApiServer<_, _, _>>::fee_history(
|
||||
&build_test_eth_api(NoopProvider::default()),
|
||||
U64::from(1),
|
||||
BlockNumberOrTag::Latest,
|
||||
@ -512,7 +512,7 @@ mod tests {
|
||||
let (eth_api, _, _) =
|
||||
prepare_eth_api(newest_block, oldest_block, block_count, MockEthProvider::default());
|
||||
|
||||
let response = <EthApi<_, _, _, _> as EthApiServer<_, _>>::fee_history(
|
||||
let response = <EthApi<_, _, _, _> as EthApiServer<_, _, _>>::fee_history(
|
||||
ð_api,
|
||||
U64::from(newest_block + 1),
|
||||
newest_block.into(),
|
||||
@ -535,7 +535,7 @@ mod tests {
|
||||
let (eth_api, _, _) =
|
||||
prepare_eth_api(newest_block, oldest_block, block_count, MockEthProvider::default());
|
||||
|
||||
let response = <EthApi<_, _, _, _> as EthApiServer<_, _>>::fee_history(
|
||||
let response = <EthApi<_, _, _, _> as EthApiServer<_, _, _>>::fee_history(
|
||||
ð_api,
|
||||
U64::from(1),
|
||||
(newest_block + 1000).into(),
|
||||
@ -558,7 +558,7 @@ mod tests {
|
||||
let (eth_api, _, _) =
|
||||
prepare_eth_api(newest_block, oldest_block, block_count, MockEthProvider::default());
|
||||
|
||||
let response = <EthApi<_, _, _, _> as EthApiServer<_, _>>::fee_history(
|
||||
let response = <EthApi<_, _, _, _> as EthApiServer<_, _, _>>::fee_history(
|
||||
ð_api,
|
||||
U64::from(0),
|
||||
newest_block.into(),
|
||||
|
||||
@ -4,7 +4,7 @@ use async_trait::async_trait;
|
||||
use jsonrpsee::{core::RpcResult, types::ErrorObjectOwned};
|
||||
use reth_primitives::{Address, BlockNumberOrTag, TxHash, B256, U256};
|
||||
use reth_rpc_api::{EthApiServer, OtterscanServer};
|
||||
use reth_rpc_eth_api::{helpers::TraceExt, EthApiTypes, RpcBlock, RpcTransaction};
|
||||
use reth_rpc_eth_api::{helpers::TraceExt, EthApiTypes, RpcBlock, RpcReceipt, RpcTransaction};
|
||||
use reth_rpc_eth_types::{utils::binary_search, EthApiError};
|
||||
use reth_rpc_server_types::result::internal_rpc_err;
|
||||
use reth_rpc_types::{
|
||||
@ -66,8 +66,11 @@ where
|
||||
#[async_trait]
|
||||
impl<Eth> OtterscanServer for OtterscanApi<Eth>
|
||||
where
|
||||
Eth: EthApiServer<RpcTransaction<Eth::NetworkTypes>, RpcBlock<Eth::NetworkTypes>>
|
||||
+ EthApiTypes<
|
||||
Eth: EthApiServer<
|
||||
RpcTransaction<Eth::NetworkTypes>,
|
||||
RpcBlock<Eth::NetworkTypes>,
|
||||
RpcReceipt<Eth::NetworkTypes>,
|
||||
> + EthApiTypes<
|
||||
NetworkTypes: Network<
|
||||
TransactionResponse = WithOtherFields<reth_rpc_types::Transaction>,
|
||||
>,
|
||||
|
||||
Reference in New Issue
Block a user