Skip to content
module

neo3.contracts.abi

NEP-14 Application Binary Interface classes.

Classes
class

neo3.contracts.abi.ContractABI(methods, events)

Bases
neo3.core.interfaces.IJson

The smart contract application binary interface describes the callable events and contracts for a given smart contract.

Methods
  • get_method(name, parameter_count) (Optional) Return the ContractMethodDescriptor matching the name (and optional parameter count) or None otherwise.
  • to_json() (dict) Convert object into JSON representation.
  • from_json(json) (ContractABI) Parse object out of JSON data.
classmethod

from_json(json) → ContractABI

Parse object out of JSON data.

Parameters
  • json (dict) a dictionary.
Raises
  • KeyError if the data supplied does not contain the necessary keys.
  • ValueError if the contract has no methods.
method

get_method(name, parameter_count) → Optional

Return the ContractMethodDescriptor matching the name (and optional parameter count) or None otherwise.

Parameters
  • name the name of the method to return.
  • parameter_count (int) the expected number of parameters teh method has.
method

to_json() → dict

Convert object into JSON representation.

class

neo3.contracts.abi.ContractEventDescriptor(name, parameters)

Bases
neo3.core.interfaces.IJson

A description for an event that a contract can broadcast.

Methods
  • to_json() (dict) Convert object into JSON representation.
  • from_json(json) (ContractEventDescriptor) Parse object out of JSON data.
classmethod

from_json(json) → ContractEventDescriptor

Parse object out of JSON data.

Parameters
  • json (dict) a dictionary.
Raises
  • KeyError if the data supplied does not contain the necessary key.
  • ValueError if the name property has an incorrect format.
method

to_json() → dict

Convert object into JSON representation.

class

neo3.contracts.abi.ContractMethodDescriptor(name, offset, parameters, return_type, safe)

Bases
neo3.contracts.abi.ContractEventDescriptor neo3.core.interfaces.IJson

A description of a callable method on a contract.

Methods
  • to_json() (dict) Convert object into JSON representation.
  • from_json(json) (ContractMethodDescriptor) Parse object out of JSON data.
classmethod

from_json(json) → ContractMethodDescriptor

Parse object out of JSON data.

Parameters
  • json (dict) a dictionary.
Raises
  • KeyError if the data supplied does not contain the necessary keys.
  • ValueError if the manifest name property has an incorrect format.
  • ValueError if the offset is negative.
method

to_json() → dict

Convert object into JSON representation.

class

neo3.contracts.abi.ContractParameterDefinition(name, type)

Bases
neo3.core.interfaces.IJson

A parameter description for a contract Method or Event.

Methods
  • to_json() (dict) Convert object into JSON representation.
  • from_json(json) (ContractParameterDefinition) Parse object out of JSON data.
classmethod

from_json(json) → ContractParameterDefinition

Parse object out of JSON data.

Parameters
  • json (dict) a dictionary.
Raises
  • KeyError if the data supplied does not contain the necessary keys.
  • ValueError if the manifest name property has an incorrect format.
  • ValueError if the type is VOID.
method

to_json() → dict

Convert object into JSON representation.

enum

neo3.contracts.abi.ContractParameterType()

Bases
enum.IntEnum int enum.ReprEnum enum.Enum

Type information for a contract method parameter.

Members
  • ANY (int) 0x0
  • ARRAY (int) 0x20
  • BOOLEAN (int) 0x10
  • BYTEARRAY (int) 0x12
  • HASH160 (int) 0x14
  • HASH256 (int) 0x15
  • INTEGER (int) 0x11
  • INTEROPINTERFACE (int) 0x30
  • MAP (int) 0x22
  • PUBLICKEY (int) 0x16
  • SIGNATURE (int) 0x17
  • STRING (int) 0x13
  • VOID (int) 0xff