diff --git a/accounts/abi/event.go b/accounts/abi/event.go index bd1098d878..033f96f58d 100644 --- a/accounts/abi/event.go +++ b/accounts/abi/event.go @@ -132,6 +132,16 @@ func (e Event) singleUnpack(v interface{}, output []byte) error { if err != nil { return err } + + // if we reach this part, there is only one output member from the contract event. + // for mobile, the result type is always a slice. + if reflect.Slice == value.Kind() && value.Len() >= 1 { + //check if it's not a byte slice + if reflect.TypeOf([]byte{}) != value.Type() { + value = value.Index(0).Elem() + } + } + if err := set(value, reflect.ValueOf(marshalledValue), e.Inputs[0]); err != nil { return err } diff --git a/accounts/abi/method.go b/accounts/abi/method.go index 66e8751f3d..9cfeecf293 100644 --- a/accounts/abi/method.go +++ b/accounts/abi/method.go @@ -162,6 +162,16 @@ func (method Method) singleUnpack(v interface{}, output []byte) error { if err != nil { return err } + + // if we reach this part, there is only one output member from the contract method. + // for mobile, the result type is always a slice. + if reflect.Slice == value.Kind() && value.Len() >= 1 { + //check if it's not a byte slice + if reflect.TypeOf([]byte{}) != value.Type() { + value = value.Index(0).Elem() + } + } + if err := set(value, reflect.ValueOf(marshalledValue), method.Outputs[0]); err != nil { return err }