feat(stellar-wallet-snap): use the shared wrapSnapHandlers and noopAssetHandlers - #366
Merged
Merged
Conversation
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Only a non-blocking test-coverage nit remains.
Review effort: Lite
Findings: 1
What changed in this PR
Migrates Stellar Snap entrypoints to shared handler wrappers and no-op asset handlers.
Changes:
- Centralizes error handling with
wrapSnapHandlers. - Removes duplicate handler-level wrappers and the unused logger.
- Replaces asset stubs with
noopAssetHandlers. - Updates tests and the manifest checksum.
| File | Summary |
|---|---|
packages/stellar-wallet-snap/src/index.ts |
Adds shared wrappers and asset handlers. |
packages/stellar-wallet-snap/src/index.test.ts |
Tests wrapped entrypoint errors. |
packages/stellar-wallet-snap/src/handlers/user-input/userInput.ts |
Removes inner error wrapping. |
packages/stellar-wallet-snap/src/handlers/keyring/keyring.ts |
Removes inner error wrapping. |
packages/stellar-wallet-snap/src/handlers/cronjob/cronjob.ts |
Removes inner error wrapping. |
packages/stellar-wallet-snap/src/handlers/clientRequest/clientRequest.ts |
Removes inner wrapping and logger dependency. |
packages/stellar-wallet-snap/src/context.ts |
Updates client handler construction. |
packages/stellar-wallet-snap/snap.manifest.json |
Updates the bundle checksum. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Battambang
reviewed
Sep 24, 2026
| cronjobHandler.handle(request); | ||
| import { logger, withCatchAndThrowSnapError } from './utils'; | ||
|
|
||
| const keyringLogger = logger.withPrefix('[🔑 KeyringHandler]'); |
Contributor
There was a problem hiding this comment.
Is also defined in
maybe there is a possible aggregation to do there
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Explanation
Migrate the Stellar Snap entrypoints to
wrapSnapHandlersandnoopAssetHandlersfrom@metamask/snap-networks-utils(added in #341).onKeyringRequest,onUserInput,onClientRequest, andonCronjobare now wrapped once, at the entrypoint, by a singlewrapSnapHandlers(withCatchAndThrowSnapError, { ... })call inindex.ts.withCatchAndThrowSnapErrorcalls are removed fromKeyringHandler,ClientRequestHandler,CronjobHandler, andUserInputHandler, so errors are not tracked twice. Their logic is unchanged: debug logs,validateOrigin,?? null, the client-status check, and the early returns.logErroroverrides:[🔑 KeyringHandler]foronKeyringRequestand[👋 ClientRequestHandler]foronClientRequest.onCronjobandonUserInputkeep using the base logger, as before.ClientRequestHandleronly used its logger for the removed wrap, so theloggerconstructor option is dropped (it is only constructed incontext.ts).onAssets*stubs are replaced bynoopAssetHandlers.References
Checklist