forked from ghostchain/ghost-node
		
	rustfmt ghost rpc and fix typos
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
		
							parent
							
								
									24a6f803c5
								
							
						
					
					
						commit
						eb3b4f2651
					
				@ -17,7 +17,7 @@ homepage.workspace = true
 | 
				
			|||||||
[workspace.package]
 | 
					[workspace.package]
 | 
				
			||||||
license = "GPL-3.0-only"
 | 
					license = "GPL-3.0-only"
 | 
				
			||||||
authors = ["571nky", "57r37ch", "f4750"]
 | 
					authors = ["571nky", "57r37ch", "f4750"]
 | 
				
			||||||
version = "0.7.207"
 | 
					version = "0.7.208"
 | 
				
			||||||
edition = "2021"
 | 
					edition = "2021"
 | 
				
			||||||
homepage = "https://ghostchain.io"
 | 
					homepage = "https://ghostchain.io"
 | 
				
			||||||
repository = "https://git.ghostchain.io/ghostchain/ghost-node"
 | 
					repository = "https://git.ghostchain.io/ghostchain/ghost-node"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,17 +1,15 @@
 | 
				
			|||||||
use std::sync::Arc;
 | 
					use std::sync::Arc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use jsonrpsee::RpcModule;
 | 
					use babe_primitives::BabeApi;
 | 
				
			||||||
use primitives::{
 | 
					use block_builder_api::BlockBuilder;
 | 
				
			||||||
    AccountId, Balance, Block, BlockNumber, Hash, Nonce,
 | 
					use consensus_common::SelectChain;
 | 
				
			||||||
};
 | 
					 | 
				
			||||||
use sc_client_api::AuxStore;
 | 
					 | 
				
			||||||
use grandpa::FinalityProofProvider;
 | 
					use grandpa::FinalityProofProvider;
 | 
				
			||||||
 | 
					use jsonrpsee::RpcModule;
 | 
				
			||||||
 | 
					use primitives::{AccountId, Balance, Block, BlockNumber, Hash, Nonce};
 | 
				
			||||||
 | 
					use sc_client_api::AuxStore;
 | 
				
			||||||
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
 | 
					pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
 | 
				
			||||||
use sp_api::ProvideRuntimeApi;
 | 
					use sp_api::ProvideRuntimeApi;
 | 
				
			||||||
use block_builder_api::BlockBuilder;
 | 
					 | 
				
			||||||
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
 | 
					use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
 | 
				
			||||||
use consensus_common::SelectChain;
 | 
					 | 
				
			||||||
use babe_primitives::BabeApi;
 | 
					 | 
				
			||||||
use sp_keystore::KeystorePtr;
 | 
					use sp_keystore::KeystorePtr;
 | 
				
			||||||
