Skip to content
module

neo3.contracts.nef

Neo Executable Format.

Classes
  • MethodToken — An interface like class supporting NEO's network serialization protocol.
  • NEF — Neo Executable Format container.
class

neo3.contracts.nef.MethodToken(hash, method, parameters_count, has_return_value, call_flags)

Bases
neo3.core.serialization.ISerializable neo3.core.interfaces.IJson

An interface like class supporting NEO's network serialization protocol.

Methods
  • __len__() — Return the length of the object in number of bytes.
  • deserialize(reader) — Deserialize the object from a binary stream.
  • serialize(writer) — Serialize the object into a binary stream.
  • to_array() (bytes) — Serialize the object into a bytearray.
  • to_json() (dict) — Convert object into JSON representation.
  • deserialize_from_bytes(data) (ISerializable_T) — Parse data into an object instance.
  • from_json(json) — Create object from JSON
method

__len__()

Return the length of the object in number of bytes.

method

deserialize(reader)

Deserialize the object from a binary stream.

Parameters
  • reader (BinaryReader) — instance.
classmethod

from_json(json)

Create object from JSON

method

serialize(writer)

Serialize the object into a binary stream.

Parameters
  • writer (BinaryWriter) — instance.
method

to_json() → dict

Convert object into JSON representation.

classmethod

deserialize_from_bytes(data)

Parse data into an object instance.

Parameters
  • data (bytes | bytearray) — hex escaped bytes.
Returns (ISerializable_T)

a deserialized instance of the class.

method

to_array() → bytes

Serialize the object into a bytearray.

class

neo3.contracts.nef.NEF(compiler_name=None, script=None, tokens=None, source=None, _magic=860243278)

Bases
neo3.core.serialization.ISerializable neo3.core.interfaces.IJson

Neo Executable Format container.

Attributes
  • checksum (int) — Data integrity value.
Methods
  • __len__() — Return the length of the object in number of bytes.
  • compute_checksum() (int) — Compute the checksum of the NEF file.
  • deserialize(reader) — Deserialize the object from a binary stream.
  • serialize(writer) — Serialize the object into a binary stream.
  • to_array() (bytes) — Serialize the object into a bytearray.
  • to_json() (dict) — Convert object into JSON representation.
  • deserialize_from_bytes(data) (ISerializable_T) — Parse data into an object instance.
  • from_file(path) — Create object from a file.
  • from_json(json) — Create object from JSON.
method

__len__()

Return the length of the object in number of bytes.

method

compute_checksum() → int

Compute the checksum of the NEF file.

method

deserialize(reader)

Deserialize the object from a binary stream.

Parameters
  • reader (BinaryReader) — instance.
classmethod

from_file(path)

Create object from a file.

Parameters
  • path (str) — location of the file.
Raises
  • FileNotFoundError — if the path is invalid.
  • ValueError — if the file is not a valid NEF.
classmethod

from_json(json)

Create object from JSON.

method

serialize(writer)

Serialize the object into a binary stream.

Parameters
  • writer (BinaryWriter) — instance.
method

to_json() → dict

Convert object into JSON representation.

classmethod

deserialize_from_bytes(data)

Parse data into an object instance.

Parameters
  • data (bytes | bytearray) — hex escaped bytes.
Returns (ISerializable_T)

a deserialized instance of the class.

method

to_array() → bytes

Serialize the object into a bytearray.