Crate pchain_sdk
source · [−]Modules
Structs
Builder to contruct CallData::arguments so that it can be passed to entrypoint
A struct to store return value from an entrypoint
wrapper struct got protocol_types::CallData
StorageField defines the key format in canonical path for fields in contract storage
smart_contract::Transaction is a handle containing the parameters of the smart contract invocation (e.g., the ‘args’ string provided by the contract_caller, the previous block hash, etc.)
Traits
Storage trait provides functions as wrapper to getter and setter to the key-value storage in world-state. Impl of this trait is generated by macro. To avoid conflict with user function, function names in this trait are prefix with two underscores.
Functions
Convert Borsh-serializable structure to bytes
Convert Borsh-serialized bytes to option of the structure
Attribute Macros
action macro applies to impl methods for mutable contract call.
contract macro transforms idiomatic rust smart contracts into contracts
that are readable and deployable by nodes in ParallelChain Mainnet.
contract_init macro transforms idiomatic rust smart contracts into contracts
that are readable and deployable by ParallelChain Mainnet Fullnode.
init macro applies to impl methods for init entrypoint
sdk_method_bindgen provides “convenience methods” to interact with the world
state using custom data types (structs).
use_contract provides smart contract developers a way to make cross contract calls by using
public functions from other smart contracts in the form of traits.
view macro applies to impl methods for read-only contract call. The below operations will take no effect after execution
Derive Macros
The macro trait ContractField can be derived to generate impl so that nested struct can be supported in contract struct.