@b3dotfun/sdk 0.0.83-alpha.3 → 0.0.83-alpha.5

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 (46) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +3 -2
  2. package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +2 -4
  3. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
  4. package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +28 -0
  5. package/dist/cjs/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
  6. package/dist/cjs/anyspend/react/hooks/useConnectedUserProfile.js +5 -8
  7. package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
  8. package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.js +2 -12
  9. package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +3 -4
  10. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
  11. package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
  12. package/dist/cjs/global-account/react/hooks/index.js +1 -3
  13. package/dist/cjs/global-account/react/hooks/useAccountWallet.js +11 -10
  14. package/dist/esm/anyspend/react/components/AnySpendCustom.js +3 -2
  15. package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +4 -6
  16. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
  17. package/dist/esm/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +25 -0
  18. package/dist/esm/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
  19. package/dist/esm/anyspend/react/hooks/useConnectedUserProfile.js +6 -9
  20. package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
  21. package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.js +2 -12
  22. package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +4 -5
  23. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
  24. package/dist/esm/global-account/react/hooks/index.d.ts +0 -1
  25. package/dist/esm/global-account/react/hooks/index.js +0 -1
  26. package/dist/esm/global-account/react/hooks/useAccountWallet.js +11 -10
  27. package/dist/types/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
  28. package/dist/types/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
  29. package/dist/types/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
  30. package/dist/types/global-account/react/hooks/index.d.ts +0 -1
  31. package/package.json +1 -1
  32. package/src/anyspend/react/components/AnySpendCustom.tsx +7 -23
  33. package/src/anyspend/react/components/common/CryptoPaySection.tsx +7 -30
  34. package/src/anyspend/react/components/common/CryptoPaymentMethodDisplay.tsx +64 -0
  35. package/src/anyspend/react/hooks/useConnectedUserProfile.ts +7 -10
  36. package/src/anyspend/react/hooks/useConnectedWalletDisplay.ts +2 -15
  37. package/src/global-account/react/components/SignInWithB3/SignIn.tsx +4 -6
  38. package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +1 -1
  39. package/src/global-account/react/hooks/index.ts +0 -1
  40. package/src/global-account/react/hooks/useAccountWallet.tsx +12 -11
  41. package/dist/cjs/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
  42. package/dist/cjs/global-account/react/hooks/useBestTransactionPath.js +0 -148
  43. package/dist/esm/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
  44. package/dist/esm/global-account/react/hooks/useBestTransactionPath.js +0 -145
  45. package/dist/types/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
  46. package/src/global-account/react/hooks/useBestTransactionPath.tsx +0 -201
@@ -12,7 +12,7 @@ export function LoginStepContainer({ children, partnerId }) {
12
12
  },
13
13
  }, !!partnerId);
14
14
  const partnerLogo = partner?.data?.[0]?.loginCustomization?.logoUrl;
