Skip to main content

zenith_core/ast/
action.rs

1//! Action block declaration AST types.
2//!
3//! The top-level `actions` block is an automation manifest: each entry
4//! declares a named transaction script the host can invoke. It is a sibling
5//! of the `assets`/`tokens`/`libraries` blocks. The engine round-trips the
6//! `tx` payload verbatim as an opaque string; it does NOT parse or validate
7//! the JSON content.
8
9use std::collections::BTreeMap;
10
11use super::Span;
12use super::node::UnknownProperty;
13
14/// A single action declaration within an `actions` block — one named
15/// transaction script.
16#[derive(Debug, Clone, PartialEq)]
17pub struct ActionDef {
18    /// The action identifier, e.g. "apply-brand-kit". Required.
19    pub id: String,
20    /// Human-readable label, e.g. "Apply Brand Kit". Optional.
21    pub label: Option<String>,
22    /// Declared version string, e.g. "1.0.0". Optional.
23    pub version: Option<String>,
24    /// The transaction script payload as an opaque JSON string. Required.
25    /// The engine round-trips this verbatim without parsing it.
26    pub tx_json: String,
27    /// Source declaration span, when available.
28    pub source_span: Option<Span>,
29    /// Forward-compat: unrecognized attributes preserved with typed values +
30    /// annotations.
31    pub unknown_props: BTreeMap<String, UnknownProperty>,
32}