Skip to content

Commit 37a85bf

Browse files
committed
chore: adds chain param
1 parent 53996cd commit 37a85bf

5 files changed

Lines changed: 19 additions & 1 deletion

File tree

app/components/Views/SocialLeaderboard/TraderPositionView/TraderPositionView.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ describe('TraderPositionView', () => {
449449
expect.objectContaining({
450450
trader_address: '0xabc',
451451
asset_name: 'PEPE',
452+
chain: 'base',
452453
caip19: expect.stringContaining('eip155:8453/erc20:'),
453454
cta_type: 'buy',
454455
}),
@@ -504,6 +505,7 @@ describe('TraderPositionView', () => {
504505
expect.objectContaining({
505506
trader_address: '0xabc',
506507
asset_name: 'ETH',
508+
chain: 'hyperliquid',
507509
perps_market: 'ETH',
508510
source: 'trader_profile',
509511
}),
@@ -522,6 +524,7 @@ describe('TraderPositionView', () => {
522524
expect.objectContaining({
523525
trader_address: '0xabc',
524526
asset_name: 'ETH',
527+
chain: 'hyperliquid',
525528
perps_market: 'ETH',
526529
cta_type: 'trade',
527530
}),
@@ -539,6 +542,7 @@ describe('TraderPositionView', () => {
539542
MetaMetricsEvents.SOCIAL_FOLLOW_TRADING_TOKEN_DISMISSED,
540543
{
541544
trader_address: '0xabc',
545+
chain: 'hyperliquid',
542546
perps_market: 'ETH',
543547
},
544548
);

app/components/Views/SocialLeaderboard/TraderProfileView/TraderProfileView.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ describe('TraderProfileView', () => {
708708
expect.objectContaining({
709709
trader_address: '0xabc',
710710
asset_name: 'BTC',
711+
chain: 'hyperliquid',
711712
perps_market: 'BTC',
712713
is_open: true,
713714
}),

app/components/Views/SocialLeaderboard/analytics/buildFollowTradingTokenContext.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ describe('buildFollowTradingTokenContext', () => {
5656
expect(context).toEqual({
5757
trader_address: '0xtrader',
5858
asset_name: 'PEPE',
59+
chain: 'base',
5960
caip19: 'eip155:8453/erc20:0x1234567890123456789012345678901234567890',
6061
});
6162
});
@@ -78,6 +79,7 @@ describe('buildFollowTradingTokenContext', () => {
7879
expect(context).toEqual({
7980
trader_address: '0xtrader',
8081
asset_name: 'ETH',
82+
chain: 'hyperliquid',
8183
perps_market: 'ETH',
8284
});
8385
expect(context).not.toHaveProperty('caip19');
@@ -92,6 +94,7 @@ describe('buildFollowTradingTokenContext', () => {
9294
expect(context).toEqual({
9395
trader_address: '0xtrader',
9496
asset_name: 'cash:SPCX',
97+
chain: 'hyperliquid',
9598
perps_market: 'xyz:SPCX',
9699
});
97100
});
@@ -109,6 +112,7 @@ describe('pickFollowTradingDismissedProperties', () => {
109112

110113
expect(pickFollowTradingDismissedProperties(context)).toEqual({
111114
trader_address: '0xtrader',
115+
chain: 'base',
112116
caip19: 'eip155:8453/erc20:0x1234567890123456789012345678901234567890',
113117
});
114118
});
@@ -124,6 +128,7 @@ describe('pickFollowTradingDismissedProperties', () => {
124128

125129
expect(pickFollowTradingDismissedProperties(context)).toEqual({
126130
trader_address: '0xtrader',
131+
chain: 'hyperliquid',
127132
perps_market: 'ETH',
128133
});
129134
expect(pickFollowTradingDismissedProperties(context)).not.toHaveProperty(

app/components/Views/SocialLeaderboard/analytics/buildFollowTradingTokenContext.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { SocialLeaderboardEventProperties } from './socialLeaderboardEvents';
77
export type FollowTradingTokenContext = {
88
[SocialLeaderboardEventProperties.TRADER_ADDRESS]: string;
99
[SocialLeaderboardEventProperties.ASSET_NAME]: string;
10+
[SocialLeaderboardEventProperties.CHAIN]: string;
1011
} & (
1112
| {
1213
[SocialLeaderboardEventProperties.CAIP19]: string;
@@ -36,6 +37,7 @@ export function buildFollowTradingTokenContext(
3637
const base = {
3738
[SocialLeaderboardEventProperties.TRADER_ADDRESS]: traderAddress,
3839
[SocialLeaderboardEventProperties.ASSET_NAME]: position.tokenSymbol,
40+
[SocialLeaderboardEventProperties.CHAIN]: position.chain.toLowerCase(),
3941
};
4042

4143
if (isPerpPosition(position)) {
@@ -67,20 +69,23 @@ export function buildFollowTradingTokenContext(
6769

6870
/**
6971
* Picks only the global identifier fields from a follow-trading context for
70-
* dismissed events (trader_address + caip19 or perps_market).
72+
* dismissed events (trader_address + chain + caip19 or perps_market).
7173
*/
7274
export function pickFollowTradingDismissedProperties(
7375
context: FollowTradingTokenContext,
7476
): Pick<
7577
FollowTradingTokenContext,
7678
| typeof SocialLeaderboardEventProperties.TRADER_ADDRESS
79+
| typeof SocialLeaderboardEventProperties.CHAIN
7780
| typeof SocialLeaderboardEventProperties.CAIP19
7881
| typeof SocialLeaderboardEventProperties.PERPS_MARKET
7982
> {
8083
if (SocialLeaderboardEventProperties.PERPS_MARKET in context) {
8184
return {
8285
[SocialLeaderboardEventProperties.TRADER_ADDRESS]:
8386
context[SocialLeaderboardEventProperties.TRADER_ADDRESS],
87+
[SocialLeaderboardEventProperties.CHAIN]:
88+
context[SocialLeaderboardEventProperties.CHAIN],
8489
[SocialLeaderboardEventProperties.PERPS_MARKET]:
8590
context[SocialLeaderboardEventProperties.PERPS_MARKET],
8691
};
@@ -89,6 +94,8 @@ export function pickFollowTradingDismissedProperties(
8994
return {
9095
[SocialLeaderboardEventProperties.TRADER_ADDRESS]:
9196
context[SocialLeaderboardEventProperties.TRADER_ADDRESS],
97+
[SocialLeaderboardEventProperties.CHAIN]:
98+
context[SocialLeaderboardEventProperties.CHAIN],
9299
[SocialLeaderboardEventProperties.CAIP19]:
93100
context[SocialLeaderboardEventProperties.CAIP19],
94101
};

app/components/Views/SocialLeaderboard/analytics/socialLeaderboardEvents.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const SocialLeaderboardEventProperties = {
1313
ASSET_NAME: 'asset_name',
1414
CAIP19: 'caip19',
1515
PERPS_MARKET: 'perps_market',
16+
CHAIN: 'chain',
1617
CHAIN_FILTER: 'chain_filter',
1718
CTA_TYPE: 'cta_type',
1819
FEED_ACTION: 'feed_action',

0 commit comments

Comments
 (0)