Skip to content

feat(client-utils): add predictionSettled activity kind - #11169

Merged
matallui merged 2 commits into
mainfrom
feat/pred-1405-settlement-kind
Oct 28, 2026
Merged

matallui merged 2 commits into
mainfrom
feat/pred-1405-settlement-kind

Conversation

@matallui

@matallui matallui commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

ActivityKind has three prediction-market kinds: predictionPlaced, predictionCashedOut and predictionClaimWinnings. Clients use predictionClaimWinnings for the payout of a resolved market, which assumes the user claims it by hand.

Some prediction markets settle automatically: when the market resolves, the payout goes to the user and there is nothing to claim. "Claimed winnings" is the wrong label for those rows, and it reads especially badly for a losing position that settles at $0. Clients need a separate kind so they can show these as a settlement instead of a claim.

This PR adds predictionSettled to ActivityKind. It shares the ActivityData variant with the other prediction kinds, so it has the same data shape. data.token holds the proceeds, with direction in. No new data fields are added.

predictionClaimWinnings is unchanged, since flows with a manual claim still use it. chainId stays required.

The change is additive. Consumers with an exhaustive switch (or Record) over ActivityKind will need a case for the new kind once they upgrade. MetaMask Mobile already handles it. Mobile currently defines the kind locally so the feature isn't blocked on a release. Once this is released and mobile bumps @metamask/client-utils, mobile drops its local copy and this package is the source of truth again.

