Skip to main content

contract_type

Attribute Macro contract_type 

Source
#[contract_type]
Expand description

Make a struct or enum usable as a contract argument, return value, or auth-token payload: derives XDR codecs, spec registration, auth-handle walkers, and the Mintable preimage machinery.

Both structs and enums recurse when minting auth tokens: a Signed<T> field — including one inside an enum variant — becomes a child auth-token node, and its preimage type in the generated Preimage mirror is AuthTokenPreimage<T::Preimage>.

Enum variants must carry explicit discriminants.

name = "..." renames the type in the spec: it replaces the final segment of the type’s spec id, and may not contain :: (the module path is always the one the type is declared in).