class ContractManifest

Bases: object

Represents the manifest of a smart contract 1.

When a smart contract is deployed, it must explicitly declare the features and permissions it will use.

When it is running, it will be limited by its declared list of features and permissions, and cannot make any behavior beyond the scope of the list.


For more details, see NEP-15.

  • name (str) – The name of the contract.

  • groups (List[ContractGroup]) – The groups of the contract.

  • supported_standards (List[str]) – Indicates which standards the contract supports. It can be a list of NEPs.

  • abi (ContractAbi) – The ABI of the contract.

  • permissions (List[ContractPermission]) – The permissions of the contract.

  • trusts (List[ContractPermissionDescriptor] or None) –

    The trusted contracts and groups of the contract.

    If a contract is trusted, the user interface will not give any warnings when called by the contract.

  • extras (str) – Custom user data as a json string.

class ContractPermission

Bases: object

Represents a permission of a contract. It describes which contracts may be invoked and which methods are called.

If a contract invokes a contract or method that is not declared in the manifest at runtime, the invocation will fail.

  • contract (ContractPermissionDescriptor or None) –

    Indicates which contract to be invoked.

    It can be a hash of a contract, a public key of a group, or a wildcard *.

    If it specifies a hash of a contract, then the contract will be invoked; If it specifies a public key of a group, then any contract in this group may be invoked; If it specifies a wildcard *, then any contract may be invoked.

  • methods (List[str] or None) –

    Indicates which methods to be called.

    It can also be assigned with a wildcard *. If it is a wildcard *, then it means that any method can be called.

class ContractPermissionDescriptor

Bases: object

Indicates which contracts are authorized to be called.

  • hash (UInt160 or None) – The hash of the contract.

  • group (ECPoint or None) – The group of the contracts.

class ContractGroup

Bases: object

Represents a set of mutually trusted contracts.

A contract will trust and allow any contract in the same group to invoke it, and the user interface will not give any warnings.

A group is identified by a public key and must be accompanied by a signature for the contract hash to prove that the contract is indeed included in the group.

  • pubkey (ECPoint) – The public key of the group.

  • signature (bytes) – The signature of the contract hash which can be verified by pubkey.

class ContractAbi

Bases: object

Represents the ABI of a smart contract 2.


For more details, see NEP-14.

class ContractMethodDescriptor

Bases: object

Represents a method in a smart contract ABI.

  • name (str) – The name of the method.

  • parameters (List[ContractParameterDefinition]) – The parameters of the method.

  • return_type (ContractParameterType) – Indicates the return type of the method.

  • offset (int) – The position of the method in the contract script.

  • safe (bool) –

    Indicates whether the method is a safe method.

    If a method is marked as safe, the user interface will not give any warnings when it is called by other contracts.

class ContractEventDescriptor

Bases: object

Represents an event in a smart contract ABI.

class ContractParameterDefinition

Bases: object

Represents a parameter of an event or method in ABI.

class ContractParameterType(value)

Bases: enum.IntEnum

An enumeration.

Any = 0
Boolean = 16
Integer = 17
ByteArray = 18
String = 19
Hash160 = 20
Hash256 = 21
PublicKey = 22
Signature = 23
Array = 32
Map = 34
InteropInterface = 48
Void = 255
classmethod _get_by_name(name: str)int