aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcroath <croathliu@gmail.com>2017-12-29 19:46:40 +0800
committercroath <croathliu@gmail.com>2017-12-29 19:56:23 +0800
commite7cd627d93d43ff52d13c66b336e12b96d9bfdef (patch)
tree0970330eb8cea0f635f5b6c163d34a0a3b34ee7a
parentf7ca03ae875c7c78191bf38f6ce1cc4bbe5361c6 (diff)
downloaddexon-e7cd627d93d43ff52d13c66b336e12b96d9bfdef.tar
dexon-e7cd627d93d43ff52d13c66b336e12b96d9bfdef.tar.gz
dexon-e7cd627d93d43ff52d13c66b336e12b96d9bfdef.tar.bz2
dexon-e7cd627d93d43ff52d13c66b336e12b96d9bfdef.tar.lz
dexon-e7cd627d93d43ff52d13c66b336e12b96d9bfdef.tar.xz
dexon-e7cd627d93d43ff52d13c66b336e12b96d9bfdef.tar.zst
dexon-e7cd627d93d43ff52d13c66b336e12b96d9bfdef.zip
accounts/abi: fix for one output interface crashing
-rw-r--r--accounts/abi/argument.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/accounts/abi/argument.go b/accounts/abi/argument.go
index ad17fbf2b..65f79c9d4 100644
--- a/accounts/abi/argument.go
+++ b/accounts/abi/argument.go
@@ -169,6 +169,16 @@ func (arguments Arguments) unpackAtomic(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()
+ }
+ }
+
return set(value, reflect.ValueOf(marshalledValue), arg)
}