Skip to main content

Module prelude

Module prelude 

Source
Expand description

Locutus stdlib prelude.

Re-exports§

pub use crate::delegate_host::decode_secret_key_list;
pub use crate::delegate_host::encode_secret_key_list;
pub use crate::delegate_host::error_codes;
pub use crate::delegate_host::DelegateCtx;
pub use bincode;
pub use blake3;
pub use serde_json;
pub use tracing;
pub use tracing_subscriber;

Modules§

encoding
Helper types for interaction between wasm and host boundaries.

Structs§

ApplicationMessage
BincodeEncoder
ClientResponse
CodeHash
Contract
A complete contract specification requires a parameters section and a contract section.
ContractCode
The executable contract.
ContractInstanceId
The key representing the hash of the contract executable code hash and a set of parameters.
ContractKey
A complete key specification, that represents a cryptographic hash that identifies the contract.
ContractNotification
Notification delivered to a delegate when a subscribed contract’s state changes.
Delegate
DelegateCode
Executable delegate
DelegateContext
DelegateInterfaceResult
DelegateKey
DelegateManifest
What a delegate declares it wants from the node.
DelegateMessage
A message sent from one delegate to another.
GetContractRequest
Request to get contract state from within a delegate.
GetContractResponse
Response containing contract state for a delegate.
JsonEncoder
NotificationMessage
Parameters
Data that forms part of a contract or a delegate along with the WebAssembly code.
PutContractRequest
Request to store a new contract from within a delegate.
PutContractResponse
Response after attempting to store a contract from a delegate.
RelatedContract
A contract related to an other contract and the specification of the kind of update notifications that should be received by this contract.
RelatedContracts
The contracts related to a parent or root contract. Tipically this means contracts which state requires to be verified or integrated in some way with the parent contract.
RelatedContractsContainer
SecretsId
State
StateDelta
Represents a modification to some state - similar to a diff in source code.
StateSummary
Summary of State changes.
SubscribeContractRequest
Request to subscribe to a contract’s state changes from within a delegate.
SubscribeContractResponse
Response after attempting to subscribe to a contract from a delegate.
UnsubscribeContractRequest
Request to stop receiving a contract’s state changes, from within a delegate.
UnsubscribeContractResponse
Response after attempting to unsubscribe from a contract from a delegate.
UpdateContractRequest
Request to update an existing contract’s state from within a delegate.
UpdateContractResponse
Response after attempting to update a contract from a delegate.
UpdateModification
An update to a contract state or any required related contracts to update that state.
UserInputRequest
UserInputResponse
WakeupSchedule
One periodic wake-up a delegate asks for.
WrappedContract
Just as freenet_stdlib::Contract but with some convenience impl.
WrappedState
The state for a contract.

Enums§

APIVersion
Marked #[non_exhaustive] so future protocol versions can be added without a source-level break. Downstream match sites must include a wildcard arm. Historical note: an earlier release had APIVersion::from_u64 panic on unknown versions; both the panic fix (0.1.8) and this attribute reduce the blast radius of version evolution.
Capability
A node-enforced capability, granted by the user once per app.
ContractContainer
Wrapper that allows contract versioning. This enum maintains the types of contracts that are allowed and their corresponding version.
ContractError
Type of errors during interaction with a contract.
ContractWasmAPIVersion
Contains the different versions available for WASM contracts.
DelegateContainer
DelegateError
Type of errors during interaction with a delegate.
DelegateWasmAPIVersion
Contains the different versions available for WASM delegates.
InboundDelegateMsg
Messages delivered into a delegate’s process() function.
LifecycleEvent
A lifecycle event, delivered as InboundDelegateMsg::Lifecycle.
LifecycleKind
A kind of LifecycleEvent a delegate can ask to receive.
ManifestError
Why a manifest could not be read.
MessageOrigin
Identifies where an inbound application message originated from.
OutboundDelegateMsg
Messages emitted out of a delegate’s process() function.
RelatedMode
Specification of the notifications of interest from a related contract.
UpdateData
Update notifications for a contract or a related contract.
ValidateResult
The result of calling the [ContractInterface::validate_state] function.
VersionError

Constants§

MANIFEST_SECTION_NAME
Name of the WASM custom section holding the manifest.
MANIFEST_VERSION
The manifest format version this stdlib writes.
MAX_MANIFEST_BYTES
Largest manifest payload a reader accepts, in bytes. A manifest is a handful of short names; anything bigger is not a manifest.
MAX_WAKEUPS
Most wake-up schedules one delegate may declare. Entries past this are ignored.
MAX_WAKEUP_INTERVAL_SECS
Longest wake-up interval, in seconds (7 days). A longer one is treated as this. Wake-ups are re-armed when a node starts rather than remembered across restarts, so a very long interval would mostly measure node uptime anyway.
MAX_WAKEUP_TAG_BYTES
Longest wake-up tag, in bytes. Entries with a longer (or empty) tag are ignored.
MIN_WAKEUP_INTERVAL_SECS
Shortest wake-up interval a node honours, in seconds. A manifest asking for less is treated as asking for this (see DelegateManifest::effective_wakeups).

Traits§

ContractInterface
Trait to implement for the contract building.
DelegateInterface
A Delegate is a webassembly code designed to act as an agent for the user on Freenet. Delegates can:
Encoder
EncodingAdapter
A contract state and it’s associated types which can be encoded and decoded via an specific encoder.

Attribute Macros§

contract
Generate the necessary code for the WASM runtime to interact with your contract ergonomically and safely.
delegate
Generate the necessary code for the WASM runtime to interact with your delegate ergonomically and safely.