Docs Category: Contract-structure

near-bindgen

To Share and +4 nLEARNs Login with NEARnear_bindgen The #[near_bindgen] macro is used on a struct and the function implementations to generate the necessary code to be a valid NEAR contract and expose the intended functions to be able to be called externally. For example, on a simple counter contract, the macro will be applied …

near-bindgen Read More »

nesting

To Share and +4 nLEARNs Login with NEARCollections Nesting Traditional approach for unique prefixes Hardcoded prefixes in the constructor using a short one letter prefix that was converted to a vector of bytes. When using nested collection, the prefix must be constructed manually. use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; use near_sdk::collections::{UnorderedMap, UnorderedSet}; use near_sdk::{near_bindgen, AccountId}; #[near_bindgen] #[derive(BorshDeserialize, …

nesting Read More »

collections

To Share and +4 nLEARNs Login with NEARCollections When deciding on data structures to use for the data of the application, it is important to minimize the amount of data read and written to storage but also the amount of data serialized and deserialized to minimize the cost of transactions. It is important to understand …

collections Read More »

Scroll to Top