Nothing else in @metamask/client-utils lists prediction kinds (mappers, formatters, tests and fixtures don't reference them), so types.ts is the only source change.

References

  • Related to PRED-1405

Checklist

  • I've updated the test suite for new or updated code as appropriate (type-only change; no runtime code or tests reference prediction kinds)
  • 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

Low Risk
Type-only addition in @metamask/client-utils with no mapper or runtime logic changes; main impact is optional compile-time updates for exhaustive ActivityKind handling in downstream apps.

Overview
Adds predictionSettled to the shared ActivityKind and wires it into the same ActivityItem/ActivityData variant as the other prediction-market kinds (predictionPlaced, predictionCashedOut, predictionClaimWinnings). Proceeds still live in data.token with direction in; predictionClaimWinnings is unchanged for manual-claim flows.

This lets clients label auto-settled prediction payouts (including $0 losses) as settlement instead of “claimed winnings.” The Unreleased changelog documents the addition.

The change is additive at runtime in this package, but TypeScript consumers with exhaustive handling over ActivityKind or ActivityItem will need a new branch when they upgrade.

Reviewed by Cursor Bugbot for commit 88798c0. Bugbot is set up for automated code reviews on this repo. Configure here.

@matallui
matallui marked this pull request as ready for review October 28, 2026 14:28
@matallui
matallui requested review from a team as code owners October 28, 2026 14:28
@matallui
matallui added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 80088a9 Oct 28, 2026
50 checks passed
@matallui
matallui deleted the feat/pred-1405-settlement-kind branch October 28, 2026 15:43
@Kriys94 Kriys94 mentioned this pull request Oct 29, 2026
1 of 2 tasks
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Nov 4, 2026
## Explanation

Release 1377.0.0. This PR only bumps versions, finalizes changelogs,
updates dependency ranges, and refreshes `yarn.lock`. The behavior
shipped here is already on `main`.

Three packages are major releases because their unreleased changelogs
include breaking changes:

- `@metamask/transaction-controller` `72.3.0` → `73.0.0`. Simulation now
goes through `SentinelApiService:simulateTransactions`. Consumers must
construct a `SentinelApiService` and delegate that action.
`getSimulationConfig` now returns `{ newUrl?: string }` only
([MetaMask#9476](MetaMask#9476)).
- `@metamask/core-backend` `12.3.0` → `13.0.0`.
`OHLCV_SERVICE_ALLOWED_ACTIONS` no longer includes
`BackendWebSocketService:getConnectionInfo` or
`BackendWebSocketService:findSubscriptionsByChannelPrefix`
([MetaMask#10884](MetaMask#10884)). This release
also adds `fetchV5MultiAccountTransactions`
([MetaMask#11194](MetaMask#11194)),
`LaunchpadTokenDetailsService`, and `ChannelSubscriptionManager`
([MetaMask#10884](MetaMask#10884)).
- `@metamask/wallet` `20.0.0` → `21.0.0`. Default initialization now
includes `NetworkEnablementController`, and the wallet messenger
delegates `SentinelApiService:simulateTransactions`. Clients must
register `MultichainNetworkController:getState` and
`SentinelApiService:simulateTransactions` on the wallet messenger
([MetaMask#10997](MetaMask#10997),
[MetaMask#9476](MetaMask#9476)).

These packages are included so they can depend on
`transaction-controller` `^73.0.0` and, where they use it,
`core-backend` `^13.0.0`:

| Package | Version |
| --- | --- |
| `@metamask/assets-controller` | `20.1.0` |
| `@metamask/assets-controllers` | `113.0.1` |
| `@metamask/bridge-controller` | `83.1.3` |
| `@metamask/bridge-status-controller` | `78.0.1` |
| `@metamask/client-utils` | `3.1.0` |
| `@metamask/eip-5792-middleware` | `4.1.0` |
| `@metamask/gator-permissions-controller` | `6.1.0` |
| `@metamask/money-account-utils` | `2.2.0` |
| `@metamask/network-enablement-controller` | `7.1.0` |
| `@metamask/phishing-controller` | `18.3.0` |
| `@metamask/profile-metrics-controller` | `5.2.1` |
| `@metamask/shield-controller` | `7.1.1` |
| `@metamask/smart-transactions-controller` | `27.2.1` |
| `@metamask/social-controllers` | `3.14.1` |
| `@metamask/subscription-controller` | `15.1.2` |
| `@metamask/transaction-pay-controller` | `30.3.2` |
| `@metamask/transaction-pay-middleware` | `2.0.1` |
| `@metamask/user-operation-controller` | `42.1.0` |

Notable changes besides the dependency bumps:

- `@metamask/assets-controller`: optional `pricePercentChange5m` and
`pricePercentChange4h` on `FungibleAssetPrice`
([MetaMask#11201](MetaMask#11201)).
- `@metamask/client-utils`: `predictionSettled` on `ActivityKind`
([MetaMask#11169](MetaMask#11169)), plus fee fixes
for contract-interaction fallback and OP Stack L1/operator fees
([MetaMask#11013](MetaMask#11013),
[MetaMask#9630](MetaMask#9630)).
- `@metamask/network-enablement-controller`: preserve enablement when a
config-registry network is auto-enabled
([MetaMask#10763](MetaMask#10763)).
- `@metamask/phishing-controller`: Arc (`0x13b2`) token scanning
([MetaMask#11144](MetaMask#11144)).
- `@metamask/transaction-pay-controller`: shared recipient resolution
and Hyperliquid perps deposit detection
([MetaMask#10887](MetaMask#10887),
[MetaMask#11026](MetaMask#11026)).

`@metamask/earn-controller`, `@metamask/money-account-mfa-whitelist`,
`@metamask/money-account-upgrade-controller`,
`@metamask/network-connection-banner-controller`,
`@metamask/perps-controller`, and `@metamask/signature-controller` only
have dependency ranges updated. They are not version-bumped and are not
published in this release.

## References

* [MetaMask#9476](MetaMask#9476)
* [MetaMask#9630](MetaMask#9630)
* [MetaMask#10763](MetaMask#10763)
* [MetaMask#10884](MetaMask#10884)
* [MetaMask#10887](MetaMask#10887)
* [MetaMask#10997](MetaMask#10997)
* [MetaMask#11013](MetaMask#11013)
* [MetaMask#11026](MetaMask#11026)
* [MetaMask#11144](MetaMask#11144)
* [MetaMask#11169](MetaMask#11169)
* [MetaMask#11194](MetaMask#11194)
* [MetaMask#11201](MetaMask#11201)

## 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
-->

- [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**
> The diff is low-risk mechanically, but the published majors force
client upgrades around transaction simulation, backend WebSocket
actions, and wallet messenger registration—areas that affect core wallet
behavior.
> 
> **Overview**
> This PR cuts **release 1377.0.0** by bumping the root monorepo
version, publishing new semver tags for many `@metamask/*` packages,
moving unreleased changelog entries into versioned sections, updating
inter-package dependency ranges, and refreshing **`yarn.lock`**. There
is **no new application logic** in the diff—only release bookkeeping for
work already on `main`.
> 
> The release centers on three **major** packages whose changelogs
document breaking changes: **`@metamask/transaction-controller`
`73.0.0`** (simulation via `SentinelApiService:simulateTransactions`;
`getSimulationConfig` shape change), **`@metamask/core-backend`
`13.0.0`** (WebSocket allowed-actions cleanup plus new backend
APIs/services), and **`@metamask/wallet` `21.0.0`** (default
`NetworkEnablementController` wiring and Sentinel simulation delegation
on the wallet messenger). Dozens of other packages are **minor/patch
bumped** mainly to depend on **`transaction-controller` `^73.0.0`** and,
where applicable, **`core-backend` `^13.0.0`**.
> 
> Several workspaces only have **`package.json` dependency range
updates** (e.g. `earn-controller`, `money-account-upgrade-controller`,
`signature-controller`) without a version bump in this PR. A few
packages also document **feature fixes** in their new changelog sections
(e.g. `assets-controller` price change fields, `client-utils` activity
kinds/fees, `phishing-controller` Arc scanning) as part of the versions
being published here.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
5a253e4. 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: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
weitingsun pushed a commit to Poovarasan-Sandhanam/metamask-mobile that referenced this pull request Nov 6, 2026
… 3.1.1 (MetaMask#39071)

## **Description**

C6 (PRED-1405, MetaMask#38411) declared the `predictionSettled` activity kind
locally in mobile so E5 was not blocked on a `@metamask/client-utils`
release. MetaMask/core#11169 shipped it upstream in
`@metamask/client-utils@3.1.0`, so mobile now consumes the upstream kind
and deletes its local copy. client-utils is again the only source of
activity kinds.

**Bump.** `@metamask/client-utils` `3.0.2` → `3.1.1`. The manifest floor
moves from `^3.0.2` to `^3.1.1` as well: the code now depends on
`predictionSettled` existing upstream, so `3.0.2` no longer type-checks.
`3.1.1` rather than `3.1.0` because it asks for
`@metamask/core-backend@^14`, which the app already uses, so the
lockfile ends up with one fewer copy.

Lockfile effect, all transitive through client-utils:

| Package | Before | After | Why |
| --- | --- | --- | --- |
| `@metamask/client-utils` | 3.0.2 | 3.1.1 | this PR |
| `@metamask/core-backend` | client-utils had a private 11.0.0 | shares
the app's 14.0.0 | 11.0.0 dropped from the lock |
| `@metamask/transaction-controller` | 72.3.0 | 72.3.0 | client-utils
asks `^73.1.1`, but the root `resolutions` pins 72.3.0 (MetaMask#39024 reverted
73 because it breaks simulations). This PR does not bring 73 back. |
| `eth-chainlist` | 0.0.795 | 0.0.873 | used by client-utils only |

**Code.** `LocalActivityKindShapes`, `LocalActivityKind` and
`ShapeKindOf` are deleted from `app/util/activity-adapters/types.ts`,
and `ActivityKind` is re-exported straight from client-utils.
`ActivityItemForKind` returns to its pre-C6 condition. Upstream puts
`predictionSettled` in the same `ActivityData` group as
`predictionClaimWinnings`, which is the shape the local mapping
borrowed, so `ActivityListItem` is unchanged for every kind.
`PredictSettlementExtras`, `KALSHI_VENUE_CHAIN_ID` and the row and
details rendering stay mobile-only. The catalog contract doc is updated.

**What the client-utils CHANGELOG (3.0.3 → 3.1.1) changes for mobile.**
I diffed the published `dist` of 3.0.2 against 3.1.1. Only three runtime
files changed, plus the `ActivityKind` type:

1. **API contract-interaction rows now carry a network fee**
(core#11013). `mapApiTransaction`'s `contractInteraction` fallback adds
`fees: getFees(transaction)`, the same helper API swap rows already use.
Mobile renders this in `ContractInteractionDetails` →
`ActivityDetailsFeesAndTotal`, so the details screen of a contract
interaction that exists only in the accounts API (no local
TransactionController record) now shows a network fee where it showed
none. This is user-visible but outside Predict. It is an upstream fix
and no mobile test depended on the old value.
2. **OP-stack L1 and operator fees in `getLocalTransactionFees`**
(core#9630). This does not reach mobile. Both `mapLocalTransaction` call
sites run `prepareLocalTransactionGroup` first, which fills
`transactionGroup.fees` from mobile's own `getLocalActivityFees`, and
client-utils only falls back to its helper when that is absent. Mobile's
helper has no L1 fee today. That gap predates this PR and is unchanged.
3. **Dependency bumps.** No transaction-controller symbol is used in
3.1.1 that 3.0.2 did not already use, and 3.0.2 already runs on the
pinned 72.3.0, so the resolution is safe. The new receipt fields the
OP-stack fee code reads are optional and only used on the fallback path
mobile never reaches. `eth-chainlist` adds 189 chains and changes the
native symbol or slip44 of 15 obscure chains (for example Rome,
c8ntinuum, Data Network). None of them is a network mobile ships by
default.
4. Node 26 support (core#10981) has no effect on the app bundle.

No test was changed.

## **Changelog**

CHANGELOG entry: null

## **Related issues**

Refs: PRED-1420

## **Manual testing steps**

N/A. The `predictionSettled` change is type-only and emits identical
JavaScript, and Predict rows are built by mobile's `mapActivityEntry`,
not by client-utils. Coverage comes from the unchanged C6 unit and
component-view tests:

- `yarn lint:tsc`: pass
- `yarn jest` over ActivityListItemRow, PredictNext activity,
ActivityScreen, ActivityDetails, ActivityList, activity-adapters,
`selectors/activity`, Transactions, MultichainTransactionsView,
`useFormatters` and `util/bridge`: 100 suites, 1244 tests pass (rerun
after merging main)
- `yarn jest -c jest.config.view.js` over ActivityDetails (including
`ActivityDetails.predict.view.test.tsx`), ActivityScreen, ActivityList,
PredictNext, SwapsLimitOrderActivityPage and confirmations activity: 22
suites, 568 tests pass (rerun after merging main)
- `yarn lint:shard` 1–4 of 4: 0 errors
- `yarn install --immutable`: pass

To see the one visible change from the bump:

```gherkin
Feature: Activity details for API-only contract interactions

  Scenario: user opens a contract interaction known only to the accounts API
    Given a wallet whose history includes a contract interaction with no local transaction record (for example, imported on a fresh install)

    When user opens Activity and taps that contract interaction
    Then the details screen shows a Network fee row
```

## **Screenshots/Recordings**

N/A. No Predict rendering changes, and the contract-interaction fee row
reuses the existing fees component.

### **Before**

N/A

### **After**

N/A

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

#### Performance checks (if applicable)

- [x] I've tested on Android
  - Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example

Performance checks are not applicable: this is a type-only change plus a
dependency bump, with no new rendering, polling or lists.

For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches shared activity types and a client-utils bump with lockfile
drift; minor user-visible change possible for API-only contract
interaction details (fees row) per upstream.
> 
> **Overview**
> **Dependency and types**
> 
> Bumps **`@metamask/client-utils`** to `^3.1.1` and refreshes
**yarn.lock** (transitive updates such as `eth-chainlist`,
`contract-metadata`, alignment with app’s `core-backend`).
> 
> **Activity adapters**
> 
> Removes the **temporary mobile union** for `predictionSettled`
(`LocalActivityKindShapes`, `LocalActivityKind`, `ShapeKindOf`).
**`ActivityKind`** is re-exported from client-utils only;
**`ActivityItemForKind`** narrows on upstream kinds directly. Upstream
now ships `predictionSettled`; mobile-only **`PredictSettlementExtras`**
/ **`KALSHI_VENUE_CHAIN_ID`** stay in `types.ts`.
> 
> **Docs**
> 
> Updates the **canonical portfolio activity catalog** to state that
`predictionSettled` comes from client-utils (3.1.0+) and the local stub
was dropped after the bump.
> 
> *Note: client-utils 3.1.x also adds network fees on API-only
contract-interaction rows; Predict rendering is unchanged per PR
description.*
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
2bb918a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

This branch was previously deployed

1 inactive deployment
default-branch — 88798c0a Deployed Oct 28, 2026 by matallui via Determine whether this PR is a release PR #6214
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.

3 participants