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

Add basic support for account RPC methods in snaps simulator #1710

Merged
merged 7 commits into from
Aug 30, 2023

Conversation

FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented Aug 30, 2023

This PR adds basic support for account RPC methods in the simulator by deriving the first address of the SRP and returning that when eth_requestAccounts or eth_accounts is requested. In the future, we should provide a permission flow that mirrors MetaMask clients, but for now this is useful.

Fixes #1578

@FrederikBolding FrederikBolding requested a review from a team as a code owner August 30, 2023 08:46
Mrtenz
Mrtenz previously approved these changes Aug 30, 2023
@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Patch coverage: 91.66% and no project coverage change.

Comparison is base (690d621) 95.87% compared to head (d1b981c) 95.87%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1710   +/-   ##
=======================================
  Coverage   95.87%   95.87%           
=======================================
  Files         239      239           
  Lines        5401     5409    +8     
  Branches      836      836           
=======================================
+ Hits         5178     5186    +8     
  Misses        223      223           
Files Changed Coverage Δ
...s/snaps-simulator/src/features/simulation/sagas.ts 75.82% <66.66%> (+0.26%) ⬆️
...ps-simulator/src/features/simulation/middleware.ts 85.71% <100.00%> (+7.14%) ⬆️

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

@@ -80,16 +80,20 @@ export function* initSaga({ payload }: PayloadAction<string>) {

const srp: string = yield select(getSrp);

const sharedHooks = {
getMnemonic: async () => mnemonicPhraseToBytes(srp),
Copy link
Member

Choose a reason for hiding this comment

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

Can this be covered?

Copy link
Member Author

Choose a reason for hiding this comment

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

None of the hooks are currently covered because we don't have tests that run them directly. IMO out of scope for this PR and not exactly sure how we test to cover them

@FrederikBolding FrederikBolding merged commit be83c45 into main Aug 30, 2023
130 of 131 checks passed
@FrederikBolding FrederikBolding deleted the fb/snaps-simulator-accounts branch August 30, 2023 10:55
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

Successfully merging this pull request may close these issues.

End-to-end test wallet_requestAccounts when the simulator supports it
2 participants