Methods & Notations
There are three types of notations that define what type of contract method is:
- Type
@view
, defines that the method is read only. These transactions are not charged; - Type
@private
, this notation hides the method. It will not be exposed to be accessed from outside the contract; - Type
@payable
, defines that the method can receive BWS token;
Here is an example code showing all possibilities:
import BywiseUtils from 'bywise-utils.js';
class HelloWorldContract {
constructor() {
// I believe I can fly
}
exempleWriteMethod() {
return "Done 1";
}
exempleReadMethod() { // @view
return "Done 2";
}
exemplePrivateMethod() { // @private
return "Done 3";
}
exemplePayableMethod() { // @payable
return "Done 4";
}
}
BywiseUtils.exportContract(new HelloWorldContract());