Skip to main content

Module template

Module template 

Source
Expand description

Render-only draft natives.

These host fns take no database action; each mutates the TransactionDraft held in the session’s Store data, which the render entry point reads back via store.into_data().

They are functionally render-only: the linker binds them on BOTH the normal eval channel (super::link) and the render surface (super::link_render) — the import must resolve wherever a compiled module references it — but the draft accumulator is armed only under render (SessionData::for_render). On the normal channel with_draft finds no draft and traps, so a non-render program can compile/link a draft native yet never accumulate anything. That trap is a safety net, not the boundary; the real gate is the render compiler-spec allowlist (a normal template/eval that shouldn’t see these simply doesn’t have them in scope). They are harmless on the normal channel either way: no DB, no secret, no mutation.

draft-split takes the entity refs returned by get-account / get-commodity plus a rational amount; it reads each entity’s id field (slot 0, per ENTITY_LAYOUTS) host-side so the draft records stable uuids.

Constants§

REGISTERED_COMMANDS

Functions§

register