@b3dotfun/sdk 0.0.87-alpha.1 → 0.0.87-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/cjs/anyspend/react/components/AnySpend.js +18 -24
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +0 -1
- package/dist/cjs/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +2 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +17 -47
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +6 -7
- package/dist/cjs/global-account/react/components/B3Provider/types.d.ts +0 -5
- package/dist/cjs/global-account/react/components/B3Provider/types.js +4 -4
- package/dist/cjs/global-account/react/components/B3Provider/useB3.d.ts +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3.js +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.d.ts +1 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Account.js +10 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.d.ts +9 -0
- package/dist/cjs/global-account/react/components/B3Provider/useB3Config.js +23 -0
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +1 -1
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.js +1 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +2 -1
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +2 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3.js +2 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +2 -1
- package/dist/cjs/global-account/react/components/index.d.ts +2 -0
- package/dist/cjs/global-account/react/components/index.js +7 -3
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +3 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.d.ts +7 -0
- package/dist/cjs/global-account/react/hooks/useAutoSelectWallet.js +42 -0
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +6 -4
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -2
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +18 -24
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +0 -1
- package/dist/esm/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +3 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +21 -51
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +6 -7
- package/dist/esm/global-account/react/components/B3Provider/types.d.ts +0 -5
- package/dist/esm/global-account/react/components/B3Provider/types.js +4 -4
- package/dist/esm/global-account/react/components/B3Provider/useB3.d.ts +1 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3.js +1 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.d.ts +1 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Account.js +6 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.d.ts +9 -0
- package/dist/esm/global-account/react/components/B3Provider/useB3Config.js +19 -0
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +2 -2
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.js +2 -3
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +3 -2
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3.js +3 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +3 -2
- package/dist/esm/global-account/react/components/index.d.ts +2 -0
- package/dist/esm/global-account/react/components/index.js +2 -0
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +4 -3
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useAutoSelectWallet.d.ts +7 -0
- package/dist/esm/global-account/react/hooks/useAutoSelectWallet.js +39 -0
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +6 -4
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -2
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/hooks/useSigMint.d.ts +1 -1
- package/dist/types/global-account/react/components/B3Provider/types.d.ts +0 -5
- package/dist/types/global-account/react/components/B3Provider/useB3.d.ts +1 -0
- package/dist/types/global-account/react/components/B3Provider/useB3Account.d.ts +1 -0
- package/dist/types/global-account/react/components/B3Provider/useB3Config.d.ts +9 -0
- package/dist/types/global-account/react/components/index.d.ts +2 -0
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +1 -1
- package/dist/types/global-account/react/hooks/useAutoSelectWallet.d.ts +7 -0
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +37 -40
- package/src/anyspend/react/components/AnySpendCustom.tsx +0 -2
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +10 -2
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +6 -7
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +20 -71
- package/src/global-account/react/components/B3Provider/types.ts +8 -9
- package/src/global-account/react/components/B3Provider/useB3.ts +1 -0
- package/src/global-account/react/components/B3Provider/useB3Account.ts +7 -0
- package/src/global-account/react/components/B3Provider/useB3Config.ts +34 -0
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +2 -2
- package/src/global-account/react/components/LinkAccount/LinkNewAccount.tsx +2 -3
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +10 -2
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +3 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3.tsx +2 -2
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +5 -2
- package/src/global-account/react/components/index.ts +2 -0
- package/src/global-account/react/hooks/useAccountWallet.tsx +4 -3
- package/src/global-account/react/hooks/useAutoSelectWallet.ts +51 -0
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +7 -5
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +2 -2
|
@@ -833,30 +833,24 @@ function AnySpendInner({ sourceChainId, destinationTokenAddress, destinationToke
|
|
|
833
833
|
else {
|
|
834
834
|
setActivePanel(panelIndex);
|
|
835
835
|
}
|
|
836
|
-
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
// Swap amounts
|
|
855
|
-
const tempSrcAmount = srcAmount;
|
|
856
|
-
const tempDstAmount = dstAmount;
|
|
857
|
-
setSrcAmount(tempDstAmount);
|
|
858
|
-
setDstAmount(tempSrcAmount);
|
|
859
|
-
}, children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }), activeTab === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, effectiveRecipientAddress: effectiveRecipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward"), dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
|
|
836
|
+
}, _recipientAddress: effectiveRecipientAddress, destinationToken: selectedDstToken, destinationChainId: selectedDstChainId, destinationAmount: dstAmount, onDestinationTokenChange: setSelectedDstToken, onDestinationChainChange: setSelectedDstChainId, fiatPaymentMethodIndex: PanelView.FIAT_PAYMENT_METHOD, recipientSelectionPanelIndex: PanelView.RECIPIENT_SELECTION, hideDstToken: isBuyMode, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward"), customUsdInputValues: customUsdInputValues }) })), activeTab === "crypto" && (_jsx("div", { className: "z-10 -my-6 flex justify-center", children: _jsx(Button, { variant: "ghost", className: cn("border-as-stroke bg-as-surface-primary h-10 w-10 rounded-xl border-2 sm:h-8 sm:w-8 sm:rounded-xl", isBuyMode && "cursor-default", selectedDstChainId === HYPERLIQUID_CHAIN_ID && "cursor-not-allowed opacity-50"), onClick: () => {
|
|
837
|
+
if (isBuyMode) {
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
// Prevent swapping if destination is Hyperliquid (only supported as destination, not source)
|
|
841
|
+
if (selectedDstChainId === HYPERLIQUID_CHAIN_ID) {
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
// Swap chain selections
|
|
845
|
+
setSelectedSrcChainId(selectedDstChainId);
|
|
846
|
+
setSelectedDstChainId(selectedSrcChainId);
|
|
847
|
+
// Swap token selections
|
|
848
|
+
setSelectedSrcToken(selectedDstToken);
|
|
849
|
+
setSelectedDstToken(selectedSrcToken);
|
|
850
|
+
// Swap amounts
|
|
851
|
+
setSrcAmount(dstAmount);
|
|
852
|
+
setDstAmount(srcAmount);
|
|
853
|
+
}, children: _jsx("div", { className: "relative flex items-center justify-center transition-opacity", children: _jsx(ArrowDown, { className: "text-as-primary/50 h-5 w-5" }) }) }) })), activeTab === "crypto" && (_jsx(CryptoReceiveSection, { isDepositMode: false, isBuyMode: isBuyMode, effectiveRecipientAddress: effectiveRecipientAddress, recipientName: recipientName || undefined, onSelectRecipient: () => navigateToPanel(PanelView.RECIPIENT_SELECTION, "forward"), dstAmount: dstAmount, dstToken: selectedDstToken, selectedDstChainId: selectedDstChainId, setSelectedDstChainId: setSelectedDstChainId, setSelectedDstToken: setSelectedDstToken, isSrcInputDirty: isSrcInputDirty, onChangeDstAmount: value => {
|
|
860
854
|
setIsSrcInputDirty(false);
|
|
861
855
|
setDstAmount(value);
|
|
862
856
|
}, anyspendQuote: anyspendQuote, onShowPointsDetail: () => navigateToPanel(PanelView.POINTS_DETAIL, "forward"), onShowFeeDetail: () => navigateToPanel(PanelView.FEE_DETAIL, "forward") }))] }), _jsxs(motion.div, { initial: { opacity: 0, y: 20, filter: "blur(10px)" }, animate: { opacity: 1, y: 0, filter: "blur(0px)" }, transition: { duration: 0.3, delay: 0.2, ease: "easeInOut" }, className: cn("mt-4 flex w-full max-w-[460px] flex-col gap-2"), children: [_jsx(ShinyButton, { accentColor: "hsl(var(--as-brand))", disabled: btnInfo.disable, onClick: onMainButtonClick, className: cn("as-main-button relative w-full", btnInfo.error ? "!bg-as-red" : btnInfo.disable ? "!bg-as-on-surface-2" : "!bg-as-brand"), textClassName: cn(btnInfo.error ? "text-white" : btnInfo.disable ? "text-as-secondary" : "text-white"), children: _jsxs("div", { className: "flex items-center justify-center gap-2", children: [btnInfo.loading && _jsx(Loader2, { className: "h-4 w-4 animate-spin" }), btnInfo.text] }) }), !hideTransactionHistoryButton && (globalAddress || effectiveRecipientAddress) ? (_jsxs(Button, { variant: "link", onClick: onClickHistory, className: "text-as-primary/50 hover:text-as-primary flex items-center gap-1 transition-colors", children: [_jsx(HistoryIcon, { className: "h-4 w-4" }), " ", _jsx("span", { className: "pr-4", children: "Transaction History" })] })) : null] })] }), _jsx("div", { className: "w-full", children: _jsx(TabsPrimitive, { defaultValue: "swap", onValueChange: value => {
|
|
@@ -180,7 +180,6 @@ function AnySpendCustomInner({ loadOrder, mode = "modal", activeTab: activeTabPr
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
}, [srcChainId, tokenList, getTokenWithBalance, nativeTokens, fungibleTokens, dirtySelectSrcToken, dstToken.address]);
|
|
183
|
-
// const { account: isAuthenticated } = useB3();
|
|
184
183
|
const getRelayQuoteRequest = useMemo(() => {
|
|
185
184
|
return generateGetRelayQuoteRequest({
|
|
186
185
|
orderType: orderType,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import app from "../../../../global-account/app.js";
|
|
4
|
-
import { Button, IPFSMediaRenderer, toast,
|
|
4
|
+
import { Button, IPFSMediaRenderer, toast, useAuthentication, useB3Config, useProfile, } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { validateImageUrl } from "../../../../global-account/react/utils/profileDisplay.js";
|
|
6
6
|
import { cn } from "../../../../shared/utils/cn.js";
|
|
7
7
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
@@ -37,7 +37,8 @@ export function AvatarEditor({ onSetAvatar, className }) {
|
|
|
37
37
|
const [zoom, setZoom] = useState(1);
|
|
38
38
|
const [croppedAreaPixels, setCroppedAreaPixels] = useState(null);
|
|
39
39
|
const fileInputRef = useRef(null);
|
|
40
|
-
const {
|
|
40
|
+
const { partnerId } = useB3Config();
|
|
41
|
+
const { user, setUser } = useAuthentication(partnerId);
|
|
41
42
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
42
43
|
const contentType = useModalStore(state => state.contentType);
|
|
43
44
|
const account = useActiveAccount();
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import { RelayKitProviderWrapper, TooltipProvider,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { RelayKitProviderWrapper, TooltipProvider, useAuthStore } from "../../../../global-account/react/index.js";
|
|
3
|
+
import { useAutoSelectWallet } from "../../../../global-account/react/hooks/useAutoSelectWallet.js";
|
|
3
4
|
import { createWagmiConfig } from "../../../../global-account/react/utils/createWagmiConfig.js";
|
|
4
5
|
import { loadGA4Script } from "../../../../global-account/utils/analytics.js";
|
|
5
|
-
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
6
6
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
7
7
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useEffect, useMemo } from "react";
|
|
9
|
+
import { ThirdwebProvider, useActiveAccount } from "thirdweb/react";
|
|
10
10
|
import { WagmiProvider } from "wagmi";
|
|
11
11
|
import { setClientType } from "../../../client-manager.js";
|
|
12
12
|
import { StyleRoot } from "../StyleRoot.js";
|
|
13
13
|
import { setToastContext, ToastProvider, useToastContext } from "../Toast/index.js";
|
|
14
14
|
import { LocalSDKProvider } from "./LocalSDKProvider.js";
|
|
15
15
|
import { B3Context } from "./types.js";
|
|
16
|
-
const debug = debugB3React("B3Provider");
|
|
17
16
|
/**
|
|
18
17
|
* Default permissions configuration for B3 provider
|
|
19
18
|
*/
|
|
@@ -47,52 +46,26 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
47
46
|
*/
|
|
48
47
|
export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa, theme = "light", clientType = "socket", partnerId, stripePublishableKey, createClientReferenceId, enableTurnkey, }) {
|
|
49
48
|
const activeAccount = useActiveAccount();
|
|
50
|
-
const [manuallySelectedWallet, setManuallySelectedWallet] = useState(undefined);
|
|
51
|
-
const wallets = useConnectedWallets();
|
|
52
49
|
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
53
|
-
const isConnected = useAuthStore(state => state.isConnected);
|
|
54
|
-
const justCompletedLogin = useAuthStore(state => state.justCompletedLogin);
|
|
55
|
-
const setActiveWallet = useSetActiveWallet();
|
|
56
|
-
const { user, setUser, refetchUser } = useAuthentication(partnerId);
|
|
57
|
-
debug("@@B3Provider:isConnected", isConnected);
|
|
58
|
-
debug("@@wallets", wallets);
|
|
59
|
-
debug("@@B3Provider:user", user);
|
|
60
|
-
debug("@@B3Provider:justCompletedLogin", justCompletedLogin);
|
|
50
|
+
//const isConnected = useAuthStore(state => state.isConnected);
|
|
51
|
+
//const justCompletedLogin = useAuthStore(state => state.justCompletedLogin);
|
|
61
52
|
// Use given accountOverride or activeAccount from thirdweb
|
|
53
|
+
// WOJ: why if isAuthenticated is false, we don't use activeAccount, which should be undefined?
|
|
54
|
+
// skip isAuthenticated check ?
|
|
62
55
|
const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
const autoSelectFirstEOAWallet = async () => {
|
|
71
|
-
// Only proceed if auto-selection is enabled and user is authenticated
|
|
72
|
-
if (!automaticallySetFirstEoa || !isAuthenticated) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
// Find the first EOA wallet (excluding ecosystem wallets)
|
|
76
|
-
const isEOAWallet = (wallet) => !wallet.id.startsWith("ecosystem.");
|
|
77
|
-
const firstEOAWallet = wallets.find(isEOAWallet);
|
|
78
|
-
if (firstEOAWallet) {
|
|
79
|
-
// Only auto-select if the last auth was via wallet or no previous auth provider
|
|
80
|
-
const lastAuthProvider = await getLastAuthProvider();
|
|
81
|
-
const shouldAutoSelect = lastAuthProvider === null || lastAuthProvider === "wallet";
|
|
82
|
-
if (shouldAutoSelect) {
|
|
83
|
-
setWallet(firstEOAWallet);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
autoSelectFirstEOAWallet();
|
|
88
|
-
}, [automaticallySetFirstEoa, isAuthenticated, setWallet, wallets]);
|
|
56
|
+
// Wrapper to set active wallet via thirdweb
|
|
57
|
+
// Note: `wallet` in context is deprecated - use useActiveWallet() from thirdweb/react instead
|
|
58
|
+
// Auto-select first EOA wallet when enabled
|
|
59
|
+
useAutoSelectWallet({
|
|
60
|
+
enabled: automaticallySetFirstEoa,
|
|
61
|
+
});
|
|
89
62
|
return (_jsx(B3Context.Provider, { value: {
|
|
90
63
|
account: effectiveAccount,
|
|
91
|
-
setWallet,
|
|
92
|
-
wallet:
|
|
93
|
-
user,
|
|
94
|
-
setUser,
|
|
95
|
-
refetchUser,
|
|
64
|
+
// setWallet,
|
|
65
|
+
//wallet: undefined, // Deprecated: use useActiveWallet() from thirdweb/react instead
|
|
66
|
+
//user,
|
|
67
|
+
//setUser,
|
|
68
|
+
//refetchUser,
|
|
96
69
|
initialized: true,
|
|
97
70
|
ready: !!effectiveAccount,
|
|
98
71
|
automaticallySetFirstEoa,
|
|
@@ -104,11 +77,8 @@ export function InnerProvider({ children, accountOverride, environment, defaultP
|
|
|
104
77
|
stripePublishableKey,
|
|
105
78
|
createClientReferenceId,
|
|
106
79
|
enableTurnkey,
|
|
107
|
-
}, children:
|
|
80
|
+
}, children: children }));
|
|
108
81
|
}
|
|
109
|
-
const InnerProvider2 = ({ children }) => {
|
|
110
|
-
return _jsx(_Fragment, { children: children });
|
|
111
|
-
};
|
|
112
82
|
/**
|
|
113
83
|
* Component to connect the toast context to the global toast API
|
|
114
84
|
*/
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3
3
|
import { ThirdwebProvider, useActiveAccount } from "thirdweb/react";
|
|
4
4
|
import { WagmiProvider } from "wagmi";
|
|
5
|
-
import { useAuthentication } from "../../hooks/useAuthentication.js";
|
|
6
5
|
import { createWagmiConfig } from "../../utils/createWagmiConfig.js";
|
|
7
6
|
import { LocalSDKProvider } from "./LocalSDKProvider.js";
|
|
8
7
|
import { B3Context } from "./types.js";
|
|
@@ -28,17 +27,17 @@ export function B3Provider({ theme = "light", children, accountOverride, environ
|
|
|
28
27
|
*/
|
|
29
28
|
export function InnerProvider({ children, accountOverride, environment, defaultPermissions = DEFAULT_PERMISSIONS, theme = "light", clientType = "socket", partnerId, rpcUrls, }) {
|
|
30
29
|
const activeAccount = useActiveAccount();
|
|
31
|
-
const { user, setUser, refetchUser } = useAuthentication(partnerId);
|
|
30
|
+
//const { user, setUser, refetchUser } = useAuthentication(partnerId);
|
|
32
31
|
const wagmiConfig = createWagmiConfig({ partnerId, rpcUrls });
|
|
33
32
|
// Use given accountOverride or activeAccount from thirdweb
|
|
34
33
|
const effectiveAccount = accountOverride || activeAccount;
|
|
35
34
|
return (_jsx(WagmiProvider, { config: wagmiConfig, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(B3Context.Provider, { value: {
|
|
36
|
-
account: effectiveAccount,
|
|
35
|
+
//account: effectiveAccount,
|
|
37
36
|
automaticallySetFirstEoa: false,
|
|
38
|
-
setWallet: () => {
|
|
37
|
+
//setWallet: () => {},
|
|
39
38
|
wallet: undefined,
|
|
40
|
-
user,
|
|
41
|
-
setUser,
|
|
39
|
+
//user,
|
|
40
|
+
//setUser,
|
|
42
41
|
initialized: true,
|
|
43
42
|
ready: !!effectiveAccount,
|
|
44
43
|
environment,
|
|
@@ -46,6 +45,6 @@ export function InnerProvider({ children, accountOverride, environment, defaultP
|
|
|
46
45
|
theme,
|
|
47
46
|
clientType,
|
|
48
47
|
partnerId,
|
|
49
|
-
refetchUser,
|
|
48
|
+
//refetchUser,
|
|
50
49
|
}, children: children }) }) }));
|
|
51
50
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Users } from "@b3dotfun/b3-api";
|
|
2
1
|
import { CreateOnrampOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOnrampOrder";
|
|
3
2
|
import { CreateOrderParams } from "../../../../anyspend/react/hooks/useAnyspendCreateOrder";
|
|
4
3
|
import { PermissionsConfig } from "../../../../global-account/types/permissions";
|
|
@@ -10,11 +9,7 @@ import { ClientType } from "../../../client-manager";
|
|
|
10
9
|
export interface B3ContextType {
|
|
11
10
|
account?: Account;
|
|
12
11
|
automaticallySetFirstEoa: boolean;
|
|
13
|
-
user?: Users;
|
|
14
|
-
setWallet: (wallet: Wallet) => void;
|
|
15
12
|
wallet?: Wallet;
|
|
16
|
-
setUser: (user?: Users) => void;
|
|
17
|
-
refetchUser: () => Promise<any>;
|
|
18
13
|
initialized: boolean;
|
|
19
14
|
ready: boolean;
|
|
20
15
|
environment?: "development" | "production";
|
|
@@ -5,11 +5,11 @@ import { createContext } from "react";
|
|
|
5
5
|
export const B3Context = createContext({
|
|
6
6
|
account: undefined,
|
|
7
7
|
automaticallySetFirstEoa: false,
|
|
8
|
-
user: undefined,
|
|
9
|
-
setWallet: () => {
|
|
8
|
+
//user: undefined,
|
|
9
|
+
//setWallet: () => {},
|
|
10
10
|
wallet: undefined,
|
|
11
|
-
setUser: () => {
|
|
12
|
-
refetchUser: async () => {
|
|
11
|
+
//setUser: () => {},
|
|
12
|
+
//refetchUser: async () => {},
|
|
13
13
|
initialized: false,
|
|
14
14
|
ready: false,
|
|
15
15
|
environment: "development",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useB3Account: () => import("thirdweb/wallets").Account | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const useB3Config: () => {
|
|
2
|
+
automaticallySetFirstEoa: boolean;
|
|
3
|
+
environment: "development" | "production" | undefined;
|
|
4
|
+
theme: "light" | "dark";
|
|
5
|
+
clientType: import("../../../client-manager").ClientType;
|
|
6
|
+
partnerId: string;
|
|
7
|
+
createClientReferenceId: ((params: import("../../../../anyspend/react").CreateOrderParams | import("../../../../anyspend/react").CreateOnrampOrderParams) => Promise<string>) | undefined;
|
|
8
|
+
enableTurnkey: boolean | undefined;
|
|
9
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useContext, useMemo } from "react";
|
|
2
|
+
import { B3Context } from "./types.js";
|
|
3
|
+
export const useB3Config = () => {
|
|
4
|
+
const context = useContext(B3Context);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error("useB3 must be used within a B3Provider");
|
|
7
|
+
}
|
|
8
|
+
const { automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey, } = context;
|
|
9
|
+
// Return a stable reference
|
|
10
|
+
return useMemo(() => ({
|
|
11
|
+
automaticallySetFirstEoa,
|
|
12
|
+
environment,
|
|
13
|
+
theme,
|
|
14
|
+
clientType,
|
|
15
|
+
partnerId,
|
|
16
|
+
createClientReferenceId,
|
|
17
|
+
enableTurnkey,
|
|
18
|
+
}), [automaticallySetFirstEoa, environment, theme, clientType, partnerId, createClientReferenceId, enableTurnkey]);
|
|
19
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import app from "../../../../global-account/app.js";
|
|
3
|
-
import { Button, toast,
|
|
3
|
+
import { Button, toast, useAuthentication, useModalStore, useQueryB3, } from "../../../../global-account/react/index.js";
|
|
4
4
|
import { client } from "../../../../shared/utils/thirdweb.js";
|
|
5
5
|
import { Copy, Loader2, Pencil } from "lucide-react";
|
|
6
6
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -17,7 +17,7 @@ export const LinkAccount = ({ partnerId, onLogout: _onLogout, chain, }) => {
|
|
|
17
17
|
const isLinking = useModalStore(state => state.isLinking);
|
|
18
18
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
19
19
|
const contentType = useModalStore(state => state.contentType);
|
|
20
|
-
const { user, setUser } =
|
|
20
|
+
const { user, setUser } = useAuthentication(partnerId);
|
|
21
21
|
const [isUpdatingCode, setIsUpdatingCode] = useState(false);
|
|
22
22
|
const [newReferralCode, setNewReferralCode] = useState("");
|
|
23
23
|
const [isEditingCode, setIsEditingCode] = useState(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import app from "../../../../global-account/app.js";
|
|
3
|
-
import { toast } from "../../../../global-account/react/index.js";
|
|
3
|
+
import { toast, useB3Account } from "../../../../global-account/react/index.js";
|
|
4
4
|
import { ecosystemWalletId } from "../../../../shared/constants/index.js";
|
|
5
5
|
import { thirdwebB3Mainnet } from "../../../../shared/constants/chains/b3Chain.js";
|
|
6
6
|
import { client } from "../../../../shared/utils/thirdweb.js";
|
|
@@ -11,7 +11,6 @@ import { createWallet, preAuthenticate } from "thirdweb/wallets";
|
|
|
11
11
|
import { WalletRow } from "../../index.js";
|
|
12
12
|
import { useModalStore } from "../../stores/useModalStore.js";
|
|
13
13
|
import { getProfileDisplayInfo } from "../../utils/profileDisplay.js";
|
|
14
|
-
import { useB3 } from "../B3Provider/useB3.js";
|
|
15
14
|
import { AppleIcon } from "../icons/AppleIcon.js";
|
|
16
15
|
import { DiscordIcon } from "../icons/DiscordIcon.js";
|
|
17
16
|
import { FarcasterIcon } from "../icons/FarcasterIcon.js";
|
|
@@ -90,7 +89,7 @@ export function LinkNewAccount({ onSuccess: onSuccessCallback, onError, onClose,
|
|
|
90
89
|
...getProfileDisplayInfo(profile),
|
|
91
90
|
originalProfile: profile,
|
|
92
91
|
}));
|
|
93
|
-
const
|
|
92
|
+
const account = useB3Account();
|
|
94
93
|
const { mutate: linkProfile } = useLinkProfile();
|
|
95
94
|
const onSuccess = useCallback(async () => {
|
|
96
95
|
await onSuccessCallback?.();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useAccountWallet,
|
|
2
|
+
import { useAccountWallet, useAuthentication, useB3Config, useModalStore, useProfile, useSimBalance, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { formatUsername } from "../../../../shared/utils/index.js";
|
|
4
4
|
import { formatDisplayNumber } from "../../../../shared/utils/number.js";
|
|
5
5
|
import { Pencil } from "lucide-react";
|
|
@@ -15,7 +15,8 @@ const ProfileSection = () => {
|
|
|
15
15
|
address: eoaAddress || account?.address,
|
|
16
16
|
fresh: true,
|
|
17
17
|
});
|
|
18
|
-
const {
|
|
18
|
+
const { partnerId } = useB3Config();
|
|
19
|
+
const { user } = useAuthentication(partnerId);
|
|
19
20
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
20
21
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
21
22
|
const navigateBack = useModalStore(state => state.navigateBack);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { ens_normalize } from "@adraffy/ens-normalize";
|
|
3
3
|
import app from "../../../../global-account/app.js";
|
|
4
|
-
import { toast,
|
|
4
|
+
import { toast, useAuthentication, useB3Config, useModalStore, useProfile } from "../../../../global-account/react/index.js";
|
|
5
5
|
import { formatUsername } from "../../../../shared/utils/index.js";
|
|
6
6
|
import { Check, Loader2, Pencil, X } from "lucide-react";
|
|
7
7
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -15,7 +15,8 @@ const SettingsProfileCard = () => {
|
|
|
15
15
|
address: eoaAddress || account?.address,
|
|
16
16
|
fresh: true,
|
|
17
17
|
});
|
|
18
|
-
const {
|
|
18
|
+
const { partnerId } = useB3Config();
|
|
19
|
+
const { user, setUser } = useAuthentication(partnerId);
|
|
19
20
|
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
20
21
|
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
21
22
|
const navigateBack = useModalStore(state => state.navigateBack);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Button, StyleRoot, useAuthStore,
|
|
2
|
+
import { Button, StyleRoot, useAuthStore, useIsMobile, useModalStore, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { useEffect } from "react";
|
|
4
|
+
import { useB3Account } from "../B3Provider/useB3Account.js";
|
|
4
5
|
import { ManageAccountButton } from "../custom/ManageAccountButton.js";
|
|
5
6
|
import { Loading } from "../ui/Loading.js";
|
|
6
7
|
export function SignInWithB3(props) {
|
|
7
8
|
const { setB3ModalOpen, setB3ModalContentType, setEcoSystemAccountAddress } = useModalStore();
|
|
8
|
-
const
|
|
9
|
+
const account = useB3Account();
|
|
9
10
|
const { isAuthenticating, isAuthenticated } = useAuthStore();
|
|
10
11
|
const isMobile = useIsMobile();
|
|
11
12
|
useEffect(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Loading, useAuthStore,
|
|
2
|
+
import { Loading, useAuthentication, useAuthStore, useB3Config, useGetAllTWSigners, useModalStore, } from "../../../../global-account/react/index.js";
|
|
3
3
|
import { debugB3React } from "../../../../shared/utils/debug.js";
|
|
4
4
|
import { useCallback, useEffect, useState } from "react";
|
|
5
5
|
import { useActiveAccount } from "thirdweb/react";
|
|
@@ -13,7 +13,8 @@ const MAX_REFETCH_ATTEMPTS = 20;
|
|
|
13
13
|
* Handles different login providers, authentication steps, and session key management
|
|
14
14
|
*/
|
|
15
15
|
export function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, }) {
|
|
16
|
-
const { automaticallySetFirstEoa,
|
|
16
|
+
const { automaticallySetFirstEoa, enableTurnkey } = useB3Config();
|
|
17
|
+
const { user, refetchUser } = useAuthentication(partnerId);
|
|
17
18
|
const [step, setStep] = useState(source === "requestPermissions" ? null : "login");
|
|
18
19
|
const [sessionKeyAdded, setSessionKeyAdded] = useState(source === "requestPermissions" ? true : false);
|
|
19
20
|
const { setB3ModalContentType, setB3ModalOpen, isOpen, contentType } = useModalStore();
|
|
@@ -3,6 +3,8 @@ export { B3Provider, InnerProvider } from "./B3Provider/B3Provider";
|
|
|
3
3
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper";
|
|
4
4
|
export { B3Context, type B3ContextType } from "./B3Provider/types";
|
|
5
5
|
export { useB3 } from "./B3Provider/useB3";
|
|
6
|
+
export { useB3Account } from "./B3Provider/useB3Account";
|
|
7
|
+
export { useB3Config } from "./B3Provider/useB3Config";
|
|
6
8
|
export { StyleRoot } from "./StyleRoot";
|
|
7
9
|
export { AuthButton } from "./SignInWithB3/components/AuthButton";
|
|
8
10
|
export { PermissionItem } from "./SignInWithB3/components/PermissionItem";
|
|
@@ -5,6 +5,8 @@ export { B3Provider, InnerProvider } from "./B3Provider/B3Provider.js";
|
|
|
5
5
|
export { RelayKitProviderWrapper } from "./B3Provider/RelayKitProviderWrapper.js";
|
|
6
6
|
export { B3Context } from "./B3Provider/types.js";
|
|
7
7
|
export { useB3 } from "./B3Provider/useB3.js";
|
|
8
|
+
export { useB3Account } from "./B3Provider/useB3Account.js";
|
|
9
|
+
export { useB3Config } from "./B3Provider/useB3Config.js";
|
|
8
10
|
export { StyleRoot } from "./StyleRoot.js";
|
|
9
11
|
// SignInWithB3 Components
|
|
10
12
|
export { AuthButton } from "./SignInWithB3/components/AuthButton.js";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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
4
|
import { useEffect, useMemo, useState } from "react";
|
|
5
5
|
import { getLastAuthProvider, useActiveWallet, useConnectedWallets, useWalletImage } from "thirdweb/react";
|
|
6
6
|
import { socialIcons } from "thirdweb/wallets/in-app";
|
|
7
|
+
import { useB3Account } from "../components/B3Provider/useB3Account.js";
|
|
7
8
|
const debug = debugB3React("useAccountWallet");
|
|
8
9
|
function useLastAuthProvider() {
|
|
9
10
|
const [lastAuthProvider, setLastAuthProvider] = useState(null);
|
|
@@ -23,7 +24,7 @@ export function useAccountWallet() {
|
|
|
23
24
|
// const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
|
|
24
25
|
// can we possibly just use useActiveAccount here?
|
|
25
26
|
// --------------------
|
|
26
|
-
const
|
|
27
|
+
const account = useB3Account();
|
|
27
28
|
const activeWallet = useActiveWallet();
|
|
28
29
|
const connectedWallets = useConnectedWallets();
|
|
29
30
|
const connectedSmartWallet = connectedWallets.find(wallet => wallet.id === ecosystemWalletId);
|
|
@@ -71,7 +72,7 @@ export function useAccountWallet() {
|
|
|
71
72
|
return res;
|
|
72
73
|
}
|
|
73
74
|
export function useAccountWalletImage() {
|
|
74
|
-
const
|
|
75
|
+
const account = useB3Account();
|
|
75
76
|
const activeWallet = useActiveWallet();
|
|
76
77
|
const connectedWallets = useConnectedWallets();
|
|
77
78
|
const connectedSmartWallet = connectedWallets.find(wallet => wallet.id === ecosystemWalletId);
|
|
@@ -13,8 +13,8 @@ export declare function useAuthentication(partnerId: string): {
|
|
|
13
13
|
onConnect: (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => Promise<void>;
|
|
14
14
|
user: {
|
|
15
15
|
email?: string | undefined;
|
|
16
|
-
telNumber?: string | undefined;
|
|
17
16
|
username?: string | undefined;
|
|
17
|
+
telNumber?: string | undefined;
|
|
18
18
|
ens?: string | undefined;
|
|
19
19
|
avatar?: string | undefined;
|
|
20
20
|
preferences?: {} | undefined;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
import { getLastAuthProvider, useConnectedWallets, useSetActiveWallet } from "thirdweb/react";
|
|
4
|
+
import { useAuthStore } from "../stores/index.js";
|
|
5
|
+
const debug = debugB3React("useAutoSelectWallet");
|
|
6
|
+
/**
|
|
7
|
+
* Hook to automatically select the first EOA wallet when user is authenticated
|
|
8
|
+
* Only auto-selects if the last auth was via wallet or no previous auth provider
|
|
9
|
+
*/
|
|
10
|
+
export function useAutoSelectWallet({ enabled }) {
|
|
11
|
+
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
12
|
+
const wallets = useConnectedWallets();
|
|
13
|
+
const setActiveWallet = useSetActiveWallet();
|
|
14
|
+
const setWallet = useCallback((wallet) => {
|
|
15
|
+
debug("@@setWallet", wallet.id, wallet.getAccount()?.address);
|
|
16
|
+
setActiveWallet(wallet);
|
|
17
|
+
}, [setActiveWallet]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const autoSelectFirstEOAWallet = async () => {
|
|
20
|
+
// Only proceed if auto-selection is enabled and user is authenticated
|
|
21
|
+
if (!enabled || !isAuthenticated) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// Find the first EOA wallet (excluding ecosystem wallets)
|
|
25
|
+
const isEOAWallet = (wallet) => !wallet.id.startsWith("ecosystem.");
|
|
26
|
+
const firstEOAWallet = wallets.find(isEOAWallet);
|
|
27
|
+
if (firstEOAWallet) {
|
|
28
|
+
// Only auto-select if the last auth was via wallet or no previous auth provider
|
|
29
|
+
const lastAuthProvider = await getLastAuthProvider();
|
|
30
|
+
const shouldAutoSelect = lastAuthProvider === null || lastAuthProvider === "wallet";
|
|
31
|
+
if (shouldAutoSelect) {
|
|
32
|
+
debug("Auto-selecting first EOA wallet", firstEOAWallet.id);
|
|
33
|
+
setWallet(firstEOAWallet);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
autoSelectFirstEOAWallet();
|
|
38
|
+
}, [enabled, isAuthenticated, setWallet, wallets]);
|
|
39
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
1
3
|
import app from "../../app.js";
|
|
4
|
+
import { useB3Config } from "../components/index.js";
|
|
2
5
|
import { useAuthStore } from "../stores/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { useB3 } from "../components/B3Provider/useB3.js";
|
|
5
|
-
import { debugB3React } from "../../../shared/utils/debug.js";
|
|
6
|
+
import { useAuthentication } from "./useAuthentication.js";
|
|
6
7
|
const debug = debugB3React("useTurnkeyAuth");
|
|
7
8
|
/**
|
|
8
9
|
* Hook for Turnkey email-based OTP authentication
|
|
@@ -17,7 +18,8 @@ export function useTurnkeyAuth() {
|
|
|
17
18
|
const [error, setError] = useState(null);
|
|
18
19
|
const setIsAuthenticating = useAuthStore(state => state.setIsAuthenticating);
|
|
19
20
|
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
20
|
-
const {
|
|
21
|
+
const { partnerId } = useB3Config();
|
|
22
|
+
const { user } = useAuthentication(partnerId);
|
|
21
23
|
/**
|
|
22
24
|
* Step 1: Initiate login with email
|
|
23
25
|
* - Calls backend to create sub-org (if needed) and send OTP
|
|
@@ -8,7 +8,7 @@ import { useCallback, useState } from "react";
|
|
|
8
8
|
import { prepareTransaction, sendTransaction as twSendTransaction } from "thirdweb";
|
|
9
9
|
import { isAddress } from "viem";
|
|
10
10
|
import { useSwitchChain } from "wagmi";
|
|
11
|
-
import {
|
|
11
|
+
import { useB3Account } from "../components/B3Provider/useB3Account.js";
|
|
12
12
|
import { useAccountWallet } from "./useAccountWallet.js";
|
|
13
13
|
const partnerId = String(process.env.PUBLIC_THIRDWEB_PARTNER_ID ||
|
|
14
14
|
process.env.NEXT_PUBLIC_THIRDWEB_PARTNER_ID ||
|
|
@@ -19,7 +19,7 @@ export function useUnifiedChainSwitchAndExecute() {
|
|
|
19
19
|
const { switchChainAsync } = useSwitchChain();
|
|
20
20
|
const [isSwitchingOrExecuting, setIsSwitchingOrExecuting] = useState(false);
|
|
21
21
|
const { isActiveSmartWallet, isActiveEOAWallet, connectedEOAWallet } = useAccountWallet();
|
|
22
|
-
const
|
|
22
|
+
const aaAccount = useB3Account();
|
|
23
23
|
// Handle EOA wallet chain switch and execute transaction
|
|
24
24
|
const handleEOASwitchChainAndSendTransaction = useCallback(async (targetChainId, params) => {
|
|
25
25
|
if (!connectedEOAWallet) {
|
|
@@ -8,8 +8,8 @@ import { Users } from "@b3dotfun/b3-api";
|
|
|
8
8
|
export declare function useUserQuery(): {
|
|
9
9
|
user: {
|
|
10
10
|
email?: string | undefined;
|
|
11
|
-
telNumber?: string | undefined;
|
|
12
11
|
username?: string | undefined;
|
|
12
|
+
telNumber?: string | undefined;
|
|
13
13
|
ens?: string | undefined;
|
|
14
14
|
avatar?: string | undefined;
|
|
15
15
|
preferences?: {} | undefined;
|