Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions ui/components/app/perps/perps-view.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,31 @@ describe('PerpsView', () => {
).toBeInTheDocument();
});

it('filters out order and funding transactions from Recent Activity', () => {
// mockTransactions contains trades (tx-001, tx-002, tx-002b),
// a funding entry (tx-003), orders (tx-004 to tx-004d), and a deposit (tx-005)
jest.mocked(usePerpsTransactionHistory).mockReturnValueOnce({
transactions: mocks.mockTransactions,
isLoading: false,
error: null,
refetch: jest.fn(),
});

renderWithProvider(<PerpsView />, mockStore);

// Trade and deposit cards should be shown
expect(screen.getByTestId('transaction-card-tx-001')).toBeInTheDocument();
expect(screen.getByTestId('transaction-card-tx-005')).toBeInTheDocument();

// Funding and order cards must not appear in Recent Activity
expect(
screen.queryByTestId('transaction-card-tx-003'),
).not.toBeInTheDocument();
expect(
screen.queryByTestId('transaction-card-tx-004'),
).not.toBeInTheDocument();
});

it('shows watchlist when mock watchlist symbols match market data', () => {
renderWithProvider(<PerpsView />, mockStore);

Expand Down
16 changes: 15 additions & 1 deletion ui/components/app/perps/perps-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,25 @@ export const PerpsView: React.FC = () => {
} = usePerpsLiveMarketData();

const {
transactions: recentActivityTransactions,
transactions: allRecentActivityTransactions,
isLoading: recentActivityLoading,
error: recentActivityError,
} = usePerpsTransactionHistory();

// Recent Activity shows only trade executions, deposits, and withdrawals.
// Open orders are already surfaced in PerpsPositionsOrders above.
// Funding payments belong in the full activity page.
const recentActivityTransactions = useMemo(
() =>
allRecentActivityTransactions.filter(
(tx) =>
tx.type === 'trade' ||
tx.type === 'deposit' ||
tx.type === 'withdrawal',
),
[allRecentActivityTransactions],
);

// Show only user-placed limit orders resting on the orderbook.
// Excludes:
// - isTrigger: TP/SL trigger orders
Expand Down
Loading