[pull] main from MetaMask:main#659
Merged
Merged
Conversation
## Explanation Adds Agentic CLI notification preferences to authenticated user storage and wires them through `NotificationServicesController`. ### `@metamask/authenticated-user-storage` - Adds `AgenticCliPreference` (`inAppNotificationsEnabled`, `pushNotificationsEnabled`) and an **optional** `agenticCli` field on `NotificationPreferences` (minor semver; the next major release should make it required). - Adds `DEFAULT_AGENTIC_CLI_PREFERENCES` (both flags default to `true`) and exports it from the package index. - **`getNotificationPreferences`**: legacy blobs that omit `agenticCli` are backfilled with a shallow copy of `DEFAULT_AGENTIC_CLI_PREFERENCES`, then validated against the full schema. When non-`null`, the returned object always includes `agenticCli` even though the type marks it optional. - **`putNotificationPreferences`**: relies on the TypeScript type for write shape; no additional runtime validation is performed on PUT. - Updates test mocks and adds coverage for legacy coercion and for ensuring returned defaults are not shared with the exported constant. ### `@metamask/notification-services-controller` - Re-exports `DEFAULT_AGENTIC_CLI_PREFERENCES` from `@metamask/authenticated-user-storage`. - Initializes `agenticCli` when building fresh notification preferences via `buildFreshPreferences`. - Agentic CLI notification delivery is gated by the Agentic backend using AUS `agenticCli` preferences; `NotificationServicesController` does not filter Agentic CLI notifications at fetch time (same as `perps` and `socialAI`). - Updates test helpers and expectations. ### Semver note This is a **minor** change: `agenticCli` is optional on `NotificationPreferences`, so existing consumers that read-modify-write via `getNotificationPreferences` do not need code changes. The next major release should make `agenticCli` required on the type. ## References - Related to Agentic CLI notification preference work ([#8933](#8933)) ## Checklist - [x] 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 - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Extending `NotificationPreferences` with a new required field is a breaking type change for consumers that build or spread preference objects without `agenticCli`. > > **Overview** > Adds **agentic CLI** notification settings to authenticated user storage: a new `AgenticCliPreference` type (in-app and push toggles) and a required `agenticCli` field on `NotificationPreferences`. > > Test mocks were updated so `MOCK_NOTIFICATION_PREFERENCES` includes sample `agenticCli` values. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit a732e09. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Gaurav Goel <grvgoel19@gmail.com>
…9165) ## Explanation The Social Leaderboard surfaces in MetaMask Mobile are switching their PnL displays from the 30-day window to the 7-day window (TSA-766). The trader-profile "Return" headline sums the **per-chain** PnL breakdown (rather than the global stat) so it includes Hyperliquid/perps and stays consistent with the position list. `TraderStats` already exposed scalar 7-day fields (`pnl7d`, `winRate7d`, `roiPercent7d`), but `PerChainBreakdown` only had the 30-day per-chain maps — so a 7-day, Hyperliquid-inclusive headline wasn't expressible. This adds the 7-day per-chain breakdown to `PerChainBreakdown` (and its struct), alongside the matching social-api change that populates it (Clicker already returns these windows). ## References - Mobile ticket: TSA-766 (Use 7d PnL) - social-api counterpart: `va-mmcx-social-api` — exposes `perChainPnl7d` / `perChainRoi7d` / `perChainVolume7d` on the profile response and chain-scopes the leaderboard 7-day fields. ## Changes - **Added**: optional `perChainPnl7d` (`Record<string, number>`), `perChainRoi7d` (`Record<string, number | null>`), and `perChainVolume7d` (`Record<string, number>`) to the `PerChainBreakdown` type and `PerChainBreakdownStruct`. - The unsuffixed fields (`perChainPnl`, `perChainRoi`, `perChainVolume`) remain the **30-day** window. - New fields are **optional** so the controller stays backward compatible with social-api versions that only return the 30-day breakdown. ## Non-breaking Purely additive. The response struct uses `superstruct`'s non-exhaustive `type()`, and the new struct fields are `optional()`, so existing 30-day-only responses continue to validate unchanged. No public export was removed, renamed, or had its signature changed. ## Test plan - `yarn workspace @metamask/social-controllers run jest --no-coverage SocialService.test.ts` — added cases asserting the 7-day per-chain breakdown round-trips, and that a profile omitting it still validates (`perChainPnl7d` is `undefined`). 45/45 pass. - `yarn workspace @metamask/social-controllers run build` — type check passes. - Changelog updated + `changelog:validate` passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
## 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/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them
…d is confirmed by simulation (#9148) ## Summary When `isGasFeeSponsored` is confirmed `true` by the simulation response, `isExternalSign` is now also set to `true` on the transaction meta. ## Fix Accounts using the Money Account keyring cannot execute `KeyringController:signTransaction` — the keyring only supports EIP-7702 authorization and message signing. Transactions from these accounts that are gas-sponsored (e.g. the Card link ERC-20 approval on Monad) would crash with: ``` KeyringController - The keyring for the current address does not support the method signTransaction. ``` Setting `isExternalSign = true` alongside `isGasFeeSponsored = true` skips the local signing step, allowing Sentinel Relay to handle submission via the sponsorship path. https://github.com/user-attachments/assets/37e22c82-0724-4204-ac4e-6d5b45998d7a ## Changes - `TransactionController`: after persisting `isGasFeeSponsored` from simulation, set `isExternalSign = true` when sponsored
…payment has no payment token (#9158) ## Summary When a fiat payment method is selected, `paymentToken` is not present. The previous guard in `syncTransaction` used `||` which required **both** to be present, blocking the fiat-only path entirely. Changed the guard from `&&` to `||` so that having either `paymentToken` or `selectedFiatPayment` is sufficient to proceed. ## Changes - `syncTransaction`: guard changed from `!paymentToken || !selectedFiatPayment` → `!paymentToken && !selectedFiatPayment` - Added test: syncs `tx.metamaskPay` when fiat payment is set but no `paymentToken` - Updated existing test description to reflect new semantics --------- Co-authored-by: Matthew Walsh <matthew.walsh@consensys.net>
…-service (#9163) ## 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? --> Update `@metamask/money-account-balance-service` to use `pending` blockTag for balance calls ## 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 - [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/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them
## Explanation The `docs/processes/migrate-tags.md` guide and its companion `scripts/migrate-tags.sh` script are overkill for what's actually needed: a single tag in `core` for the latest version released from the source repo, so `action-publish-release` doesn't try to re-release it. This PR: - Removes `docs/processes/migrate-tags.md`, the dead link in `docs/README.md`, and the now-orphaned `scripts/migrate-tags.sh`. - Adds a short "tag the latest source-repo release in core" step to `docs/processes/package-migration-process-guide.md` under PR#6, with the `git tag -a @metamask/<package-name>@<latest-version> <sha>` command. ## References None. ## Checklist - [ ] 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 - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them
… except 400 and 429 (#9123) ## Explanation Consider all HTTP errors thrown by `RpcService` when using Infura as service policy failures except if the HTTP status code is `400` or `429`. Previously we would only consider `5xx` HTTP status codes as failures that could trip the circuit. ## References https://consensyssoftware.atlassian.net/browse/WPC-1111 ## 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/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them --------- Co-authored-by: cryptodev-2s <109512101+cryptodev-2s@users.noreply.github.com>
## Explanation `scripts/semver.sh` was only sourced by `scripts/migrate-tags.sh`, which is being removed in #9171. With that script gone, `semver.sh` is orphaned, so this PR deletes it too. ## References - Follow-up to #9171 ## 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/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )