From a0bf2ea7e732b114518c3d8c66db337e0a7932f1 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Fri, 20 Nov 2015 13:45:37 +0100 Subject: accounts/abi: added output parsing & added call mechanism Added calling mechanism and return value parsing --- accounts/abi/type.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'accounts/abi/type.go') diff --git a/accounts/abi/type.go b/accounts/abi/type.go index 16d7491e7..8f0238fc9 100644 --- a/accounts/abi/type.go +++ b/accounts/abi/type.go @@ -31,6 +31,7 @@ const ( BoolTy SliceTy AddressTy + HashTy RealTy ) @@ -121,7 +122,7 @@ func NewType(t string) (typ Type, err error) { typ.Kind = reflect.Invalid case "address": typ.Kind = reflect.Slice - typ.Type = byte_ts + typ.Type = address_t typ.Size = 20 typ.T = AddressTy case "string": @@ -130,6 +131,11 @@ func NewType(t string) (typ Type, err error) { if vsize > 0 { typ.Size = 32 } + case "hash": + typ.Kind = reflect.Slice + typ.Size = 32 + typ.Type = hash_t + typ.T = HashTy case "bytes": typ.Kind = reflect.Slice typ.Type = byte_ts @@ -206,9 +212,9 @@ func (t Type) pack(v interface{}) ([]byte, error) { } case reflect.Array: if v, ok := value.Interface().(common.Address); ok { - return t.pack(v[:]) + return common.LeftPadBytes(v[:], 32), nil } else if v, ok := value.Interface().(common.Hash); ok { - return t.pack(v[:]) + return v[:], nil } } -- cgit