pub fn payable()
Expand description
Payable Methods inner #[near]
annotation. More details can be found here
Methods can be annotated with #[payable]
to allow tokens to be transferred with the method invocation. For more information, see payable methods.
To declare a function as payable, use the #[payable]
annotation as follows:
§Examples
§Basic example
use near_sdk::near;
#[near(contract_state)]
#[derive(Default)]
pub struct Counter {
val: i8,
}
#[near]
impl Counter {
#[payable]
pub fn my_method(&mut self) {
//...
}
}