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

refactor: elcontracts/writer interface to use request-response pattern #506

Open
9 of 26 tasks
damiramirez opened this issue Feb 3, 2025 · 0 comments
Open
9 of 26 tasks

Comments

@damiramirez
Copy link
Contributor

damiramirez commented Feb 3, 2025

Currently, the SDK interfaces are tightly coupled with the underlying contract interfaces. This results in breaking changes whenever contract interfaces are updated, even if the core functionality remains the same. To improve flexibility and maintainability, we should refactor the SDK to adopt a request-response pattern.

Proposed Solution

  • Introduce request structs to encapsulate input parameters.
  • Continue returning the Ethereum Receipt (from go-ethereum) instead of creating a custom response struct.
func (w *ChainWriter) Bar(
	ctx context.Context,
	request BarRequest,
	txOptions *TxOptions,
) (*types.Receipt, error) {
       ...
}

type TxOptions struct {
    Options *bind.TransactOpts
}

type BarRequest struct {
    WaitForReceipt bool
    // ... other fields
}

Updated methods:

@damiramirez damiramirez changed the title refactor: elcontracts/reader interface to use request-response pattern refactor: elcontracts/writer interface to use request-response pattern Feb 3, 2025
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

No branches or pull requests

1 participant