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 SdkClient #2804

Open
victor-yanev opened this issue Aug 8, 2024 · 0 comments
Open

Refactor SdkClient #2804

victor-yanev opened this issue Aug 8, 2024 · 0 comments
Labels
Epic Technical Debt Issue which resolves technical debt

Comments

@victor-yanev
Copy link
Contributor

Problem

Currently, we are passing client and service classes around within methods and this is creating unnecessary coupling between the SdkClient and other classes, which we should address.

Solution

To avoid this and simplify the dependency structure, we can take the following steps:

  • Follow the dependency tree: EthImpl -> HapiService -> AccountService, TransactionService, ContractService, FeeService -> SdkClient, MirrorNodeClient. We can consider opening separate issues to extract logic for accounts, contracts, and fees into distinct services.

  • Keep the logic for initializing SdkClient into HapiService. This way, HapiService will manage the SdkClient and be the main point of interaction.

  • Remove the direct dependency on TransactionService from EthImpl. Instead, initialize TransactionService inside HapiService, and have HapiService pass the initialized SdkClient to it.

  • Add methods such as createFile, deleteFile, appendFile, etc., directly in HapiService. This should be our main entry point for operations (e.g., instead of calling hapiService.getSdkClient().createFile(), we should directly call hapiService.createFile()).

  • The wrapper logic for executeQuery and executeTransaction should also reside within HapiService. HapiService can then use these wrappers and delegate the actual execution to the SdkClient as needed.

  • With HapiService calling TransactionService to fetch and extract transaction details, it remains agnostic to whether SdkClient or MirrorNodeClient is being used.

This approach untangles the dependencies between classes, resulting in a clear and linear dependency tree.

Alternatives

No response

@victor-yanev victor-yanev added Epic Technical Debt Issue which resolves technical debt labels Aug 8, 2024
@quiet-node quiet-node self-assigned this Aug 14, 2024
@quiet-node quiet-node moved this from Backlog to Sprint Backlog in Smart Contract Sprint Board Aug 14, 2024
@quiet-node quiet-node added this to the 0.55.0 milestone Aug 14, 2024
@acuarica acuarica moved this from Sprint Backlog to Tasks In Progress in Smart Contract Sprint Board Aug 19, 2024
@quiet-node quiet-node moved this from Tasks In Progress to Sprint Backlog in Smart Contract Sprint Board Aug 19, 2024
@quiet-node quiet-node moved this from Sprint Backlog to Backlog in Smart Contract Sprint Board Sep 4, 2024
@quiet-node quiet-node modified the milestones: 0.55.0, 0.57.0 Sep 17, 2024
@quiet-node quiet-node modified the milestones: 0.57.0, 0.59.0 Oct 16, 2024
@quiet-node quiet-node removed their assignment Oct 16, 2024
@quiet-node quiet-node modified the milestones: 0.59.0, 0.61.0 Nov 11, 2024
@quiet-node quiet-node modified the milestones: 0.61.0, 0.62.0 Nov 26, 2024
@quiet-node quiet-node removed this from the 0.62.0 milestone Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Epic Technical Debt Issue which resolves technical debt
Projects
Status: Backlog
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants