diff --git a/neo3/api/helpers/unwrap.py b/neo3/api/helpers/unwrap.py index 5562006..a6e1f06 100644 --- a/neo3/api/helpers/unwrap.py +++ b/neo3/api/helpers/unwrap.py @@ -147,6 +147,13 @@ def as_dict(res: noderpc.ExecutionResult, idx: int = 0) -> dict: Raises: ValueError: if the index is out of range, or the value cannot be converted to a dict. + + Warning: + Accepted key types on the Virtual Machine side are `int`, `str` and `bytes`. + However, when data is returned there is no way to differentiate between + the key being of type `str` or `bytes` as the RPC node will encode both as a `ByteString`. + The dictionary returned will return such types as `bytes` and it is the user responsibility to decode + them to a `str` if needed. """ return item(res, idx).as_dict() diff --git a/neo3/api/noderpc.py b/neo3/api/noderpc.py index 95aac47..9d04708 100644 --- a/neo3/api/noderpc.py +++ b/neo3/api/noderpc.py @@ -522,11 +522,6 @@ def _parse_stack_item(item: _Item) -> StackItem: map_ = [] for stack_item in item["value"]: key = ExecutionResult._parse_stack_item(stack_item["key"]) - key_type = StackItemType(stack_item["key"]["type"]) - if key_type == StackItemType.BYTE_STRING: - key.value = key.value.decode() - else: - key.value = str(key.value) value = ExecutionResult._parse_stack_item(stack_item["value"]) map_.append((key, value)) return MapStackItem(type_, map_)