Skip to content

Commit

Permalink
improve parsing when result stack has multiple items
Browse files Browse the repository at this point in the history
  • Loading branch information
Hecate2 committed Sep 1, 2022
1 parent bbac2e0 commit 74d5dc2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions neo_fairy_client/rpc/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,12 @@ def parse_single_item(item: Union[Dict, List]):
return result
if not result['stack']:
return result['stack']
result: List = result['stack'][0]
return parse_single_item(result)
stack: List = result['stack']
if len(stack) > 1: # typically happens when we invoke a script calling a series of methods
return [parse_single_item(item) for item in stack]
else: # if the stack has only 1 item, we simply return the item without a wrapping list
result: List = stack[0]
return parse_single_item(result)

@classmethod
def parse_params(cls, param: Union[str, int, dict, Hash160Str, UInt160, UInt256, bytes]) -> Dict[str, str]:
Expand Down

0 comments on commit 74d5dc2

Please sign in to comment.