Commit c16d9c7
authored
fix(perps): show long orders in Activity and dedupe perps deposits + clean up (#33235)
## **Description**
Fixes to the redesigned Perps Activity
1. Long orders were missing from Perps → Orders (TMCU-1070). The
activity adapter only modelled short order kinds and dropped every
long-side order (it string-matched the display title and returned null
for anything containing "long"/"buy"). A user who placed long
limit/market/stop orders saw them under Trades but never under Orders
(e.g. MetaMask showed 3 orders where HyperLiquid had 10+).
2. Perps deposits double-rendered (TMCU-1066). A HyperLiquid deposit is
a real Arbitrum USDC transaction, so it appeared once under Perps →
Deposits (as a perps deposit) and again under Transactions (as a generic
"Interaction in progress"). The generic EVM copy of
perpsDeposit/perpsDepositAndOrder/perpsWithdraw transactions is now
suppressed from the generic stream when Perps is enabled (the perps
source already surfaces them); the confirmed API copy is still collapsed
by the existing hash-based dedup.
3. Order status now reads as an order lifecycle, not a blockchain status
(TMCU-1072). Both surfaces updated to mirror the extension's Orders
view:
- List row: shows the lifecycle status (Filled / Canceled / Rejected /
Open), muted, in the right column instead of a misleading notional
amount (the notional duplicated the size subtitle and was wrong for
canceled/rejected orders). Order titles also drop the "— Canceled"/"—
Failed" suffix since the status now lives in the right column.
- Details screen: the order Status row shows Filled / Canceled /
Rejected / Open instead of the blockchain-oriented Confirmed / Failed.
Scoped to orders only — sends/swaps/trades/funding/deposits keep
"Confirmed".
4. Duplicate filter bar (TMCU-1063). Switching filters after scrolling
briefly rendered two filter rows — the pinned bar wasn't unpinning
because scrollY wasn't reset on the programmatic scroll-to-top. Now
reset on filter change.
## **Changelog**
<!-- mms-check: type=changelog required=true blocking=true -->
CHANGELOG entry: Fixed Perps long and limit orders not appearing in the
Activity "Orders" filter, and stopped HyperLiquid deposits from also
showing as generic entries under the "Transactions" filter.
## **Related issues**
<!-- mms-check: type=issue-link required=true -->
Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-1070
Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-1066
Refs: https://consensyssoftware.atlassian.net/browse/TMCU-1072
Refs: https://consensyssoftware.atlassian.net/browse/TMCU-1063
## **Manual testing steps**
<!-- mms-check: type=manual-testing required=true -->
```gherkin
Feature: Perps orders in the Activity feed
Scenario: Long orders appear under the Orders filter with a lifecycle status
Given I have placed long-side perps orders on HyperLiquid (market, limit, and/or a triggered stop)
When I open Activity and select Perps → Order
Then I see the long orders (e.g. "Market long", "Market — close long", "Limit long")
And each row shows Filled / Canceled / Rejected on the right, muted, instead of a dollar amount
And short orders continue to appear unchanged
Scenario: Order details use order-lifecycle status, not blockchain status
Given I open the details for a filled perps order
Then the Status row reads "Filled" (not "Confirmed")
And a non-order transaction's details still read "Confirmed"
Scenario: A perps deposit is not duplicated into the Transactions filter
Given I fund a perps position, creating a HyperLiquid (Arbitrum USDC) deposit
When I open Activity
Then the deposit appears once under Perps → Deposits
And it does not also appear as a generic "Interaction in progress" under the Transactions filter
Scenario: Filter bar does not duplicate
Given I open Activity and scroll down
When I switch the filter to Perps
Then only one filter row is shown
```
## **Screenshots/Recordings**
- **Long orders were missing from Perps → Orders
[TMCU-1070](https://consensyssoftware.atlassian.net/browse/TMCU-1070)**
- **Order rows now show their lifecycle status
[TMCU-1072](https://consensyssoftware.atlassian.net/browse/TMCU-1072)**
| Before | After |
| --- | --- |
| <img alt="orders_before"
src="https://github.com/user-attachments/assets/ad81a6d2-0aa4-4351-a0b5-6e66be4656b9"
/> | <img alt="orders_after"
src="https://github.com/user-attachments/assets/10522f2b-1a0c-46dc-a239-f14255679b20"
/> |
| Before | After |
| --- | --- |
| <img alt="oders_details_before"
src="https://github.com/user-attachments/assets/12a7e4df-1310-4f45-8395-531629a792f5"
/> | <img alt="oders_details_after"
src="https://github.com/user-attachments/assets/4cc1c519-e072-4f7b-933c-53c81855ee5d"
/> |
- **Perps deposits double-rendered
[TMCU-1066](https://consensyssoftware.atlassian.net/browse/TMCU-1066)**
**Before**
https://github.com/user-attachments/assets/af4be45c-d082-410a-a8a0-e41170717ed4
**After**
https://github.com/user-attachments/assets/6c61c3b9-3bc0-45e0-aa43-3c41344e2af2
- **Fixed the double filter bar
[TMCU-1063](https://consensyssoftware.atlassian.net/browse/TMCU-163)**
**Before**
https://github.com/user-attachments/assets/42d5b9bd-eac8-4826-8a4a-083bbbd15d21
**After**
https://github.com/user-attachments/assets/47203864-22d2-4487-be7a-9b338923289b
### **Before**
`~`
### **After**
`~`
## **Pre-merge author checklist**
<!-- mms-check: type=checklist required=true -->
- [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
- [ ] 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)
- [ ] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [ ] 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
- [ ] 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
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**
- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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 activity list merging/dedup and perps order classification
across list, adapter, and details; mistakes could hide wallet txs or
mis-bucket orders, but behavior is heavily covered by new tests.
>
> **Overview**
> Fixes **Perps Activity** so long orders appear under **Orders**,
deposits aren’t duplicated, and order rows match extension-style
lifecycle labels.
>
> **Long orders (TMCU-1070):** `mapPerpsTransaction` no longer drops
long orders or infers kind from the display title. It classifies orders
from structured `side`, `reduceOnly`, `isTrigger`, and limit/market/stop
signals via shared `orderDirection` helpers (aligned with
`formatOrderLabel`). New activity kinds (`marketLong`, `limitLong`,
close/stop variants) are added to `PERPS_ORDER_KINDS` /
`isPerpsOrderKind` and wired through titles, icons, filters, and details
routing. `transformOrdersToTransactions` now passes those fields on the
normalized `order` payload.
>
> **Deposit dedupe (TMCU-1066):** When Perps is enabled, local EVM rows
for `perpsDeposit`, `perpsDepositAndOrder`, and `perpsWithdraw`
(including batch-wrapped and speed-up/cancel groups) are filtered out so
only the perps-domain row shows.
>
> **Order row UX:** List rows show **Filled / Canceled / Rejected /
Open** (muted) in the amount column instead of notional USD; order
titles drop the `— Canceled` suffix. Details use the same
`resolvePerpsOrderStatusLabel` on the status pill (e.g. Filled vs
Confirmed).
>
> **Other:** Resets `scrollY` when the activity type filter changes to
avoid a double pinned filter bar; expands tests and i18n for long order
titles.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a9525a5. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
[TMCU-1070]:
https://consensyssoftware.atlassian.net/browse/TMCU-1070?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ1 parent 5baa9a2 commit c16d9c7
27 files changed
Lines changed: 771 additions & 245 deletions
File tree
- app
- components
- UI
- ActivityListItemRow
- Perps
- types
- utils
- Views
- ActivityDetails
- components
- templates
- ActivityList
- ActivityScreen
- util/activity-adapters
- adapters
- locales/languages
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| |||
Lines changed: 95 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
796 | 796 | | |
797 | 797 | | |
798 | 798 | | |
799 | | - | |
800 | | - | |
801 | 799 | | |
802 | 800 | | |
803 | 801 | | |
804 | | - | |
805 | | - | |
806 | | - | |
| 802 | + | |
807 | 803 | | |
808 | 804 | | |
809 | 805 | | |
810 | | - | |
811 | | - | |
| 806 | + | |
| 807 | + | |
812 | 808 | | |
813 | 809 | | |
814 | 810 | | |
| |||
820 | 816 | | |
821 | 817 | | |
822 | 818 | | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
829 | 824 | | |
830 | 825 | | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
831 | 902 | | |
832 | 903 | | |
833 | 904 | | |
| |||
851 | 922 | | |
852 | 923 | | |
853 | 924 | | |
854 | | - | |
855 | | - | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | | - | |
861 | 925 | | |
862 | 926 | | |
863 | | - | |
| 927 | + | |
864 | 928 | | |
865 | 929 | | |
866 | 930 | | |
| |||
884 | 948 | | |
885 | 949 | | |
886 | 950 | | |
887 | | - | |
888 | | - | |
889 | 951 | | |
890 | 952 | | |
891 | 953 | | |
| |||
1763 | 1825 | | |
1764 | 1826 | | |
1765 | 1827 | | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
1766 | 1833 | | |
1767 | 1834 | | |
1768 | 1835 | | |
| |||
1838 | 1905 | | |
1839 | 1906 | | |
1840 | 1907 | | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
1841 | 1913 | | |
1842 | 1914 | | |
1843 | 1915 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
9 | 16 | | |
10 | 17 | | |
11 | 18 | | |
| |||
55 | 62 | | |
56 | 63 | | |
57 | 64 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
3 | 21 | | |
4 | 22 | | |
5 | 23 | | |
| |||
45 | 63 | | |
46 | 64 | | |
47 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
48 | 72 | | |
49 | 73 | | |
50 | 74 | | |
| |||
Lines changed: 27 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
| |||
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 75 | + | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
| |||
301 | 299 | | |
302 | 300 | | |
303 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
304 | 306 | | |
305 | 307 | | |
306 | 308 | | |
| |||
1221 | 1223 | | |
1222 | 1224 | | |
1223 | 1225 | | |
| 1226 | + | |
| 1227 | + | |
1224 | 1228 | | |
1225 | 1229 | | |
1226 | 1230 | | |
| |||
1240 | 1244 | | |
1241 | 1245 | | |
1242 | 1246 | | |
1243 | | - | |
1244 | | - | |
1245 | | - | |
1246 | | - | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
1247 | 1263 | | |
1248 | 1264 | | |
1249 | 1265 | | |
| |||
1273 | 1289 | | |
1274 | 1290 | | |
1275 | 1291 | | |
| 1292 | + | |
1276 | 1293 | | |
1277 | 1294 | | |
0 commit comments