Skip to content

fix(bridge-status-controller): use SnapKeyring.submitRequest to dispatch Snap keyring requests #5924

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ccharly
Copy link
Contributor

@ccharly ccharly commented Jun 5, 2025

Explanation

I missed this when introducing the KeyringRequest.origin feature.

The main problem is that this controller is dispatching "raw Snap request", thus, preventing any type-checking when doing keyring API updades.

By using SnapKeyring this should prevent this kind of problems in the future and it aligns well on how other controllers interact with the Snap keyring requests!

References

N/A

Changelog

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@ccharly ccharly force-pushed the fix/use-snap-keyring-in-bridge branch from 8512029 to bd4ede5 Compare June 5, 2025 08:27
Comment on lines -2857 to -2884
Array [
"SnapController:handleRequest",
Object {
"handler": "onKeyringRequest",
"origin": "metamask",
"request": Object {
"id": "test-uuid-1234",
"jsonrpc": "2.0",
"method": "keyring_submitRequest",
"params": Object {
"account": undefined,
"id": "test-uuid-1234",
"request": Object {
"method": "signAndSendTransaction",
"params": Object {
"account": Object {
"address": "0x123...",
},
"scope": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
"transaction": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAHDXLY8oVRIwA8ZdRSGjM5RIZJW8Wv+Twyw3NqU4Hov+OHoHp/dmeDvstKbICW3ezeGR69t3/PTAvdXgZVdJFJXaxkoKXUTWfEAyQyCCG9nwVoDsd10OFdnM9ldSi+9SLqHpqWVDV+zzkm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2KgqDJdBPFH4SYIM1kBAAA=",
},
},
"scope": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
},
},
"snapId": "test-snap",
},
],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We no longer uses the SnapController to dispatch those request.

"@metamask/gas-fee-controller": "npm:^23.0.0"
"@metamask/keyring-api": "npm:^18.0.0"
"@metamask/multichain-transactions-controller": "npm:^2.0.0"
"@metamask/network-controller": "npm:^23.5.1"
"@metamask/polling-controller": "npm:^13.0.0"
"@metamask/snaps-controllers": "npm:^12.3.1"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this dependency now that we rely solely on the SnapKeyring to dispatch keyring requests.

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.

1 participant