go-ethereum icon indicating copy to clipboard operation
go-ethereum copied to clipboard

abigen: create output type for structured contract functions

Open joey1123455 opened this issue 1 year ago • 0 comments

Enhance abigen to Generate Output Types for Contract Functions

Description

Issue #29689

Current limitations:

  • It does not create separate output types for contract functions
  • This makes it challenging to use the generated bindings in a generic way across different projects

Proposed enhancements:

  1. Generate dedicated structs for each function's return type
  2. Export these structs in the generated package

Example before:

func SomeFunction() (struct{ Field1 int, Field2 string }, error)

Example after:

type SomeFunctionOutput struct {
    Field1 int
    Field2 string
}

func SomeFunction() (SomeFunctionOutput, error)

joey1123455 avatar Oct 12 '24 00:10 joey1123455