There is no way to do this.
You can remove the entire Call
from the runtime:
construct_runtime! {
..
MyPallet: my_pallet exclude_parts { Call },
..
}
This will remove Call
and will leave all other parts like Origin
, Event
etc as part of your runtime.
The only solution to prevent users from calling certain calls of a pallet is to use the BaseCallFilter
:
pub struct TestBaseCallFilter;
impl Contains<RuntimeCall> for TestBaseCallFilter {
fn contains(c: &RuntimeCall) -> bool {
match *c {
// Only allow `whatever` and `yes` calls from `MyPallet`.
RuntimeCall::MyPallet(call) => match call {
my_pallet::Call::whatever { .. } => true,
my_pallet::Call::yes { .. } => true,
_ => false,
},
_ => true,
}
}
}
These calls will not be "hidden" from the user, but in a "perfect world" a normal user would also use some dedicated app for your runtime. This dedicated app wouldn't provide a way to construct these "forbidden" calls.