From 926ffcbd848fb73eb871260014c801b24d667eb4 Mon Sep 17 00:00:00 2001 From: Francis Nepomuceno Date: Thu, 20 Aug 2026 00:11:00 -0400 Subject: [PATCH] feat(client-utils): add shared mobile activity types Add the staking, prediction, and perps activity kinds and item variants that MetaMask Mobile still declares locally, so its temporary type shim can be removed. Mapper behavior is unchanged, keeping Extension's existing `stakingDeposit` to `deposit` mapping intact. Co-authored-by: Cursor --- packages/client-utils/CHANGELOG.md | 5 +++ packages/client-utils/src/types.ts | 51 ++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/packages/client-utils/CHANGELOG.md b/packages/client-utils/CHANGELOG.md index 231595fad3..0e48612281 100644 --- a/packages/client-utils/CHANGELOG.md +++ b/packages/client-utils/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Add `stake` / `unstake` activity kinds and a `PerpsOrderKind` type covering every perps order kind ([#9916](https://github.com/MetaMask/core/pull/9916)) +- Add `ActivityItem` variants for staking, prediction, and perps activity kinds that previously had no matching data shape ([#9916](https://github.com/MetaMask/core/pull/9916)) + ### Changed - Bump `@metamask/core-backend` from `^8.1.1` to `^8.1.2` ([#9886](https://github.com/MetaMask/core/pull/9886)) diff --git a/packages/client-utils/src/types.ts b/packages/client-utils/src/types.ts index 08c8c5c00c..c305e255e0 100644 --- a/packages/client-utils/src/types.ts +++ b/packages/client-utils/src/types.ts @@ -1,6 +1,18 @@ import type { ValueTransfer as _ValueTransfer } from '@metamask/core-backend'; import type { CaipChainId } from '@metamask/utils'; +export type PerpsOrderKind = + | 'marketShort' + | 'stopMarketCloseShort' + | 'marketCloseShort' + | 'limitShort' + | 'limitCloseShort' + | 'marketLong' + | 'stopMarketCloseLong' + | 'marketCloseLong' + | 'limitLong' + | 'limitCloseLong'; + export type ActivityKind = | 'receive' | 'sell' @@ -25,6 +37,8 @@ export type ActivityKind = | 'smartAccountUpgrade' | 'lendingDeposit' | 'lendingWithdrawal' + | 'stake' + | 'unstake' | 'predictionsAddFunds' | 'predictionsWithdrawFunds' | 'predictionClaimWinnings' @@ -44,9 +58,7 @@ export type ActivityKind = | 'perpsReceivedFundingFees' | 'perpsCloseShortTakeProfit' | 'perpsCloseLongTakeProfit' - | 'marketShort' - | 'stopMarketCloseShort' - | 'marketCloseShort' + | PerpsOrderKind | 'assetActivation' | 'assetDeactivation' | 'rampBuy' @@ -164,6 +176,39 @@ export type ActivityItem = token?: TokenAmount; } > + | ActivityData< + | 'stake' + | 'unstake' + | 'sell' + | 'contractDeployment' + | 'smartAccountUpgrade' + | 'predictionsAddFunds' + | 'predictionsWithdrawFunds' + | 'predictionClaimWinnings' + | 'predictionCashedOut' + | 'predictionPlaced' + | 'perpsOpenLong' + | 'perpsCloseLong' + | 'perpsCloseLongLiquidated' + | 'perpsCloseLongStopLoss' + | 'perpsOpenShort' + | 'perpsCloseShort' + | 'perpsCloseShortLiquidated' + | 'perpsCloseShortStopLoss' + | 'perpsPaidFundingFees' + | 'perpsReceivedFundingFees' + | 'perpsCloseShortTakeProfit' + | 'perpsCloseLongTakeProfit' + | PerpsOrderKind, + { + from?: string; + to?: string; + token?: TokenAmount; + sourceToken?: TokenAmount; + destinationToken?: TokenAmount; + fees?: Fee[]; + } + > | ActivityData< 'contractInteraction', {