smartcontract: marshal Arrays properly

This commit is contained in:
Evgenii Stratonikov 2020-03-05 13:34:01 +03:00
parent f92fd3c948
commit b945f4346a
2 changed files with 19 additions and 6 deletions

View file

@ -51,6 +51,22 @@ var marshalJSONTestCases = []struct {
},
result: `{"type":"Array","value":[{"type":"String","value":"str 1"},{"type":"Integer","value":2}]}`,
},
{
input: Parameter{
Type: ArrayType,
Value: []Parameter{
{Type: ByteArrayType, Value: []byte{1, 2}},
{
Type: ArrayType,
Value: []Parameter{
{Type: ByteArrayType, Value: []byte{3, 2, 1}},
{Type: ByteArrayType, Value: []byte{7, 8, 9}},
}},
},
},
result: `{"type":"Array","value":[{"type":"ByteArray","value":"0102"},{"type":"Array","value":[` +
`{"type":"ByteArray","value":"030201"},{"type":"ByteArray","value":"070809"}]}]}`,
},
{
input: Parameter{
Type: MapType,