15
- return (_jsxs("div", { className: "flex flex-col items-center justify-center pt-6", children: [partnerLogo && (_jsx("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
15
+ return (_jsxs("div", { className: "bg-b3-react-background flex flex-col items-center justify-center pt-6", children: [partnerLogo && (_jsx("img", { src: partnerLogo, alt: "Partner Logo", className: "partner-logo mb-6 h-12 w-auto object-contain" })), children] }));
16
16
  }
17
17
  export function LoginStep({ onSuccess, chain }) {
18
18
  const { partnerId, theme } = useB3();
@@ -6,7 +6,6 @@ export { useAnalytics } from "./useAnalytics";
6
6
  export { useAuthentication } from "./useAuthentication";
7
7
  export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
8
8
  export { useB3EnsName } from "./useB3EnsName";
9
- export { useBestTransactionPath } from "./useBestTransactionPath";
10
9
  export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
11
10
  export * from "./useClaim";
12
11
  export { useClient } from "./useClient";
@@ -6,7 +6,6 @@ export { useAnalytics } from "./useAnalytics.js";
6
6
  export { useAuthentication } from "./useAuthentication.js";
7
7
  export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses.js";
8
8
  export { useB3EnsName } from "./useB3EnsName.js";
9
- export { useBestTransactionPath } from "./useBestTransactionPath.js";
10
9
  export { useChainSwitchWithAction } from "./useChainSwitchWithAction.js";
11
10
  export * from "./useClaim.js";
12
11
  export { useClient } from "./useClient.js";
@@ -1,7 +1,6 @@
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";
5
4
  import { useEffect, useMemo, useState } from "react";
6
5
  import { getLastAuthProvider, useActiveWallet, useConnectedWallets, useWalletImage } from "thirdweb/react";
7
6
  import { socialIcons } from "thirdweb/wallets/in-app";
@@ -18,7 +17,13 @@ function useLastAuthProvider() {
18
17
  return lastAuthProvider;
19
18
  }
20
19
  export function useAccountWallet() {
21
- const { account, user } = useB3();
20
+ // WOJ: --------------------
21
+ // values from in useB3:
22
+ // const activeAccount = useActiveAccount();
23
+ // const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
24
+ // can we possibly just use useActiveAccount here?
25
+ // --------------------
26
+ const { account } = useB3();
22
27
  const activeWallet = useActiveWallet();
23
28
  const connectedWallets = useConnectedWallets();
24
29
  const connectedSmartWallet = connectedWallets.find(wallet => wallet.id === ecosystemWalletId);
@@ -31,7 +36,6 @@ export function useAccountWallet() {
31
36
  debug("connectedEOAWallet", connectedEOAWallet);
32
37
  debug("isActiveSmartWallet", isActiveSmartWallet);
33
38
  debug("isActiveEOAWallet", isActiveEOAWallet);
34
- const { data: walletImage } = useWalletImage(connectedEOAWallet?.id);
35
39
  // If not EOA sign in, then we need to show the smart wallet icon
36
40
  const lastAuthProvider = useLastAuthProvider();
37
41
  const smartWalletIcon = lastAuthProvider && !connectedEOAWallet
@@ -39,13 +43,12 @@ export function useAccountWallet() {
39
43
  : "https://gradvatar.com/0x0000000000000000000000000000000000000000"; // show smart wallet of eoa wallet is gradvatar
40
44
  const { data: profileData } = useProfile({ address: account?.address });
41
45
  const ensName = profileData?.displayName?.replace(/\.b3\.fun/g, "");
42
- const avatarUrl = user?.avatar ? getIpfsUrl(user?.avatar) : profileData?.avatar;
43
46
  const res = useMemo(() => ({
44
47
  wallet: {
45
48
  ...account,
46
49
  ensName,
47
50
  meta: {
48
- icon: avatarUrl || (isActiveSmartWallet ? smartWalletIcon : walletImage) || "",
51
+ icon: "", // deprecated
49
52
  },
50
53
  },
51
54
  address: account?.address,
@@ -55,22 +58,20 @@ export function useAccountWallet() {
55
58
  isActiveSmartWallet: isActiveSmartWallet,
56
59
  isActiveEOAWallet: isActiveEOAWallet,
57
60
  smartWalletIcon: smartWalletIcon,
58
- eoaWalletIcon: walletImage,
61
+ eoaWalletIcon: "", // deprecated
59
62
  }), [
60
63
  account,
61
- avatarUrl,
62
64
  connectedEOAWallet,
63
65
  connectedSmartWallet,
64
66
  ensName,
65
67
  isActiveEOAWallet,
66
68
  isActiveSmartWallet,
67
69
  smartWalletIcon,
68
- walletImage,
69
70
  ]);
70
71
  return res;
71
72
  }
72
73
  export function useAccountWalletImage() {
73
- const { account, user } = useB3();
74
+ const { account } = useB3();
74
75
  const activeWallet = useActiveWallet();
75
76
  const connectedWallets = useConnectedWallets();
76
77
  const connectedSmartWallet = connectedWallets.find(wallet => wallet.id === ecosystemWalletId);
@@ -83,6 +84,6 @@ export function useAccountWalletImage() {
83
84
  ? socialIcons[lastAuthProvider]
84
85
  : "https://gradvatar.com/0x0000000000000000000000000000000000000000"; // show smart wallet of eoa wallet is gradvatar
85
86
  const { data: profileData } = useProfile({ address: account?.address });
86
- const avatarUrl = user?.avatar || profileData?.avatar;
87
+ const avatarUrl = profileData?.avatar;
87
88
  return avatarUrl || (isActiveSmartWallet ? smartWalletIcon : walletImage) || "";
88
89
  }
@@ -0,0 +1,15 @@
1
+ import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
2
+ interface CryptoPaymentMethodDisplayProps {
3
+ paymentMethod: CryptoPaymentMethodType;
4
+ connectedAddress?: string | null;
5
+ connectedName?: string | null;
6
+ }
7
+ /**
8
+ * Displays the selected crypto payment method with appropriate label
9
+ * - CONNECT_WALLET: Shows wallet address/name or "Connect wallet"
10
+ * - GLOBAL_WALLET: Shows "Global Account"
11
+ * - TRANSFER_CRYPTO: Shows "Transfer crypto"
12
+ * - NONE: Shows "Select payment method"
13
+ */
14
+ export declare function CryptoPaymentMethodDisplay({ paymentMethod, connectedAddress, connectedName, }: CryptoPaymentMethodDisplayProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -1,8 +1,9 @@
1
+ import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMethod";
1
2
  /**
2
3
  * Hook that provides connected user's address, profile, and cleaned display name
3
4
  * Combines logic for getting connected address from either global account or thirdweb wallets
4
5
  */
5
- export declare function useConnectedUserProfile(): {
6
+ export declare function useConnectedUserProfile(selectedCryptoPaymentMethod?: CryptoPaymentMethodType): {
6
7
  address: string | undefined;
7
8
  profile: import("@tanstack/react-query").UseQueryResult<import("@b3dotfun/sdk/global-account/react").CombinedProfile, Error>;
8
9
  name: string | null | undefined;
@@ -2,8 +2,6 @@ import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMetho
2
2
  interface UseConnectedWalletDisplayResult {
3
3
  walletAddress: string | undefined;
4
4
  shouldShowConnectedEOA: boolean;
5
- shouldShowWagmiWallet: boolean;
6
- isWalletDuplicated: boolean;
7
5
  suggestedPaymentMethod: CryptoPaymentMethodType;
8
6
  }
9
7
  /**
@@ -6,7 +6,6 @@ export { useAnalytics } from "./useAnalytics";
6
6
  export { useAuthentication } from "./useAuthentication";
7
7
  export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
8
8
  export { useB3EnsName } from "./useB3EnsName";
9
- export { useBestTransactionPath } from "./useBestTransactionPath";
10
9
  export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
11
10
  export * from "./useClaim";
12
11
  export { useClient } from "./useClient";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.0.83-alpha.3",
3
+ "version": "0.0.83-alpha.5",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -48,6 +48,7 @@ import { useCryptoPaymentMethodState } from "../hooks/useCryptoPaymentMethodStat
48
48
  import { useRecipientAddressState } from "../hooks/useRecipientAddressState";
49
49
  import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper";
50
50
  import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
51
+ import { CryptoPaymentMethodDisplay } from "./common/CryptoPaymentMethodDisplay";
51
52
  import { FeeBreakDown } from "./common/FeeBreakDown";
52
53
  import { FIAT_PAYMENT_METHOD_DISPLAY, FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
53
54
  import { OrderDetails } from "./common/OrderDetails";
@@ -469,7 +470,7 @@ function AnySpendCustomInner({
469
470
 
470
471
  const isCreatingOrder = isCreatingRegularOrder || isCreatingOnrampOrder;
471
472
 
472
- const { address: connectedAddress, name: connectedName } = useConnectedUserProfile();
473
+ const { address: connectedAddress, name: connectedName } = useConnectedUserProfile(effectiveCryptoPaymentMethod);
473
474
  const recipientProfile = useProfile({ address: recipientAddress });
474
475
  const recipientName = recipientProfile.data?.name;
475
476
 
@@ -951,28 +952,11 @@ function AnySpendCustomInner({
951
952
  className="text-as-tertiarry flex flex-wrap items-center justify-end gap-2 text-sm transition-colors hover:text-blue-700"
952
953
  onClick={() => setActivePanel(PanelView.CRYPTO_PAYMENT_METHOD)}
953
954
  >
954
- {effectiveCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (
955
- <>
956
- {connectedAddress ? (
957
- <span className="text-as-tertiarry whitespace-nowrap">
958
- {connectedName ? formatUsername(connectedName) : shortenAddress(connectedAddress || "")}
959
- </span>
960
- ) : (
961
- <span className="whitespace-nowrap">Connect wallet</span>
962
- )}
963
- <ChevronRight className="h-4 w-4 shrink-0" />
964
- </>
965
- ) : effectiveCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
966
- <>
967
- <span className="whitespace-nowrap">Transfer crypto</span>
968
- <ChevronRight className="h-4 w-4 shrink-0" />
969
- </>
970
- ) : (
971
- <>
972
- <span className="whitespace-nowrap">Select payment method</span>
973
- <ChevronRight className="h-4 w-4 shrink-0" />
974
- </>
975
- )}
955
+ <CryptoPaymentMethodDisplay
956
+ paymentMethod={effectiveCryptoPaymentMethod}
957
+ connectedAddress={connectedAddress}
958
+ connectedName={connectedName}
959
+ />
976
960
  </button>
977
961
  </motion.div>
978
962
 
@@ -1,13 +1,12 @@
1
1
  import { useProfile, useTokenData } from "@b3dotfun/sdk/global-account/react";
2
- import { formatUsername } from "@b3dotfun/sdk/shared/utils";
3
- import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
4
2
  import { formatDisplayNumber } from "@b3dotfun/sdk/shared/utils/number";
5
- import { ChevronRight, Info } from "lucide-react";
3
+ import { Info } from "lucide-react";
6
4
  import { motion } from "motion/react";
7
5
  import { useEffect, useRef } from "react";
8
6
  import { components } from "../../../types/api";
9
7
  import { useConnectedWalletDisplay } from "../../hooks/useConnectedWalletDisplay";
10
8
  import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
9
+ import { CryptoPaymentMethodDisplay } from "./CryptoPaymentMethodDisplay";
11
10
  import { OrderTokenAmount } from "./OrderTokenAmount";
12
11
  import { TokenBalance } from "./TokenBalance";
13
12
 
@@ -103,33 +102,11 @@ export function CryptoPaySection({
103
102
  className="text-as-tertiarry flex h-7 items-center gap-2 text-sm transition-colors focus:!outline-none"
104
103
  onClick={onSelectCryptoPaymentMethod}
105
104
  >
106
- {selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET ? (
107
- <>
108
- {walletAddress ? (
109
- <div className="flex items-center gap-1">
110
- {connectedName ? formatUsername(connectedName) : shortenAddress(walletAddress || "")}
111
- </div>
112
- ) : (
113
- "Connect wallet"
114
- )}
115
- <ChevronRight className="h-4 w-4" />
116
- </>
117
- ) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET ? (
118
- <>
119
- Global Account
120
- <ChevronRight className="h-4 w-4" />
121
- </>
122
- ) : selectedCryptoPaymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO ? (
123
- <>
124
- Transfer crypto
125
- <ChevronRight className="h-4 w-4" />
126
- </>
127
- ) : (
128
- <>
129
- Select payment method
130
- <ChevronRight className="h-4 w-4" />
131
- </>
132
- )}
105
+ <CryptoPaymentMethodDisplay
106
+ paymentMethod={selectedCryptoPaymentMethod}
107
+ connectedAddress={walletAddress}
108
+ connectedName={connectedName}
109
+ />
133
110
  </button>
134
111
  </div>
135
112
  <OrderTokenAmount
@@ -0,0 +1,64 @@
1
+ import { formatUsername } from "@b3dotfun/sdk/shared/utils";
2
+ import { shortenAddress } from "@b3dotfun/sdk/shared/utils/formatAddress";
3
+ import { ChevronRight } from "lucide-react";
4
+ import { CryptoPaymentMethodType } from "./CryptoPaymentMethod";
5
+
6
+ interface CryptoPaymentMethodDisplayProps {
7
+ paymentMethod: CryptoPaymentMethodType;
8
+ connectedAddress?: string | null;
9
+ connectedName?: string | null;
10
+ }
11
+
12
+ /**
13
+ * Displays the selected crypto payment method with appropriate label
14
+ * - CONNECT_WALLET: Shows wallet address/name or "Connect wallet"
15
+ * - GLOBAL_WALLET: Shows "Global Account"
16
+ * - TRANSFER_CRYPTO: Shows "Transfer crypto"
17
+ * - NONE: Shows "Select payment method"
18
+ */
19
+ export function CryptoPaymentMethodDisplay({
20
+ paymentMethod,
21
+ connectedAddress,
22
+ connectedName,
23
+ }: CryptoPaymentMethodDisplayProps) {
24
+ if (paymentMethod === CryptoPaymentMethodType.CONNECT_WALLET) {
25
+ return (
26
+ <>
27
+ {connectedAddress ? (
28
+ <span className="text-as-tertiarry whitespace-nowrap">
29
+ {connectedName ? formatUsername(connectedName) : shortenAddress(connectedAddress)}
30
+ </span>
31
+ ) : (
32
+ <span className="whitespace-nowrap">Connect wallet</span>
33
+ )}
34
+ <ChevronRight className="h-4 w-4 shrink-0" />
35
+ </>
36
+ );
37
+ }
38
+
39
+ if (paymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET) {
40
+ return (
41
+ <>
42
+ <span className="whitespace-nowrap">Global Account</span>
43
+ <ChevronRight className="h-4 w-4 shrink-0" />
44
+ </>
45
+ );
46
+ }
47
+
48
+ if (paymentMethod === CryptoPaymentMethodType.TRANSFER_CRYPTO) {
49
+ return (
50
+ <>
51
+ <span className="whitespace-nowrap">Transfer crypto</span>
52
+ <ChevronRight className="h-4 w-4 shrink-0" />
53
+ </>
54
+ );
55
+ }
56
+
57
+ // NONE or any other case
58
+ return (
59
+ <>
60
+ <span className="whitespace-nowrap">Select payment method</span>
61
+ <ChevronRight className="h-4 w-4 shrink-0" />
62
+ </>
63
+ );
64
+ }
@@ -1,22 +1,19 @@
1
- import { useAccountWallet, useProfile } from "@b3dotfun/sdk/global-account/react";
2
- import { useConnectedWallets } from "thirdweb/react";
1
+ import { useProfile } from "@b3dotfun/sdk/global-account/react";
2
+ import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMethod";
3
+ import { useConnectedWalletDisplay } from "./useConnectedWalletDisplay";
3
4
 
4
5
  /**
5
6
  * Hook that provides connected user's address, profile, and cleaned display name
6
7
  * Combines logic for getting connected address from either global account or thirdweb wallets
7
8
  */
8
- export function useConnectedUserProfile() {
9
- const { address: globalAddress } = useAccountWallet();
10
- const connectedWallets = useConnectedWallets();
11
-
12
- // Get connected address from global account or first connected wallet
13
- const connectedAddress = globalAddress || connectedWallets?.[0]?.getAccount()?.address;
9
+ export function useConnectedUserProfile(selectedCryptoPaymentMethod?: CryptoPaymentMethodType) {
10
+ const { walletAddress } = useConnectedWalletDisplay(selectedCryptoPaymentMethod);
14
11
 
15
12
  // Fetch profile data for the connected address with cleaned name
16
- const connectedProfile = useProfile({ address: connectedAddress });
13
+ const connectedProfile = useProfile({ address: walletAddress });
17
14
 
18
15
  return {
19
- address: connectedAddress,
16
+ address: walletAddress,
20
17
  profile: connectedProfile,
21
18
  name: connectedProfile.data?.name,
22
19
  isLoading: connectedProfile.isLoading,
@@ -5,8 +5,6 @@ import { CryptoPaymentMethodType } from "../components/common/CryptoPaymentMetho
5
5
  interface UseConnectedWalletDisplayResult {
6
6
  walletAddress: string | undefined;
7
7
  shouldShowConnectedEOA: boolean;
8
- shouldShowWagmiWallet: boolean;
9
- isWalletDuplicated: boolean;
10
8
  suggestedPaymentMethod: CryptoPaymentMethodType;
11
9
  }
12
10
 
@@ -22,27 +20,18 @@ export function useConnectedWalletDisplay(
22
20
 
23
21
  const globalWalletAddress = connectedSmartWallet?.getAccount()?.address;
24
22
 
25
- // Helper function to check if two addresses are the same
26
- const isSameAddress = (addr1?: string, addr2?: string): boolean => {
27
- if (!addr1 || !addr2) return false;
28
- return addr1.toLowerCase() === addr2.toLowerCase();
29
- };
30
-
31
23
  // Check if connectedEOAWallet and wagmi wallet represent the same wallet
32
24
  const connectedEOAAddress = connectedEOAWallet?.getAccount()?.address;
33
- const isWalletDuplicated =
34
- isSameAddress(connectedEOAAddress, wagmiAddress) || isSameAddress(globalWalletAddress, wagmiAddress);
35
25
 
36
26
  // Determine which wallet to show (prefer connectedEOAWallet if both exist and are the same)
37
27
  const shouldShowConnectedEOA = !!connectedEOAWallet;
38
28
  // this is disabled because we don't want to display In-App Wallet as a payment method
39
- const shouldShowWagmiWallet = false; // wagmiWalletIsConnected && (!isWalletDuplicated || !connectedEOAWallet);
40
29
 
41
30
  // Determine which address to use based on payment method
42
31
  let walletAddress: string | undefined;
43
32
 
44
33
  if (selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET) {
45
- walletAddress = connectedSmartWallet?.getAccount()?.address;
34
+ walletAddress = globalWalletAddress;
46
35
  } else if (selectedCryptoPaymentMethod === CryptoPaymentMethodType.CONNECT_WALLET) {
47
36
  // Prefer connectedEOAWallet, fallback to wagmi wallet
48
37
  walletAddress = connectedEOAAddress || wagmiAddress;
@@ -58,7 +47,7 @@ export function useConnectedWalletDisplay(
58
47
  if (connectedEOAAddress || wagmiAddress) {
59
48
  // If there's a connected EOA or wagmi wallet, suggest CONNECT_WALLET
60
49
  suggestedPaymentMethod = CryptoPaymentMethodType.CONNECT_WALLET;
61
- } else if (connectedSmartWallet?.getAccount()?.address) {
50
+ } else if (globalWalletAddress) {
62
51
  // If only global wallet is available, suggest that
63
52
  suggestedPaymentMethod = CryptoPaymentMethodType.GLOBAL_WALLET;
64
53
  }
@@ -66,8 +55,6 @@ export function useConnectedWalletDisplay(
66
55
  return {
67
56
  walletAddress,
68
57
  shouldShowConnectedEOA,
69
- shouldShowWagmiWallet,
70
- isWalletDuplicated,
71
58
  suggestedPaymentMethod,
72
59
  };
73
60
  }
@@ -13,8 +13,7 @@ import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
13
13
  import { cn, truncateAddress } from "@b3dotfun/sdk/shared/utils";
14
14
  import { Menu, MenuButton, MenuItems, Transition } from "@headlessui/react";
15
15
  import { ReactNode, useEffect } from "react";
16
- import { useConnectedWallets, useSetActiveWallet } from "thirdweb/react";
17
- import { useAccountWalletImage } from "../../hooks/useAccountWallet";
16
+ import { useConnectedWallets, useSetActiveWallet, useWalletImage } from "thirdweb/react";
18
17
  import { ManageAccountButton } from "../custom/ManageAccountButton";
19
18
 
20
19
  type SignInProps = {
@@ -40,9 +39,10 @@ export function SignIn(props: SignInWithB3Props) {
40
39
  isActiveSmartWallet,
41
40
  isActiveEOAWallet,
42
41
  smartWalletIcon,
43
- eoaWalletIcon,
44
42
  } = useAccountWallet();
45
43
 
44
+ const { data: walletImage } = useWalletImage(connectedEOAWallet?.id);
45
+
46
46
  const isMobile = useIsMobile();
47
47
  const { logout } = useAuthentication(partnerId);
48
48
  const onDisconnect = async (): Promise<void> => {
@@ -72,8 +72,6 @@ export function SignIn(props: SignInWithB3Props) {
72
72
  }
73
73
  }, [connectedEOAWallet, isActiveEOAWallet, setActiveWallet, automaticallySetFirstEoa]);
74
74
 
75
- const walletImage = useAccountWalletImage();
76
-
77
75
  // Desktop version - original dropdown menu
78
76
  return (
79
77
  <StyleRoot>
@@ -115,7 +113,7 @@ export function SignIn(props: SignInWithB3Props) {
115
113
  <div className="flex items-center">
116
114
  <img
117
115
  className="bg-b3-react-primary h-16 w-16 rounded-full opacity-100"
118
- src={eoaWalletIcon}
116
+ src={walletImage}
119
117
  alt={connectedEOAWallet?.id}
120
118
  />
121
119
  <div className="ml-4 grow">
@@ -40,7 +40,7 @@ export function LoginStepContainer({ children, partnerId }: LoginStepContainerPr
40
40
  const partnerLogo = partner?.data?.[0]?.loginCustomization?.logoUrl;
41
41
 
42
42
  return (
43
- <div className="flex flex-col items-center justify-center pt-6">
43
+ <div className="bg-b3-react-background flex flex-col items-center justify-center pt-6">
44
44
  {partnerLogo && (
45
45
  <img src={partnerLogo} alt="Partner Logo" className="partner-logo mb-6 h-12 w-auto object-contain" />
46
46
  )}
@@ -6,7 +6,6 @@ export { useAnalytics } from "./useAnalytics";
6
6
  export { useAuthentication } from "./useAuthentication";
7
7
  export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
8
8
  export { useB3EnsName } from "./useB3EnsName";
9
- export { useBestTransactionPath } from "./useBestTransactionPath";
10
9
  export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
11
10
  export * from "./useClaim";
12
11
  export { useClient } from "./useClient";
@@ -1,7 +1,6 @@
1
1
  import { useB3, useProfile } from "@b3dotfun/sdk/global-account/react";
2
2
  import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
3
3
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
4
- import { getIpfsUrl } from "@b3dotfun/sdk/shared/utils/ipfs";
5
4
  import { useEffect, useMemo, useState } from "react";
6
5
  import { getLastAuthProvider, useActiveWallet, useConnectedWallets, useWalletImage } from "thirdweb/react";
7
6
  import { Account, Wallet } from "thirdweb/wallets";
@@ -44,7 +43,13 @@ export function useAccountWallet(): {
44
43
  eoaWalletIcon?: string;
45
44
  smartWalletIcon?: string;
46
45
  } {
47
- const { account, user } = useB3();
46
+ // WOJ: --------------------
47
+ // values from in useB3:
48
+ // const activeAccount = useActiveAccount();
49
+ // const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
50
+ // can we possibly just use useActiveAccount here?
51
+ // --------------------
52
+ const { account } = useB3();
48
53
 
49
54
  const activeWallet = useActiveWallet();
50
55
  const connectedWallets = useConnectedWallets();
@@ -61,8 +66,6 @@ export function useAccountWallet(): {
61
66
  debug("isActiveSmartWallet", isActiveSmartWallet);
62
67
  debug("isActiveEOAWallet", isActiveEOAWallet);
63
68
 
64
- const { data: walletImage } = useWalletImage(connectedEOAWallet?.id);
65
-
66
69
  // If not EOA sign in, then we need to show the smart wallet icon
67
70
  const lastAuthProvider = useLastAuthProvider();
68
71
 
@@ -73,7 +76,6 @@ export function useAccountWallet(): {
73
76
 
74
77
  const { data: profileData } = useProfile({ address: account?.address });
75
78
  const ensName = profileData?.displayName?.replace(/\.b3\.fun/g, "");
76
- const avatarUrl = user?.avatar ? getIpfsUrl(user?.avatar) : profileData?.avatar;
77
79
 
78
80
  const res = useMemo(
79
81
  () => ({
@@ -81,7 +83,7 @@ export function useAccountWallet(): {
81
83
  ...account,
82
84
  ensName,
83
85
  meta: {
84
- icon: avatarUrl || (isActiveSmartWallet ? smartWalletIcon : walletImage) || "",
86
+ icon: "", // deprecated
85
87
  },
86
88
  },
87
89
 
@@ -95,18 +97,16 @@ export function useAccountWallet(): {
95
97
  isActiveEOAWallet: isActiveEOAWallet,
96
98
 
97
99
  smartWalletIcon: smartWalletIcon,
98
- eoaWalletIcon: walletImage,
100
+ eoaWalletIcon: "", // deprecated
99
101
  }),
100
102
  [
101
103
  account,
102
- avatarUrl,
103
104
  connectedEOAWallet,
104
105
  connectedSmartWallet,
105
106
  ensName,
106
107
  isActiveEOAWallet,
107
108
  isActiveSmartWallet,
108
109
  smartWalletIcon,
109
- walletImage,
110
110
  ],
111
111
  );
112
112
 
@@ -114,7 +114,7 @@ export function useAccountWallet(): {
114
114
  }
115
115
 
116
116
  export function useAccountWalletImage(): string {
117
- const { account, user } = useB3();
117
+ const { account } = useB3();
118
118
 
119
119
  const activeWallet = useActiveWallet();
120
120
  const connectedWallets = useConnectedWallets();
@@ -134,7 +134,8 @@ export function useAccountWalletImage(): string {
134
134
  : "https://gradvatar.com/0x0000000000000000000000000000000000000000"; // show smart wallet of eoa wallet is gradvatar
135
135
 
136
136
  const { data: profileData } = useProfile({ address: account?.address });
137
- const avatarUrl = user?.avatar || profileData?.avatar;
137
+
138
+ const avatarUrl = profileData?.avatar;
138
139
 
139
140
  return avatarUrl || (isActiveSmartWallet ? smartWalletIcon : walletImage) || "";
140
141
  }
@@ -1,41 +0,0 @@
1
- import { components } from "../../../anyspend/types/api";
2
- export type TransactionType = "send" | "swap" | "bridge";
3
- export interface SprinterOption {
4
- chainId: number;
5
- balance: bigint;
6
- formattedBalance: string;
7
- }
8
- export interface TransactionPath {
9
- type: "native" | "sprinter" | "anyspend";
10
- hasNativePath: boolean;
11
- hasSprinterPath: boolean;
12
- availableBalance: bigint;
13
- totalCrossChainBalance: number;
14
- sprinterOptions?: SprinterOption[];
15
- }
16
- export interface TransactionPathResult extends TransactionPath {
17
- loading: boolean;
18
- }
19
- interface UseBestTransactionPathProps {
20
- amount: bigint;
21
- token: components["schemas"]["Token"];
22
- address?: string;
23
- transactionType?: TransactionType;
24
- }
25
- /**
26
- * Hook to determine the optimal transaction path based on user's balances across chains
27
- *
28
- * @param props.amount - Amount to transact
29
- * @param props.token - Token (a Token object)
30
- * @param props.address - Target address (optional, defaults to self)
31
- * @param props.transactionType - Type of transaction (optional, defaults to 'send')
32
- *
33
- * - type: The recommended path type ('native', 'sprinter', or 'anyspend')
34
- * - hasNativePath: Whether direct native token transfer is possible (1st best path)
35
- * - hasSprinterPath: Whether bridging via Sprinter is possible (2nd best path)
36
- * - availableBalance: The user's balance of this asset
37
- * - sprinterOptions: Available chains and balances for bridging
38
- * @returns TransactionPathResult object containing path information and loading state
39
- */
40
- export declare function useBestTransactionPath({ amount, token, address, transactionType: _transactionType, }: UseBestTransactionPathProps): TransactionPathResult;
41
- export {};