Skip to content

Commit fa2b75b

Browse files
committed
accounts/abi: fix case of generated java functions (ethereum#18372)
1 parent 24221b7 commit fa2b75b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

accounts/abi/bind/bind.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ var namedType = map[Lang]func(string, abi.Type) string{
322322
// methodNormalizer is a name transformer that modifies Solidity method names to
323323
// conform to target language naming concentions.
324324
var methodNormalizer = map[Lang]func(string) string{
325-
LangGo: capitalise,
325+
LangGo: abi.ToCamelCase,
326326
}
327327

328328
// capitalise makes a camel-case string which starts with an upper case character.
@@ -332,9 +332,12 @@ func capitalise(input string) string {
332332

333333
// decapitalise makes a camel-case string which starts with a lower case character.
334334
func decapitalise(input string) string {
335-
// NOTE: This is the current behavior, it doesn't match the comment
336-
// above and needs to be investigated.
337-
return abi.ToCamelCase(input)
335+
if len(input) == 0 {
336+
return input
337+
}
338+
339+
goForm := abi.ToCamelCase(input)
340+
return strings.ToLower(goForm[:1]) + goForm[1:]
338341
}
339342

340343
// structured checks whether a list of ABI data types has enough information to

0 commit comments

Comments
 (0)