pub fn private()
Expand description
Private Methods inner #[near]
annotation. More details can be found here
Some methods need to be exposed to allow the contract to call a method on itself through a promise, but want to disallow any other contract to call it. For this, use the #[private]
annotation to panic when this method is called externally. See private methods for more information.
This annotation can be applied to any method through the following:
§Examples
§Basic example
use near_sdk::near;
#[near(contract_state)]
#[derive(Default)]
pub struct Counter {
val: u64,
}
#[near]
impl Counter {
#[private]
pub fn my_method(&mut self) {
// ...
}
}