mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-25 17:37:56 +00:00
391d2f5241
* Add Canvas node as Parachain template * Remove `pallet-contracts` * Point to local Cumulus dependency * Use double quotes instead of single quotes * Get rid of GPL licensing * Remove references to Canvas * Get rid of warnings * Remove GLP-3 License copy-pasta file * Copy in README from `substrate-parachain-template` * Add mention of `polkadot-launch` tool * Add missing screenshot asset * Remove Canvas hidden files and scripts * Rename `template` to `parachain-template` * Remove a few more Canvas references * Add `pallet-template` * Get `pallet-template` compiling * Remove TODOs about Weights * Sort some dependencies * Remove contracts specific const * Change binary name back to `parachain-collator` * RustFmt * Fix mock tests * Purge sneaky whitespace * Add template pallet index to runtime Co-authored-by: Ricardo Rius <9488369+riusricardo@users.noreply.github.com> * Add force authoring to collator `polkadot-launch` config Co-authored-by: Ricardo Rius <9488369+riusricardo@users.noreply.github.com> * Refer README readers to `substrate-parachain-template` * Remove license header in `build.rs` Co-authored-by: Michael Müller <michi@parity.io> * Fix punctuation nitpick Co-authored-by: Michael Müller <michi@parity.io> * Remove unused `lib.rs` file * Add note about Rococo network Co-authored-by: Ricardo Rius <9488369+riusricardo@users.noreply.github.com> Co-authored-by: Michael Müller <michi@parity.io>
58 lines
1.9 KiB
Rust
58 lines
1.9 KiB
Rust
//! A collection of node-specific RPC methods.
|
|
//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer
|
|
//! used by Substrate nodes. This file extends those RPC definitions with
|
|
//! capabilities that are specific to this project's runtime configuration.
|
|
|
|
#![warn(missing_docs)]
|
|
|
|
use std::sync::Arc;
|
|
|
|
use parachain_template_runtime::{opaque::Block, AccountId, Balance, Index as Nonce};
|
|
|
|
use sc_client_api::AuxStore;
|
|
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
|
|
use sc_transaction_pool_api::TransactionPool;
|
|
use sp_api::ProvideRuntimeApi;
|
|
use sp_block_builder::BlockBuilder;
|
|
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
|
|
|
|
/// A type representing all RPC extensions.
|
|
pub type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
|
|
|
|
/// Full client dependencies
|
|
pub struct FullDeps<C, P> {
|
|
/// The client instance to use.
|
|
pub client: Arc<C>,
|
|
/// Transaction pool instance.
|
|
pub pool: Arc<P>,
|
|
/// Whether to deny unsafe calls
|
|
pub deny_unsafe: DenyUnsafe,
|
|
}
|
|
|
|
/// Instantiate all RPC extensions.
|
|
pub fn create_full<C, P>(deps: FullDeps<C, P>) -> RpcExtension
|
|
where
|
|
C: ProvideRuntimeApi<Block>
|
|
+ HeaderBackend<Block>
|
|
+ AuxStore
|
|
+ HeaderMetadata<Block, Error = BlockChainError>
|
|
+ Send
|
|
+ Sync
|
|
+ 'static,
|
|
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
|
|
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
|
|
C::Api: BlockBuilder<Block>,
|
|
P: TransactionPool + Sync + Send + 'static,
|
|
{
|
|
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
|
use substrate_frame_rpc_system::{FullSystem, SystemApi};
|
|
|
|
let mut io = jsonrpc_core::IoHandler::default();
|
|
let FullDeps { client, pool, deny_unsafe } = deps;
|
|
|
|
io.extend_with(SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe)));
|
|
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client)));
|
|
|
|
io
|
|
}
|