mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Add trie migration rpc to polkadot-parachain (#1424)
* add trie migration rpc to polkadot-parachain * pass backend * fix
This commit is contained in:
@@ -42,8 +42,9 @@ pub struct FullDeps<C, P> {
|
||||
}
|
||||
|
||||
/// Instantiate all RPC extensions.
|
||||
pub fn create_full<C, P>(
|
||||
pub fn create_full<C, P, B>(
|
||||
deps: FullDeps<C, P>,
|
||||
backend: Arc<B>,
|
||||
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
|
||||
where
|
||||
C: ProvideRuntimeApi<Block>
|
||||
@@ -57,15 +58,19 @@ where
|
||||
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
|
||||
C::Api: BlockBuilder<Block>,
|
||||
P: TransactionPool + Sync + Send + 'static,
|
||||
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
|
||||
B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>,
|
||||
{
|
||||
use frame_rpc_system::{System, SystemApiServer};
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
|
||||
use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer};
|
||||
|
||||
let mut module = RpcExtension::new(());
|
||||
let FullDeps { client, pool, deny_unsafe } = deps;
|
||||
|
||||
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
|
||||
module.merge(TransactionPayment::new(client).into_rpc())?;
|
||||
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
|
||||
module.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?;
|
||||
|
||||
Ok(module)
|
||||
}
|
||||
|
||||
@@ -560,6 +560,7 @@ where
|
||||
let client = client.clone();
|
||||
let transaction_pool = transaction_pool.clone();
|
||||
|
||||
let backend_for_rpc = backend.clone();
|
||||
Box::new(move |deny_unsafe, _| {
|
||||
let deps = rpc::FullDeps {
|
||||
client: client.clone(),
|
||||
@@ -567,7 +568,7 @@ where
|
||||
deny_unsafe,
|
||||
};
|
||||
|
||||
rpc::create_full(deps).map_err(Into::into)
|
||||
rpc::create_full(deps, backend_for_rpc.clone()).map_err(Into::into)
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user