Integrate ink!

This commit is contained in:
Luke Parker
2022-07-16 21:06:54 -04:00
parent 314c9cd8f7
commit 9cb2d8aa4a
6 changed files with 415 additions and 121 deletions

View File

@@ -39,6 +39,7 @@ sp-blockchain = { git = "https://github.com/serai-dex/substrate" }
sp-block-builder = { git = "https://github.com/serai-dex/substrate" }
substrate-frame-rpc-system = { git = "https://github.com/serai-dex/substrate" }
pallet-transaction-payment-rpc = { git = "https://github.com/serai-dex/substrate" }
pallet-contracts-rpc = { git = "https://github.com/serai-dex/substrate", package = "pallet-contracts-rpc" }
# These dependencies are used for runtime benchmarking
frame-benchmarking = { git = "https://github.com/serai-dex/substrate" }

View File

@@ -9,7 +9,7 @@ use sp_api::ProvideRuntimeApi;
pub use sc_rpc_api::DenyUnsafe;
use serai_runtime::{opaque::Block, AccountId, Balance, Index};
use serai_runtime::{BlockNumber, Hash, opaque::Block, AccountId, Balance, Index};
pub struct FullDeps<C, P> {
pub client: Arc<C>,
@@ -29,18 +29,21 @@ pub fn create_full<
deps: FullDeps<C, P>,
) -> Result<RpcModule<()>, Box<dyn std::error::Error + Send + Sync>>
where
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
+ BlockBuilder<Block>,
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index> +
pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance> +
pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash> +
BlockBuilder<Block>,
{
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
use substrate_frame_rpc_system::{System, SystemApiServer};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
use pallet_contracts_rpc::{Contracts, ContractsApiServer};
let mut module = RpcModule::new(());
let FullDeps { client, pool, deny_unsafe } = deps;
module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
module.merge(TransactionPayment::new(client).into_rpc())?;
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
module.merge(Contracts::new(client).into_rpc())?;
Ok(module)
}