ParseReturnValue return the value of rawReturnTypeStr type. Return type can be: bytearray, string, int, bool. Types can be split with "," each other, such as int,string,bool Type array can be express with "[]", such [int,string], param array can be nested, such as [int,[int,bool]]
(rawValue interface{}, rawReturnTypeStr string, vmtype payload.VmType)
| 213 | //Types can be split with "," each other, such as int,string,bool |
| 214 | //Type array can be express with "[]", such [int,string], param array can be nested, such as [int,[int,bool]] |
| 215 | func ParseReturnValue(rawValue interface{}, rawReturnTypeStr string, vmtype payload.VmType) ([]interface{}, error) { |
| 216 | returnTypes, _, err := parseRawParamsString(rawReturnTypeStr) |
| 217 | if err != nil { |
| 218 | return nil, fmt.Errorf("parse raw return types:%s error:%s", rawReturnTypeStr, err) |
| 219 | } |
| 220 | var rawValues []interface{} |
| 221 | rawValues, ok := rawValue.([]interface{}) |
| 222 | if !ok { |
| 223 | rawValues = append(rawValues, rawValue) |
| 224 | } |
| 225 | if vmtype == payload.NEOVM_TYPE { |
| 226 | return parseReturnNeoValueArray(rawValues, returnTypes) |
| 227 | } else { |
| 228 | return parasReturnValueWasmArray(rawValues, returnTypes) |
| 229 | } |
| 230 | |
| 231 | } |
| 232 | |
| 233 | func parasReturnValueWasmArray(rawValues []interface{}, returnTypes []interface{}) ([]interface{}, error) { |
| 234 | values := make([]interface{}, 0) |
no test coverage detected