pub enum ParamType {
}Expand description
Type of a transaction parameter.
This enum represents the various types that transaction parameters can have,
including primitives, compound types, and references to TX3 core types. It is
built from the TII params JSON schema by ParamType::from_json_schema, which
never fails — any shape it does not recognize becomes ParamType::Unknown.
Variants§
Bytes
Byte array type (hex-encoded).
Integer
Integer type (signed or unsigned).
Boolean
Boolean type.
Unit
Unit type ({ "type": "null" }).
UtxoRef
UTXO reference in format 0x[64hex]#[index].
Address
Bech32-encoded blockchain address.
Utxo
A resolved UTxO object.
AnyAsset
An asset identified at runtime by policy and name.
List(Box<ParamType>)
Homogeneous, variable-length sequence (array + items).
Tuple(Vec<ParamType>)
Fixed-length, positionally-typed sequence (array + prefixItems).
Map(Box<ParamType>)
String-keyed homogeneous map (object + additionalProperties).
Record(Vec<(String, ParamType)>)
User-defined record (object + properties), (field name, type) in
declared order (the schema’s required array, which tx3c emits in
source order — properties is alphabetized and must not drive field
order). Encoding maps the user’s by-name object to positional fields.
Variant(Vec<VariantCase>)
User-defined tagged union (oneOf), externally tagged.
Unknown(Value)
A schema shape that could not be interpreted; carries the raw schema.
Implementations§
Source§impl ParamType
impl ParamType
Sourcepub fn field(&self, name: &str) -> Option<&ParamType>
pub fn field(&self, name: &str) -> Option<&ParamType>
Looks up a field type by name in a ParamType::Record; None for any
other kind or an absent field.
Sourcepub fn from_json_schema(
schema: &Value,
components: &HashMap<String, Value>,
) -> ParamType
pub fn from_json_schema( schema: &Value, components: &HashMap<String, Value>, ) -> ParamType
Creates a parameter type from a JSON schema node.
Interprets every shape tx3c can emit (see the SDK spec’s
api-surface/args.md). It never fails: an unrecognized shape — including a
bare string, an unresolved object, or an unknown $ref — becomes
ParamType::Unknown carrying the raw schema.
§Arguments
schema- The JSON schema node to interpretcomponents- The TII’scomponents.schemastable, used to resolve#/components/schemas/<Name>references to user-defined types