diff --git a/jormungandr/src/jrpc/eth_block_info/logic.rs b/jormungandr/src/jrpc/eth_block_info/logic.rs index 0fc74d9a44..6c95f52401 100644 --- a/jormungandr/src/jrpc/eth_block_info/logic.rs +++ b/jormungandr/src/jrpc/eth_block_info/logic.rs @@ -1,8 +1,10 @@ -use super::Error; use crate::{ blockchain::{Blockchain, Ref}, context::Context, - jrpc::eth_types::{block::Block, block_number::BlockNumber, number::Number}, + jrpc::{ + eth_types::{block::Block, block_number::BlockNumber, number::Number}, + Error, + }, }; use chain_evm::ethereum_types::H256; use chain_impl_mockchain::block::Block as JorBlock; diff --git a/jormungandr/src/jrpc/eth_block_info/mod.rs b/jormungandr/src/jrpc/eth_block_info/mod.rs index 81e020be78..5616021b8c 100644 --- a/jormungandr/src/jrpc/eth_block_info/mod.rs +++ b/jormungandr/src/jrpc/eth_block_info/mod.rs @@ -3,14 +3,6 @@ use jsonrpsee_http_server::RpcModule; mod logic; -#[derive(Debug, thiserror::Error)] -pub enum Error { - #[error(transparent)] - ContextError(#[from] crate::context::Error), - #[error(transparent)] - Storage(#[from] crate::blockchain::StorageError), -} - pub fn eth_block_info_module(context: ContextLock) -> RpcModule { let mut module = RpcModule::new(context); diff --git a/jormungandr/src/jrpc/eth_chain_info/logic.rs b/jormungandr/src/jrpc/eth_chain_info/logic.rs index 10229883de..b49ffbc934 100644 --- a/jormungandr/src/jrpc/eth_chain_info/logic.rs +++ b/jormungandr/src/jrpc/eth_chain_info/logic.rs @@ -1,8 +1,8 @@ -use super::Error; use crate::{ context::Context, - jrpc::eth_types::{ - block_number::BlockNumber, fee::FeeHistory, number::Number, sync::SyncStatus, + jrpc::{ + eth_types::{block_number::BlockNumber, fee::FeeHistory, number::Number, sync::SyncStatus}, + Error, }, }; diff --git a/jormungandr/src/jrpc/eth_chain_info/mod.rs b/jormungandr/src/jrpc/eth_chain_info/mod.rs index a99ff6b084..9ab77abd8a 100644 --- a/jormungandr/src/jrpc/eth_chain_info/mod.rs +++ b/jormungandr/src/jrpc/eth_chain_info/mod.rs @@ -3,9 +3,6 @@ use jsonrpsee_http_server::RpcModule; mod logic; -#[derive(Debug, thiserror::Error)] -pub enum Error {} - pub fn eth_chain_info_module(context: ContextLock) -> RpcModule { let mut module = RpcModule::new(context); diff --git a/jormungandr/src/jrpc/eth_filter/logic.rs b/jormungandr/src/jrpc/eth_filter/logic.rs index 4b4af3589a..8c29441445 100644 --- a/jormungandr/src/jrpc/eth_filter/logic.rs +++ b/jormungandr/src/jrpc/eth_filter/logic.rs @@ -1,10 +1,12 @@ -use super::Error; use crate::{ context::Context, - jrpc::eth_types::{ - filter::{Filter, FilterChanges}, - log::Log, - number::Number, + jrpc::{ + eth_types::{ + filter::{Filter, FilterChanges}, + log::Log, + number::Number, + }, + Error, }, }; diff --git a/jormungandr/src/jrpc/eth_filter/mod.rs b/jormungandr/src/jrpc/eth_filter/mod.rs index 4a87af9473..aaf5b4387d 100644 --- a/jormungandr/src/jrpc/eth_filter/mod.rs +++ b/jormungandr/src/jrpc/eth_filter/mod.rs @@ -3,9 +3,6 @@ use jsonrpsee_http_server::RpcModule; mod logic; -#[derive(Debug, thiserror::Error)] -pub enum Error {} - pub fn eth_filter_module(context: ContextLock) -> RpcModule { let mut module = RpcModule::new(context); diff --git a/jormungandr/src/jrpc/eth_miner/logic.rs b/jormungandr/src/jrpc/eth_miner/logic.rs index f5c0781ee6..9036a800cc 100644 --- a/jormungandr/src/jrpc/eth_miner/logic.rs +++ b/jormungandr/src/jrpc/eth_miner/logic.rs @@ -1,11 +1,11 @@ -use chain_evm::ethereum_types::{H160, H256, H64}; - use crate::{ context::Context, - jrpc::eth_types::{number::Number, work::Work}, + jrpc::{ + eth_types::{number::Number, work::Work}, + Error, + }, }; - -use super::Error; +use chain_evm::ethereum_types::{H160, H256, H64}; pub fn mining(_context: &Context) -> Result { // TODO implement diff --git a/jormungandr/src/jrpc/eth_miner/mod.rs b/jormungandr/src/jrpc/eth_miner/mod.rs index a7d954b2c5..2f9d28079f 100644 --- a/jormungandr/src/jrpc/eth_miner/mod.rs +++ b/jormungandr/src/jrpc/eth_miner/mod.rs @@ -3,9 +3,6 @@ use jsonrpsee_http_server::RpcModule; mod logic; -#[derive(Debug, thiserror::Error)] -pub enum Error {} - pub fn eth_miner_module(context: ContextLock) -> RpcModule { let mut module = RpcModule::new(context); diff --git a/jormungandr/src/jrpc/eth_transaction/logic.rs b/jormungandr/src/jrpc/eth_transaction/logic.rs index 1267d522fe..8d27bcfded 100644 --- a/jormungandr/src/jrpc/eth_transaction/logic.rs +++ b/jormungandr/src/jrpc/eth_transaction/logic.rs @@ -1,9 +1,11 @@ -use super::Error; use crate::{ context::Context, - jrpc::eth_types::{ - block_number::BlockNumber, bytes::Bytes, number::Number, receipt::Receipt, - transaction::Transaction, + jrpc::{ + eth_types::{ + block_number::BlockNumber, bytes::Bytes, number::Number, receipt::Receipt, + transaction::Transaction, + }, + Error, }, }; use chain_evm::ethereum_types::{H160, H256, H512}; diff --git a/jormungandr/src/jrpc/eth_transaction/mod.rs b/jormungandr/src/jrpc/eth_transaction/mod.rs index ec3ccc6741..dc047301f8 100644 --- a/jormungandr/src/jrpc/eth_transaction/mod.rs +++ b/jormungandr/src/jrpc/eth_transaction/mod.rs @@ -3,9 +3,6 @@ use jsonrpsee_http_server::RpcModule; mod logic; -#[derive(Debug, thiserror::Error)] -pub enum Error {} - pub fn eth_transaction_module(context: ContextLock) -> RpcModule { let mut module = RpcModule::new(context); diff --git a/jormungandr/src/jrpc/mod.rs b/jormungandr/src/jrpc/mod.rs index 25ce226559..f1c3dfa6b4 100644 --- a/jormungandr/src/jrpc/mod.rs +++ b/jormungandr/src/jrpc/mod.rs @@ -16,11 +16,20 @@ mod eth_types; use crate::context::ContextLock; use jsonrpsee_http_server::{HttpServerBuilder, RpcModule}; use std::net::SocketAddr; +use thiserror::Error; pub struct Config { pub listen: SocketAddr, } +#[derive(Debug, Error)] +pub enum Error { + #[error(transparent)] + ContextError(#[from] crate::context::Error), + #[error(transparent)] + Storage(#[from] crate::blockchain::StorageError), +} + pub async fn start_jrpc_server(config: Config, _context: ContextLock) { let server = HttpServerBuilder::default() .build(config.listen)