Skip to content

Commit bf7e266

Browse files
authored
Merge pull request #3 from dydxprotocol/sync/upstream-main
Sync/upstream main
2 parents 713824e + af2e026 commit bf7e266

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1635
-293
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@cosmjs/tendermint-rpc": "^0.32.1",
5656
"@datadog/browser-logs": "^5.23.3",
5757
"@dydxprotocol/v4-client-js": "3.1.1",
58-
"@dydxprotocol/v4-localization": "1.1.355",
58+
"@dydxprotocol/v4-localization": "1.1.358",
5959
"@dydxprotocol/v4-proto": "^7.0.0-dev.0",
6060
"@emotion/is-prop-valid": "^1.3.0",
6161
"@hugocxl/react-to-image": "^0.0.9",

pnpm-lock.yaml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/configs/v1/env.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,4 +1141,4 @@
11411141
}
11421142
},
11431143
"restrictedLocales": []
1144-
}
1144+
}

src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import { useLocalStorage } from './hooks/useLocalStorage';
5858
import { useReferralCode } from './hooks/useReferralCode';
5959
import { useShouldShowFooter } from './hooks/useShouldShowFooter';
6060
import { useSimpleUiEnabled } from './hooks/useSimpleUiEnabled';
61+
import { useUpdateSwaps } from './hooks/useUpdateSwaps';
6162
import { useUpdateTransfers } from './hooks/useUpdateTransfers';
6263
import { WalletConnectionProvider } from './hooks/useWalletConnection';
6364
import { isTruthy } from './lib/isTruthy';
@@ -94,6 +95,7 @@ const Content = () => {
9495
useAnalytics();
9596
useCommandMenu();
9697
useUpdateTransfers();
98+
useUpdateSwaps();
9799
useReferralCode();
98100
useUiRefreshMigrations();
99101
useOpenDepositIfRelevant();

src/components/Accordion.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Content, Header, Item, Root, Trigger } from '@radix-ui/react-accordion'
22
import styled, { keyframes } from 'styled-components';
33

44
import breakpoints from '@/styles/breakpoints';
5-
import { layoutMixins } from '@/styles/layoutMixins';
65

76
import { Icon, IconName } from './Icon';
87

