skip unpack method when no return args
This commit is contained in:
parent
724f77e3ec
commit
dcf1318a24
|
@ -129,7 +129,7 @@ func BindV2(types []string, abis []string, bytecodes []string, fsigs []map[strin
|
|||
if call.Structured {
|
||||
continue
|
||||
}
|
||||
if len(call.Normalized.Outputs) == 1 {
|
||||
if len(call.Normalized.Outputs) < 2 {
|
||||
continue
|
||||
}
|
||||
// Build up dictionary of existing arg names.
|
||||
|
|
|
@ -89,6 +89,8 @@ var (
|
|||
return _{{$contract.Type}}.abi.Pack("{{.Original.Name}}" {{range .Normalized.Inputs}}, {{.Name}}{{end}})
|
||||
}
|
||||
|
||||
{{/* Unpack method is needed only when there are return args */}}
|
||||
{{if .Normalized.Outputs }}
|
||||
func (_{{$contract.Type}} *{{$contract.Type}}) Unpack{{.Normalized.Name}}(data []byte) ({{if .Structured}}struct{ {{range .Normalized.Outputs}}{{.Name}} {{bindtype .Type $structs}};{{end}} },{{else}}{{range .Normalized.Outputs}}{{bindtype .Type $structs}},{{end}}{{end}} error) {
|
||||
out, err := _{{$contract.Type}}.abi.Unpack("{{.Original.Name}}", data)
|
||||
{{if .Structured}}
|
||||
|
@ -111,6 +113,7 @@ var (
|
|||
{{end}}
|
||||
}
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{range .Events}}
|
||||
// {{$contract.Type}}{{.Normalized.Name}} represents a {{.Normalized.Name}} event raised by the {{$contract.Type}} contract.
|
||||
|
|
Loading…
Reference in New Issue