Skip to main content

luna.primitives

Parameter Objects

class Parameter(StateValuable[T], Named)

A Parameter is a constant value stored in the state. This value is set upon contract creation once at the start.

Variable Objects

class Variable(StateValuable[T], Named, RuntimeInit)

A Variable stores a value in state. This value can be changed at runtime.

Constant Objects

class Constant(Variable)

A Constant is a wrapper around a variable that can store an initial value, but once assigned that value can not be changed. Note that if the Constant is not provided an initial value i.e. value is None, we automatically extend the type_ annotation to be a Union of NoValue and the raw type to support extension

Secret Objects

class Secret(StateValuable[str])

A Secret retrieves the value of a secret from the OrganizationSecret Model This value cannot be changed at runtime.

Connection Objects

class Connection(Named, Stateful, Generic[T])

A connection to a data source to look up data and data values.

read

def read() -> T | NoValue

Read the data from the connection.

read_raw

def read_raw() -> Any

Read raw data from the connection without any processing.

ParticipantDetail Objects

class ParticipantDetail(StateValuable[str])

A ParticipantDetail returns the value of a detail of a participant As we can only resolve the specific participant at runtime we need to pass in the role

class Link(Stateful)

A linked template gives access to another template's attributes at runtime.

put_event

def put_event(*,
event_name: str,
publish_at: datetime | None = None,
payload: dict[str, JsonValue] | None = None)

Emit an event into the contract.

Role Objects

class Role(StateValuable[List[Participant]], Named)

A Role represents a list of participant acting on a contract. The value will be the list of participants with the given role. If there is only one participant, the value will be that participant and not a singleton list.

PaymentDetails Objects

class PaymentDetails(StateValuable[str])

Stateful PaymentDetails class used to resolve participant and set/get participant details