I am trying to add a custom rpc in Substrate, but I ran into a problem.
I have done all steps in this article:
and my code is here:
https://github.com/dortajkianoush/substrate_rpc
but it shows me this error:
error: duplicate lang item in crate `sp_io` (which `sp_application_crypto` depends on): `panic_impl`.
|
= note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
= note: first definition in `sp_io` loaded from /home/kianoush/projects/substrate_rpc/target/debug/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-ff5bbb618e892e0d.rmeta
= note: second definition in `sp_io` loaded from /home/kianoush/projects/substrate_rpc/target/debug/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-c5af71db43952901.rmeta
error: duplicate lang item in crate `sp_io` (which `sp_application_crypto` depends on): `oom`.
|
= note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
= note: first definition in `sp_io` loaded from /home/kianoush/projects/substrate_rpc/target/debug/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-ff5bbb618e892e0d.rmeta
= note: second definition in `sp_io` loaded from /home/kianoush/projects/substrate_rpc/target/debug/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-c5af71db43952901.rmeta
error[E0277]: the trait bound `sp_runtime::generic::Block<sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo256>, sp_runtime::generic::UncheckedExtrinsic<MultiAddress<AccountId32, ()>, RuntimeCall, MultiSignature, (CheckNonZeroSender<Runtime>, CheckSpecVersion<Runtime>, CheckTxVersion<Runtime>, CheckGenesis<Runtime>, CheckEra<Runtime>, CheckNonce<Runtime>, CheckWeight<Runtime>, ChargeTransactionPayment<Runtime>)>>: sp_runtime::traits::Block` is not satisfied
--> /home/kianoush/projects/substrate_rpc/runtime/src/lib.rs:403:7
|
403 | impl pallet_template_runtime_api::TemplateApi<Block> for Runtime {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `sp_runtime::traits::Block` is not implemented for `sp_runtime::generic::Block<sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo256>, sp_runtime::generic::UncheckedExtrinsic<MultiAddress<AccountId32, ()>, RuntimeCall, MultiSignature, (CheckNonZeroSender<Runtime>, CheckSpecVersion<Runtime>, CheckTxVersion<Runtime>, CheckGenesis<Runtime>, CheckEra<Runtime>, CheckNonce<Runtime>, CheckWeight<Runtime>, ChargeTransactionPayment<Runtime>)>>`
|
= help: the trait `sp_runtime::traits::Block` is implemented for `sp_runtime::generic::block::Block<Header, Extrinsic>`
note: required by a bound in `TemplateApi`
--> /home/kianoush/projects/substrate_rpc/pallets/template/rpc/runtime-api/src/lib.rs:5:1
|
5 | / sp_api::decl_runtime_apis! {
6 | | pub trait TemplateApi {
7 | | fn get_value() -> u32;
8 | | }
9 | | }
| |_^ required by this bound in `TemplateApi`
= note: this error originates in the macro `sp_api::decl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0277`.
error: could not compile `node-template-runtime` due to 3 previous errors