Add canvas-kusama runtime (#980)

* Added kanvas runtime

* Fix up benchmarking

* Fixup markdown stucture

* replace :emoji_name: by utf8
* fix up header hierarchy

* Merge canvas README

* Only use "Canvas" as a name

* Remove reference to Rocanvas
This commit is contained in:
Alexander Theißen
2022-02-17 22:18:48 +01:00
committed by GitHub
parent eeca2bb61a
commit 4d319d0fae
13 changed files with 3174 additions and 295 deletions
+31 -2
View File
@@ -20,6 +20,8 @@
use std::sync::Arc;
use pallet_contracts_rpc::{Contracts, ContractsApi};
use parachains_common::{AccountId, Balance, Block, BlockNumber, Hash, Index as Nonce};
use sc_client_api::AuxStore;
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
use sc_transaction_pool_api::TransactionPool;
@@ -27,8 +29,6 @@ use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use parachains_common::{AccountId, Balance, Block, Index as Nonce};
/// A type representing all RPC extensions.
pub type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
@@ -68,3 +68,32 @@ where
io
}
/// Instantiate all RPCs we want at the canvas-kusama chain.
pub fn create_canvas_kusama<C, P>(deps: FullDeps<C, P>) -> RpcExtension
where
C: ProvideRuntimeApi<Block>
+ HeaderBackend<Block>
+ AuxStore
+ HeaderMetadata<Block, Error = BlockChainError>
+ Send
+ Sync
+ 'static,
C::Api: frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,
C::Api: BlockBuilder<Block>,
P: TransactionPool + Sync + Send + 'static,
{
use frame_rpc_system::{FullSystem, SystemApi};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
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.clone())));
io.extend_with(ContractsApi::to_delegate(Contracts::new(client)));
io
}