[#21] Add [][]byte
type in toStackParameter converter
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
aa98592ac4
commit
df3564eaf2
1 changed files with 14 additions and 1 deletions
|
@ -144,11 +144,24 @@ func toStackParameter(value interface{}) (sc.Parameter, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: add more types
|
// todo: add more types
|
||||||
switch value.(type) {
|
switch v := value.(type) {
|
||||||
case []byte:
|
case []byte:
|
||||||
result.Type = sc.ByteArrayType
|
result.Type = sc.ByteArrayType
|
||||||
case int64: // TODO: add other numerical types
|
case int64: // TODO: add other numerical types
|
||||||
result.Type = sc.IntegerType
|
result.Type = sc.IntegerType
|
||||||
|
case [][]byte:
|
||||||
|
arr := make([]sc.Parameter, 0, len(v))
|
||||||
|
for i := range v {
|
||||||
|
elem, err := toStackParameter(v[i])
|
||||||
|
if err != nil {
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
|
||||||
|
arr = append(arr, elem)
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Type = sc.ArrayType
|
||||||
|
result.Value = arr
|
||||||
default:
|
default:
|
||||||
return result, errors.Errorf("chain/client: unsupported parameter %v", value)
|
return result, errors.Errorf("chain/client: unsupported parameter %v", value)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue