@b3dotfun/sdk 0.0.35-alpha.2 → 0.0.35-alpha.4

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.
Files changed (61) hide show
  1. package/dist/cjs/global-account/bsmnt.d.ts +2 -0
  2. package/dist/cjs/global-account/bsmnt.js +42 -1
  3. package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +6 -0
  4. package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +55 -0
  5. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +6 -0
  6. package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +108 -0
  7. package/dist/cjs/global-account/react/components/B3DynamicModal.js +9 -1
  8. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.d.ts +3 -1
  9. package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +19 -5
  10. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.d.ts +3 -1
  11. package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +6 -6
  12. package/dist/cjs/global-account/react/hooks/useAccountWallet.js +3 -2
  13. package/dist/cjs/global-account/react/hooks/useAuthentication.js +7 -0
  14. package/dist/cjs/global-account/react/hooks/useProfile.d.ts +1 -1
  15. package/dist/cjs/global-account/react/hooks/useRPMToken.d.ts +7 -0
  16. package/dist/cjs/global-account/react/hooks/useRPMToken.js +11 -0
  17. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +11 -1
  18. package/dist/cjs/global-account/react/utils/updateAvatar.d.ts +4 -0
  19. package/dist/cjs/global-account/react/utils/updateAvatar.js +54 -0
  20. package/dist/esm/global-account/bsmnt.d.ts +2 -0
  21. package/dist/esm/global-account/bsmnt.js +39 -0
  22. package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +6 -0
  23. package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +52 -0
  24. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +6 -0
  25. package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +102 -0
  26. package/dist/esm/global-account/react/components/B3DynamicModal.js +9 -1
  27. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.d.ts +3 -1
  28. package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +20 -6
  29. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.d.ts +3 -1
  30. package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +6 -6
  31. package/dist/esm/global-account/react/hooks/useAccountWallet.js +3 -2
  32. package/dist/esm/global-account/react/hooks/useAuthentication.js +7 -0
  33. package/dist/esm/global-account/react/hooks/useProfile.d.ts +1 -1
  34. package/dist/esm/global-account/react/hooks/useRPMToken.d.ts +7 -0
  35. package/dist/esm/global-account/react/hooks/useRPMToken.js +8 -0
  36. package/dist/esm/global-account/react/stores/useModalStore.d.ts +11 -1
  37. package/dist/esm/global-account/react/utils/updateAvatar.d.ts +4 -0
  38. package/dist/esm/global-account/react/utils/updateAvatar.js +18 -0
  39. package/dist/styles/index.css +1 -1
  40. package/dist/types/global-account/bsmnt.d.ts +2 -0
  41. package/dist/types/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +6 -0
  42. package/dist/types/global-account/react/components/AvatarEditor/AvatarEditor.d.ts +6 -0
  43. package/dist/types/global-account/react/components/ManageAccount/BalanceContent.d.ts +3 -1
  44. package/dist/types/global-account/react/components/ManageAccount/ManageAccount.d.ts +3 -1
  45. package/dist/types/global-account/react/hooks/useProfile.d.ts +1 -1
  46. package/dist/types/global-account/react/hooks/useRPMToken.d.ts +7 -0
  47. package/dist/types/global-account/react/stores/useModalStore.d.ts +11 -1
  48. package/dist/types/global-account/react/utils/updateAvatar.d.ts +4 -0
  49. package/package.json +6 -5
  50. package/src/global-account/bsmnt.ts +47 -0
  51. package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +90 -0
  52. package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +233 -0
  53. package/src/global-account/react/components/B3DynamicModal.tsx +27 -2
  54. package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +63 -35
  55. package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +106 -78
  56. package/src/global-account/react/hooks/useAccountWallet.tsx +3 -2
  57. package/src/global-account/react/hooks/useAuthentication.ts +9 -0
  58. package/src/global-account/react/hooks/useProfile.ts +1 -1
  59. package/src/global-account/react/hooks/useRPMToken.ts +17 -0
  60. package/src/global-account/react/stores/useModalStore.ts +13 -1
  61. package/src/global-account/react/utils/updateAvatar.ts +21 -0
@@ -84,6 +84,10 @@ export interface ManageAccountModalProps extends BaseModalProps {
84
84
  setActiveTab?: (tab: "overview" | "tokens" | "nfts" | "apps" | "settings") => void;
85
85
  /** Whether to show the referral information */
86
86
  showReferralInfo?: boolean;
87
+ /** Whether to show the swap button */
88
+ showSwap?: boolean;
89
+ /** Whether to show the deposit button */
90
+ showDeposit?: boolean;
87
91
  }
88
92
  /**
89
93
  * Props for the AnySpend modal
@@ -287,10 +291,16 @@ export interface AnySpendDepositHypeProps extends BaseModalProps {
287
291
  /** Callback function called when the deposit is successful */
288
292
  onSuccess?: (amount?: string) => void;
289
293
  }
294
+ export interface AvatarEditorModalProps extends BaseModalProps {
295
+ /** Modal type identifier */
296
+ type: "avatarEditor";
297
+ /** Callback function called when avatar is successfully set */
298
+ onSuccess?: () => void;
299
+ }
290
300
  /**
291
301
  * Union type of all possible modal content types
292
302
  */
293
- export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps;
303
+ export type ModalContentType = SignInWithB3ModalProps | RequestPermissionsModalProps | ManageAccountModalProps | AnySpendModalProps | AnyspendOrderDetailsProps | AnySpendNftProps | AnySpendJoinTournamentProps | AnySpendFundTournamentProps | AnySpendOrderHistoryProps | AnySpendStakeB3Props | AnySpendBuySpinProps | AnySpendSignatureMintProps | AnySpendBondKitProps | LinkAccountModalProps | AnySpendDepositHypeProps | AvatarEditorModalProps;
294
304
  /**
295
305
  * State interface for the modal store
296
306
  */
@@ -0,0 +1,4 @@
1
+ export declare function updateAvatar(avatar: string): Promise<{
2
+ success: boolean;
3
+ error?: string;
4
+ }>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.updateAvatar = updateAvatar;
37
+ const bsmnt_1 = __importStar(require("../../../global-account/bsmnt"));
38
+ const debug_1 = require("../../../shared/utils/debug");
39
+ const debug = (0, debug_1.debugB3React)("updateAvatar");
40
+ async function updateAvatar(avatar) {
41
+ try {
42
+ // Extract avatar ID from URL
43
+ const avatarID = (0, bsmnt_1.extractAvatarIdFromUrl)(avatar);
44
+ if (!avatarID) {
45
+ throw new Error("Invalid avatar URL");
46
+ }
47
+ // Set the avatar in the profiles service
48
+ return await bsmnt_1.default.service("profiles").setAvatar({ avatarUrl: String(avatar), avatarID: String(avatarID) }, {});
49
+ }
50
+ catch (error) {
51
+ debug("Failed to update avatar:", error);
52
+ throw error; // Re-throw to handle in component
53
+ }
54
+ }
@@ -1,4 +1,6 @@
1
1
  declare const app: import("@b3dotfun/basement-api").ClientApplication;
2
2
  export declare const authenticate: (accessToken: string, identityToken: string, params?: Record<string, any>) => Promise<import("@feathersjs/authentication").AuthenticationResult | null>;
3
3
  export declare const resetSocket: () => void;
4
+ export declare function extractAvatarIdFromUrl(url: string): string | null;
5
+ export declare const authenticateWithB3JWT: (fullToken: string, params?: Record<string, any>) => Promise<import("@feathersjs/authentication").AuthenticationResult | null>;
4
6
  export default app;
@@ -1,8 +1,10 @@
1
1
  import { createClient } from "@b3dotfun/basement-api";
2
+ import { debugB3React } from "../shared/utils/debug.js";
2
3
  import { AuthenticationClient } from "@feathersjs/authentication-client";
3
4
  import socketio from "@feathersjs/socketio-client";
4
5
  import Cookies from "js-cookie";
5
6
  import io from "socket.io-client";
7
+ const debug = debugB3React("bsmnt");
6
8
  // Also use b3 auth token since we are using b3-jwt strategy
7
9
  const BSMNT_AUTH_COOKIE_NAME = "b3-auth";
8
10
  const BSMNT_API_URL = process.env.EXPO_PUBLIC_BSMNT_API ||
@@ -58,4 +60,41 @@ export const resetSocket = () => {
58
60
  socket.connect();
59
61
  // reset the socket connection
60
62
  };
63
+ export function extractAvatarIdFromUrl(url) {
64
+ const regex = /https:\/\/models\.readyplayer\.me\/([a-f0-9]{24})\.[a-zA-Z0-9]+/;
65
+ const match = url.match(regex);
66
+ return match ? match[1] : null;
67
+ }
68
+ export const authenticateWithB3JWT = async (fullToken, params) => {
69
+ // Do not authenticate if there is no token
70
+ if (!fullToken) {
71
+ console.log("No token found, not authenticating");
72
+ return null;
73
+ }
74
+ debug("Authenticating with token:12", fullToken);
75
+ try {
76
+ const response = await app.authenticate({
77
+ strategy: "b3-jwt",
78
+ accessToken: fullToken,
79
+ }, {
80
+ query: params || {},
81
+ });
82
+ debug("Authenticated", response);
83
+ // Store streamToken if it exists in the response
84
+ if (response?.streamToken) {
85
+ Cookies.set("stream-token", response.streamToken, {
86
+ expires: new Date(response.authExpires),
87
+ secure: process.env.NODE_ENV === "production",
88
+ sameSite: "strict",
89
+ });
90
+ debug("Stream token stored in cookies");
91
+ }
92
+ return response;
93
+ }
94
+ catch (error) {
95
+ debug(`Authentication error:5`, error);
96
+ debug("Authentication JWT", fullToken);
97
+ return null;
98
+ }
99
+ };
61
100
  export default app;
@@ -0,0 +1,6 @@
1
+ interface AvatarCreatorProps {
2
+ onSetAvatar?: () => void;
3
+ className?: string;
4
+ }
5
+ export declare function AvatarCreator({ onSetAvatar, className }: AvatarCreatorProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useProfile } from "../../../../global-account/react/index.js";
4
+ import { useRPMToken } from "../../../../global-account/react/hooks/useRPMToken.js";
5
+ import { updateAvatar } from "../../../../global-account/react/utils/updateAvatar.js";
6
+ import { cn } from "../../../../shared/utils/cn.js";
7
+ import { debugB3React } from "../../../../shared/utils/debug.js";
8
+ import { AvatarCreator as AvatarCreatorRPM, } from "@readyplayerme/react-avatar-creator";
9
+ import { useState } from "react";
10
+ import { toast } from "sonner";
11
+ import { useActiveAccount } from "thirdweb/react";
12
+ const debug = debugB3React("AvatarCreator");
13
+ const config = {
14
+ clearCache: true,
15
+ bodyType: "fullbody",
16
+ quickStart: true,
17
+ language: "en",
18
+ };
19
+ export function AvatarCreator({ onSetAvatar, className }) {
20
+ const { token, refetch: refetchRPMToken } = useRPMToken();
21
+ const [loading, setIsLoading] = useState(false);
22
+ const account = useActiveAccount();
23
+ const { data: profile, refetch: refreshProfile } = useProfile({
24
+ address: account?.address,
25
+ fresh: true,
26
+ });
27
+ const hasAvatar = profile?.avatar;
28
+ const handleOnAvatarExported = async (event) => {
29
+ setIsLoading(true);
30
+ debug("@@AvatarExportedEvent", event);
31
+ try {
32
+ const avatarUpload = await updateAvatar(event.data.url);
33
+ debug("@@avatarUpload", avatarUpload);
34
+ await refreshProfile();
35
+ toast.success(hasAvatar ? "Nice look! Your avatar has been updated!" : "Looks great! Your avatar has been saved!");
36
+ onSetAvatar?.();
37
+ await refetchRPMToken(undefined);
38
+ }
39
+ catch (e) {
40
+ debug("@@error:AvatarCreator", e);
41
+ toast.error("Failed to update avatar. Please try again.");
42
+ }
43
+ setIsLoading(false);
44
+ };
45
+ if (loading) {
46
+ return (_jsxs("div", { className: "flex h-[80vh] w-full flex-col items-center justify-center gap-4", children: [_jsx("div", { className: "border-primary h-8 w-8 animate-spin rounded-full border-4 border-t-transparent" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: "Saving your avatar" })] }));
47
+ }
48
+ if (!token) {
49
+ return (_jsxs("div", { className: "flex h-[80vh] w-full flex-col items-center justify-center gap-4", children: [_jsx("div", { className: "border-primary h-8 w-8 animate-spin rounded-full border-4 border-t-transparent" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: "Loading avatar creator" })] }));
50
+ }
51
+ return (_jsx("div", { className: cn("h-[calc(90vh-2px)] w-full", className), children: _jsx(AvatarCreatorRPM, { className: "h-full w-full", subdomain: "b3", config: { ...config, token }, onAvatarExported: handleOnAvatarExported }) }));
52
+ }
@@ -0,0 +1,6 @@
1
+ interface AvatarEditorProps {
2
+ onSetAvatar?: () => void;
3
+ className?: string;
4
+ }
5
+ export declare function AvatarEditor({ onSetAvatar, className }: AvatarEditorProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,102 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import app from "../../../../global-account/app.js";
4
+ import { Button, useB3, useProfile } from "../../../../global-account/react/index.js";
5
+ import { cn } from "../../../../shared/utils/cn.js";
6
+ import { debugB3React } from "../../../../shared/utils/debug.js";
7
+ import { client } from "../../../../shared/utils/thirdweb.js";
8
+ import { Check, Loader2, Upload, X } from "lucide-react";
9
+ import { useRef, useState } from "react";
10
+ import { toast } from "sonner";
11
+ import { useActiveAccount } from "thirdweb/react";
12
+ import { upload } from "thirdweb/storage";
13
+ const debug = debugB3React("AvatarEditor");
14
+ export function AvatarEditor({ onSetAvatar, className }) {
15
+ const [selectedFile, setSelectedFile] = useState(null);
16
+ const [previewUrl, setPreviewUrl] = useState(null);
17
+ const [isUploading, setIsUploading] = useState(false);
18
+ const [isSaving, setIsSaving] = useState(false);
19
+ const fileInputRef = useRef(null);
20
+ const { setUser } = useB3();
21
+ const account = useActiveAccount();
22
+ const { data: profile, refetch: refreshProfile } = useProfile({
23
+ address: account?.address,
24
+ fresh: true,
25
+ });
26
+ // Thirdweb upload function
27
+ const hasAvatar = profile?.avatar;
28
+ const handleFileSelect = (event) => {
29
+ const file = event.target.files?.[0];
30
+ if (file) {
31
+ // Validate file type
32
+ if (!file.type.startsWith("image/")) {
33
+ toast.error("Please select an image file");
34
+ return;
35
+ }
36
+ // Validate file size (max 5MB)
37
+ if (file.size > 5 * 1024 * 1024) {
38
+ toast.error("File size must be less than 5MB");
39
+ return;
40
+ }
41
+ setSelectedFile(file);
42
+ // Create preview URL
43
+ const url = URL.createObjectURL(file);
44
+ setPreviewUrl(url);
45
+ }
46
+ };
47
+ const handleRemoveFile = () => {
48
+ setSelectedFile(null);
49
+ if (previewUrl) {
50
+ URL.revokeObjectURL(previewUrl);
51
+ setPreviewUrl(null);
52
+ }
53
+ if (fileInputRef.current) {
54
+ fileInputRef.current.value = "";
55
+ }
56
+ };
57
+ const handleUpload = async () => {
58
+ if (!selectedFile) {
59
+ toast.error("Please select an image first");
60
+ return;
61
+ }
62
+ setIsUploading(true);
63
+ try {
64
+ debug("Starting upload to IPFS", selectedFile);
65
+ // Upload to IPFS using Thirdweb
66
+ const ipfsUrl = await upload({
67
+ client,
68
+ files: [selectedFile],
69
+ });
70
+ debug("Upload successful", ipfsUrl);
71
+ // Save avatar URL using profiles service
72
+ setIsSaving(true);
73
+ const user = await app.service("users").setAvatar({
74
+ avatar: ipfsUrl,
75
+ },
76
+ // @ts-expect-error - our typed client is expecting context even though it's set elsewhere
77
+ {});
78
+ // update user
79
+ // @ts-expect-error this resolved fine, look into why expect-error needed
80
+ setUser(user);
81
+ // Refresh profile to get updated avatar
82
+ await refreshProfile();
83
+ toast.success(hasAvatar ? "Nice look! Your avatar has been updated!" : "Looks great! Your avatar has been saved!");
84
+ onSetAvatar?.();
85
+ // Clean up
86
+ handleRemoveFile();
87
+ }
88
+ catch (error) {
89
+ debug("Error uploading avatar:", error);
90
+ toast.error("Failed to upload avatar. Please try again.");
91
+ }
92
+ finally {
93
+ setIsUploading(false);
94
+ setIsSaving(false);
95
+ }
96
+ };
97
+ const handleFileInputClick = () => {
98
+ fileInputRef.current?.click();
99
+ };
100
+ const isLoading = isUploading || isSaving;
101
+ return (_jsxs("div", { className: cn("flex flex-col items-center justify-center space-y-6 p-8", className), children: [_jsxs("div", { className: "space-y-2 text-center", children: [_jsx("h2", { className: "font-neue-montreal-semibold text-b3-grey text-2xl", children: hasAvatar ? "Update Your Avatar" : "Set Your Avatar" }), _jsx("p", { className: "text-b3-foreground-muted font-neue-montreal-medium", children: "Upload an image to personalize your profile" })] }), hasAvatar && !previewUrl && (_jsx("div", { className: "relative", children: _jsx("div", { className: "border-b3-primary-blue h-32 w-32 overflow-hidden rounded-full border-4", children: _jsx("img", { src: profile.avatar, alt: "Current avatar", className: "h-full w-full object-cover" }) }) })), _jsxs("div", { className: "w-full max-w-md", children: [!selectedFile ? (_jsxs("div", { onClick: handleFileInputClick, className: "border-b3-line hover:border-b3-primary-blue hover:bg-b3-primary-wash/20 cursor-pointer rounded-xl border-2 border-dashed p-8 text-center transition-colors", children: [_jsx(Upload, { className: "text-b3-grey mx-auto mb-4 h-12 w-12" }), _jsx("p", { className: "text-b3-grey font-neue-montreal-semibold mb-2", children: "Click to select an image" }), _jsx("p", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "PNG, JPG, or GIF up to 5MB" })] })) : (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "relative", children: [_jsx("div", { className: "border-b3-primary-blue mx-auto h-32 w-32 overflow-hidden rounded-full border-4", children: previewUrl ? (_jsx("img", { src: previewUrl, alt: "Preview", className: "h-full w-full object-cover" })) : (_jsx("div", { className: "bg-b3-primary-wash flex h-full w-full items-center justify-center rounded-full", children: _jsx("p", { className: "text-b3-grey font-neue-montreal-semibold text-sm", children: "No file selected" }) })) }), _jsx("button", { onClick: handleRemoveFile, className: "bg-b3-negative absolute -right-2 -top-2 flex h-8 w-8 items-center justify-center rounded-full text-white transition-colors hover:bg-red-600", disabled: isLoading, children: _jsx(X, { size: 16 }) })] }), _jsxs("div", { className: "space-y-1 text-center", children: [_jsx("p", { className: "text-b3-grey font-neue-montreal-semibold text-sm", children: selectedFile.name }), _jsxs("p", { className: "text-b3-foreground-muted font-neue-montreal-medium text-xs", children: [(selectedFile.size / 1024 / 1024).toFixed(2), " MB"] })] })] })), _jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileSelect, className: "hidden" })] }), _jsxs("div", { className: "flex w-full max-w-md gap-3", children: [selectedFile && (_jsx(Button, { onClick: handleUpload, disabled: isLoading, className: "bg-b3-primary-blue hover:bg-b3-primary-blue/90 flex-1 text-white", children: isLoading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), isUploading ? "Uploading..." : "Saving..."] })) : (_jsxs(_Fragment, { children: [_jsx(Check, { className: "mr-2 h-4 w-4" }), hasAvatar ? "Update Avatar" : "Set Avatar"] })) })), _jsxs(Button, { variant: "outline", onClick: handleFileInputClick, disabled: isLoading, className: "flex-1", children: [_jsx(Upload, { className: "mr-2 h-4 w-4" }), selectedFile ? "Change Image" : "Select Image"] })] }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium max-w-md text-center text-xs", children: _jsx("p", { children: "Your avatar will be uploaded to IPFS and stored securely. Make sure you have the rights to use this image." }) })] }));
102
+ }
@@ -4,6 +4,7 @@ import { AnySpendDepositHype } from "../../../anyspend/react/components/Anyspend
4
4
  import { useIsMobile, useModalStore } from "../../../global-account/react/index.js";
5
5
  import { cn } from "../../../shared/utils/cn.js";
6
6
  import { debugB3React } from "../../../shared/utils/debug.js";
7
+ import { AvatarEditor } from "./AvatarEditor/AvatarEditor.js";
7
8
  import { useB3 } from "./B3Provider/useB3.js";
8
9
  import { LinkAccount } from "./LinkAccount/LinkAccount.js";
9
10
  import { ManageAccount } from "./ManageAccount/ManageAccount.js";
@@ -29,6 +30,7 @@ export function B3DynamicModal() {
29
30
  "anySpendSignatureMint",
30
31
  "anySpendBondKit",
31
32
  "linkAccount",
33
+ "avatarEditor",
32
34
  ];
33
35
  const freestyleTypes = [
34
36
  "anySpendNft",
@@ -80,6 +82,8 @@ export function B3DynamicModal() {
80
82
  return _jsx(LinkAccount, { ...contentType });
81
83
  case "anySpendDepositHype":
82
84
  return _jsx(AnySpendDepositHype, { ...contentType, mode: "modal" });
85
+ case "avatarEditor":
86
+ return _jsx(AvatarEditor, { onSetAvatar: contentType.onSuccess });
83
87
  // Add other modal types here
84
88
  default:
85
89
  return null;
@@ -89,5 +93,9 @@ export function B3DynamicModal() {
89
93
  const ModalContent = isMobile ? DrawerContent : DialogContent;
90
94
  const ModalTitle = isMobile ? DrawerTitle : DialogTitle;
91
95
  const ModalDescription = isMobile ? DrawerDescription : DialogDescription;
92
- return (_jsx(ModalComponent, { open: isOpen, onOpenChange: setB3ModalOpen, children: _jsxs(ModalContent, { className: cn(contentClass, "rounded-2xl bg-white shadow-xl dark:bg-gray-900", "border border-gray-200 dark:border-gray-800", "mx-auto w-full max-w-md", "sm:max-w-lg sm:rounded-b-none"), hideCloseButton: hideCloseButton, children: [_jsx(ModalTitle, { className: "sr-only hidden", children: contentType?.type || "Modal" }), _jsx(ModalDescription, { className: "sr-only hidden", children: contentType?.type || "Modal Body" }), _jsxs("div", { className: cn("no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]"), children: [history.length > 0 && contentType?.showBackButton && (_jsxs("button", { onClick: navigateBack, className: "flex items-center gap-2 px-6 py-4 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-white", children: [_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M15.8337 10H4.16699", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M10.0003 15.8334L4.16699 10L10.0003 4.16669", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }), _jsx("span", { className: "text-sm font-medium", children: "Back" })] })), renderContent()] })] }) }));
96
+ return (_jsxs(ModalComponent, { open: isOpen, onOpenChange: setB3ModalOpen, children: [_jsxs(ModalContent, { className: cn(contentClass, "rounded-2xl bg-white shadow-xl dark:bg-gray-900", "border border-gray-200 dark:border-gray-800",
97
+ // Remove default width classes for avatar editor
98
+ contentType?.type === "avatarEditor"
99
+ ? "!w-[90vw] !max-w-none" // Use !important to override default styles
100
+ : "mx-auto w-full max-w-md sm:max-w-lg"), hideCloseButton: hideCloseButton, children: [_jsx(ModalTitle, { className: "sr-only hidden", children: contentType?.type || "Modal" }), _jsx(ModalDescription, { className: "sr-only hidden", children: contentType?.type || "Modal Body" }), _jsxs("div", { className: cn("no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]"), children: [history.length > 0 && contentType?.showBackButton && (_jsxs("button", { onClick: navigateBack, className: "flex items-center gap-2 px-6 py-4 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-white", children: [_jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M15.8337 10H4.16699", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M10.0003 15.8334L4.16699 10L10.0003 4.16669", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }), _jsx("span", { className: "text-sm font-medium", children: "Back" })] })), renderContent()] })] }), contentType?.type === "avatarEditor" && (_jsx("button", { onClick: () => setB3ModalOpen(false), className: "fixed right-5 top-5 z-[100] cursor-pointer text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-white", children: _jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M18 6L6 18M6 6L18 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }))] }));
93
101
  }
@@ -1,6 +1,8 @@
1
1
  interface BalanceContentProps {
2
2
  onLogout?: () => void;
3
3
  partnerId: string;
4
+ showDeposit?: boolean;
5
+ showSwap?: boolean;
4
6
  }
5
- export declare function BalanceContent({ onLogout, partnerId }: BalanceContentProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function BalanceContent({ onLogout, partnerId, showDeposit, showSwap }: BalanceContentProps): import("react/jsx-runtime").JSX.Element;
6
8
  export {};
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, CopyToClipboard, useAuthentication, useB3BalanceFromAddresses, useModalStore, useNativeBalance, useProfile, } from "../../../../global-account/react/index.js";
2
+ import { Button, CopyToClipboard, useAuthentication, useB3, useB3BalanceFromAddresses, useModalStore, useNativeBalance, useProfile, } from "../../../../global-account/react/index.js";
3
3
  import { BankIcon } from "../../../../global-account/react/components/icons/BankIcon.js";
4
4
  import { SignOutIcon } from "../../../../global-account/react/components/icons/SignOutIcon.js";
5
5
  import { SwapIcon } from "../../../../global-account/react/components/icons/SwapIcon.js";
6
6
  import { formatUsername } from "../../../../shared/utils/index.js";
7
+ import { getIpfsUrl } from "../../../../shared/utils/ipfs.js";
7
8
  import { Loader2, Pencil } from "lucide-react";
8
9
  import { useEffect, useRef, useState } from "react";
9
10
  import { useActiveAccount } from "thirdweb/react";
@@ -16,18 +17,31 @@ function centerTruncate(str, length = 4) {
16
17
  return str;
17
18
  return `${str.slice(0, length)}...${str.slice(-length)}`;
18
19
  }
19
- export function BalanceContent({ onLogout, partnerId }) {
20
+ export function BalanceContent({ onLogout, partnerId, showDeposit = true, showSwap = true }) {
20
21
  const account = useActiveAccount();
21
22
  const { address: eoaAddress, info: eoaInfo } = useFirstEOA();
22
23
  const { data: profile } = useProfile({
23
24
  address: eoaAddress || account?.address,
24
25
  fresh: true,
25
26
  });
26
- const { setB3ModalOpen, setB3ModalContentType } = useModalStore();
27
+ const { user } = useB3();
28
+ const { setB3ModalOpen, setB3ModalContentType, navigateBack } = useModalStore();
27
29
  const { logout } = useAuthentication(partnerId);
28
30
  const [logoutLoading, setLogoutLoading] = useState(false);
29
31
  const [openAccordions, setOpenAccordions] = useState([]);
30
32
  const hasExpandedRef = useRef(false);
33
+ const avatarUrl = user?.avatar ? getIpfsUrl(user?.avatar) : profile?.avatar;
34
+ const handleEditAvatar = () => {
35
+ setB3ModalOpen(true);
36
+ setB3ModalContentType({
37
+ type: "avatarEditor",
38
+ showBackButton: true,
39
+ onSuccess: () => {
40
+ // navigate back on success
41
+ navigateBack();
42
+ },
43
+ });
44
+ };
31
45
  console.log("eoaAddress", eoaAddress);
32
46
  console.log("account?.address", account?.address);
33
47
  // Balance data fetching
@@ -71,18 +85,18 @@ export function BalanceContent({ onLogout, partnerId }) {
71
85
  setB3ModalOpen(false);
72
86
  setLogoutLoading(false);
73
87
  };
74
- return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsxs("div", { className: "global-account-profile flex items-center gap-4", children: [_jsxs("div", { className: "global-account-profile-avatar relative", children: [profile?.avatar ? (_jsx("img", { src: profile?.avatar, alt: "Profile", className: "size-24 rounded-full" })) : (_jsx("div", { className: "bg-b3-primary-wash size-24 rounded-full" })), _jsx("div", { className: "bg-b3-grey border-b3-background absolute -bottom-1 -right-1 flex size-8 items-center justify-center rounded-full border-4", children: _jsx(Pencil, { size: 16, className: "text-b3-background" }) })] }), _jsxs("div", { className: "global-account-profile-info", children: [_jsx("h2", { className: "text-b3-grey text-xl font-semibold", children: profile?.displayName || formatUsername(profile?.name || "") }), _jsxs("div", { className: "address-button 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", children: [_jsx("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(account?.address || "", 6) }), _jsx(CopyToClipboard, { text: account?.address || "" })] })] })] }) }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs(Button, { 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", onClick: () => {
88
+ return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsxs("div", { className: "global-account-profile flex items-center gap-4", children: [_jsxs("div", { className: "global-account-profile-avatar relative", children: [avatarUrl ? (_jsx("img", { src: avatarUrl, alt: "Profile", className: "size-24 rounded-full" })) : (_jsx("div", { className: "bg-b3-primary-wash size-24 rounded-full" })), _jsx("button", { onClick: handleEditAvatar, className: "bg-b3-grey border-b3-background hover:bg-b3-grey/80 absolute -bottom-1 -right-1 flex size-8 items-center justify-center rounded-full border-4 transition-colors", children: _jsx(Pencil, { size: 16, className: "text-b3-background" }) })] }), _jsxs("div", { className: "global-account-profile-info", children: [_jsx("h2", { className: "text-b3-grey text-xl font-semibold", children: profile?.displayName || formatUsername(profile?.name || "") }), _jsxs("div", { className: "address-button 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", children: [_jsx("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(account?.address || "", 6) }), _jsx(CopyToClipboard, { text: account?.address || "" })] })] })] }) }), (showDeposit || showSwap) && (_jsxs("div", { className: "grid grid-cols-2 gap-3", children: [showDeposit && (_jsxs(Button, { 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", onClick: () => {
75
89
  setB3ModalOpen(true);
76
90
  setB3ModalContentType({
77
91
  type: "anySpend",
78
92
  defaultActiveTab: "fiat",
79
93
  showBackButton: true,
80
94
  });
81
- }, children: [_jsx(BankIcon, { size: 24, className: "text-b3-primary-blue shrink-0" }), _jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Deposit" })] }), _jsxs(Button, { 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", onClick: () => {
95
+ }, children: [_jsx(BankIcon, { size: 24, className: "text-b3-primary-blue shrink-0" }), _jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Deposit" })] })), showSwap && (_jsxs(Button, { 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", onClick: () => {
82
96
  setB3ModalOpen(true);
83
97
  setB3ModalContentType({
84
98
  type: "anySpend",
85
99
  showBackButton: true,
86
100
  });
87
- }, children: [_jsx(SwapIcon, { size: 24, className: "text-b3-primary-blue" }), _jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Swap" })] })] }), _jsxs(Accordion, { type: "multiple", value: openAccordions, onValueChange: setOpenAccordions, className: "space-y-2", children: [_jsxs(AccordionItem, { value: "global-account", className: "border-none", children: [_jsx(AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: _jsx("span", { children: "Balance" }) }), _jsxs(AccordionContent, { className: "space-y-4", children: [_jsx(TokenBalanceRow, { icon: _jsx(B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${b3Balance?.formattedTotal || "0.00"} B3`, usdValue: b3Balance?.balanceUsdFormatted || "0.00", priceChange: b3Balance?.priceChange24h }), _jsx(TokenBalanceRow, { icon: _jsx(EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${nativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: nativeBalance?.formattedTotalUsd || "0.00", priceChange: nativeBalance?.priceChange24h })] })] }), eoaAddress && (_jsxs(AccordionItem, { value: "eoa-account", className: "border-none", children: [_jsx(AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("span", { children: ["Connected ", eoaInfo?.data?.name || "Wallet"] }), _jsxs("div", { className: "address-button 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", children: [_jsx("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(eoaAddress, 6) }), _jsx(CopyToClipboard, { text: eoaAddress })] })] }) }), _jsxs(AccordionContent, { className: "space-y-4", children: [_jsx(TokenBalanceRow, { icon: _jsx(B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${eoaB3Balance?.formattedTotal || "0.00"} B3`, usdValue: eoaB3Balance?.balanceUsdFormatted || "0.00", priceChange: eoaB3Balance?.priceChange24h }), _jsx(TokenBalanceRow, { icon: _jsx(EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${eoaNativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: eoaNativeBalance?.formattedTotalUsd || "0.00", priceChange: eoaNativeBalance?.priceChange24h })] })] }))] }), _jsxs("button", { className: "logout-button border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors", onClick: onLogoutEnhanced, children: [_jsx("span", { className: "font-neue-montreal-semibold text-b3-grey", children: "Sign out" }), _jsx("div", { className: "absolute right-4", children: logoutLoading ? (_jsx(Loader2, { className: "animate-spin", size: 16 })) : (_jsx(SignOutIcon, { size: 16, className: "text-b3-grey" })) })] })] }));
101
+ }, children: [_jsx(SwapIcon, { size: 24, className: "text-b3-primary-blue" }), _jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Swap" })] }))] })), _jsxs(Accordion, { type: "multiple", value: openAccordions, onValueChange: setOpenAccordions, className: "space-y-2", children: [_jsxs(AccordionItem, { value: "global-account", className: "border-none", children: [_jsx(AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: _jsx("span", { children: "Balance" }) }), _jsxs(AccordionContent, { className: "space-y-4", children: [_jsx(TokenBalanceRow, { icon: _jsx(B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${b3Balance?.formattedTotal || "0.00"} B3`, usdValue: b3Balance?.balanceUsdFormatted || "0.00", priceChange: b3Balance?.priceChange24h }), _jsx(TokenBalanceRow, { icon: _jsx(EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${nativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: nativeBalance?.formattedTotalUsd || "0.00", priceChange: nativeBalance?.priceChange24h })] })] }), eoaAddress && (_jsxs(AccordionItem, { value: "eoa-account", className: "border-none", children: [_jsx(AccordionTrigger, { className: "text-b3-grey font-neue-montreal-semibold py-2 hover:no-underline", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("span", { children: ["Connected ", eoaInfo?.data?.name || "Wallet"] }), _jsxs("div", { className: "address-button 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", children: [_jsx("span", { className: "text-b3-foreground-muted font-mono text-xs", children: centerTruncate(eoaAddress, 6) }), _jsx(CopyToClipboard, { text: eoaAddress })] })] }) }), _jsxs(AccordionContent, { className: "space-y-4", children: [_jsx(TokenBalanceRow, { icon: _jsx(B3TokenIcon, { className: "size-10" }), name: "B3", balance: `${eoaB3Balance?.formattedTotal || "0.00"} B3`, usdValue: eoaB3Balance?.balanceUsdFormatted || "0.00", priceChange: eoaB3Balance?.priceChange24h }), _jsx(TokenBalanceRow, { icon: _jsx(EthereumTokenIcon, { className: "size-10" }), name: "Ethereum", balance: `${eoaNativeBalance?.formattedTotal || "0.00"} ETH`, usdValue: eoaNativeBalance?.formattedTotalUsd || "0.00", priceChange: eoaNativeBalance?.priceChange24h })] })] }))] }), _jsxs("button", { className: "logout-button border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors", onClick: onLogoutEnhanced, children: [_jsx("span", { className: "font-neue-montreal-semibold text-b3-grey", children: "Sign out" }), _jsx("div", { className: "absolute right-4", children: logoutLoading ? (_jsx(Loader2, { className: "animate-spin", size: 16 })) : (_jsx(SignOutIcon, { size: 16, className: "text-b3-grey" })) })] })] }));
88
102
  }
@@ -7,6 +7,8 @@ interface ManageAccountProps {
7
7
  chain: Chain;
8
8
  partnerId: string;
9
9
  containerClassName?: string;
10
+ showSwap?: boolean;
11
+ showDeposit?: boolean;
10
12
  }
11
- export declare function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain, partnerId, }: ManageAccountProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain, partnerId, showSwap, showDeposit, }: ManageAccountProps): import("react/jsx-runtime").JSX.Element;
12
14
  export {};
@@ -13,7 +13,7 @@ import { getProfileDisplayInfo } from "../../utils/profileDisplay.js";
13
13
  import { AccountAssets } from "../AccountAssets/AccountAssets.js";
14
14
  import { ContentTokens } from "./ContentTokens.js";
15
15
  import { BalanceContent } from "./BalanceContent.js";
16
- export function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain, partnerId, }) {
16
+ export function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit, chain, partnerId, showSwap, showDeposit, }) {
17
17
  const [revokingSignerId, setRevokingSignerId] = useState(null);
18
18
  const account = useActiveAccount();
19
19
  const { data: nfts, isLoading } = useAccountAssets(account?.address);
@@ -146,22 +146,22 @@ export function ManageAccount({ onLogout, onSwap: _onSwap, onDeposit: _onDeposit
146
146
  },
147
147
  });
