Skip to content

Conversation

@orestiseth
Copy link
Contributor

@orestiseth orestiseth commented Oct 14, 2025

Note

Implements setSelectedAccounts, updates cron to synchronize only selected accounts, adjusts account creation defaults, and updates tests and dependencies.

  • Handlers:
    • Keyring (src/handlers/KeyringHandler.ts):
      • Add routing for KeyringRpcMethod.SetSelectedAccounts calling setSelectedAccounts.
      • New setSelectedAccounts(accounts) validates IDs and triggers fullScan on selected accounts.
      • Change createAccount default synchronize to false.
      • discoverAccounts no longer filters by transaction history (returns all discovered accounts).
    • Cron (src/handlers/CronHandler.ts):
      • Inject SnapsProvider and use getSelectedAccounts to sync only selected accounts.
      • Constructor/signature updated and wiring added in src/index.ts.
  • Validation (src/handlers/validation.ts):
    • Add validateSelectedAccounts to ensure provided IDs exist; throws ValidationError.
  • Use cases (src/use-cases/AccountUseCases.ts):
    • discover no longer performs fullScan.
  • Tests:
    • Update unit/integration tests to mock snap_manageAccounts getSelectedAccounts, reflect new defaults, and new behaviors (CronHandler.test.ts, integration tests, KeyringHandler.test.ts, AccountUseCases.test.ts).
  • Config/Deps:
    • Bump @metamask/keyring-api to ^21.1.0, @metamask/keyring-snap-sdk to ^7.1.0, @metamask/snaps-jest to ^9.4.1 (and related lockfile updates).
    • Update snap.manifest.json source shasum.

Written by Cursor Bugbot for commit e553517. This will update automatically on new commits. Configure here.

@socket-security
Copy link

socket-security bot commented Oct 14, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​metamask/​keyring-snap-sdk@​6.0.0 ⏵ 7.1.074 +210074 +394 -2100
Added@​metamask/​keyring-api@​21.1.01001001009650

View full report

@orestiseth orestiseth marked this pull request as ready for review October 14, 2025 16:52
@orestiseth orestiseth requested a review from a team as a code owner October 14, 2025 16:52
@orestiseth orestiseth changed the title feat: introduce setSelectedAccounts feat: add support for setSelectedAccounts Oct 14, 2025
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@aganglada aganglada left a comment

Choose a reason for hiding this comment

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

Looks great to me

@orestiseth orestiseth merged commit fbb3183 into main Oct 21, 2025
16 checks passed
@orestiseth orestiseth deleted the feat/optimise-accounts-syncing branch October 21, 2025 13:00
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.

4 participants