1

I need to determine whether RPCs are enabled in a OCW. I am thinking that I could check rpc_external and/or ws_external in sc_cli::commands::run_cmd but (1) is this the best way and (2) if it is, how do I access it? For the latter, I tried adding sc-cli as a Cargo.toml dependency but it generated a bunch of errors.

lib.rs:

    if sc_cli::commands::run_cmd::rpc_external {
        frame_support::log::info!("RPCs enabled");
    } else {
        frame_support::log::info!("RPC disabled");
    }

Cargo.toml:

sc-cli = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28"}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.