0xPolygonMiden / miden-client

Client library that facilitates interaction with the Miden rollup
MIT License
27 stars 23 forks source link

Refactor Shared Logic Between TonicClient and WebTonicClient #415

Open dagarcia7 opened 1 week ago

dagarcia7 commented 1 week ago

What should be done?

After this PR is merged, the miden-client will now have a WASM-compatible rpc client. As noted in this comment, the WebTonicClient and the TonicClient currently share a lot of logic after the client is created in each function. This code duplication opens the door to potential bugs in the future as it becomes easy to update the code in one place but not the other. As a result, we should refactor the code slightly so that each RPC client method calls share logic once the client is created and the request is sent.

How should it be done?

We should pull out shared logic for each of the RPC client functions into the src/rpc folder and refactor the logic for each function in both src/rpc/tonic_client/mod.rs and src/rpc/web_tonic_client/mod.rs to use this shared logic.

When is this task done?

This task is done when the refactor described above is complete and both RPC clients build successfully.

Additional context

This issue is blocked on https://github.com/0xPolygonMiden/miden-client/pull/409