aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/abi.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-10-29 05:57:21 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-10-30 04:40:18 +0800
commit1f72952f043e9df3df71eb27a6ed7c6bef93a3f2 (patch)
tree48753e3b5bb1d2e2105b6764b111fd5f2304a66b /accounts/abi/abi.go
parent6b5a42a15ca54749d41c0b29b4a26ebb3a1a53f0 (diff)
downloaddexon-1f72952f043e9df3df71eb27a6ed7c6bef93a3f2.tar.gz
dexon-1f72952f043e9df3df71eb27a6ed7c6bef93a3f2.tar.zst
dexon-1f72952f043e9df3df71eb27a6ed7c6bef93a3f2.zip
accounts/abi: ABI fixes & added types
Changed field `input` to new `inputs`. Addad Hash and Address as input types. Added bytes[N] and N validation
Diffstat (limited to 'accounts/abi/abi.go')
-rw-r--r--accounts/abi/abi.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/accounts/abi/abi.go b/accounts/abi/abi.go
index de3128902..3f05bfe2d 100644
--- a/accounts/abi/abi.go
+++ b/accounts/abi/abi.go
@@ -36,7 +36,7 @@ import (
type Method struct {
Name string
Const bool
- Input []Argument
+ Inputs []Argument
Return Type // not yet implemented
}
@@ -49,9 +49,9 @@ type Method struct {
// Please note that "int" is substitute for its canonical representation "int256"
func (m Method) String() (out string) {
out += m.Name
- types := make([]string, len(m.Input))
+ types := make([]string, len(m.Inputs))
i := 0
- for _, input := range m.Input {
+ for _, input := range m.Inputs {
types[i] = input.Type.String()
i++
}
@@ -104,7 +104,7 @@ func (abi ABI) pack(name string, args ...interface{}) ([]byte, error) {
var ret []byte
for i, a := range args {
- input := method.Input[i]
+ input := method.Inputs[i]
packed, err := input.Type.pack(a)
if err != nil {
@@ -129,8 +129,8 @@ func (abi ABI) Pack(name string, args ...interface{}) ([]byte, error) {
}
// start with argument count match
- if len(args) != len(method.Input) {
- return nil, fmt.Errorf("argument count mismatch: %d for %d", len(args), len(method.Input))
+ if len(args) != len(method.Inputs) {
+ return nil, fmt.Errorf("argument count mismatch: %d for %d", len(args), len(method.Inputs))
}
arguments, err := abi.pack(name, args...)