Skip to main content

Crate lyquid

Crate lyquid 

Source
Expand description

Guest-side development kit for Lyquid WASM modules.

lyquid is the crate Lyquid authors import inside contract crates. It exposes the ABI tags, call context, result and error types, LyteMemory layout constants, HTTP request shapes, guest memory helpers, runtime host imports, and the method proc-macro facade. Those pieces line up with the metadata decoded by lyquor-wasm and the entry points executed by lyquor-vm: method macros generate network, instance, Ethereum-exported, and UPC entry points, while runtime helpers perform host calls from inside the WASM guest.

Re-exports§

pub use runtime::prelude;
pub use hashbrown;
pub use lyquor_primitives;
pub use alloy_sol_types;

Modules§

consts
Method metadata categories and WASM custom-section encoding helpers.
http
HTTP request and response types exposed to Lyquid instance functions.
mem
Guest pointer and memory-layout helpers.
method
Lyquid method syntax (attribute macros).
runtime
Guest runtime support for memory, calls, oracle, UPC, and synchronization. Guest runtime internals for Lyquid WASM modules.
upc
well_known
Stable hostnames and endpoint URLs exposed by the Lyquor runtime.

Macros§

call
Initiate a inter-lyquid call. Only usable by network functions.
decode_eth_call_params
encode_eth_call_params
eprint
Print to the console (error output).
eprintln
Print a line to the console (error output).
log
Log a custom event that has happened. (Similar to Solidity’s emit event, or log* instruction in EVM.) Only usable by network functions.
print
Print to the console (standard output).
println
Print a line to the console (standard output).
state
Defines network-level and instance-level persistent state variables for a Lyquid contract.
submit_certified_call
Submit a certified call to the sequencing backend. Returns the backend-specific submission result as raw bytes (e.g., tx hash for EVM).
trigger
Trigger an instance function with a given mode. TriggerMode::Commit is only valid from network functions and runs after slot commit.
upc
Initiate a Universal Procedure Call (UPC). Only usable by instance functions.

Structs§

FuncEthInfo
Ethereum export metadata for a Lyquid method.
FuncInfo
Method metadata decoded from Lyquid WASM custom sections.

Enums§

LyquidError
Error type shared by generated Lyquid wrappers and host-facing runtime helpers.

Constants§

ABI_ETH
Numeric ABI tag for Ethereum-compatible call payloads.
ABI_LYQUOR
Numeric ABI tag for native Lyquor call payloads.
INSTANCE_MEMSIZE_IN_MB
Size cap for the addressable LyteMemory that is locally viewed (and persisted) for one Lyquid instance.
INTERNAL_STATE_PREFIX
Prefix bytes used for runtime-owned state in versioned state.
LYTEMEM_BASE
The base address for LyteMemory. Volatile’s upper address is below next to this address. Everything from this base to NETWORK_MEMSIZE_IN_MB and INSTANCE_MEMSIZE_IN_MB are persistent.
LYTEMEM_PAGE_PREFIX
Prefix bytes used for lite pages in versioned state.
LYTEMEM_SIZE_IN_MB
Total size of the memory in megabytes.
LYTESTACK_BASE
The starting address for stacks used by Lyquid.
NETWORK_MEMSIZE_IN_MB
Size cap for the addressable LyteMemory that is globally viewed (and persisted) by all Lyquid instances.
VAR_CATALOG_PREFIX
Prefix bytes used for varaiable catalog in versioned state.
VOLATILE_MEMSIZE_IN_MB
Size cap for the volatile memory that can be used by each function call.
WASM_CALLSTACK_LIMIT
The maximum size of a stack per call.
WASM_DEFAULT_STACK_BASE
Default stack base address for Lyquid guest modules.
WASM_INIT_FUNC
Exported guest initialization function name.
WASM_INIT_VAR_FUNC
Exported guest state-variable initialization function name.
WASM_INSTANCE_METHOD_PREFIX
Prefix for exported instance method entry points.
WASM_NETWORK_METHOD_PREFIX
Prefix for exported network method entry points.
WASM_NUKE_STATE_FUNC
Exported guest function name that marks Lyquid state uninitialized; the VM calls it to reset network state when a new Lyquid image is loaded.
WASM_STACK_POINTER
WASM global name for the guest stack pointer.
WASM_VOLATILE_ALLOC_FUNC
Exported guest volatile-memory allocation function name.
WASM_VOLATILE_DEALLOC_FUNC
Exported guest volatile-memory deallocation function name.

Type Aliases§

LyquidResult
Standard result type for Lyquid runtime and generated wrapper operations.