Metadata
- class pycardano.metadata.Metadata(*args, **kwargs)
Bases:
DictCBORSerializable
- KEY_TYPE
alias of
int
- VALUE_TYPE
alias of
Any
- MAX_ITEM_SIZE = 64
- INTERNAL_TYPES = (<class 'dict'>, <class 'list'>, <class 'int'>, <class 'bytes'>, <class 'str'>)
- class pycardano.metadata.ShelleyMarryMetadata(metadata: 'Metadata', native_scripts: 'Optional[List[NativeScript]]' = None)
Bases:
ArrayCBORSerializable
- native_scripts: List[NativeScript] | None = None
- class pycardano.metadata.AlonzoMetadata(metadata: 'Optional[Metadata]' = None, native_scripts: 'Optional[List[NativeScript]]' = None, plutus_v1_scripts: 'Optional[List[PlutusV1Script]]' = None, plutus_v2_scripts: 'Optional[List[PlutusV2Script]]' = None, plutus_v3_scripts: 'Optional[List[PlutusV3Script]]' = None)
Bases:
MapCBORSerializable
- TAG: ClassVar[int] = 259
- native_scripts: List[NativeScript] | None = None
- plutus_v1_scripts: List[PlutusV1Script] | None = None
- plutus_v2_scripts: List[PlutusV2Script] | None = None
- plutus_v3_scripts: List[PlutusV3Script] | None = None
- to_primitive() bytes | bytearray | str | int | float | Decimal | bool | None | tuple | list | IndefiniteList | dict | defaultdict | OrderedDict | datetime | Pattern | CBORSimpleValue | CBORTag | set | Fraction | frozenset | FrozenDict | FrozenList | IndefiniteFrozenList | ByteString
Convert the instance and its elements to CBOR primitives recursively.
- Returns:
A CBOR primitive.
- Return type:
Primitive
- Raises:
SerializeException – When the object or its elements could not be converted to CBOR primitive types.
- classmethod from_primitive(value: CBORTag) AlonzoMetadata
Restore a primitive value to its original class type.
- Parameters:
cls (MapBase) – The original class type.
values (
Primitive
) – A CBOR primitive.
- Returns:
Restored object.
- Return type:
MapBase
- Raises:
pycardano.exception.DeserializeException – When the object could not be restored from primitives.
- class pycardano.metadata.AuxiliaryData(data: 'Union[Metadata, ShelleyMarryMetadata, AlonzoMetadata]')
Bases:
CBORSerializable
- data: Metadata | ShelleyMarryMetadata | AlonzoMetadata
- to_primitive() bytes | bytearray | str | int | float | Decimal | bool | None | tuple | list | IndefiniteList | dict | defaultdict | OrderedDict | datetime | Pattern | CBORSimpleValue | CBORTag | set | Fraction | frozenset | FrozenDict | FrozenList | IndefiniteFrozenList | ByteString
Convert the instance and its elements to CBOR primitives recursively.
- Returns:
A CBOR primitive.
- Return type:
Primitive
- Raises:
SerializeException – When the object or its elements could not be converted to CBOR primitive types.
- classmethod from_primitive(value: bytes | bytearray | str | int | float | Decimal | bool | None | tuple | list | IndefiniteList | dict | defaultdict | OrderedDict | datetime | Pattern | CBORSimpleValue | CBORTag | set | Fraction | frozenset | FrozenDict | FrozenList | IndefiniteFrozenList | ByteString, type_args: tuple | None = None) AuxiliaryData
Turn a CBOR primitive to its original class type.
- Parameters:
cls (CBORBase) – The original class type.
value (
Primitive
) – A CBOR primitive.type_args (Optional[tuple]) – Type arguments for the class.
- Returns:
A CBOR serializable object.
- Return type:
CBORBase
- Raises:
DeserializeException – When the object could not be restored from primitives.
- hash() AuxiliaryDataHash