Native Script

Cardano native script

class pycardano.nativescript.NativeScript

Bases: ArrayCBORSerializable

json_tag: ClassVar[str]
json_field: ClassVar[str]
classmethod from_primitive(value: list) Union[ScriptPubkey, ScriptAll, ScriptAny, ScriptNofK, InvalidBefore, InvalidHereAfter]

Restore a primitive value to its original class type.

Parameters:
  • cls (ArrayBase) – The original class type.

  • values (List[Primitive]) – A list whose elements are CBOR primitives.

Returns:

Restored object.

Return type:

ArrayBase

Raises:

DeserializeException – When the object could not be restored from primitives.

hash() ScriptHash
classmethod from_dict(script_json: Dict[str, Any]) Union[ScriptPubkey, ScriptAll, ScriptAny, ScriptNofK, InvalidBefore, InvalidHereAfter]

Parse a standard native script dictionary (potentially parsed from a JSON file).

to_dict() Dict[str, Any]

Export to standard native script dictionary (potentially to dump to a JSON file).

class pycardano.nativescript.ScriptPubkey(key_hash: 'VerificationKeyHash')

Bases: NativeScript

json_tag: ClassVar[str] = 'sig'
json_field: ClassVar[str] = 'keyHash'
key_hash: VerificationKeyHash
class pycardano.nativescript.ScriptAll(native_scripts: 'List[Union[ScriptPubkey, ScriptAll, ScriptAny, ScriptNofK, InvalidBefore, InvalidHereAfter]]')

Bases: NativeScript

json_tag: ClassVar[str] = 'all'
json_field: ClassVar[str] = 'scripts'
native_scripts: List[Union[ScriptPubkey, ScriptAll, ScriptAny, ScriptNofK, InvalidBefore, InvalidHereAfter]]
class pycardano.nativescript.ScriptAny(native_scripts: 'List[Union[ScriptPubkey, ScriptAll, ScriptAny, ScriptNofK, InvalidBefore, InvalidHereAfter]]')

Bases: NativeScript

json_tag: ClassVar[str] = 'any'
json_field: ClassVar[str] = 'scripts'
native_scripts: List[Union[ScriptPubkey, ScriptAll, ScriptAny, ScriptNofK, InvalidBefore, InvalidHereAfter]]
class pycardano.nativescript.ScriptNofK(n: 'int', native_scripts: 'List[Union[ScriptPubkey, ScriptAll, ScriptAny, ScriptNofK, InvalidBefore, InvalidHereAfter]]')

Bases: NativeScript

json_tag: ClassVar[str] = 'atLeast'
json_field: ClassVar[str] = 'required'
n: int
native_scripts: List[Union[ScriptPubkey, ScriptAll, ScriptAny, ScriptNofK, InvalidBefore, InvalidHereAfter]]
class pycardano.nativescript.InvalidBefore(before: 'int')

Bases: NativeScript

json_tag: ClassVar[str] = 'after'
json_field: ClassVar[str] = 'slot'
before: int
class pycardano.nativescript.InvalidHereAfter(after: 'int')

Bases: NativeScript

json_tag: ClassVar[str] = 'before'
json_field: ClassVar[str] = 'slot'
after: int