[#505] morph/container: Change parsing of Get contract method's result

`Get` method of `Container` contract returns structure with 4 fields
(container is the 1st one).

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-05-25 17:10:48 +03:00 committed by Alex Vanin
parent 017fb6abed
commit cf40e19985

View file

@ -43,9 +43,18 @@ func (c *Client) Get(args GetArgs) (*GetValues, error) {
return nil, fmt.Errorf("unexpected stack item count (%s): %d", c.getMethod, ln) return nil, fmt.Errorf("unexpected stack item count (%s): %d", c.getMethod, ln)
} }
cnrBytes, err := client.BytesFromStackItem(prms[0]) arr, err := client.ArrayFromStackItem(prms[0])
if err != nil { if err != nil {
return nil, fmt.Errorf("could not get byte array from stack item (%s): %w", c.getMethod, err) return nil, fmt.Errorf("could not get item array of container (%s): %w", c.getMethod, err)
}
if len(arr) != 4 {
return nil, fmt.Errorf("unexpected container stack item count (%s): %d", c.getMethod, len(arr))
}
cnrBytes, err := client.BytesFromStackItem(arr[0])
if err != nil {
return nil, fmt.Errorf("could not get byte array of container (%s): %w", c.getMethod, err)
} }
return &GetValues{ return &GetValues{