You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The #[near_bindgen] from sdk enables generation of functions that effectively gets exposed in the compiled wasm file.
Those functions are actually invoked from the near runtime and runs the contract's logic.
On the Rust code, as they need to be individually marked with Rust attributes, they must either be created manually or get generated by macros. And if #[near_bindgen] is to be used, that usage also must either be created manually or also get generated by macros - example on fungible-token usage.
This library currently doesn't support this and so those extern functions must be created manually.
In order to have automated generation of those, some design on macros is required.
Some possibilities are:
Generate a macro that will actually generate the code, when called by the user, similar on the macros on the fungible-token usage example.
A benefit is to not require such generator macro to be written manually, as all information that are required (ie. the trait and method names, whether the method requires self, and the actual Self/struct/contract type) exist during the impl item definition.
Users have more control of how and when they are making extern functions in their contracts, as this action would be extremely contained and explicit, and independent from the trait and impl definitions themselves.
Enables the possibility to universally add customizations on those macros usage, such as skipping methods for when making externs, prefix/postfix on method names, etc.
The text was updated successfully, but these errors were encountered:
* Alternative to #15
* Enhances #12 to allow a contract to contain a particular state inside a field, and automatically access that field for it's exposed method calls
* This is shown in the newly added example 03, where `Struct3` has a `FungibleToken` field inside of it
* In the code, some methods are now generic over some `OuterType`. In example 03, that type would be `Struct3`.
* Added aliases to `contract_standards` as `cs` and `contract_interface` as `ci`.
The
#[near_bindgen]
from sdk enables generation of functions that effectively gets exposed in the compiled wasm file.Those functions are actually invoked from the near runtime and runs the contract's logic.
On the Rust code, as they need to be individually marked with Rust attributes, they must either be created manually or get generated by macros. And if
#[near_bindgen]
is to be used, that usage also must either be created manually or also get generated by macros - example on fungible-token usage.This library currently doesn't support this and so those extern functions must be created manually.
In order to have automated generation of those, some design on macros is required.
Some possibilities are:
The text was updated successfully, but these errors were encountered: