Skip to content

Commit

Permalink
https://github.com/neo-project/neo/pull/2356
Browse files Browse the repository at this point in the history
  • Loading branch information
ixje committed Apr 20, 2021
1 parent c61a5be commit ca3e20f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions neo3/contracts/abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import enum
from typing import List, Optional, Type, Union, cast
from enum import IntEnum
from neo3.core import types, IJson, IInteroperable, serialization
from neo3.core import types, IJson, IInteroperable, serialization, cryptography
from neo3 import contracts, vm


Expand Down Expand Up @@ -41,6 +41,8 @@ def from_type(cls, class_type: Optional[Type[object]]) -> ContractParameterType:
return ContractParameterType.INTEGER
elif class_type in [bytes, bytearray, vm.BufferStackItem, vm.ByteStringStackItem]:
return ContractParameterType.BYTEARRAY
elif class_type == cryptography.ECPoint:
return ContractParameterType.PUBLICKEY
elif hasattr(class_type, '__origin__'):
if class_type.__origin__ == list: # type: ignore
return ContractParameterType.ARRAY
Expand All @@ -64,10 +66,12 @@ def from_type(cls, class_type: Optional[Type[object]]) -> ContractParameterType:
return ContractParameterType.ARRAY
elif issubclass(class_type, IInteroperable):
return ContractParameterType.ARRAY
elif class_type == vm.StackItem:
return ContractParameterType.ANY
elif issubclass(class_type, enum.Enum):
return ContractParameterType.INTEGER
else:
return ContractParameterType.ANY
return ContractParameterType.INTEROP_INTERFACE


class ContractParameterDefinition(IJson):
Expand Down

0 comments on commit ca3e20f

Please sign in to comment.