@@ -14,26 +13,31 @@ export type AccordionItem = {
1413
export type AccordionProps = {
1514
items: AccordionItem[];
1615
className?: string;
16+
triggerIcon?: React.ReactNode;
17+
triggerRotation?: number;
1718
};
1819

19-
export const Accordion = ({ items, className }: AccordionProps) => (
20+
export const Accordion = ({ items, className, triggerIcon, triggerRotation }: AccordionProps) => (
2021
<$Root className={className} type="single" collapsible>
2122
{items.map(({ header, content }, idx) => (
2223
// eslint-disable-next-line react/no-array-index-key
2324
<Item key={idx} value={idx.toString()}>
2425
<Header>
25-
<$Trigger>
26+
<$Trigger $triggerRotation={triggerRotation}>
2627
{header}
27-
<$Icon>
28-
<Icon iconName={IconName.Plus} size="1.125em" />
29-
</$Icon>
28+
{triggerIcon ?? (
29+
<$Icon>
30+
<Icon iconName={IconName.Plus} size="1.125em" />
31+
</$Icon>
32+
)}
3033
</$Trigger>
3134
</Header>
3235
<$Content>{content}</$Content>
3336
</Item>
3437
))}
3538
</$Root>
3639
);
40+
3741
const $Root = styled(Root)`
3842
--accordion-paddingY: 1rem;
3943
--accordion-paddingX: 1rem;
@@ -63,8 +67,10 @@ const $Icon = styled.div`
6367
font: var(--font-small-book);
6468
`;
6569

66-
const $Trigger = styled(Trigger)`
67-
${layoutMixins.spacedRow}
70+
const $Trigger = styled(Trigger)<{ $triggerRotation?: number }>`
71+
display: flex;
72+
align-items: center;
73+
justify-content: space-between;
6874
width: 100%;
6975
padding: var(--accordion-paddingY) var(--accordion-paddingX);
7076
gap: 0.5rem;
@@ -79,13 +85,13 @@ const $Trigger = styled(Trigger)`
7985
}
8086
}
8187
82-
svg {
88+
${$Icon} {
8389
color: var(--color-text-0);
8490
transition: transform 0.3s var(--ease-out-expo);
8591
}
8692
87-
&[data-state='open'] svg {
88-
transform: rotate(45deg);
93+
&[data-state='open'] ${$Icon} {
94+
transform: ${({ $triggerRotation }) => `rotate(${$triggerRotation ?? 45}deg)`};
8995
}
9096
`;
9197

src/components/Icon.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ import {
142142
} from '@/icons';
143143
import { ChaosLabsIcon } from '@/icons/chaos-labs';
144144
import { LogoShortIcon } from '@/icons/logo-short';
145+
import SignalIcon from '@/icons/signal.svg';
145146
import UsdcIcon from '@/icons/usdc.svg';
146147

147148
import { calc } from '@/lib/do';
@@ -257,6 +258,7 @@ export enum IconName {
257258
Shield = 'Shield',
258259
ShieldStroke = 'ShieldStroke',
259260
Show = 'Show',
261+
Signal = 'Signal',
260262
Sparkles = 'Sparkles',
261263
SpeechBubble = 'SpeechBubble',
262264
SocialLogin = 'SocialLogin',
@@ -398,6 +400,7 @@ const icons = {
398400
[IconName.Settings]: SettingsIcon,
399401
[IconName.Share]: ShareIcon,
400402
[IconName.Shield]: ShieldIcon,
403+
[IconName.Signal]: SignalIcon,
401404
[IconName.ShieldStroke]: ShieldStrokeIcon,
402405
[IconName.Show]: ShowIcon,
403406
[IconName.Sparkles]: SparklesIcon,

src/constants/chains.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type Chain = {
99
icon: string;
1010
walletNetworkType: WalletNetworkType;
1111
gasDenom: string;
12+
explorerBaseUrl: string;
1213
};
1314

1415
export const CHAIN_INFO: { [chainId: string]: Chain } = {
@@ -17,60 +18,70 @@ export const CHAIN_INFO: { [chainId: string]: Chain } = {
1718
icon: '/chains/ethereum.png',
1819
walletNetworkType: WalletNetworkType.Evm,
1920
gasDenom: 'ETH',
21+
explorerBaseUrl: 'https://etherscan.io',
2022
},
2123
[arbitrum.id]: {
2224
name: 'Arbitrum',
2325
icon: '/chains/arbitrum.png',
2426
walletNetworkType: WalletNetworkType.Evm,
2527
gasDenom: 'ETH',
28+
explorerBaseUrl: 'https://arbiscan.io',
2629
},
2730
[optimism.id]: {
2831
name: 'Optimism',
2932
icon: '/chains/optimism.png',
3033
walletNetworkType: WalletNetworkType.Evm,
3134
gasDenom: 'ETH',
35+
explorerBaseUrl: 'https://optimistic.etherscan.io',
3236
},
3337
[base.id]: {
3438
name: 'Base',
3539
icon: '/chains/base.png',
3640
walletNetworkType: WalletNetworkType.Evm,
3741
gasDenom: 'ETH',
42+
explorerBaseUrl: 'https://basescan.org',
3843
},
3944
[polygon.id]: {
4045
name: 'Polygon',
4146
icon: '/chains/polygon.png',
4247
walletNetworkType: WalletNetworkType.Evm,
4348
gasDenom: 'POL',
49+
explorerBaseUrl: 'https://polygonscan.com',
4450
},
4551
[avalanche.id]: {
4652
name: 'Avalanche',
4753
icon: '/chains/avalanche.png',
4854
walletNetworkType: WalletNetworkType.Evm,
4955
gasDenom: 'AVAX',
56+
explorerBaseUrl: 'https://snowtrace.io',
5057
},
5158
[SOLANA_MAINNET_ID]: {
5259
name: 'Solana',
5360
icon: '/chains/solana.png',
5461
walletNetworkType: WalletNetworkType.Solana,
5562
gasDenom: 'SOL',
63+
explorerBaseUrl: 'https://explorer.solana.com',
5664
},
5765
[CosmosChainId.Neutron]: {
5866
name: 'Neutron',
5967
icon: '/chains/neutron.png',
6068
walletNetworkType: WalletNetworkType.Cosmos,
6169
gasDenom: 'NTRN',
70+
explorerBaseUrl: 'https://mintscan.io/neutron',
6271
},
6372
[CosmosChainId.Noble]: {
6473
name: 'Noble',
6574
icon: '/chains/noble.png',
6675
walletNetworkType: WalletNetworkType.Cosmos,
6776
gasDenom: 'USDC',
77+
explorerBaseUrl: 'https://mintscan.io/noble',
6878
},
6979
[CosmosChainId.Osmosis]: {
7080
name: 'Osmosis',
7181
icon: '/chains/osmosis.png',
7282
walletNetworkType: WalletNetworkType.Cosmos,
7383
gasDenom: 'OSMO',
84+
explorerBaseUrl: 'https://mintscan.io/osmosis',
7485
},
7586
};
7687

src/constants/notifications.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export enum NotificationType {
2222
FillWithNoOrder = 'FillWithNoOrder',
2323
Order = 'Order',
2424
CosmosWalletLifecycle = 'CosmosWalletLifecycle', // lifecycle events for cosmos wallets
25+
DepositAddressEvents = 'DepositAddressEvents', // lifecycle events for deposit notifications
26+
Swap = 'Swap',
2527
}
2628

2729
export enum NotificationCategoryPreferences {
@@ -41,6 +43,7 @@ export const NotificationTypeCategory: {
4143
[NotificationType.SkipTransfer]: NotificationCategoryPreferences.Transfers,
4244
[NotificationType.SkipTransfer2]: NotificationCategoryPreferences.Transfers,
4345
[NotificationType.FunkitDeposit]: NotificationCategoryPreferences.Transfers,
46+
[NotificationType.Swap]: NotificationCategoryPreferences.Transfers,
4447
[NotificationType.BlockTradingReward]: NotificationCategoryPreferences.Trading, // deprecated
4548
[NotificationType.FillWithNoOrder]: NotificationCategoryPreferences.Trading,
4649
[NotificationType.Order]: NotificationCategoryPreferences.Trading,
@@ -55,6 +58,7 @@ export const NotificationTypeCategory: {
5558
[NotificationType.PredictionMarketConcluded]: NotificationCategoryPreferences.MustSee,
5659
[NotificationType.Custom]: NotificationCategoryPreferences.MustSee,
5760
[NotificationType.CosmosWalletLifecycle]: NotificationCategoryPreferences.MustSee,
61+
[NotificationType.DepositAddressEvents]: NotificationCategoryPreferences.MustSee,
5862
};
5963

6064
export const SingleSessionNotificationTypes = [

src/constants/tokens.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ export const USDC_ADDRESSES = {
1919
[CosmosChainId.Neutron]: 'ibc/B559A80D62249C8AA07A380E2A2BEA6E5CA9A6F079C912C3A9E9B494105E4F81',
2020
};
2121

22+
export const DYDX_CHAIN_DYDX_DENOM = 'adydx';
2223
export const DYDX_CHAIN_USDC_DENOM =
2324
'ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5';
2425

2526
export const USDC_DECIMALS = 6;
27+
export const DYDX_DECIMALS = 18;
2628
export const ETH_DECIMALS = 18;
2729

2830
export type TokenForTransfer = {

src/constants/tooltips/trade.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ export const tradeTooltips = {
159159
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAX_WITHDRAW_TITLE }),
160160
body: stringGetter({ key: TOOLTIP_STRING_KEYS.MAX_WITHDRAW_BODY }),
161161
}),
162+
'max-slippage': ({ stringGetter }) => ({
163+
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAX_SLIPPAGE_TITLE }),
164+
body: stringGetter({ key: TOOLTIP_STRING_KEYS.MAX_SLIPPAGE_BODY }),
165+
}),
162166
'maker-fee': ({ stringGetter }) => ({
163167
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAKER_FEE_TITLE }),
164168
body: stringGetter({ key: TOOLTIP_STRING_KEYS.MAKER_FEE_BODY }),
@@ -227,6 +231,10 @@ export const tradeTooltips = {
227231
title: stringGetter({ key: TOOLTIP_STRING_KEYS.PRICE_IMPACT_TITLE }),
228232
body: stringGetter({ key: TOOLTIP_STRING_KEYS.PRICE_IMPACT_BODY }),
229233
}),
234+
'price-impact-warning': ({ stringGetter }) => ({
235+
title: stringGetter({ key: TOOLTIP_STRING_KEYS.PRICE_IMPACT_WARNING_TITLE }),
236+
body: stringGetter({ key: TOOLTIP_STRING_KEYS.PRICE_IMPACT_WARNING_BODY }),
237+
}),
230238
'realized-pnl': ({ stringGetter }) => ({
231239
title: stringGetter({ key: TOOLTIP_STRING_KEYS.REALIZED_PNL_TITLE }),
232240
body: stringGetter({ key: TOOLTIP_STRING_KEYS.REALIZED_PNL_BODY }),

0 commit comments

Comments
 (0)