148
148
  };
149
- return (_jsxs("div", { className: "space-y-8", children: [_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Linked Accounts" }), _jsxs(Button, { className: "bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? (_jsx(Loader2, { className: "text-b3-primary-blue animate-spin", size: 16 })) : (_jsx(LinkIcon, { size: 16, className: "text-b3-primary-blue" })), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? (_jsx("div", { className: "flex justify-center py-8", children: _jsx(Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? (_jsx("div", { className: "space-y-4", children: profiles.map(profile => (_jsxs("div", { className: "bg-b3-line flex items-center justify-between rounded-xl p-4", children: [_jsxs("div", { className: "flex items-center gap-3", children: [profile.imageUrl ? (_jsx("img", { src: profile.imageUrl, alt: profile.title, className: "size-10 rounded-full" })) : (_jsx("div", { className: "bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-b3-grey font-neue-montreal-semibold", children: profile.title }), _jsx("span", { className: "text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs", children: profile.type.toUpperCase() })] }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), _jsx(Button, { variant: "ghost", size: "icon", className: "text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? (_jsx(Loader2, { className: "animate-spin" })) : (_jsx(UnlinkIcon, { size: 16 })) })] }, profile.title))) })) : (_jsx("div", { className: "text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }), showReferralInfo && (
149
+ return (_jsxs("div", { className: "linked-accounts-settings space-y-8", children: [_jsxs("div", { className: "linked-accounts-section space-y-4", children: [_jsxs("div", { className: "linked-accounts-header flex items-center justify-between", children: [_jsx("h3", { className: "text-b3-grey font-neue-montreal-semibold linked-accounts-settings-title text-xl", children: "Linked Accounts" }), _jsxs(Button, { className: "linked-accounts-settings-button linked-accounts-link-button bg-b3-primary-wash hover:bg-b3-primary-wash/70 flex items-center gap-2 rounded-full px-4 py-2", onClick: handleOpenLinkModal, disabled: isLinking, children: [isLinking ? (_jsx(Loader2, { className: "linked-accounts-link-loading text-b3-primary-blue animate-spin", size: 16 })) : (_jsx(LinkIcon, { size: 16, className: "linked-accounts-link-icon text-b3-primary-blue" })), _jsx("span", { className: "linked-accounts-link-text text-b3-grey font-neue-montreal-semibold", children: isLinking ? "Linking..." : "Link New Account" })] })] }), isLoadingProfiles ? (_jsx("div", { className: "linked-accounts-loading flex justify-center py-8", children: _jsx(Loader2, { className: "text-b3-grey animate-spin" }) })) : profiles.length > 0 ? (_jsx("div", { className: "linked-accounts-list space-y-4", children: profiles.map(profile => (_jsxs("div", { className: "linked-account-item bg-b3-line flex items-center justify-between rounded-xl p-4", children: [_jsxs("div", { className: "linked-account-info flex items-center gap-3", children: [profile.imageUrl ? (_jsx("img", { src: profile.imageUrl, alt: profile.title, className: "linked-account-avatar linked-account-avatar-image size-10 rounded-full" })) : (_jsx("div", { className: "linked-account-avatar linked-account-avatar-placeholder bg-b3-primary-wash flex h-10 w-10 items-center justify-center rounded-full", children: _jsx("span", { className: "linked-account-initial text-b3-grey font-neue-montreal-semibold text-sm uppercase", children: profile.initial }) })), _jsxs("div", { className: "linked-account-details", children: [_jsxs("div", { className: "linked-account-title-row flex items-center gap-2", children: [_jsx("span", { className: "linked-account-title text-b3-grey font-neue-montreal-semibold", children: profile.title }), _jsx("span", { className: "linked-account-type text-b3-foreground-muted font-neue-montreal-medium bg-b3-primary-wash rounded px-2 py-0.5 text-xs", children: profile.type.toUpperCase() })] }), _jsx("div", { className: "linked-account-subtitle text-b3-foreground-muted font-neue-montreal-medium text-sm", children: profile.subtitle })] })] }), _jsx(Button, { variant: "ghost", size: "icon", className: "linked-account-unlink-button text-b3-grey hover:text-b3-negative", onClick: () => handleUnlink(profile), disabled: unlinkingAccountId === profile.title || isUnlinking, children: unlinkingAccountId === profile.title || isUnlinking ? (_jsx(Loader2, { className: "linked-account-unlink-loading animate-spin" })) : (_jsx(UnlinkIcon, { size: 16, className: "linked-account-unlink-icon" })) })] }, profile.title))) })) : (_jsx("div", { className: "linked-accounts-empty text-b3-foreground-muted py-8 text-center", children: "No linked accounts found" }))] }), showReferralInfo && (
150
150
  /* Referral Section */
151
- _jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Referrals" }), _jsxs("div", { className: "bg-b3-line rounded-xl p-4", children: [isEditingCode && (_jsxs("div", { children: [_jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), _jsxs("div", { className: "flex items-center justify-between", children: [!isEditingCode && (_jsxs("div", { children: [_jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), _jsx("div", { className: "flex items-center gap-2", children: isEditingCode ? (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("input", { type: "text", value: newReferralCode, onChange: e => setNewReferralCode(e.target.value), className: "rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", placeholder: "Enter new code", ref: referallCodeRef }), _jsx(Button, { size: "sm", onClick: handleUpdateReferralCode, disabled: isUpdatingCode || !newReferralCode, children: isUpdatingCode ? _jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : "Save" }), _jsx(Button, { size: "sm", variant: "ghost", onClick: () => {
151
+ _jsxs("div", { className: "referrals-section space-y-4", children: [_jsx("h3", { className: "referrals-title text-b3-grey font-neue-montreal-semibold text-xl", children: "Referrals" }), _jsxs("div", { className: "referral-code-container bg-b3-line rounded-xl p-4", children: [isEditingCode && (_jsxs("div", { className: "referral-code-header-editing", children: [_jsx("div", { className: "referral-code-title text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), _jsx("div", { className: "referral-code-description text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), _jsxs("div", { className: "referral-code-content flex items-center justify-between", children: [!isEditingCode && (_jsxs("div", { className: "referral-code-header", children: [_jsx("div", { className: "referral-code-title text-b3-grey font-neue-montreal-semibold", children: "Your Referral Code" }), _jsx("div", { className: "referral-code-description text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Share this code with friends to earn rewards" })] })), _jsx("div", { className: "referral-code-actions flex items-center gap-2", children: isEditingCode ? (_jsxs("div", { className: "referral-code-edit-form flex items-center gap-2", children: [_jsx("input", { type: "text", value: newReferralCode, onChange: e => setNewReferralCode(e.target.value), className: "referral-code-input rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", placeholder: "Enter new code", ref: referallCodeRef }), _jsx(Button, { size: "sm", className: "referral-code-save-button", onClick: handleUpdateReferralCode, disabled: isUpdatingCode || !newReferralCode, children: isUpdatingCode ? (_jsx(Loader2, { className: "referral-code-save-loading h-4 w-4 animate-spin" })) : ("Save") }), _jsx(Button, { size: "sm", variant: "ghost", className: "referral-code-cancel-button", onClick: () => {
152
152
  setIsEditingCode(false);
153
153
  setNewReferralCode("");
154
- }, children: "Cancel" })] })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", children: currentReferralCode }), _jsx(Button, { size: "icon", variant: "ghost", onClick: handleCopyCode, children: _jsx(Copy, { className: "h-4 w-4" }) }), _jsx(Button, { size: "icon", variant: "ghost", onClick: () => {
154
+ }, children: "Cancel" })] })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "referral-code-display rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm", children: currentReferralCode }), _jsx(Button, { size: "icon", variant: "ghost", className: "referral-code-copy-button", onClick: handleCopyCode, children: _jsx(Copy, { className: "referral-code-copy-icon h-4 w-4" }) }), _jsx(Button, { size: "icon", variant: "ghost", className: "referral-code-edit-button", onClick: () => {
155
155
  setIsEditingCode(true);
156
156
  setTimeout(() => {
157
157
  referallCodeRef.current?.focus();
158
158
  }, 100);
159
- }, children: _jsx(Pencil, { className: "h-4 w-4" }) })] })) })] })] }), _jsxs("div", { className: "bg-b3-line rounded-xl p-4", children: [_jsx("div", { className: "text-b3-grey font-neue-montreal-semibold mb-4", children: "Referred Users" }), isLoadingReferrals ? (_jsx("div", { className: "flex justify-center py-4", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-gray-400" }) })) : referrals?.data?.length ? (_jsx("div", { className: "space-y-3", children: referrals.data.map((referral) => (_jsxs("div", { className: "flex items-center justify-between rounded-lg bg-white p-3", children: [_jsx("div", { className: "text-sm font-medium", children: referral.referreeId }), _jsx("div", { className: "text-sm text-gray-500", children: new Date(referral.createdAt).toLocaleDateString() })] }, String(referral._id)))) })) : (_jsx("div", { className: "py-4 text-center text-gray-500", children: "No referred users yet" }))] })] })), _jsxs("div", { className: "space-y-4", children: [_jsx("h3", { className: "text-b3-grey font-neue-montreal-semibold text-xl", children: "Account Preferences" }), _jsx("div", { className: "bg-b3-line rounded-xl p-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { children: [_jsx("div", { className: "text-b3-grey font-neue-montreal-semibold", children: "Dark Mode" }), _jsx("div", { className: "text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Switch between light and dark theme" })] }), _jsx("div", { className: "bg-b3-primary-wash h-6 w-12 rounded-full" })] }) })] }), _jsxs("div", { className: "border-b3-line flex items-center justify-between rounded-2xl border p-4", children: [_jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("img", { src: "https://cdn.b3.fun/b3_logo.svg", alt: "B3", className: "h-4" }), _jsx("h3", { className: "font-neue-montreal-semibold text-b3-grey", children: "Global Account" })] }), _jsx("p", { className: "text-b3-foreground-muted font-neue-montreal-medium mt-2 text-sm", children: "Your universal account for all B3 apps" })] }), _jsx("button", { className: "text-b3-grey hover:text-b3-grey/80 hover:bg-b3-line border-b3-line flex size-12 items-center justify-center rounded-full border", onClick: onLogoutEnhanced, children: logoutLoading ? _jsx(Loader2, { className: "animate-spin" }) : _jsx(SignOutIcon, { size: 16, className: "text-b3-grey" }) })] })] }));
159
+ }, children: _jsx(Pencil, { className: "referral-code-edit-icon h-4 w-4" }) })] })) })] })] }), _jsxs("div", { className: "referred-users-container bg-b3-line rounded-xl p-4", children: [_jsx("div", { className: "referred-users-title text-b3-grey font-neue-montreal-semibold mb-4", children: "Referred Users" }), isLoadingReferrals ? (_jsx("div", { className: "referred-users-loading flex justify-center py-4", children: _jsx(Loader2, { className: "h-6 w-6 animate-spin text-gray-400" }) })) : referrals?.data?.length ? (_jsx("div", { className: "referred-users-list space-y-3", children: referrals.data.map((referral) => (_jsxs("div", { className: "referred-user-item flex items-center justify-between rounded-lg bg-white p-3", children: [_jsx("div", { className: "referred-user-id text-sm font-medium", children: referral.referreeId }), _jsx("div", { className: "referred-user-date text-sm text-gray-500", children: new Date(referral.createdAt).toLocaleDateString() })] }, String(referral._id)))) })) : (_jsx("div", { className: "referred-users-empty py-4 text-center text-gray-500", children: "No referred users yet" }))] })] })), _jsxs("div", { className: "account-preferences-section space-y-4", children: [_jsx("h3", { className: "account-preferences-title text-b3-grey font-neue-montreal-semibold text-xl", children: "Account Preferences" }), _jsx("div", { className: "account-preferences-container bg-b3-line rounded-xl p-4", children: _jsxs("div", { className: "account-preference-item flex items-center justify-between", children: [_jsxs("div", { className: "account-preference-info", children: [_jsx("div", { className: "account-preference-title text-b3-grey font-neue-montreal-semibold", children: "Dark Mode" }), _jsx("div", { className: "account-preference-description text-b3-foreground-muted font-neue-montreal-medium text-sm", children: "Switch between light and dark theme" })] }), _jsx("div", { className: "account-preference-toggle theme-toggle-placeholder bg-b3-primary-wash h-6 w-12 rounded-full" })] }) })] }), _jsxs("button", { className: "logout-button logout-section border-b3-line hover:bg-b3-line relative flex w-full items-center justify-center rounded-2xl border p-4 transition-colors", onClick: onLogoutEnhanced, children: [_jsx("span", { className: "logout-text font-neue-montreal-semibold text-b3-grey", children: "Sign out" }), _jsx("div", { className: "logout-icon-container absolute right-4", children: logoutLoading ? (_jsx(Loader2, { className: "logout-loading animate-spin", size: 16 })) : (_jsx(SignOutIcon, { size: 16, className: "logout-icon text-b3-grey" })) })] })] }));
160
160
  };
161
161
  return (_jsx("div", { className: "b3-manage-account bg-b3-background flex flex-col rounded-xl", children: _jsx("div", { className: "flex-1", children: _jsxs(TabsPrimitive, { defaultValue: activeTab, onValueChange: value => {
162
162
  const tab = value;
163
163
  if (["overview", "tokens", "nfts", "apps", "settings"].includes(tab)) {
164
164
  setActiveTab?.(tab);
165
165
  }
166
- }, children: [_jsx("div", { className: "px-4", children: _jsxs(TabsListPrimitive, { className: "grid h-auto grid-cols-2 grid-rows-2 gap-3 rounded-none border-none bg-transparent", children: [_jsxs(TabTriggerPrimitive, { value: "overview", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(BarChart3, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Overview" })] }), _jsxs(TabTriggerPrimitive, { value: "tokens", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Coins, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Tokens" })] }), _jsxs(TabTriggerPrimitive, { value: "nfts", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Image, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "NFTs" })] }), _jsxs(TabTriggerPrimitive, { value: "settings", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Settings, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Settings" })] })] }) }), _jsx(TabsContentPrimitive, { value: "overview", className: "px-4 pb-4 pt-2", children: _jsx(BalanceContent, { onLogout: onLogout, partnerId: partnerId }) }), _jsx(TabsContentPrimitive, { value: "tokens", className: "px-4 pb-4 pt-2", children: _jsx(ContentTokens, { activeTab: activeTab }) }), _jsx(TabsContentPrimitive, { value: "nfts", className: "px-4 pb-4 pt-2", children: _jsx("div", { className: "grid grid-cols-3 gap-4", children: nfts?.nftResponse ? (_jsx(AccountAssets, { nfts: nfts.nftResponse, isLoading: isLoading })) : (_jsx("div", { className: "col-span-3 py-12 text-center text-gray-500", children: "No NFTs found" })) }) }), _jsx(TabsContentPrimitive, { value: "apps", className: "px-4 pb-4 pt-2", children: _jsx(AppsContent, {}) }), _jsx(TabsContentPrimitive, { value: "settings", className: "px-4 pb-4 pt-2", children: _jsx(SettingsContent, {}) })] }) }) }));
166
+ }, children: [_jsx("div", { className: "px-4", children: _jsxs(TabsListPrimitive, { className: "grid h-auto grid-cols-2 grid-rows-2 gap-3 rounded-none border-none bg-transparent", children: [_jsxs(TabTriggerPrimitive, { value: "overview", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(BarChart3, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Overview" })] }), _jsxs(TabTriggerPrimitive, { value: "tokens", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Coins, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Tokens" })] }), _jsxs(TabTriggerPrimitive, { value: "nfts", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Image, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "NFTs" })] }), _jsxs(TabTriggerPrimitive, { value: "settings", className: "data-[state=active]:bg-b3-primary-blue data-[state=active]:hover:bg-b3-primary-blue data-[state=active]:border-b3-primary-blue group flex h-12 w-full items-center justify-center gap-2 rounded-xl border border-gray-200 bg-white p-2 text-center shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md data-[state=active]:shadow-lg", children: [_jsx(Settings, { size: 20, className: "text-b3-primary-blue shrink-0 group-data-[state=active]:text-white" }), _jsx("span", { className: "text-b3-grey font-neue-montreal-semibold text-sm group-data-[state=active]:text-white", children: "Settings" })] })] }) }), _jsx(TabsContentPrimitive, { value: "overview", className: "px-4 pb-4 pt-2", children: _jsx(BalanceContent, { onLogout: onLogout, partnerId: partnerId, showDeposit: showDeposit, showSwap: showSwap }) }), _jsx(TabsContentPrimitive, { value: "tokens", className: "px-4 pb-4 pt-2", children: _jsx(ContentTokens, { activeTab: activeTab }) }), _jsx(TabsContentPrimitive, { value: "nfts", className: "px-4 pb-4 pt-2", children: _jsx("div", { className: "grid grid-cols-3 gap-4", children: nfts?.nftResponse ? (_jsx(AccountAssets, { nfts: nfts.nftResponse, isLoading: isLoading })) : (_jsx("div", { className: "col-span-3 py-12 text-center text-gray-500", children: "No NFTs found" })) }) }), _jsx(TabsContentPrimitive, { value: "apps", className: "px-4 pb-4 pt-2", children: _jsx(AppsContent, {}) }), _jsx(TabsContentPrimitive, { value: "settings", className: "px-4 pb-4 pt-2", children: _jsx(SettingsContent, {}) })] }) }) }));
167
167
  }
@@ -1,6 +1,7 @@
1
1
  import { useB3, useProfile } from "../../../global-account/react/index.js";
2
2
  import { ecosystemWalletId } from "../../../shared/constants/index.js";
3
3
  import { debugB3React } from "../../../shared/utils/debug.js";
4
+ import { getIpfsUrl } from "../../../shared/utils/ipfs.js";
4
5
  import { useEffect, useMemo, useState } from "react";
5
6
  import { getLastAuthProvider, useActiveWallet, useConnectedWallets, useWalletImage } from "thirdweb/react";
6
7
  import { socialIcons } from "thirdweb/wallets/in-app";
@@ -17,7 +18,7 @@ function useLastAuthProvider() {
17
18
  return lastAuthProvider;
18
19
  }
19
20
  export function useAccountWallet() {
20
- const { account } = useB3();
21
+ const { account, user } = useB3();
21
22
  const activeWallet = useActiveWallet();
22
23
  const connectedWallets = useConnectedWallets();
23
24
  const connectedSmartWallet = connectedWallets.find(wallet => wallet.id === ecosystemWalletId);
@@ -38,7 +39,7 @@ export function useAccountWallet() {
38
39
  : "https://gradvatar.com/0x0000000000000000000000000000000000000000"; // show smart wallet of eoa wallet is gradvatar
39
40
  const { data: profileData } = useProfile({ address: account?.address });
40
41
  const ensName = profileData?.displayName?.replace(/\.b3\.fun/g, "");
41
- const avatarUrl = profileData?.avatar;
42
+ const avatarUrl = user?.avatar ? getIpfsUrl(user?.avatar) : profileData?.avatar;
42
43
  const res = useMemo(() => ({
43
44
  wallet: {
44
45
  ...account,