Skip to content
Closed
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
9 changes: 6 additions & 3 deletions src/components/trade/header/user-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,13 @@ export function UserMenu() {
}, []);

async function handleLogout() {
if (authenticated) {
await logout();
try {
if (authenticated) {
await logout();
}
} finally {
disconnect();
}
disconnect();
}

if (!mounted || !ready || isConnecting) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/trade/mobile/mobile-positions-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useConnection } from "wagmi";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Skeleton } from "@/components/ui/skeleton";
import { POSITIONS_TABS, UI_TEXT } from "@/config/constants";
import { HL_ALL_DEXS, POSITIONS_TABS, UI_TEXT } from "@/config/constants";
import { useAccountBalances } from "@/hooks/trade/use-account-balances";
import { cn } from "@/lib/cn";
import { useSubOpenOrders } from "@/lib/hyperliquid/hooks/subscription";
Expand Down Expand Up @@ -32,7 +32,7 @@ export function MobilePositionsView({ className }: MobilePositionsViewProps) {
const { perpPositions, isLoading: isLoadingState } = useAccountBalances();

const { data: ordersEvent, status: ordersStatus } = useSubOpenOrders(
{ user: address ?? "0x0" },
{ user: address ?? "0x0", dex: HL_ALL_DEXS },
{ enabled: isConnected && !!address },
);
const openOrders = ordersEvent?.orders;
Expand Down
6 changes: 5 additions & 1 deletion src/components/trade/mobile/mobile-terminal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMemo, useState } from "react";
import { useConnection } from "wagmi";
import { HL_ALL_DEXS } from "@/config/constants";
import { useAccountBalances } from "@/hooks/trade/use-account-balances";
import { cn } from "@/lib/cn";
import { useSubOpenOrders } from "@/lib/hyperliquid/hooks/subscription";
Expand All @@ -22,7 +23,10 @@ export function MobileTerminal({ className }: Props) {

const { address, isConnected } = useConnection();
const { perpPositions } = useAccountBalances();
const { data: ordersEvent } = useSubOpenOrders({ user: address ?? "0x0" }, { enabled: isConnected && !!address });
const { data: ordersEvent } = useSubOpenOrders(
{ user: address ?? "0x0", dex: HL_ALL_DEXS },
{ enabled: isConnected && !!address },
);
const openOrders = ordersEvent?.orders;

const positionsCount = useMemo(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/trade/positions/orders-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import { FALLBACK_VALUE_PLACEHOLDER } from "@/config/constants";
import { FALLBACK_VALUE_PLACEHOLDER, HL_ALL_DEXS } from "@/config/constants";
import { cn } from "@/lib/cn";
import { formatDateTime, formatToken, formatUSD } from "@/lib/format";
import { useMarkets } from "@/lib/hyperliquid";
Expand Down Expand Up @@ -44,7 +44,7 @@ export function OrdersTab() {
data: openOrdersEvent,
status,
error,
} = useSubOpenOrders({ user: address ?? "0x0" }, { enabled: isConnected && !!address });
} = useSubOpenOrders({ user: address ?? "0x0", dex: HL_ALL_DEXS }, { enabled: isConnected && !!address });
const markets = useMarkets();
const [selectedOrderIds, setSelectedOrderIds] = useState<Set<number>>(() => new Set());

Expand Down
5 changes: 4 additions & 1 deletion src/components/trade/positions/positions-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export function PositionsPanel() {
const { address, isConnected } = useConnection();
const { perpSummary, spotBalances } = useAccountBalances();
const { positions } = useUserPositions();
const { data: ordersEvent } = useSubOpenOrders({ user: address ?? "0x0" }, { enabled: isConnected && !!address });
const { data: ordersEvent } = useSubOpenOrders(
{ user: address ?? "0x0", dex: HL_ALL_DEXS },
{ enabled: isConnected && !!address },
);
const { data: twapStatesEvent } = useSubTwapStates(
{ user: address ?? "0x0", dex: HL_ALL_DEXS },
{ enabled: isConnected && !!address },
Expand Down
12 changes: 11 additions & 1 deletion src/components/trade/tradebox/trade-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ import {
import type { ActiveDialog } from "@/lib/trade/types";
import { useButtonContent } from "@/lib/trade/use-button-content";
import { perpInput, spotInput, useOrderValidation } from "@/lib/trade/use-order-validation";
import { useDepositModalActions, useSettingsDialogActions, useSwapModalActions } from "@/stores/use-global-modal-store";
import {
useDepositModalActions,
useFaucetModalActions,
useSettingsDialogActions,
useSwapModalActions,
} from "@/stores/use-global-modal-store";
import { useMarketOrderSlippageBps, useMarketOrderSlippagePercent } from "@/stores/use-global-settings-store";
import {
useLimitPrice,
Expand Down Expand Up @@ -137,9 +142,12 @@ export function TradePanel() {
const [activeDialog, setActiveDialog] = useState<Exclude<ActiveDialog, "wallet">>(null);

const { open: openDepositModal } = useDepositModalActions();
const { open: openFaucetModal } = useFaucetModalActions();
const { open: openSettingsDialog } = useSettingsDialogActions();
const { open: openSwapModal } = useSwapModalActions();

const isTestnet = import.meta.env.VITE_HYPERLIQUID_TESTNET === "true";

const swapTargetToken = useMemo(() => {
if (!market || market.kind !== "builderPerp") return null;

Expand Down Expand Up @@ -424,8 +432,10 @@ export function TradePanel() {
canApprove,
side,
isSubmitting,
isTestnet,
onConnectWallet: () => !authenticated && login(),
onDeposit: () => openDepositModal("deposit"),
onFaucet: openFaucetModal,
onRegister: handleRegister,
onSubmit: handleSubmit,
});
Expand Down
2 changes: 1 addition & 1 deletion src/config/privy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { PrivyClientConfig } from "@privy-io/react-auth";
import { arbitrum, arbitrumSepolia } from "wagmi/chains";

export const privyConfig: PrivyClientConfig = {
loginMethods: ["google", "wallet"],
loginMethods: ["google", "email", "twitter"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Removing "wallet" from loginMethods prevents users from connecting their existing EOA wallets (like MetaMask or Rabby) directly through the Privy modal. For a trading terminal, supporting direct wallet connections is typically essential for many users. If the intention was to add social logins, consider including "wallet" in the list as well to maintain support for all user types.

Suggested change
loginMethods: ["google", "email", "twitter"],
loginMethods: ["google", "wallet", "email", "twitter"],

embeddedWallets: {
ethereum: {
createOnLogin: "users-without-wallets",
Expand Down
8 changes: 6 additions & 2 deletions src/lib/trade/use-button-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ interface ButtonContentInput {
canApprove: boolean;
side: Side;
isSubmitting: boolean;
isTestnet: boolean;
onConnectWallet: () => void;
onDeposit: () => void;
onFaucet: () => void;
onRegister: () => void;
onSubmit: () => void;
}
Expand Down Expand Up @@ -58,8 +60,8 @@ export function useButtonContent(input: ButtonContentInput): ButtonContent {
}
if (input.availableBalance <= 0) {
return {
text: t`Deposit`,
action: input.onDeposit,
text: input.isTestnet ? t`Deposit USDH or use Faucet` : t`Deposit`,
action: input.isTestnet ? input.onFaucet : input.onDeposit,
disabled: false,
variant: "cyan",
};
Expand All @@ -79,8 +81,10 @@ export function useButtonContent(input: ButtonContentInput): ButtonContent {
isRegistering,
input.canApprove,
input.isAgentLoading,
input.isTestnet,
input.onConnectWallet,
input.onDeposit,
input.onFaucet,
input.onRegister,
input.onSubmit,
input.side,
Expand Down
4 changes: 4 additions & 0 deletions src/locales/ar/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ msgstr ""
#~ msgid "Deposit on Hyperliquid"
#~ msgstr "إيداع في Hyperliquid"

#: src/lib/trade/use-button-content.ts
msgid "Deposit USDH or use Faucet"
msgstr ""

#: src/components/trade/positions/send-dialog.tsx
msgid "Destination"
msgstr ""
Expand Down
4 changes: 4 additions & 0 deletions src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,10 @@ msgstr "Deposit failed"
#~ msgid "Deposit on Hyperliquid"
#~ msgstr "Deposit on Hyperliquid"

#: src/lib/trade/use-button-content.ts
msgid "Deposit USDH or use Faucet"
msgstr "Deposit USDH or use Faucet"

#: src/components/trade/positions/send-dialog.tsx
msgid "Destination"
msgstr "Destination"
Expand Down
4 changes: 4 additions & 0 deletions src/locales/es/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ msgstr ""
#~ msgid "Deposit on Hyperliquid"
#~ msgstr "Depositar en Hyperliquid"

#: src/lib/trade/use-button-content.ts
msgid "Deposit USDH or use Faucet"
msgstr ""

#: src/components/trade/positions/send-dialog.tsx
msgid "Destination"
msgstr ""
Expand Down
4 changes: 4 additions & 0 deletions src/locales/fr/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ msgstr ""
#~ msgid "Deposit on Hyperliquid"
#~ msgstr "Déposer sur Hyperliquid"

#: src/lib/trade/use-button-content.ts
msgid "Deposit USDH or use Faucet"
msgstr ""

#: src/components/trade/positions/send-dialog.tsx
msgid "Destination"
msgstr ""
Expand Down
4 changes: 4 additions & 0 deletions src/locales/hi/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ msgstr ""
#~ msgid "Deposit on Hyperliquid"
#~ msgstr "Hyperliquid पर जमा करें"

#: src/lib/trade/use-button-content.ts
msgid "Deposit USDH or use Faucet"
msgstr ""

#: src/components/trade/positions/send-dialog.tsx
msgid "Destination"
msgstr ""
Expand Down
4 changes: 4 additions & 0 deletions src/locales/zh/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ msgstr ""
#~ msgid "Deposit on Hyperliquid"
#~ msgstr "在 Hyperliquid 存款"

#: src/lib/trade/use-button-content.ts
msgid "Deposit USDH or use Faucet"
msgstr ""

#: src/components/trade/positions/send-dialog.tsx
msgid "Destination"
msgstr ""
Expand Down
4 changes: 4 additions & 0 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@
}

@layer components {
#privy-dialog input#email-input ~ button {
display: none;
}
Comment on lines +394 to +396

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hiding the button following the email input in the Privy dialog (input#email-input ~ button) will likely break the email login flow for mouse users, as they won't be able to submit the form. Additionally, this CSS selector is brittle as it relies on the internal DOM structure of the Privy modal. It is recommended to use Privy's configuration options or dashboard settings for UI customizations instead of forced CSS overrides.


.active\:scale-98:active {
transform: scale(0.98);
}
Expand Down
Loading