Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abigen: create output type for structured contract functions #30578

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joey1123455
Copy link

Enhance abigen to Generate Output Types for Contract Functions

Description

Issue #29689

Current limitations:

  • abigen generates Go bindings for Ethereum smart contracts
  • 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
  3. Update the function signatures to use these new structs instead of anonymous structs

Example before:

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

Example after:

type SomeFunctionOutput struct {
    Field1 int
    Field2 string
}

func SomeFunction() (SomeFunctionOutput, error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant