separate `WebClient` and `MockWebClient` in the rust section
- Vorherrschende Sprache
- TypeScript
- Sterne
- 1
- Forks
- 21
- Ø Merge
- 12 Std. 14 Min.
- Gemergte PRs (30 T.)
- 41
Beschreibung
After merging 0xMiden/miden-client#1096, the access to the `MockRpcApi` is done via the functions in `crates/web-client/src/mock.rs` which belong to the `WebClient` struct. Ideally we would want these functions to only be accesible if the client uses a mocked RPC api.
This will require some refactoring, we should try to reduce code duplication, we wouldn't want all the logic to be copied twice.
> I wonder if this should be a fully separate class. I think this would allow for better separation (for example, the `serialize_mock_chain()` call would not be included for `WebClient`; and maybe we could have other helpers that are only available for the mocked client). Of course, this probably implies changing the service worker and some other parts f the JS side. If you agree, let's open an issue to track this.
_Originally posted by @igamigo in https://github.com/0xMiden/miden-client/pull/1096#discussion_r2271161967_
Beitragsleitfaden
Rechercherichtung
Das Issue behandelt die Refaktorierung des Rust-Webclients, um `WebClient` und `MockWebClient` zu trennen. Beginnen Sie mit der Untersuchung von `crates/web-client/src/mock.rs` und der `WebClient`-Struktur, um die derzeitige Kopplung zu verstehen. Suchen Sie nach Traits oder bedingter Kompilierung, um Duplizierung zu reduzieren. Die Änderungen werden sich auch auf die JavaScript-Seite auswirken, einschließlich des Service Workers. 'Erledigt' bedeutet, dass die mock-spezifischen Funktionen nur zugänglich sind, wenn eine gemockte RPC-API verwendet wird, ohne signifikante Code-Duplizierung.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust, typescript
- Bereich
- backend, tooling
- Issue-Typ
- Refactoring
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100