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: refactor services and clients #419

Merged
merged 32 commits into from
Aug 30, 2024

Conversation

denishacquin
Copy link
Contributor

@denishacquin denishacquin commented Aug 27, 2024

Fixes #408
Fixes #413
Fixes #412

What

  • Refactored all wallet-related logic in one dedicated hook
  • Removed 'provide' for rpc client and wrapped rpc client in a hook instead
  • Moved all utils to hooks
  • Updated signTransaction unit test
  • Fixed a couple of bugs with example contracts / storage reset

Why

  • to normalize and refactor functionality
  • to fix a couple of bugs

Testing done

  • lint OK
  • e2e OK
  • units OK
  • tested the bug fixes

Checks

  • I have tested this code
  • I have reviewed my own PR
  • I have created an issue for this PR

Tips for reviewing

  • Might want to check the refactor of useWallet hook to validate decisions there.

User facing release notes

  • Fixed a couple of bugs with storage resetting

Copy link

codecov bot commented Aug 27, 2024

Codecov Report

Attention: Patch coverage is 14.78599% with 219 lines in your changes missing coverage. Please review.

Please upload report for BASE (staging@67cd3c4). Learn more about missing BASE report.

Files Patch % Lines
frontend/src/hooks/useSetupStores.ts 0.00% 68 Missing and 1 partial ⚠️
frontend/src/hooks/useWebSocketClient.ts 0.00% 14 Missing and 1 partial ⚠️
frontend/src/hooks/useContractQueries.ts 0.00% 13 Missing and 1 partial ⚠️
frontend/src/hooks/useInputMap.ts 0.00% 14 Missing ⚠️
frontend/src/hooks/useShortAddress.ts 0.00% 13 Missing and 1 partial ⚠️
frontend/src/hooks/useFileName.ts 0.00% 12 Missing and 1 partial ⚠️
frontend/src/hooks/index.ts 0.00% 10 Missing ⚠️
frontend/src/stores/node.ts 0.00% 9 Missing ⚠️
...src/components/Simulator/ConstructorParameters.vue 0.00% 8 Missing ⚠️
frontend/src/hooks/useRpcClient.ts 0.00% 5 Missing and 1 partial ⚠️
... and 14 more
Additional details and impacted files
@@            Coverage Diff            @@
##             staging    #419   +/-   ##
=========================================
  Coverage           ?   2.56%           
=========================================
  Files              ?     104           
  Lines              ?    7649           
  Branches           ?     111           
=========================================
  Hits               ?     196           
  Misses             ?    7351           
  Partials           ?     102           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@denishacquin denishacquin self-assigned this Aug 28, 2024
@denishacquin denishacquin changed the title 408 sim fe refactor services and clients refactor: use hooks to wrap services/clients and remove utils Aug 28, 2024
@denishacquin denishacquin changed the title refactor: use hooks to wrap services/clients and remove utils refactor: refactor services and clients Aug 28, 2024
@denishacquin denishacquin marked this pull request as ready for review August 29, 2024 09:15
Den added 2 commits August 29, 2024 12:15
…ents

# Conflicts:
#	frontend/src/components/Simulator/CodeEditor.vue
#	frontend/src/stores/contracts.ts
Copy link
Collaborator

@cristiam86 cristiam86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@denishacquin great work! I love seeing the utils getting nuked! but I wonders if everything should be a hook as I understand that those are mostly about dynamic values

frontend/src/hooks/useShortAddress.ts Outdated Show resolved Hide resolved
frontend/src/hooks/useShortAddress.ts Outdated Show resolved Hide resolved
frontend/src/hooks/useRpcClient.ts Show resolved Hide resolved
frontend/src/hooks/usePythonSyntax.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@cristiam86 cristiam86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great! almost there, just a small detail just to close it in a perfect way :D

frontend/src/hooks/useWallet.ts Show resolved Hide resolved
@denishacquin denishacquin merged commit 3260416 into staging Aug 30, 2024
16 checks passed
@github-actions github-actions bot mentioned this pull request Sep 4, 2024
@cristiam86 cristiam86 deleted the 408-sim-fe-refactor-services-and-clients branch September 4, 2024 10:31
cristiam86 added a commit that referenced this pull request Sep 4, 2024
## What's Changed
* feat: various frontend improvements by @denishacquin in
#418
* fix: 409 sim fe alow horizontal scroll when there is syntax error in
the contract by @denishacquin in
#430
* ci: gh action to validate pr title by @AgustinRamiroDiaz in
#429
* refactor: refactor services and clients by @denishacquin in
#419
* docs: updated contributing by @cristiam86 in
#421
* feat: 417 sim fe allow re ordering contract tabs by dragging them
around by @denishacquin in
#434
* test: 425 frontend unit testing by @denishacquin in
#426
* chore(backend): refactor database connector to use sqlalchemy by
@AgustinRamiroDiaz in
#420
* chore(github): update PR template by @AgustinRamiroDiaz in
#457


**Full Changelog**:
v0.3.2...0.4.0
AgustinRamiroDiaz pushed a commit that referenced this pull request Sep 9, 2024
* refactor: convert rpc client to a hook instead of provide/inject

* refactor: web3 hook

* refactor: short address hook

* refactor: db hook

* fix: remove db version redundancy

* refactor: ws hook

* refactor: rpc client/hook

* refactor: input map hook, move useContractQueries to hooks index

* refactor: python syntax hook

* refactor: filename hook

* refactor: setup stores

* refactor: rename eth to wallet

* fix: wrong input mapping

* refactor: normalize naming for wallet methods

* fix: update omitted replace

* fix: replace updated method

* fix: consistently delete example contracts on reset storage

* fix: don't reload all example files when they already exist with a change

* fix: remove comment

* fix: allow id param on tx items

* fix: load opened files correctly from storage, remove some legacy code

* refactor: move shortenAddress to useWallet hook and simplify it's definition

* refactor: move python syntax to a constant

* refactor: web client

* refactor: wrap web3 methods

* fix: adapt implementations after web3 wallet wrapping

* fix: use lodash debounce instead of vue-debounce because of breaking deps in testing

* fix: wrong typing

---------

Co-authored-by: Den <[email protected]>
Co-authored-by: Den <[email protected]>
@github-actions github-actions bot mentioned this pull request Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants