@b3dotfun/sdk 0.0.30 → 0.0.31-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/react/components/AnySpend.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +2 -1
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
- package/dist/cjs/anyspend/react/components/AnyspendDepositHype.js +6 -1
- package/dist/cjs/anyspend/react/components/common/ChainTokenIcon.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/common/ChainTokenIcon.js +2 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +23 -28
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +5 -5
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +3 -3
- package/dist/cjs/anyspend/react/components/common/PaySection.js +1 -1
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +2 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +5 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +1 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +6 -0
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +94 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.d.ts +14 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ContentTokens.js +272 -0
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +9 -51
- package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +10 -0
- package/dist/cjs/global-account/react/components/ManageAccount/TokenBalanceRow.js +8 -0
- package/dist/cjs/global-account/react/components/TokenIcon.d.ts +11 -0
- package/dist/cjs/global-account/react/components/TokenIcon.js +43 -0
- package/dist/cjs/global-account/react/components/ui/accordion.d.ts +7 -0
- package/dist/cjs/global-account/react/components/ui/accordion.js +53 -0
- package/dist/cjs/global-account/react/components/ui/dialog.js +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +2 -0
- package/dist/cjs/global-account/react/hooks/index.js +5 -1
- package/dist/cjs/global-account/react/hooks/useAnalytics.d.ts +7 -0
- package/dist/cjs/global-account/react/hooks/useAnalytics.js +29 -0
- package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +2 -1
- package/dist/cjs/global-account/react/hooks/useNativeBalance.js +2 -1
- package/dist/cjs/global-account/react/hooks/useSimBalance.d.ts +24 -0
- package/dist/cjs/global-account/react/hooks/useSimBalance.js +29 -0
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -1
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -2
- package/dist/cjs/global-account/react/utils/profileDisplay.js +9 -0
- package/dist/cjs/global-account/utils/analytics.d.ts +16 -0
- package/dist/cjs/global-account/utils/analytics.js +55 -0
- package/dist/cjs/shared/constants/index.d.ts +1 -0
- package/dist/cjs/shared/constants/index.js +2 -1
- package/dist/cjs/shared/generated/chain-networks.json +185 -17
- package/dist/esm/anyspend/react/components/AnySpend.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +2 -1
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
- package/dist/esm/anyspend/react/components/AnyspendDepositHype.js +5 -1
- package/dist/esm/anyspend/react/components/common/ChainTokenIcon.d.ts +1 -1
- package/dist/esm/anyspend/react/components/common/ChainTokenIcon.js +2 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +22 -27
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +5 -5
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +4 -4
- package/dist/esm/anyspend/react/components/common/PaySection.js +1 -1
- package/dist/esm/global-account/react/components/B3DynamicModal.js +2 -5
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +5 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +1 -0
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +6 -0
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +88 -0
- package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.d.ts +14 -0
- package/dist/esm/global-account/react/components/ManageAccount/ContentTokens.js +266 -0
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +12 -51
- package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +10 -0
- package/dist/esm/global-account/react/components/ManageAccount/TokenBalanceRow.js +5 -0
- package/dist/esm/global-account/react/components/TokenIcon.d.ts +11 -0
- package/dist/esm/global-account/react/components/TokenIcon.js +37 -0
- package/dist/esm/global-account/react/components/ui/accordion.d.ts +7 -0
- package/dist/esm/global-account/react/components/ui/accordion.js +14 -0
- package/dist/esm/global-account/react/components/ui/dialog.js +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +2 -0
- package/dist/esm/global-account/react/hooks/index.js +2 -0
- package/dist/esm/global-account/react/hooks/useAnalytics.d.ts +7 -0
- package/dist/esm/global-account/react/hooks/useAnalytics.js +26 -0
- package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +2 -1
- package/dist/esm/global-account/react/hooks/useNativeBalance.js +2 -1
- package/dist/esm/global-account/react/hooks/useSimBalance.d.ts +24 -0
- package/dist/esm/global-account/react/hooks/useSimBalance.js +26 -0
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -2
- package/dist/esm/global-account/react/utils/profileDisplay.js +9 -0
- package/dist/esm/global-account/utils/analytics.d.ts +16 -0
- package/dist/esm/global-account/utils/analytics.js +50 -0
- package/dist/esm/shared/constants/index.d.ts +1 -0
- package/dist/esm/shared/constants/index.js +1 -0
- package/dist/esm/shared/generated/chain-networks.json +185 -17
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnyspendDepositHype.d.ts +4 -0
- package/dist/types/anyspend/react/components/common/ChainTokenIcon.d.ts +1 -1
- package/dist/types/anyspend/react/components/common/CryptoReceiveSection.d.ts +3 -1
- package/dist/types/anyspend/react/components/common/PanelOnramp.d.ts +4 -1
- package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +6 -0
- package/dist/types/global-account/react/components/ManageAccount/ContentTokens.d.ts +14 -0
- package/dist/types/global-account/react/components/ManageAccount/TokenBalanceRow.d.ts +10 -0
- package/dist/types/global-account/react/components/TokenIcon.d.ts +11 -0
- package/dist/types/global-account/react/components/ui/accordion.d.ts +7 -0
- package/dist/types/global-account/react/hooks/index.d.ts +2 -0
- package/dist/types/global-account/react/hooks/useAnalytics.d.ts +7 -0
- package/dist/types/global-account/react/hooks/useSimBalance.d.ts +24 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -2
- package/dist/types/global-account/utils/analytics.d.ts +16 -0
- package/dist/types/shared/constants/index.d.ts +1 -0
- package/package.json +10 -18
- package/src/anyspend/react/components/AnySpend.tsx +1 -0
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +2 -1
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +3 -2
- package/src/anyspend/react/components/AnyspendDepositHype.tsx +10 -0
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +4 -4
- package/src/anyspend/react/components/common/ChainTokenIcon.tsx +8 -2
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +56 -107
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +12 -3
- package/src/anyspend/react/components/common/OrderDetails.tsx +5 -5
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +2 -2
- package/src/anyspend/react/components/common/PanelOnramp.tsx +11 -5
- package/src/anyspend/react/components/common/PaySection.tsx +1 -1
- package/src/global-account/react/components/B3DynamicModal.tsx +8 -7
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -0
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +2 -1
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +228 -0
- package/src/global-account/react/components/ManageAccount/ContentTokens.tsx +568 -0
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +86 -341
- package/src/global-account/react/components/ManageAccount/TokenBalanceRow.tsx +46 -0
- package/src/global-account/react/components/TokenIcon.tsx +87 -0
- package/src/global-account/react/components/ui/accordion.tsx +53 -0
- package/src/global-account/react/components/ui/dialog.tsx +1 -1
- package/src/global-account/react/hooks/index.ts +2 -0
- package/src/global-account/react/hooks/useAccountAssets.ts +1 -0
- package/src/global-account/react/hooks/useAnalytics.tsx +30 -0
- package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +3 -2
- package/src/global-account/react/hooks/useNativeBalance.tsx +2 -1
- package/src/global-account/react/hooks/useSimBalance.ts +56 -0
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +3 -1
- package/src/global-account/react/stores/useModalStore.ts +2 -2
- package/src/global-account/react/utils/profileDisplay.ts +9 -0
- package/src/global-account/utils/analytics.ts +64 -0
- package/src/shared/constants/index.ts +2 -0
- package/src/shared/generated/chain-networks.json +185 -17
- package/src/{anyspend/types → types}/window.d.ts +5 -1
- package/dist/cjs/index.d.ts +0 -0
- package/dist/cjs/index.js +0 -2
- package/dist/esm/index.d.ts +0 -0
- package/dist/esm/index.js +0 -2
- package/dist/types/index.d.ts +0 -0
- package/src/index.ts +0 -1
|
@@ -28,8 +28,6 @@ export function B3DynamicModal() {
|
|
|
28
28
|
const { theme } = useB3();
|
|
29
29
|
const isMobile = useIsMobile();
|
|
30
30
|
|
|
31
|
-
let hideCloseButton = false;
|
|
32
|
-
|
|
33
31
|
// Define arrays for different modal type groups
|
|
34
32
|
const fullWidthTypes = [
|
|
35
33
|
"anySpend",
|
|
@@ -57,9 +55,7 @@ export function B3DynamicModal() {
|
|
|
57
55
|
|
|
58
56
|
// Check if current content type is in freestyle types
|
|
59
57
|
const isFreestyleType = freestyleTypes.includes(contentType?.type as string);
|
|
60
|
-
|
|
61
|
-
hideCloseButton = true;
|
|
62
|
-
}
|
|
58
|
+
const hideCloseButton = isFreestyleType;
|
|
63
59
|
|
|
64
60
|
// Build content class using cn utility
|
|
65
61
|
// eslint-disable-next-line tailwindcss/no-custom-classname
|
|
@@ -129,13 +125,18 @@ export function B3DynamicModal() {
|
|
|
129
125
|
"rounded-2xl bg-white shadow-xl dark:bg-gray-900",
|
|
130
126
|
"border border-gray-200 dark:border-gray-800",
|
|
131
127
|
"mx-auto w-full max-w-md",
|
|
132
|
-
"sm:max-w-lg",
|
|
128
|
+
"sm:max-w-lg sm:rounded-b-none",
|
|
133
129
|
)}
|
|
134
130
|
hideCloseButton={hideCloseButton}
|
|
135
131
|
>
|
|
136
132
|
<ModalTitle className="sr-only hidden">{contentType?.type || "Modal"}</ModalTitle>
|
|
137
133
|
<ModalDescription className="sr-only hidden">{contentType?.type || "Modal Body"}</ModalDescription>
|
|
138
|
-
<div
|
|
134
|
+
<div
|
|
135
|
+
className={cn(
|
|
136
|
+
"no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]",
|
|
137
|
+
contentType?.type === "manageAccount" && "h-[90dvh]",
|
|
138
|
+
)}
|
|
139
|
+
>
|
|
139
140
|
{history.length > 0 && contentType?.showBackButton && (
|
|
140
141
|
<button
|
|
141
142
|
onClick={navigateBack}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RelayKitProviderWrapper, TooltipProvider, useAuthStore } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { User } from "@b3dotfun/sdk/global-account/types/b3-api.types";
|
|
3
3
|
import { PermissionsConfig } from "@b3dotfun/sdk/global-account/types/permissions";
|
|
4
|
+
import { loadGA4Script } from "@b3dotfun/sdk/global-account/utils/analytics";
|
|
4
5
|
import { supportedChains } from "@b3dotfun/sdk/shared/constants/chains/supported";
|
|
5
6
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
6
7
|
import { useCallback, useEffect, useState } from "react";
|
|
@@ -60,6 +61,11 @@ export function B3Provider({
|
|
|
60
61
|
style?: React.CSSProperties;
|
|
61
62
|
};
|
|
62
63
|
}) {
|
|
64
|
+
// Initialize Google Analytics on mount
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
loadGA4Script();
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
63
69
|
return (
|
|
64
70
|
<WagmiProvider config={wagmiConfig}>
|
|
65
71
|
<QueryClientProvider client={queryClient}>
|
|
@@ -10,7 +10,7 @@ import { getProfileDisplayInfo } from "../../utils/profileDisplay";
|
|
|
10
10
|
import { useB3 } from "../B3Provider/useB3";
|
|
11
11
|
import { Button } from "../ui/button";
|
|
12
12
|
type OTPStrategy = "email" | "phone";
|
|
13
|
-
type SocialStrategy = "google" | "x" | "discord" | "apple";
|
|
13
|
+
type SocialStrategy = "google" | "x" | "discord" | "apple" | "farcaster";
|
|
14
14
|
type Strategy = OTPStrategy | SocialStrategy;
|
|
15
15
|
|
|
16
16
|
interface AuthMethod {
|
|
@@ -27,6 +27,7 @@ const AUTH_METHODS: AuthMethod[] = [
|
|
|
27
27
|
{ id: "x", label: "X (Twitter)", enabled: true },
|
|
28
28
|
{ id: "discord", label: "Discord", enabled: true },
|
|
29
29
|
{ id: "apple", label: "Apple", enabled: true },
|
|
30
|
+
{ id: "farcaster", label: "Farcaster", enabled: true },
|
|
30
31
|
];
|
|
31
32
|
|
|
32
33
|
export function LinkAccount({
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
CopyToClipboard,
|
|
4
|
+
useAuthentication,
|
|
5
|
+
useB3BalanceFromAddresses,
|
|
6
|
+
useModalStore,
|
|
7
|
+
useNativeBalance,
|
|
8
|
+
useProfile,
|
|
9
|
+
} from "@b3dotfun/sdk/global-account/react";
|
|
10
|
+
import { BankIcon } from "@b3dotfun/sdk/global-account/react/components/icons/BankIcon";
|
|
11
|
+
import { SignOutIcon } from "@b3dotfun/sdk/global-account/react/components/icons/SignOutIcon";
|
|
12
|
+
import { SwapIcon } from "@b3dotfun/sdk/global-account/react/components/icons/SwapIcon";
|
|
13
|
+
import { formatUsername } from "@b3dotfun/sdk/shared/utils";
|
|
14
|
+
import { Loader2, Pencil } from "lucide-react";
|
|
15
|
+
import { useEffect, useRef, useState } from "react";
|
|
16
|
+
import { useActiveAccount } from "thirdweb/react";
|
|
17
|
+
import useFirstEOA from "../../hooks/useFirstEOA";
|
|
18
|
+
import { B3TokenIcon, EthereumTokenIcon } from "../TokenIcon";
|
|
19
|
+
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "../ui/accordion";
|
|
20
|
+
import { TokenBalanceRow } from "./TokenBalanceRow";
|
|
21
|
+
|
|
22
|
+
interface BalanceContentProps {
|
|
23
|
+
onLogout?: () => void;
|
|
24
|
+
partnerId: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function centerTruncate(str: string, length = 4) {
|
|
28
|
+
if (str.length <= length * 2) return str;
|
|
29
|
+
return `${str.slice(0, length)}...${str.slice(-length)}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function BalanceContent({ onLogout, partnerId }: BalanceContentProps) {
|
|
33
|
+
const account = useActiveAccount();
|
|
34
|
+
const { address: eoaAddress, info: eoaInfo } = useFirstEOA();
|
|
35
|
+
const { data: profile } = useProfile({
|
|
36
|
+
address: eoaAddress || account?.address,
|
|
37
|
+
fresh: true,
|
|
38
|
+
});
|
|
39
|
+
const { setB3ModalOpen, setB3ModalContentType } = useModalStore();
|
|
40
|
+
const { logout } = useAuthentication(partnerId);
|
|
41
|
+
const [logoutLoading, setLogoutLoading] = useState(false);
|
|
42
|
+
const [openAccordions, setOpenAccordions] = useState<string[]>([]);
|
|
43
|
+
const hasExpandedRef = useRef(false);
|
|
44
|
+
|
|
45
|
+
console.log("eoaAddress", eoaAddress);
|
|
46
|
+
console.log("account?.address", account?.address);
|
|
47
|
+
|
|
48
|
+
// Balance data fetching
|
|
49
|
+
const { data: eoaNativeBalance, isLoading: eoaNativeLoading } = useNativeBalance(eoaAddress);
|
|
50
|
+
const { data: eoaB3Balance, isLoading: eoaB3Loading } = useB3BalanceFromAddresses(eoaAddress);
|
|
51
|
+
const { data: b3Balance, isLoading: b3Loading } = useB3BalanceFromAddresses(account?.address);
|
|
52
|
+
const { data: nativeBalance, isLoading: nativeLoading } = useNativeBalance(account?.address);
|
|
53
|
+
|
|
54
|
+
// Calculate total USD values for comparison
|
|
55
|
+
const globalAccountTotalUsd = (b3Balance?.balanceUsd || 0) + (nativeBalance?.totalUsd || 0);
|
|
56
|
+
const eoaTotalUsd = (eoaB3Balance?.balanceUsd || 0) + (eoaNativeBalance?.totalUsd || 0);
|
|
57
|
+
|
|
58
|
+
// Check if both data sets are ready (not loading and have data)
|
|
59
|
+
const isGlobalDataReady = !b3Loading && !nativeLoading && b3Balance !== undefined && nativeBalance !== undefined;
|
|
60
|
+
const isEoaDataReady =
|
|
61
|
+
!eoaAddress || (!eoaB3Loading && !eoaNativeLoading && eoaB3Balance !== undefined && eoaNativeBalance !== undefined);
|
|
62
|
+
const isBothDataReady = isGlobalDataReady && isEoaDataReady;
|
|
63
|
+
|
|
64
|
+
// Reset expansion flag when component mounts
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
hasExpandedRef.current = false;
|
|
67
|
+
setOpenAccordions([]);
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
// Auto-expand the appropriate section when data becomes ready
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (isBothDataReady && !hasExpandedRef.current && eoaAddress && account?.address) {
|
|
73
|
+
hasExpandedRef.current = true;
|
|
74
|
+
|
|
75
|
+
// Determine which section to expand based on higher balance
|
|
76
|
+
if (globalAccountTotalUsd === 0 && eoaTotalUsd === 0) {
|
|
77
|
+
// If both have 0 balance, expand global account by default
|
|
78
|
+
setOpenAccordions(["global-account"]);
|
|
79
|
+
} else if (globalAccountTotalUsd >= eoaTotalUsd) {
|
|
80
|
+
setOpenAccordions(["global-account"]);
|
|
81
|
+
} else {
|
|
82
|
+
setOpenAccordions(["eoa-account"]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, [isBothDataReady, globalAccountTotalUsd, eoaTotalUsd, eoaAddress, account?.address]);
|
|
86
|
+
|
|
87
|
+
const onLogoutEnhanced = async () => {
|
|
88
|
+
setLogoutLoading(true);
|
|
89
|
+
await logout();
|
|
90
|
+
onLogout?.();
|
|
91
|
+
setB3ModalOpen(false);
|
|
92
|
+
setLogoutLoading(false);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<div className="flex flex-col gap-6">
|
|
97
|
+
{/* Profile Section */}
|
|
98
|
+
<div className="flex items-center justify-between">
|
|
99
|
+
<div className="flex items-center gap-4">
|
|
100
|
+
<div className="relative">
|
|
101
|
+
{profile?.avatar ? (
|
|
102
|
+
<img src={profile?.avatar} alt="Profile" className="size-24 rounded-full" />
|
|
103
|
+
) : (
|
|
104
|
+
<div className="bg-b3-primary-wash size-24 rounded-full" />
|
|
105
|
+
)}
|
|
106
|
+
<div className="bg-b3-grey border-b3-background absolute -bottom-1 -right-1 flex size-8 items-center justify-center rounded-full border-4">
|
|
107
|
+
<Pencil size={16} className="text-b3-background" />
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
<div>
|
|
111
|
+
<h2 className="text-b3-grey text-xl font-semibold">
|
|
112
|
+
{profile?.displayName || formatUsername(profile?.name || "")}
|
|
113
|
+
</h2>
|
|
114
|
+
<div className="border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors">
|
|
115
|
+
<span className="text-b3-foreground-muted font-mono text-xs">
|
|
116
|
+
{centerTruncate(account?.address || "", 6)}
|
|
117
|
+
</span>
|
|
118
|
+
<CopyToClipboard text={account?.address || ""} />
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
{/* Quick Actions */}
|
|
125
|
+
<div className="grid grid-cols-2 gap-3">
|
|
126
|
+
<Button
|
|
127
|
+
className="manage-account-deposit bg-b3-primary-wash hover:bg-b3-primary-wash/70 h-[84px] w-full flex-col items-start gap-2 rounded-2xl"
|
|
128
|
+
onClick={() => {
|
|
129
|
+
setB3ModalOpen(true);
|
|
130
|
+
setB3ModalContentType({
|
|
131
|
+
type: "anySpend",
|
|
132
|
+
defaultActiveTab: "fiat",
|
|
133
|
+
showBackButton: true,
|
|
134
|
+
});
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
<BankIcon size={24} className="text-b3-primary-blue shrink-0" />
|
|
138
|
+
<div className="text-b3-grey font-neue-montreal-semibold">Deposit</div>
|
|
139
|
+
</Button>
|
|
140
|
+
<Button
|
|
141
|
+
className="manage-account-swap bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex h-[84px] w-full flex-col items-start gap-2 rounded-2xl"
|
|
142
|
+
onClick={() => {
|
|
143
|
+
setB3ModalOpen(true);
|
|
144
|
+
setB3ModalContentType({
|
|
145
|
+
type: "anySpend",
|
|
146
|
+
showBackButton: true,
|
|
147
|
+
});
|
|
148
|
+
}}
|
|
149
|
+
>
|
|
150
|
+
<SwapIcon size={24} className="text-b3-primary-blue" />
|
|
151
|
+
<div className="text-b3-grey font-neue-montreal-semibold">Swap</div>
|
|
152
|
+
</Button>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
{/* Balance Sections with Accordions */}
|
|
156
|
+
<Accordion type="multiple" value={openAccordions} onValueChange={setOpenAccordions} className="space-y-2">
|
|
157
|
+
{/* Global Account Balance Section */}
|
|
158
|
+
<AccordionItem value="global-account" className="border-none">
|
|
159
|
+
<AccordionTrigger className="text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline">
|
|
160
|
+
<span>Balance</span>
|
|
161
|
+
</AccordionTrigger>
|
|
162
|
+
<AccordionContent className="space-y-4">
|
|
163
|
+
<TokenBalanceRow
|
|
164
|
+
icon={<B3TokenIcon className="size-10" />}
|
|
165
|
+
name="B3"
|
|
166
|
+
balance={`${b3Balance?.formattedTotal || "0.00"} B3`}
|
|
167
|
+
usdValue={b3Balance?.balanceUsdFormatted || "0.00"}
|
|
168
|
+
priceChange={b3Balance?.priceChange24h}
|
|
169
|
+
/>
|
|
170
|
+
<TokenBalanceRow
|
|
171
|
+
icon={<EthereumTokenIcon className="size-10" />}
|
|
172
|
+
name="Ethereum"
|
|
173
|
+
balance={`${nativeBalance?.formattedTotal || "0.00"} ETH`}
|
|
174
|
+
usdValue={nativeBalance?.formattedTotalUsd || "0.00"}
|
|
175
|
+
priceChange={nativeBalance?.priceChange24h}
|
|
176
|
+
/>
|
|
177
|
+
</AccordionContent>
|
|
178
|
+
</AccordionItem>
|
|
179
|
+
|
|
180
|
+
{/* EOA Account Balance Section */}
|
|
181
|
+
{eoaAddress && (
|
|
182
|
+
<AccordionItem value="eoa-account" className="border-none">
|
|
183
|
+
<AccordionTrigger className="text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline">
|
|
184
|
+
<div className="flex items-center gap-3">
|
|
185
|
+
<span>Connected {eoaInfo?.data?.name || "Wallet"}</span>
|
|
186
|
+
<div className="border-b3-line bg-b3-line/20 hover:bg-b3-line/40 flex w-fit items-center gap-2 rounded-full border px-3 py-1 transition-colors">
|
|
187
|
+
<span className="text-b3-foreground-muted font-mono text-xs">{centerTruncate(eoaAddress, 6)}</span>
|
|
188
|
+
<CopyToClipboard text={eoaAddress} />
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</AccordionTrigger>
|
|
192
|
+
<AccordionContent className="space-y-4">
|
|
193
|
+
<TokenBalanceRow
|
|
194
|
+
icon={<B3TokenIcon className="size-10" />}
|
|
195
|
+
name="B3"
|
|
196
|
+
balance={`${eoaB3Balance?.formattedTotal || "0.00"} B3`}
|
|
197
|
+
usdValue={eoaB3Balance?.balanceUsdFormatted || "0.00"}
|
|
198
|
+
priceChange={eoaB3Balance?.priceChange24h}
|
|
199
|
+
/>
|
|
200
|
+
<TokenBalanceRow
|
|
201
|
+
icon={<EthereumTokenIcon className="size-10" />}
|
|
202
|
+
name="Ethereum"
|
|
203
|
+
balance={`${eoaNativeBalance?.formattedTotal || "0.00"} ETH`}
|
|
204
|
+
usdValue={eoaNativeBalance?.formattedTotalUsd || "0.00"}
|
|
205
|
+
priceChange={eoaNativeBalance?.priceChange24h}
|
|
206
|
+
/>
|
|
207
|
+
</AccordionContent>
|
|
208
|
+
</AccordionItem>
|
|
209
|
+
)}
|
|
210
|
+
</Accordion>
|
|
211
|
+
|
|
212
|
+
{/* Sign Out */}
|
|
213
|
+
<button
|
|
214
|
+
className="border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors"
|
|
215
|
+
onClick={onLogoutEnhanced}
|
|
216
|
+
>
|
|
217
|
+
<span className="font-neue-montreal-semibold text-b3-grey">Sign out</span>
|
|
218
|
+
<div className="absolute right-4">
|
|
219
|
+
{logoutLoading ? (
|
|
220
|
+
<Loader2 className="animate-spin" size={16} />
|
|
221
|
+
) : (
|
|
222
|
+
<SignOutIcon size={16} className="text-b3-grey" />
|
|
223
|
+
)}
|
|
224
|
+
</div>
|
|
225
|
+
</button>
|
|
226
|
+
</div>
|
|
227
|
+
);
|
|
228
|
+
}
|