diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2016-03-30 22:22:02 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2016-04-05 02:30:58 +0800 |
commit | 022cbd680052eb87b32d5f59587957779d382c0c (patch) | |
tree | f4894fc2eeea920233fcdd108e0977cc3b19fb6f /accounts/abi/abi.go | |
parent | 96c7c39ae4a031a508b0470ff2b1a95f0f3f9e51 (diff) | |
download | go-tangerine-022cbd680052eb87b32d5f59587957779d382c0c.tar go-tangerine-022cbd680052eb87b32d5f59587957779d382c0c.tar.gz go-tangerine-022cbd680052eb87b32d5f59587957779d382c0c.tar.bz2 go-tangerine-022cbd680052eb87b32d5f59587957779d382c0c.tar.lz go-tangerine-022cbd680052eb87b32d5f59587957779d382c0c.tar.xz go-tangerine-022cbd680052eb87b32d5f59587957779d382c0c.tar.zst go-tangerine-022cbd680052eb87b32d5f59587957779d382c0c.zip |
abi: accept input slices of all supported types
Diffstat (limited to 'accounts/abi/abi.go')
-rw-r--r-- | accounts/abi/abi.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/accounts/abi/abi.go b/accounts/abi/abi.go index 91f9700d9..01603b217 100644 --- a/accounts/abi/abi.go +++ b/accounts/abi/abi.go @@ -63,9 +63,8 @@ func (abi ABI) pack(method Method, args ...interface{}) ([]byte, error) { return nil, fmt.Errorf("`%s` %v", method.Name, err) } - // check for a string or bytes input type - switch input.Type.T { - case StringTy, BytesTy: + // check for a slice type (string, bytes, slice) + if input.Type.T == StringTy || input.Type.T == BytesTy || input.Type.IsSlice { // calculate the offset offset := len(method.Inputs)*32 + len(variableInput) // set the offset @@ -73,7 +72,7 @@ func (abi ABI) pack(method Method, args ...interface{}) ([]byte, error) { // Append the packed output to the variable input. The variable input // will be appended at the end of the input. variableInput = append(variableInput, packed...) - default: + } else { // append the packed value to the input ret = append(ret, packed...) } |