Docs Category: Contract-interface

serialization-interface

To Share and +4 nLEARNs NEAR Wallet Serialization Protocols Serialization formats within the SDK define how data structures are translated into bytes which are needed for passing data into methods of the smart contract or storing data in state. For the case of method parameters, JSON (default) and Borsh are supported with the SDK and …

serialization-interface Read More »

public-methods

To Share and +4 nLEARNs NEAR Wallet Public Method Types Methods can be called externally by using the pub identifier within the #[near_bindgen] macro which will expose the method in the compiled WASM bytecode. It is important to only mark methods that should be called externally as public. If you need a contract to call …

public-methods Read More »

private-methods

To Share and +4 nLEARNs NEAR Wallet Private Methods When using callbacks Usually, when a contract has to have a callback for a remote cross-contract call, this callback method should only be called by the contract itself. It’s to avoid someone else calling it and messing the state. Pretty common pattern is to have an …

private-methods Read More »

contract-mutability

To Share and +4 nLEARNs NEAR Wallet Contract Mutability Contract state mutability is handled automatically based on how self is used in the function parameters. Depending on which is used, the #[near_bindgen] macro will generate the respective code to load/deserialize state for any function which uses self and serialize/store state only for when &mut self …

contract-mutability Read More »

payable-methods

To Share and +4 nLEARNs NEAR Wallet Payable Methods We can allow methods to accept token transfer together with the function call. This is done so that contracts can define a fee in tokens that needs to be paid when they are used. By default the methods are not payable and they will panic if …

payable-methods Read More »

Scroll to Top