use tx_pool_api::TransactionPool;
 | 
					use tx_pool_api::TransactionPool;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -61,7 +59,16 @@ pub struct FullDeps<C, P, SC, B> {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn create_full_rpc<C, P, SC, B>(
 | 
					pub fn create_full_rpc<C, P, SC, B>(
 | 
				
			||||||
    FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa, backend } : FullDeps<C, P, SC, B>,
 | 
					    FullDeps {
 | 
				
			||||||
 | 
					        client,
 | 
				
			||||||
 | 
					        pool,
 | 
				
			||||||
 | 
					        select_chain,
 | 
				
			||||||
 | 
					        chain_spec,
 | 
				
			||||||
 | 
					        deny_unsafe,
 | 
				
			||||||
 | 
					        babe,
 | 
				
			||||||
 | 
					        grandpa,
 | 
				
			||||||
 | 
					        backend,
 | 
				
			||||||
 | 
					    }: FullDeps<C, P, SC, B>,
 | 
				
			||||||
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
 | 
					) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
 | 
				
			||||||
where
 | 
					where
 | 
				
			||||||
    C: ProvideRuntimeApi<Block>
 | 
					    C: ProvideRuntimeApi<Block>
 | 
				
			||||||
@ -80,20 +87,19 @@ where
 | 
				
			|||||||
    B: sc_client_api::Backend<Block> + Send + Sync + 'static,
 | 
					    B: sc_client_api::Backend<Block> + Send + Sync + 'static,
 | 
				
			||||||
    B::State: sc_client_api::StateBackend<sp_runtime::traits::HashingFor<Block>>,
 | 
					    B::State: sc_client_api::StateBackend<sp_runtime::traits::HashingFor<Block>>,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    use frame_rpc_system::{System, SystemApiServer};
 | 
					 | 
				
			||||||
    use pallet_transaction_payment_rpc::{
 | 
					 | 
				
			||||||
        TransactionPayment, TransactionPaymentApiServer,
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    use babe_rpc::{Babe, BabeApiServer};
 | 
					    use babe_rpc::{Babe, BabeApiServer};
 | 
				
			||||||
 | 
					    use frame_rpc_system::{System, SystemApiServer};
 | 
				
			||||||
    use grandpa_rpc::{Grandpa, GrandpaApiServer};
 | 
					    use grandpa_rpc::{Grandpa, GrandpaApiServer};
 | 
				
			||||||
 | 
					    use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
 | 
				
			||||||
    use sc_rpc_spec_v2::chain_spec::{ChainSpec, ChainSpecApiServer};
 | 
					    use sc_rpc_spec_v2::chain_spec::{ChainSpec, ChainSpecApiServer};
 | 
				
			||||||
    use sc_sync_state_rpc::{SyncState, SyncStateApiServer};
 | 
					    use sc_sync_state_rpc::{SyncState, SyncStateApiServer};
 | 
				
			||||||
    use substrate_state_trie_migration_rpc::{
 | 
					    use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer};
 | 
				
			||||||
        StateMigration, StateMigrationApiServer,
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let mut io = RpcModule::new(());
 | 
					    let mut io = RpcModule::new(());
 | 
				
			||||||
    let BabeDeps { babe_worker_handle, keystore } = babe;
 | 
					    let BabeDeps {
 | 
				
			||||||
 | 
					        babe_worker_handle,
 | 
				
			||||||
 | 
					        keystore,
 | 
				
			||||||
 | 
					    } = babe;
 | 
				
			||||||
    let GrandpaDeps {
 | 
					    let GrandpaDeps {
 | 
				
			||||||
        shared_voter_state,
 | 
					        shared_voter_state,
 | 
				
			||||||
        shared_authority_set,
 | 
					        shared_authority_set,
 | 
				
			||||||
@ -103,10 +109,13 @@ where
 | 
				
			|||||||
    } = grandpa;
 | 
					    } = grandpa;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let chain_name = chain_spec.name().to_string();
 | 
					    let chain_name = chain_spec.name().to_string();
 | 
				
			||||||
    let genesis_hash = client.hash(0).ok().flatten().expect("Genesis block exists; qed;");
 | 
					    let genesis_hash = client
 | 
				
			||||||
 | 
					        .hash(0)
 | 
				
			||||||
 | 
					        .ok()
 | 
				
			||||||
 | 
					        .flatten()
 | 
				
			||||||
 | 
					        .expect("Genesis block exists; qed;");
 | 
				
			||||||
    let properties = chain_spec.properties();
 | 
					    let properties = chain_spec.properties();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    io.merge(ChainSpec::new(chain_name, genesis_hash, properties).into_rpc())?;
 | 
					    io.merge(ChainSpec::new(chain_name, genesis_hash, properties).into_rpc())?;
 | 
				
			||||||
    io.merge(StateMigration::new(client.clone(), backend.clone(), deny_unsafe).into_rpc())?;
 | 
					    io.merge(StateMigration::new(client.clone(), backend.clone(), deny_unsafe).into_rpc())?;
 | 
				
			||||||
    io.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
 | 
					    io.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
 | 
				
			||||||
@ -119,7 +128,8 @@ where
 | 
				
			|||||||
            keystore,
 | 
					            keystore,
 | 
				
			||||||
            select_chain,
 | 
					            select_chain,
 | 
				
			||||||
            deny_unsafe,
 | 
					            deny_unsafe,
 | 
				
			||||||
        ).into_rpc()
 | 
					        )
 | 
				
			||||||
 | 
					        .into_rpc(),
 | 
				
			||||||
    )?;
 | 
					    )?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    io.merge(
 | 
					    io.merge(
 | 
				
			||||||
@ -129,7 +139,8 @@ where
 | 
				
			|||||||
            shared_voter_state,
 | 
					            shared_voter_state,
 | 
				
			||||||
            justification_stream,
 | 
					            justification_stream,
 | 
				
			||||||
            finality_provider,
 | 
					            finality_provider,
 | 
				
			||||||
        ).into_rpc(),
 | 
					        )
 | 
				
			||||||
 | 
					        .into_rpc(),
 | 
				
			||||||
    )?;
 | 
					    )?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    io.merge(
 | 
					    io.merge(
 | 
				
			||||||
@ -137,8 +148,9 @@ where
 | 
				
			|||||||
            chain_spec,
 | 
					            chain_spec,
 | 
				
			||||||
            client.clone(),
 | 
					            client.clone(),
 | 
				
			||||||
            shared_authority_set,
 | 
					            shared_authority_set,
 | 
				
			||||||
            babe_worker_handle
 | 
					            babe_worker_handle,
 | 
				
			||||||
        )?.into_rpc(),
 | 
					        )?
 | 
				
			||||||
 | 
					        .into_rpc(),
 | 
				
			||||||
    )?;
 | 
					    )?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Ok(io)
 | 
					    Ok(io)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user