Skip to content

Commit a08af58

Browse files
committed
unused params from rpc
1 parent 0963bf9 commit a08af58

File tree

5 files changed

+23
-86
lines changed

5 files changed

+23
-86
lines changed

node/src/rpc.rs

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,20 @@
55
66
#![warn(missing_docs)]
77

8-
use std::sync::Arc;
9-
108
use jsonrpsee::RpcModule;
11-
use sc_transaction_pool_api::TransactionPool;
12-
use sp_api::ProvideRuntimeApi;
13-
use sp_block_builder::BlockBuilder;
14-
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
15-
use tuxedo_core::types::OpaqueBlock as Block;
16-
17-
pub use sc_rpc_api::DenyUnsafe;
189

1910
/// Full client dependencies.
20-
pub struct FullDeps<C, P> {
21-
/// The client instance to use.
22-
pub client: Arc<C>,
23-
/// Transaction pool instance.
24-
pub pool: Arc<P>,
25-
/// Whether to deny unsafe calls
26-
pub deny_unsafe: DenyUnsafe,
11+
pub struct FullDeps {
12+
// As you add RPC methods, you will likely need to add components to
13+
// fetch data from. It is common to find the client or tx pool here.
14+
// You will also need to add generic params and trait bounds as required.
15+
// See the upstream Substrate node template for more details.
2716
}
2817

2918
/// Instantiate all full RPC extensions.
30-
pub fn create_full<C, P>(
31-
_deps: FullDeps<C, P>,
32-
) -> Result<RpcModule<()>, Box<dyn std::error::Error + Send + Sync>>
33-
where
34-
C: ProvideRuntimeApi<Block>
35-
+ HeaderBackend<Block>
36-
+ HeaderMetadata<Block, Error = BlockChainError>
37-
+ Send
38-
+ Sync
39-
+ 'static,
40-
C::Api: BlockBuilder<Block>,
41-
P: TransactionPool + 'static,
42-
{
19+
pub fn create_full(
20+
_deps: FullDeps,
21+
) -> Result<RpcModule<()>, Box<dyn std::error::Error + Send + Sync>> {
4322
let module = RpcModule::new(());
4423
// Extend this RPC with a custom API by using the following syntax.
4524
// `YourRpcStruct` should have a reference to a client, which is needed

node/src/service.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,8 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
210210
let prometheus_registry = config.prometheus_registry().cloned();
211211

212212
let rpc_extensions_builder = {
213-
let client = client.clone();
214-
let pool = transaction_pool.clone();
215-
216-
Box::new(move |deny_unsafe, _| {
217-
let deps = rpc::FullDeps {
218-
client: client.clone(),
219-
pool: pool.clone(),
220-
deny_unsafe,
221-
};
213+
Box::new(move |_deny_unsafe, _| {
214+
let deps = rpc::FullDeps {};
222215
rpc::create_full(deps).map_err(Into::into)
223216
})
224217
};

parachain-node/src/dev_service.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,8 @@ pub fn new_dev(config: Configuration) -> Result<TaskManager, ServiceError> {
223223
}
224224

225225
let rpc_builder = {
226-
let client = client.clone();
227-
let transaction_pool = transaction_pool.clone();
228-
229-
Box::new(move |deny_unsafe, _| {
230-
let deps = crate::rpc::FullDeps {
231-
client: client.clone(),
232-
pool: transaction_pool.clone(),
233-
deny_unsafe,
234-
};
226+
Box::new(move |_deny_unsafe, _| {
227+
let deps = crate::rpc::FullDeps {};
235228

236229
crate::rpc::create_full(deps).map_err(Into::into)
237230
})

parachain-node/src/rpc.rs

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,23 @@
55
66
#![warn(missing_docs)]
77

8-
use std::sync::Arc;
9-
108
use jsonrpsee::RpcModule;
11-
pub use sc_rpc::DenyUnsafe;
12-
use sc_transaction_pool_api::TransactionPool;
13-
use sp_api::ProvideRuntimeApi;
14-
use sp_block_builder::BlockBuilder;
15-
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
16-
use tuxedo_core::types::OpaqueBlock as Block;
179

1810
/// A type representing all RPC extensions.
1911
pub type RpcExtension = jsonrpsee::RpcModule<()>;
2012

21-
/// Full client dependencies
22-
pub struct FullDeps<C, P> {
23-
/// The client instance to use.
24-
pub client: Arc<C>,
25-
/// Transaction pool instance.
26-
pub pool: Arc<P>,
27-
/// Whether to deny unsafe calls
28-
pub deny_unsafe: DenyUnsafe,
13+
/// Full client dependencies.
14+
pub struct FullDeps {
15+
// As you add RPC methods, you will likely need to add components to
16+
// fetch data from. It is common to find the client or tx pool here.
17+
// You will also need to add generic params and trait bounds as required.
18+
// See the upstream parachain node template for more details.
2919
}
3020

3121
/// Instantiate all RPC extensions.
32-
pub fn create_full<C, P>(
33-
_deps: FullDeps<C, P>,
34-
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
35-
where
36-
C: ProvideRuntimeApi<Block>
37-
+ HeaderBackend<Block>
38-
+ HeaderMetadata<Block, Error = BlockChainError>
39-
+ Send
40-
+ Sync
41-
+ 'static,
42-
C::Api: BlockBuilder<Block>,
43-
P: TransactionPool + Sync + Send + 'static,
44-
{
22+
pub fn create_full(
23+
_deps: FullDeps,
24+
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>> {
4525
let module = RpcModule::new(());
4626
// Extend this RPC with a custom API by using the following syntax.
4727
// `YourRpcStruct` should have a reference to a client, which is needed

parachain-node/src/service.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,16 +212,8 @@ async fn start_node_impl(
212212
.await?;
213213

214214
let rpc_builder = {
215-
let client = client.clone();
216-
let transaction_pool = transaction_pool.clone();
217-
218-
Box::new(move |deny_unsafe, _| {
219-
let deps = crate::rpc::FullDeps {
220-
client: client.clone(),
221-
pool: transaction_pool.clone(),
222-
deny_unsafe,
223-
};
224-
215+
Box::new(move |_deny_unsafe, _| {
216+
let deps = crate::rpc::FullDeps {};
225217
crate::rpc::create_full(deps).map_err(Into::into)
226218
})
227219
};

0 commit comments

Comments
 (0)