Re-exports§
pub use unc_sys as sys;pub use base64;pub use borsh;pub use bs58;pub use serde;pub use serde_json;pub use crate::utils::*;
Modules§
- Collections that offer an alternative to standard containers from
std::collections::*by utilizing the underlying blockchain trie storage more efficiently. - Blockchain-specific methods available to the smart contract. This is a wrapper around a low-level
BlockchainInterface. Unless you know what you are doing prefer usingenv::*whenever possible. In case of cross-contract calls prefer using even higher-level API available throughcallback_args,callback_args_vec,ext_contract,Promise, andPromiseOrValue. - Helper types for JSON serialization.
- Collections and types used when interacting with storage.
- Helper methods that often used in smart contracts.
Macros§
- Helper macro to log a message through
env::log_str. This macro can be used similar to thestd::formatmacro in most cases. - Helper macro to create assertions that will panic through the runtime host functions.
- setup_allocDeprecatedDeprecated helper function which used to generate code to initialize the
GlobalAllocator. This is now initialized by default. Disablewee_allocfeature to configure manually.
Structs§
- A simple type used in conjunction with FunctionError representing that the function should abort without a custom message.
- Utility Account Identifier.
- Account identifier. This is the human readable UTF-8 string which is used internally to index accounts on the network and their respective state.
- Weight of unused gas to use with
promise_batch_action_function_call_weight. - A structure representing a result of the scheduled execution on another contract.
- Promise index that is computed only once.
- Public key in a binary format with base58 string serialization with human-readable curve. The key types currently supported are
secp256k1anded25519.
Enums§
- Allow an access key to spend either an unlimited or limited amount of gas
- PublicKey curve
- All error variants which can occur with promise results.
- When the method can return either a promise or a value, it can be called with
PromiseOrValue::PromiseorPromiseOrValue::Valueto specify which one should be returned. - When there is a callback attached to one or more contract calls the execution results of these calls are available to the contract invoked through the callback.
Traits§
- Enables contract runtime to panic with the given type. Any error type used in conjunction with
#[handle_result]has to implement this trait. - Converts Self into a
Vec<u8>that is used for a storage key throughinto_storage_key.
Type Aliases§
- Height of the block.
- BlockHeightDeltaDeprecatedBlock height delta that measures the difference between
BlockHeights. - Raw type for 32 bytes of the hash.
- Raw type for duration in nanoseconds
- Height of the epoch.
- GCCountDeprecated
- IteratorIndexDeprecated
- NonceDeprecatedNonce for transactions.
- NumBlocksDeprecatedNumber of blocks in current group.
- NumSeatsDeprecatedNumber of seats of validators (block producer or hidden ones) in current group (settlement).
- NumShardsDeprecatedNumber of shards in current group.
- PromiseIdDeprecated
- ProtocolVersionDeprecated
- ReceiptIndexDeprecatedAn index of Receipt to append an action
- ShardIdDeprecatedShard index, from 0 to NUM_SHARDS - 1.
- StorageUsage is used to count the amount of storage used by a contract.
- StorageUsageChangeDeprecatedStorageUsageChange is used to count the storage usage within a single contract call.
- Raw type for timestamp in nanoseconds
- ValidatorIdDeprecatedValidator identifier in current group.
- ValidatorMaskDeprecatedMask which validators participated in multi sign.
Attribute Macros§
ext_contracttakes a Rust Trait and converts it to a module with static methods. Each of these static methods takes positional arguments defined by the Trait, then the receiver_id, the attached deposit and the amount of gas and returns a new Promise.- This attribute macro is used on a struct and its implementations to generate the necessary code to expose
pubmethods from the contract as well as generating the glue code to be a valid UNC contract.
Derive Macros§
BorshStorageKeygenerates implementation forBorshIntoStorageKeytrait. It allows the type to be passed as a unique prefix for persistent collections. The type should also implement or deriveBorshSerializetrait.- NOTE: This is an internal implementation for
#[unc_bindgen(events(standard = ...))]attribute. FunctionErrorgenerates implementation forunc_sdk::FunctionErrortrait. It allows contract runtime to panic with the type using itsToStringimplementation as the message.PanicOnDefaultgenerates implementation forDefaulttrait that panics with the following messageThe contract is not initializedwhendefault()is called. This is a helpful macro in case the contract is required to be initialized with eitherinitorinit(ignore_state).