anvil_zksync_api_server/impls/
eth_test.rs1use anvil_zksync_api_decl::EthTestNamespaceServer;
2use anvil_zksync_core::node::InMemoryNode;
3use jsonrpsee::core::{async_trait, RpcResult};
4use zksync_types::transaction_request::CallRequest;
5use zksync_types::H256;
6
7use crate::error::RpcErrorAdapter;
8
9pub struct EthTestNamespace {
10 node: InMemoryNode,
11}
12
13impl EthTestNamespace {
14 pub fn new(node: InMemoryNode) -> Self {
15 Self { node }
16 }
17}
18
19#[async_trait]
20impl EthTestNamespaceServer for EthTestNamespace {
21 async fn send_transaction(&self, tx: CallRequest) -> RpcResult<H256> {
22 self.node
23 .send_transaction_impl(tx)
24 .await
25 .map_err(RpcErrorAdapter::into)
26 }
27}