smartcontract: add support for valueless Parameters

This is fine:
            {
               "type" : "Signature"
            },
This commit is contained in:
Roman Khimov 2021-07-23 11:46:26 +03:00
parent 59b4377f90
commit cbe1eeb08c

View file

@ -109,7 +109,11 @@ func (p *Parameter) UnmarshalJSON(data []byte) (err error) {
if err = json.Unmarshal(data, &r); err != nil { if err = json.Unmarshal(data, &r); err != nil {
return return
} }
switch p.Type = r.Type; r.Type { p.Type = r.Type
if len(r.Value) == 0 {
return
}
switch r.Type {
case BoolType: case BoolType:
if err = json.Unmarshal(r.Value, &boolean); err != nil { if err = json.Unmarshal(r.Value, &boolean); err != nil {
return return