diff --git a/accounts/abi/bind/template.go b/accounts/abi/bind/template.go index 22073d0e97..5caf254f67 100644 --- a/accounts/abi/bind/template.go +++ b/accounts/abi/bind/template.go @@ -462,12 +462,25 @@ const tmplSourceJava = ` package {{.Package}}; import org.ethereum.geth.*; +import java.util.*; {{range $contract := .Contracts}} public class {{.Type}} { // ABI is the input ABI used to generate the binding from. public final static String ABI = "{{.InputABI}}"; + {{if $contract.FuncSigs}} + // {{.Type}}FuncSigs maps the 4-byte function signature to its string representation. + public final static Map {{.Type}}FuncSigs; + static { + Hashtable temp = new Hashtable(); + {{range $strsig, $binsig := .FuncSigs}} + temp.put("{{$binsig}}", "{{$strsig}}"); + {{end}} + {{.Type}}FuncSigs = Collections.unmodifiableMap(temp); + } + {{end}} + {{if .InputBin}} // BYTECODE is the compiled bytecode used for deploying new contracts. public final static String BYTECODE = "0x{{.InputBin}}";