@@ -37,8 +37,6 @@ type Lang int
37
37
38
38
const (
39
39
LangGo Lang = iota
40
- LangJava
41
- LangObjC
42
40
)
43
41
44
42
// Bind generates a Go wrapper around a contract ABI. This wrapper isn't meant
@@ -160,15 +158,15 @@ func Bind(types []string, abis []string, bytecodes []string, pkg string, lang La
160
158
// bindType is a set of type binders that convert Solidity types to some supported
161
159
// programming language types.
162
160
var bindType = map [Lang ]func (kind abi.Type ) string {
163
- LangGo : bindTypeGo ,
164
- LangJava : bindTypeJava ,
161
+ LangGo : bindTypeGo ,
165
162
}
166
163
167
164
// Helper function for the binding generators.
168
165
// It reads the unmatched characters after the inner type-match,
169
- // (since the inner type is a prefix of the total type declaration),
170
- // looks for valid arrays (possibly a dynamic one) wrapping the inner type,
171
- // and returns the sizes of these arrays.
166
+ //
167
+ // (since the inner type is a prefix of the total type declaration),
168
+ // looks for valid arrays (possibly a dynamic one) wrapping the inner type,
169
+ // and returns the sizes of these arrays.
172
170
//
173
171
// Returned array sizes are in the same order as solidity signatures; inner array size first.
174
172
// Array sizes may also be "", indicating a dynamic array.
@@ -244,15 +242,6 @@ func arrayBindingJava(inner string, arraySizes []string) string {
244
242
return inner + strings .Repeat ("[]" , len (arraySizes ))
245
243
}
246
244
247
- // bindTypeJava converts a Solidity type to a Java one. Since there is no clear mapping
248
- // from all Solidity types to Java ones (e.g. uint17), those that cannot be exactly
249
- // mapped will use an upscaled type (e.g. BigDecimal).
250
- func bindTypeJava (kind abi.Type ) string {
251
- stringKind := kind .String ()
252
- innerLen , innerMapping := bindUnnestedTypeJava (stringKind )
253
- return arrayBindingJava (wrapArray (stringKind , innerLen , innerMapping ))
254
- }
255
-
256
245
// The inner function of bindTypeJava, this finds the inner type of stringKind.
257
246
// (Or just the type itself if it is not an array or slice)
258
247
// The length of the matched part is returned, with the the translated type.
@@ -311,8 +300,7 @@ func bindUnnestedTypeJava(stringKind string) (int, string) {
311
300
// bindTopicType is a set of type binders that convert Solidity types to some
312
301
// supported programming language topic types.
313
302
var bindTopicType = map [Lang ]func (kind abi.Type ) string {
314
- LangGo : bindTopicTypeGo ,
315
- LangJava : bindTopicTypeJava ,
303
+ LangGo : bindTopicTypeGo ,
316
304
}
317
305
318
306
// bindTypeGo converts a Solidity topic type to a Go one. It is almost the same
@@ -325,64 +313,16 @@ func bindTopicTypeGo(kind abi.Type) string {
325
313
return bound
326
314
}
327
315
328
- // bindTypeGo converts a Solidity topic type to a Java one. It is almost the same
329
- // funcionality as for simple types, but dynamic types get converted to hashes.
330
- func bindTopicTypeJava (kind abi.Type ) string {
331
- bound := bindTypeJava (kind )
332
- if bound == "String" || bound == "Bytes" {
333
- bound = "Hash"
334
- }
335
- return bound
336
- }
337
-
338
316
// namedType is a set of functions that transform language specific types to
339
317
// named versions that my be used inside method names.
340
318
var namedType = map [Lang ]func (string , abi.Type ) string {
341
- LangGo : func (string , abi.Type ) string { panic ("this shouldn't be needed" ) },
342
- LangJava : namedTypeJava ,
343
- }
344
-
345
- // namedTypeJava converts some primitive data types to named variants that can
346
- // be used as parts of method names.
347
- func namedTypeJava (javaKind string , solKind abi.Type ) string {
348
- switch javaKind {
349
- case "byte[]" :
350
- return "Binary"
351
- case "byte[][]" :
352
- return "Binaries"
353
- case "string" :
354
- return "String"
355
- case "string[]" :
356
- return "Strings"
357
- case "boolean" :
358
- return "Bool"
359
- case "boolean[]" :
360
- return "Bools"
361
- case "BigInt[]" :
362
- return "BigInts"
363
- default :
364
- parts := regexp .MustCompile (`(u)?int([0-9]*)(\[[0-9]*\])?` ).FindStringSubmatch (solKind .String ())
365
- if len (parts ) != 4 {
366
- return javaKind
367
- }
368
- switch parts [2 ] {
369
- case "8" , "16" , "32" , "64" :
370
- if parts [3 ] == "" {
371
- return capitalise (fmt .Sprintf ("%sint%s" , parts [1 ], parts [2 ]))
372
- }
373
- return capitalise (fmt .Sprintf ("%sint%ss" , parts [1 ], parts [2 ]))
374
-
375
- default :
376
- return javaKind
377
- }
378
- }
319
+ LangGo : func (string , abi.Type ) string { panic ("this shouldn't be needed" ) },
379
320
}
380
321
381
322
// methodNormalizer is a name transformer that modifies Solidity method names to
382
323
// conform to target language naming concentions.
383
324
var methodNormalizer = map [Lang ]func (string ) string {
384
- LangGo : capitalise ,
385
- LangJava : decapitalise ,
325
+ LangGo : capitalise ,
386
326
}
387
327
388
328
// capitalise makes a camel-case string which starts with an upper case character.
0 commit comments