Skip to content

Conversation

@oscarwroche
Copy link
Contributor

@oscarwroche oscarwroche commented Jan 9, 2026

Explanation

References

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
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

  • Keyring Controller: New KeyringControllerError class with codes/context, JSON/string serialization, and error chaining; refactors controller to throw KeyringControllerError (renamed enum to KeyringControllerErrorMessage); exports errors; extensive test updates including hardware wallet error preservation.
  • Multichain Account Service (Snaps): Add SnapPlatformWatcher and MultichainAccountService:ensureCanUseSnapPlatform; new SnapAccountProvider.withSnap guard (and make client private); update Sol/Btc/Trx providers to use guarded client/keyring access for discovery/creation; add lodash; new tests.
  • Bridge/Intents: In bridge status controller, set isStateOnly: true on intent addTransaction and remove swaps metadata and initial gas estimate.
  • Assets/Bridge package bumps: @metamask/assets-controllers to 95.0.0 with changelog links; bridge-controller depends on it; monorepo version to 742.0.0.

Scope: error-handling overhaul and Snap readiness guard across providers; minor intent/bridge metadata change; package version bumps.

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

montelaidev and others added 9 commits January 8, 2026 10:41
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

This PR introduces a new KeyringController error that will properly
propagate errors from the keyring instances.

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
Related to
https://consensyssoftware.atlassian.net/browse/MUL-1304?atlOrigin=eyJpIjoiZmYwZmRmNDg1NDkzNDMxMjg2ZTBmNmUwYzQzZTA2ZjgiLCJwIjoiaiJ9
-->

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs)
- [x] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Introduces a unified error type and updates error handling across the
keyring controller.
> 
> - Add `KeyringControllerError` with code/context/cause support and
JSON/string serialization (`src/errors.ts`), export via `src/index.ts`
> - Rename enum to `KeyringControllerErrorMessage` and refactor
`KeyringController` to throw `KeyringControllerError` (wrapping keyring
errors) instead of generic errors; normalize many error sites and
messages
> - New tests covering error features, wrapping (incl. hardware wallet
errors), and edge cases; update existing tests to expect
`KeyringControllerErrorMessage`
> - Add mock hardware keyring for testing; minor test improvements
(deadlock prevention pattern)
> - Changelog updated to note new error type
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
dcde33f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Charly Chevalier <[email protected]>
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## 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](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Release 742.0.0** with updated assets controllers and dependency
alignments.
> 
> - Publish `@metamask/[email protected]`
> - Adds RWA token data support (`includeRwaData`, new `TokenRwaData`
and `TokenSearchItem.rwaData`), updates spot-prices support, exports
`selectAllAssets`, and adds MSU/Etherlink support with MSU native token
address mapping
> - Includes dependency bumps and a breaking change in
`AccountTrackerController` (requires additional KeyringController
actions/events)
> - Bump `@metamask/assets-controllers` to `^95.0.0` in
`bridge-controller` and `transaction-pay-controller`
> - Update root version to `742.0.0` and refresh `yarn.lock`
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
0bffb8d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
…7266)

## Explanation

Snap requests are now delayed after the onboarding, to avoid starting
requests "too soon" on the clients, we now have a logic to wait for the
Snap platform to be ready.

This makes sure that any calls that uses retries or timeouts will start
their calls AFTER the Snap platform is ready to process anything.

We stumbled upon this bug during the concurrent requests/Snap state
inconsistency investigation. Initial account providers requests were
usually timing out because they were hitting their limit because they
were starting a bit "late" since the Snap platform was not ready yet.
(This was also still causing concurrent requests, despite the
`maxConcurrency: 1`, since Snaps were still processing the timed out
request while receiving new ones).

To future-proof this and fully await for the Snap platform to be ready,
we now send 1 simple Snap request and wait for it to be executed (being
successful or not). Then, we start processing all Snap requests with our
usual logic (timeouts, semaphore, retries, etc...)

## References

- MetaMask/metamask-mobile#23807

## 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](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Ensures Snap-based flows wait for platform readiness and refactors
providers to use a guarded Snap access pattern.
> 
> - **Add** `SnapPlatformWatcher` to track Snap platform readiness and
gate operations; expose
`MultichainAccountService:ensureCanUseSnapPlatform` action/method and
register its handler
> - **Refactor (BREAKING)**: make `SnapAccountProvider.client` private
and introduce `SnapAccountProvider.withSnap` to access `{ client,
keyring }`; update `Sol/Btc/TrxAccountProvider` to use `withSnap`, move
creation helpers private, and use restricted keyring for
`createAccount`/`removeAccount`
> - **Service updates**: instantiate watcher in
`MultichainAccountService` and route readiness checks; wire new action;
minor resync adjustments to use guarded keyring ops
> - **Tests**: add comprehensive unit tests for watcher and provider
readiness gating; adapt existing provider tests to new helpers/mocks
> - **Misc**: update `CHANGELOG.md`; add `lodash` dependency
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
3c898b2. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@oscarwroche oscarwroche requested review from a team as code owners January 9, 2026 10:57
@oscarwroche oscarwroche merged commit 6c38a94 into wip/intent-swap-architecture-refactory Jan 9, 2026
279 of 280 checks passed
@oscarwroche oscarwroche deleted the temp/matt-intents-test branch January 9, 2026 11:00
networkClientId,
type: transactionType,
skipInitialGasEstimate: true,
swaps: {
Copy link

Choose a reason for hiding this comment

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

Swap metadata removed from intent transaction creation

High Severity

The change removes the entire swaps.meta object and skipInitialGasEstimate option from the addTransactionFn call, replacing them with only isStateOnly: true. This removes important display metadata including sourceTokenSymbol, destinationTokenSymbol, sourceTokenAmount, destinationTokenAmount, decimals, addresses, swapTokenValue, approvalTxId, and the nested swapMetaData object. Test files and snapshots in the codebase expect transactions to have these properties for proper display in activity views. Given the PR title "Temp/matt intents test", this appears to be temporary/test code that was accidentally committed rather than an intentional feature change.

Fix in Cursor Fix in Web

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.

6 participants