@b3dotfun/sdk 0.1.2-alpha.3 → 0.1.2-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.
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustomExactIn.js +12 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +1 -5
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.native.js +1 -1
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/cjs/global-account/react/components/B3Provider/LocalSDKProvider.js +1 -3
- package/dist/cjs/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +19 -152
- package/dist/cjs/global-account/react/components/index.d.ts +0 -1
- package/dist/cjs/global-account/react/components/index.js +3 -6
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -1
- package/dist/cjs/global-account/react/hooks/index.js +2 -4
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/cjs/global-account/react/hooks/useAuth.js +14 -31
- package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/useTWAuth.js +3 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +3 -19
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
- package/dist/esm/anyspend/react/components/AnySpendCustomExactIn.js +12 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendStakeUpsideExactIn.js +2 -2
- package/dist/esm/global-account/react/components/B3DynamicModal.js +1 -5
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/esm/global-account/react/components/B3Provider/B3ConfigProvider.js +1 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.native.js +1 -1
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/esm/global-account/react/components/B3Provider/LocalSDKProvider.js +1 -3
- package/dist/esm/global-account/react/components/B3Provider/RelayKitProviderWrapper.js +1 -3
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +20 -153
- package/dist/esm/global-account/react/components/index.d.ts +0 -1
- package/dist/esm/global-account/react/components/index.js +0 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -1
- package/dist/esm/global-account/react/hooks/index.js +0 -1
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/esm/global-account/react/hooks/useAuth.js +14 -31
- package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/useTWAuth.js +3 -3
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +3 -19
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpendCustomExactIn.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpendStakeUpsideExactIn.d.ts +2 -1
- package/dist/types/global-account/react/components/B3Provider/B3ConfigProvider.d.ts +1 -3
- package/dist/types/global-account/react/components/B3Provider/B3Provider.d.ts +1 -4
- package/dist/types/global-account/react/components/B3Provider/B3Provider.native.d.ts +1 -1
- package/dist/types/global-account/react/components/B3Provider/LocalSDKProvider.d.ts +1 -4
- package/dist/types/global-account/react/components/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/index.d.ts +0 -1
- package/dist/types/global-account/react/hooks/useAuth.d.ts +2 -3
- package/dist/types/global-account/react/hooks/useTWAuth.d.ts +1 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +3 -19
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpendCustomExactIn.tsx +15 -1
- package/src/anyspend/react/components/AnySpendStakeUpsideExactIn.tsx +3 -0
- package/src/global-account/react/components/B3DynamicModal.tsx +0 -5
- package/src/global-account/react/components/B3Provider/B3ConfigProvider.tsx +0 -4
- package/src/global-account/react/components/B3Provider/B3Provider.native.tsx +1 -1
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +1 -11
- package/src/global-account/react/components/B3Provider/LocalSDKProvider.tsx +0 -6
- package/src/global-account/react/components/B3Provider/RelayKitProviderWrapper.tsx +1 -4
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +27 -184
- package/src/global-account/react/components/index.ts +0 -3
- package/src/global-account/react/hooks/index.ts +0 -1
- package/src/global-account/react/hooks/useAuth.ts +14 -31
- package/src/global-account/react/hooks/useTWAuth.tsx +3 -5
- package/src/global-account/react/stores/useModalStore.ts +2 -20
- package/dist/cjs/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/cjs/global-account/react/components/TurnkeyAuthModal.js +0 -86
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +0 -142
- package/dist/esm/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/esm/global-account/react/components/TurnkeyAuthModal.js +0 -83
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +0 -136
- package/dist/types/global-account/react/components/TurnkeyAuthModal.d.ts +0 -8
- package/dist/types/global-account/react/hooks/useTurnkeyAuth.d.ts +0 -20
- package/src/global-account/react/components/TurnkeyAuthModal.tsx +0 -243
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +0 -171
|
@@ -18,6 +18,7 @@ export interface AnySpendCustomExactInProps {
|
|
|
18
18
|
sourceTokenChainId?: number;
|
|
19
19
|
destinationToken: components["schemas"]["Token"];
|
|
20
20
|
destinationChainId: number;
|
|
21
|
+
destinationTokenAmount?: string;
|
|
21
22
|
onSuccess?: (amount: string) => void;
|
|
22
23
|
onOpenCustomModal?: () => void;
|
|
23
24
|
mainFooter?: React.ReactNode;
|
|
@@ -33,7 +33,7 @@ function AnySpendCustomExactIn(props) {
|
|
|
33
33
|
const fingerprintConfig = (0, AnySpendFingerprintWrapper_1.getFingerprintConfig)();
|
|
34
34
|
return ((0, jsx_runtime_1.jsx)(AnySpendFingerprintWrapper_1.AnySpendFingerprintWrapper, { fingerprint: fingerprintConfig, children: (0, jsx_runtime_1.jsx)(AnySpendCustomExactInInner, { ...props }) }));
|
|
35
35
|
}
|
|
36
|
-
function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, orderType = "custom_exact_in", minDestinationAmount, header, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, }) {
|
|
36
|
+
function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddress, paymentType = "crypto", sourceTokenAddress, sourceTokenChainId, destinationToken, destinationChainId, onSuccess, onOpenCustomModal, mainFooter, onTokenSelect, customUsdInputValues, preferEoa, customExactInConfig, destinationTokenAmount, orderType = "custom_exact_in", minDestinationAmount, header, returnToHomeUrl, customRecipientLabel, returnHomeLabel, classes, }) {
|
|
37
37
|
const actionLabel = customExactInConfig?.action ?? "Custom Execution";
|
|
38
38
|
const DESTINATION_TOKEN_DETAILS = {
|
|
39
39
|
SYMBOL: destinationToken.symbol ?? "TOKEN",
|
|
@@ -66,6 +66,17 @@ function AnySpendCustomExactInInner({ loadOrder, mode = "modal", recipientAddres
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}, [preferEoa, connectedEOAWallet, setActiveWallet]);
|
|
69
|
+
// Prefill destination amount if provided (for EXACT_OUTPUT mode)
|
|
70
|
+
const appliedDestinationAmount = (0, react_4.useRef)(false);
|
|
71
|
+
(0, react_4.useEffect)(() => {
|
|
72
|
+
if (destinationTokenAmount && !appliedDestinationAmount.current) {
|
|
73
|
+
appliedDestinationAmount.current = true;
|
|
74
|
+
// Convert wei to human-readable format
|
|
75
|
+
const formattedAmount = (0, number_1.formatUnits)(destinationTokenAmount, destinationToken.decimals);
|
|
76
|
+
setDstAmountInput(formattedAmount);
|
|
77
|
+
setIsSrcInputDirty(false); // Switch to EXACT_OUTPUT mode
|
|
78
|
+
}
|
|
79
|
+
}, [destinationTokenAmount, destinationToken.decimals, setDstAmountInput, setIsSrcInputDirty]);
|
|
69
80
|
const selectedRecipientOrDefault = selectedRecipientAddress ?? recipientAddress;
|
|
70
81
|
const expectedDstAmountRaw = anyspendQuote?.data?.currencyOut?.amount ?? "0";
|
|
71
82
|
const buildCustomPayload = (_recipient) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { components } from "../../../anyspend/types/api";
|
|
2
|
-
export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, }: {
|
|
2
|
+
export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientAddress, sourceTokenAddress, sourceTokenChainId, destinationTokenAmount, stakingContractAddress, token, onSuccess, }: {
|
|
3
3
|
loadOrder?: string;
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
recipientAddress: string;
|
|
@@ -7,5 +7,6 @@ export declare function AnySpendStakeUpsideExactIn({ loadOrder, mode, recipientA
|
|
|
7
7
|
sourceTokenChainId?: number;
|
|
8
8
|
stakingContractAddress: string;
|
|
9
9
|
token: components["schemas"]["Token"];
|
|
10
|
+
destinationTokenAmount?: string;
|
|
10
11
|
onSuccess?: (amount: string) => void;
|
|
11
12
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -17,7 +17,7 @@ const STAKE_FOR_FUNCTION_ABI = JSON.stringify([
|
|
|
17
17
|
outputs: [],
|
|
18
18
|
},
|
|
19
19
|
]);
|
|
20
|
-
function AnySpendStakeUpsideExactIn({ loadOrder, mode = "modal", recipientAddress, sourceTokenAddress, sourceTokenChainId, stakingContractAddress, token, onSuccess, }) {
|
|
20
|
+
function AnySpendStakeUpsideExactIn({ loadOrder, mode = "modal", recipientAddress, sourceTokenAddress, sourceTokenChainId, destinationTokenAmount, stakingContractAddress, token, onSuccess, }) {
|
|
21
21
|
if (!recipientAddress)
|
|
22
22
|
return null;
|
|
23
23
|
const header = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", { className: "from-b3-react-background to-as-on-surface-1 w-full rounded-t-lg bg-gradient-to-t", children: (0, jsx_runtime_1.jsx)("div", { className: "mb-1 flex w-full flex-col items-center gap-2", children: (0, jsx_runtime_1.jsxs)("span", { className: "font-sf-rounded text-2xl font-semibold", children: ["Swap & Stake ", token.symbol, " (Exact In)"] }) }) }) }));
|
|
@@ -29,5 +29,5 @@ function AnySpendStakeUpsideExactIn({ loadOrder, mode = "modal", recipientAddres
|
|
|
29
29
|
spenderAddress: stakingContractAddress,
|
|
30
30
|
action: `stake ${token.symbol}`,
|
|
31
31
|
};
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: token, destinationChainId: chains_1.base.id, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(AnySpendCustomExactIn_1.AnySpendCustomExactIn, { loadOrder: loadOrder, mode: mode, recipientAddress: recipientAddress, sourceTokenAddress: sourceTokenAddress, sourceTokenChainId: sourceTokenChainId, destinationToken: token, destinationChainId: chains_1.base.id, destinationTokenAmount: destinationTokenAmount, customExactInConfig: customExactInConfig, header: header, onSuccess: onSuccess }));
|
|
33
33
|
}
|
|
@@ -25,7 +25,6 @@ const RequestPermissions_1 = require("./RequestPermissions/RequestPermissions");
|
|
|
25
25
|
const Send_1 = require("./Send/Send");
|
|
26
26
|
const SignInWithB3Flow_1 = require("./SignInWithB3/SignInWithB3Flow");
|
|
27
27
|
const index_1 = require("./Toast/index");
|
|
28
|
-
const TurnkeyAuthModal_1 = require("./TurnkeyAuthModal");
|
|
29
28
|
const dialog_1 = require("./ui/dialog");
|
|
30
29
|
const drawer_1 = require("./ui/drawer");
|
|
31
30
|
const debug = (0, debug_1.debugB3React)("B3DynamicModal");
|
|
@@ -50,7 +49,6 @@ function B3DynamicModal() {
|
|
|
50
49
|
"anySpendBuySpin",
|
|
51
50
|
"anySpendOrderHistory",
|
|
52
51
|
"signInWithB3",
|
|
53
|
-
"turnkeyAuth",
|
|
54
52
|
"anySpendSignatureMint",
|
|
55
53
|
"anySpendBondKit",
|
|
56
54
|
"linkAccount",
|
|
@@ -80,7 +78,7 @@ function B3DynamicModal() {
|
|
|
80
78
|
const hideCloseButton = true;
|
|
81
79
|
// Build content class using cn utility
|
|
82
80
|
// eslint-disable-next-line tailwindcss/no-custom-classname
|
|
83
|
-
const contentClass = (0, cn_1.cn)("b3-modal", theme === "dark" && "dark", fullWidthTypes.includes(contentType?.type) && "w-full", isFreestyleType && "b3-modal-freestyle", contentType?.type === "signInWithB3" && "p-0", contentType?.type === "
|
|
81
|
+
const contentClass = (0, cn_1.cn)("b3-modal", theme === "dark" && "dark", fullWidthTypes.includes(contentType?.type) && "w-full", isFreestyleType && "b3-modal-freestyle", contentType?.type === "signInWithB3" && "p-0", contentType?.type === "anySpend" && "md:p-0", contentType?.type === "send" && "p-0", contentType?.type === "manageAccount" && " md:p-0 md:pt-2", contentType?.type === "linkAccount" && "md:p-0");
|
|
84
82
|
debug("contentType", contentType);
|
|
85
83
|
const renderContent = () => {
|
|
86
84
|
if (!contentType)
|
|
@@ -88,8 +86,6 @@ function B3DynamicModal() {
|
|
|
88
86
|
switch (contentType.type) {
|
|
89
87
|
case "signInWithB3":
|
|
90
88
|
return (0, jsx_runtime_1.jsx)(SignInWithB3Flow_1.SignInWithB3Flow, { ...contentType });
|
|
91
|
-
case "turnkeyAuth":
|
|
92
|
-
return (0, jsx_runtime_1.jsx)(TurnkeyAuthModal_1.TurnkeyAuthModal, { ...contentType });
|
|
93
89
|
case "requestPermissions":
|
|
94
90
|
return (0, jsx_runtime_1.jsx)(RequestPermissions_1.RequestPermissions, { ...contentType });
|
|
95
91
|
case "manageAccount":
|
|
@@ -13,9 +13,8 @@ export interface B3ConfigContextType {
|
|
|
13
13
|
partnerId: string;
|
|
14
14
|
stripePublishableKey?: string;
|
|
15
15
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
16
|
-
enableTurnkey: boolean;
|
|
17
16
|
}
|
|
18
|
-
export declare function B3ConfigProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId,
|
|
17
|
+
export declare function B3ConfigProvider({ children, accountOverride, environment, defaultPermissions, automaticallySetFirstEoa, theme, clientType, partnerId, stripePublishableKey, createClientReferenceId, }: {
|
|
19
18
|
children: React.ReactNode;
|
|
20
19
|
accountOverride?: Account;
|
|
21
20
|
environment?: "development" | "production";
|
|
@@ -26,6 +25,5 @@ export declare function B3ConfigProvider({ children, accountOverride, environmen
|
|
|
26
25
|
partnerId: string;
|
|
27
26
|
stripePublishableKey?: string;
|
|
28
27
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
29
|
-
enableTurnkey?: boolean;
|
|
30
28
|
}): import("react/jsx-runtime").JSX.Element;
|
|
31
29
|
export declare function useB3Config(): B3ConfigContextType;
|
|
@@ -14,7 +14,7 @@ const DEFAULT_PERMISSIONS = {
|
|
|
14
14
|
endDate: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365), // 1 year from now
|
|
15
15
|
};
|
|
16
16
|
const B3ConfigContext = (0, react_1.createContext)(null);
|
|
17
|
-
function B3ConfigProvider({ children, accountOverride, environment = "development", defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa = false, theme = "light", clientType = "rest", partnerId, stripePublishableKey, createClientReferenceId,
|
|
17
|
+
function B3ConfigProvider({ children, accountOverride, environment = "development", defaultPermissions = DEFAULT_PERMISSIONS, automaticallySetFirstEoa = false, theme = "light", clientType = "rest", partnerId, stripePublishableKey, createClientReferenceId, }) {
|
|
18
18
|
return ((0, jsx_runtime_1.jsx)(B3ConfigContext.Provider, { value: {
|
|
19
19
|
accountOverride,
|
|
20
20
|
environment,
|
|
@@ -25,7 +25,6 @@ function B3ConfigProvider({ children, accountOverride, environment = "developmen
|
|
|
25
25
|
partnerId,
|
|
26
26
|
stripePublishableKey,
|
|
27
27
|
createClientReferenceId,
|
|
28
|
-
enableTurnkey,
|
|
29
28
|
}, children: children }));
|
|
30
29
|
}
|
|
31
30
|
function useB3Config() {
|
|
@@ -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";
|
|
@@ -9,7 +8,7 @@ import { ClientType } from "../../../client-manager";
|
|
|
9
8
|
/**
|
|
10
9
|
* Main B3Provider component
|
|
11
10
|
*/
|
|
12
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId,
|
|
11
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey, toaster: _toaster, clientType, rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors, createClientReferenceId, defaultPermissions, }: {
|
|
13
12
|
theme: "light" | "dark";
|
|
14
13
|
children: React.ReactNode;
|
|
15
14
|
accountOverride?: Account;
|
|
@@ -30,7 +29,5 @@ export declare function B3Provider({ theme, children, accountOverride, environme
|
|
|
30
29
|
connectors?: CreateConnectorFn[];
|
|
31
30
|
overrideDefaultConnectors?: boolean;
|
|
32
31
|
createClientReferenceId?: (params: CreateOrderParams | CreateOnrampOrderParams) => Promise<string>;
|
|
33
|
-
enableTurnkey?: boolean;
|
|
34
32
|
defaultPermissions?: PermissionsConfig;
|
|
35
|
-
onTurnkeyConnect?: (user: Users) => void | Promise<void>;
|
|
36
33
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -26,7 +26,7 @@ const queryClient = new react_query_1.QueryClient();
|
|
|
26
26
|
*/
|
|
27
27
|
function B3Provider({ theme = "light", children, accountOverride, environment, automaticallySetFirstEoa, simDuneApiKey,
|
|
28
28
|
// deprecated since v0.0.87
|
|
29
|
-
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId,
|
|
29
|
+
toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey, onConnect, onLogout, connectors, overrideDefaultConnectors = false, createClientReferenceId, defaultPermissions, }) {
|
|
30
30
|
// Initialize Google Analytics on mount
|
|
31
31
|
(0, react_2.useEffect)(() => {
|
|
32
32
|
(0, analytics_1.loadGA4Script)();
|
|
@@ -36,7 +36,7 @@ toaster: _toaster, clientType = "rest", rpcUrls, partnerId, stripePublishableKey
|
|
|
36
36
|
(0, client_manager_1.setClientType)(clientType);
|
|
37
37
|
}, [clientType]);
|
|
38
38
|
const wagmiConfig = (0, react_2.useMemo)(() => (0, createWagmiConfig_1.createWagmiConfig)({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }), [partnerId, rpcUrls, connectors, overrideDefaultConnectors]);
|
|
39
|
-
return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, onLogoutCallback: onLogout,
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(react_3.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(wagmi_1.WagmiProvider, { config: wagmiConfig, reconnectOnMount: false, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(react_1.TooltipProvider, { children: (0, jsx_runtime_1.jsx)(index_1.ToastProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, onLogoutCallback: onLogout, children: (0, jsx_runtime_1.jsxs)(B3ConfigProvider_1.B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: !!automaticallySetFirstEoa, theme: theme, clientType: clientType, partnerId: partnerId, stripePublishableKey: stripePublishableKey, createClientReferenceId: createClientReferenceId, defaultPermissions: defaultPermissions, children: [(0, jsx_runtime_1.jsx)(ToastContextConnector, {}), (0, jsx_runtime_1.jsxs)(react_1.RelayKitProviderWrapper, { simDuneApiKey: simDuneApiKey, children: [children, (0, jsx_runtime_1.jsx)(StyleRoot_1.StyleRoot, { id: "b3-root" })] }), (0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: !!automaticallySetFirstEoa })] }) }) }) }) }) }) }));
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Component to connect the toast context to the global toast API
|
|
@@ -4,7 +4,7 @@ import { ClientType } from "../../../client-manager";
|
|
|
4
4
|
/**
|
|
5
5
|
* Main B3Provider component
|
|
6
6
|
*/
|
|
7
|
-
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls, onConnect, defaultPermissions, }: {
|
|
7
|
+
export declare function B3Provider({ theme, children, accountOverride, environment, clientType, partnerId, rpcUrls: _rpcUrls, onConnect, defaultPermissions, }: {
|
|
8
8
|
theme: "light" | "dark";
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
accountOverride?: Account;
|
|
@@ -18,7 +18,7 @@ const queryClient = new react_query_1.QueryClient();
|
|
|
18
18
|
/**
|
|
19
19
|
* Main B3Provider component
|
|
20
20
|
*/
|
|
21
|
-
function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls, onConnect, defaultPermissions, }) {
|
|
21
|
+
function B3Provider({ theme = "light", children, accountOverride, environment, clientType = "socket", partnerId, rpcUrls: _rpcUrls, onConnect, defaultPermissions, }) {
|
|
22
22
|
return ((0, jsx_runtime_1.jsx)(react_1.ThirdwebProvider, { children: (0, jsx_runtime_1.jsx)(LocalSDKProvider_1.LocalSDKProvider, { onConnectCallback: onConnect, children: (0, jsx_runtime_1.jsxs)(B3ConfigProvider_1.B3ConfigProvider, { accountOverride: accountOverride, environment: environment, automaticallySetFirstEoa: false, theme: theme, clientType: clientType, partnerId: partnerId, defaultPermissions: defaultPermissions, children: [children, (0, jsx_runtime_1.jsx)(AuthenticationProvider_1.default, { partnerId: partnerId, automaticallySetFirstEoa: false })] }) }) }));
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Users } from "@b3dotfun/b3-api";
|
|
2
1
|
import { Wallet } from "thirdweb/wallets";
|
|
3
2
|
/**
|
|
4
3
|
* Local SDK Context for internal SDK state (like authentication callbacks)
|
|
@@ -7,15 +6,13 @@ import { Wallet } from "thirdweb/wallets";
|
|
|
7
6
|
export interface LocalSDKContextType {
|
|
8
7
|
onConnectCallback?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
9
8
|
onLogoutCallback?: () => void | Promise<void>;
|
|
10
|
-
onTurnkeyConnect?: (user: Users) => void | Promise<void>;
|
|
11
9
|
}
|
|
12
10
|
export declare const LocalSDKContext: import("react").Context<LocalSDKContextType>;
|
|
13
11
|
/**
|
|
14
12
|
* Local SDK Provider that wraps the app and provides internal SDK state
|
|
15
13
|
*/
|
|
16
|
-
export declare function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback,
|
|
14
|
+
export declare function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback, }: {
|
|
17
15
|
children: React.ReactNode;
|
|
18
16
|
onConnectCallback?: (wallet: Wallet, b3Jwt: string) => void | Promise<void>;
|
|
19
17
|
onLogoutCallback?: () => void | Promise<void>;
|
|
20
|
-
onTurnkeyConnect?: (user: Users) => void | Promise<void>;
|
|
21
18
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,15 +7,13 @@ const react_1 = require("react");
|
|
|
7
7
|
exports.LocalSDKContext = (0, react_1.createContext)({
|
|
8
8
|
onConnectCallback: undefined,
|
|
9
9
|
onLogoutCallback: undefined,
|
|
10
|
-
onTurnkeyConnect: undefined,
|
|
11
10
|
});
|
|
12
11
|
/**
|
|
13
12
|
* Local SDK Provider that wraps the app and provides internal SDK state
|
|
14
13
|
*/
|
|
15
|
-
function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback,
|
|
14
|
+
function LocalSDKProvider({ children, onConnectCallback, onLogoutCallback, }) {
|
|
16
15
|
return ((0, jsx_runtime_1.jsx)(exports.LocalSDKContext.Provider, { value: {
|
|
17
16
|
onConnectCallback,
|
|
18
17
|
onLogoutCallback,
|
|
19
|
-
onTurnkeyConnect,
|
|
20
18
|
}, children: children }));
|
|
21
19
|
}
|
|
@@ -14,8 +14,6 @@ function RelayKitProviderWrapper({ children, simDuneApiKey, }) {
|
|
|
14
14
|
};
|
|
15
15
|
fetchChains();
|
|
16
16
|
}, []);
|
|
17
|
-
const isTurnkeyPrimary = process.env.NEXT_PUBLIC_TURNKEY_PRIMARY === "true";
|
|
18
|
-
const appName = isTurnkeyPrimary ? "Smart Wallet" : "AnySpend";
|
|
19
17
|
return ((0, jsx_runtime_1.jsx)(relay_kit_ui_1.RelayKitProvider, { options: {
|
|
20
18
|
baseApiUrl: relay_sdk_1.MAINNET_RELAY_API,
|
|
21
19
|
source: "anyspend",
|
|
@@ -25,7 +23,7 @@ function RelayKitProviderWrapper({ children, simDuneApiKey, }) {
|
|
|
25
23
|
},
|
|
26
24
|
chains: relayChains,
|
|
27
25
|
privateChainIds: undefined,
|
|
28
|
-
appName,
|
|
26
|
+
appName: "AnySpend",
|
|
29
27
|
useGasFeeEstimations: true,
|
|
30
28
|
}, children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }) }));
|
|
31
29
|
}
|
|
@@ -6,8 +6,6 @@ const react_1 = require("../../../../global-account/react");
|
|
|
6
6
|
const debug_1 = require("../../../../shared/utils/debug");
|
|
7
7
|
const react_2 = require("react");
|
|
8
8
|
const react_3 = require("thirdweb/react");
|
|
9
|
-
const LocalSDKProvider_1 = require("../B3Provider/LocalSDKProvider");
|
|
10
|
-
const TurnkeyAuthModal_1 = require("../TurnkeyAuthModal");
|
|
11
9
|
const SignInWithB3Privy_1 = require("./SignInWithB3Privy");
|
|
12
10
|
const LoginStep_1 = require("./steps/LoginStep");
|
|
13
11
|
const LoginStepCustom_1 = require("./steps/LoginStepCustom");
|
|
@@ -18,9 +16,8 @@ const MAX_REFETCH_ATTEMPTS = 20;
|
|
|
18
16
|
* Handles different login providers, authentication steps, and session key management
|
|
19
17
|
*/
|
|
20
18
|
function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onError, chain, sessionKeyAddress, partnerId, closeAfterLogin = false, source = "signInWithB3Button", signersEnabled = false, }) {
|
|
21
|
-
const { automaticallySetFirstEoa
|
|
22
|
-
const { user,
|
|
23
|
-
const { onTurnkeyConnect } = (0, react_2.useContext)(LocalSDKProvider_1.LocalSDKContext);
|
|
19
|
+
const { automaticallySetFirstEoa } = (0, react_1.useB3Config)();
|
|
20
|
+
const { user, logout } = (0, react_1.useAuthentication)(partnerId);
|
|
24
21
|
// FIXME Logout before login to ensure a clean state
|
|
25
22
|
const hasLoggedOutRef = (0, react_2.useRef)(false);
|
|
26
23
|
(0, react_2.useEffect)(() => {
|
|
@@ -38,13 +35,10 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
38
35
|
const account = (0, react_3.useActiveAccount)();
|
|
39
36
|
const isAuthenticating = (0, react_1.useAuthStore)(state => state.isAuthenticating);
|
|
40
37
|
const isAuthenticated = (0, react_1.useAuthStore)(state => state.isAuthenticated);
|
|
41
|
-
const setIsAuthenticated = (0, react_1.useAuthStore)(state => state.setIsAuthenticated);
|
|
42
38
|
const isConnected = (0, react_1.useAuthStore)(state => state.isConnected);
|
|
43
|
-
const setIsConnected = (0, react_1.useAuthStore)(state => state.setIsConnected);
|
|
44
39
|
const setJustCompletedLogin = (0, react_1.useAuthStore)(state => state.setJustCompletedLogin);
|
|
45
40
|
const [refetchCount, setRefetchCount] = (0, react_2.useState)(0);
|
|
46
41
|
const [refetchError, setRefetchError] = (0, react_2.useState)(null);
|
|
47
|
-
const [turnkeyAuthCompleted, setTurnkeyAuthCompleted] = (0, react_2.useState)(false);
|
|
48
42
|
const { data: signers, refetch: refetchSigners, isFetching: isFetchingSigners, } = (0, react_1.useGetAllTWSigners)({
|
|
49
43
|
chain,
|
|
50
44
|
accountAddress: account?.address,
|
|
@@ -77,8 +71,8 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
77
71
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
78
72
|
}, [refetchCount, refetchSigners, onError, refetchQueued]);
|
|
79
73
|
// Extract the completion flow logic to be reused
|
|
80
|
-
const
|
|
81
|
-
debug("Running post-
|
|
74
|
+
const handlePostAuthFlow = (0, react_2.useCallback)(() => {
|
|
75
|
+
debug("Running post-authentication flow logic");
|
|
82
76
|
// Check if we already have a signer for this partner
|
|
83
77
|
const hasExistingSigner = signers?.some(signer => signer.partner.id === partnerId);
|
|
84
78
|
if (hasExistingSigner) {
|
|
@@ -135,56 +129,6 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
135
129
|
handleRefetchSigners,
|
|
136
130
|
setSessionKeyAdded,
|
|
137
131
|
]);
|
|
138
|
-
// Define handleTurnkeySuccess before the useEffect that uses it
|
|
139
|
-
const handleTurnkeySuccess = (0, react_2.useCallback)(async (user) => {
|
|
140
|
-
debug("Turnkey authentication successful - setting completed flag", { user, onTurnkeyConnect });
|
|
141
|
-
// Call the onTurnkeyConnect callback
|
|
142
|
-
onTurnkeyConnect?.(user);
|
|
143
|
-
// Set completed flag FIRST before any async operations
|
|
144
|
-
setTurnkeyAuthCompleted(true);
|
|
145
|
-
// Refetch user to update the user state with Turnkey ID
|
|
146
|
-
debug("Refetching user after Turnkey success...");
|
|
147
|
-
// TODO: See why sometimes this fails with "No wallet found during auto-connect"
|
|
148
|
-
await refetchUser();
|
|
149
|
-
debug("User refetched successfully");
|
|
150
|
-
// Set authentication and connection state so UI updates properly
|
|
151
|
-
setIsAuthenticated(true);
|
|
152
|
-
setIsConnected(true);
|
|
153
|
-
setJustCompletedLogin(true);
|
|
154
|
-
// After user data is refreshed, close Turnkey modal and go back to sign-in flow
|
|
155
|
-
debug("Switching back to signInWithB3 modal");
|
|
156
|
-
setB3ModalContentType({
|
|
157
|
-
type: "signInWithB3",
|
|
158
|
-
strategies,
|
|
159
|
-
onLoginSuccess,
|
|
160
|
-
onSessionKeySuccess,
|
|
161
|
-
onError,
|
|
162
|
-
chain,
|
|
163
|
-
sessionKeyAddress,
|
|
164
|
-
partnerId,
|
|
165
|
-
closeAfterLogin,
|
|
166
|
-
source,
|
|
167
|
-
signersEnabled,
|
|
168
|
-
});
|
|
169
|
-
// The useEffect will re-run with updated user data to complete the sign-in process
|
|
170
|
-
}, [
|
|
171
|
-
onTurnkeyConnect,
|
|
172
|
-
refetchUser,
|
|
173
|
-
strategies,
|
|
174
|
-
onLoginSuccess,
|
|
175
|
-
onSessionKeySuccess,
|
|
176
|
-
onError,
|
|
177
|
-
chain,
|
|
178
|
-
sessionKeyAddress,
|
|
179
|
-
partnerId,
|
|
180
|
-
closeAfterLogin,
|
|
181
|
-
source,
|
|
182
|
-
signersEnabled,
|
|
183
|
-
setB3ModalContentType,
|
|
184
|
-
setIsAuthenticated,
|
|
185
|
-
setIsConnected,
|
|
186
|
-
setJustCompletedLogin,
|
|
187
|
-
]);
|
|
188
132
|
// Handle post-login flow after signers are loaded
|
|
189
133
|
(0, react_2.useEffect)(() => {
|
|
190
134
|
debug("@@SignInWithB3Flow:useEffect", {
|
|
@@ -197,49 +141,11 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
197
141
|
});
|
|
198
142
|
if (isConnected && isAuthenticated && user) {
|
|
199
143
|
// Mark that login just completed BEFORE opening manage account or closing modal
|
|
200
|
-
// This allows Turnkey modal to show (if enableTurnkey is true)
|
|
201
144
|
if (closeAfterLogin) {
|
|
202
145
|
setJustCompletedLogin(true);
|
|
203
146
|
}
|
|
204
|
-
//
|
|
205
|
-
|
|
206
|
-
// - enableTurnkey={true} is set on B3Provider
|
|
207
|
-
// - NEXT_PUBLIC_TURNKEY_PRIMARY is NOT set to true (otherwise Turnkey shows as primary)
|
|
208
|
-
// - User just logged in AND hasn't completed Turnkey auth in this session
|
|
209
|
-
// For new users (!turnkeyId): Show email form
|
|
210
|
-
// For returning users (turnkeyId && turnkeyEmail): Auto-skip to OTP
|
|
211
|
-
// Also check that we're not already showing the Turnkey modal
|
|
212
|
-
const hasTurnkeyId = user?.partnerIds?.turnkeyId;
|
|
213
|
-
const hasTurnkeyEmail = !!user?.email;
|
|
214
|
-
const isTurnkeyModalCurrentlyOpen = contentType?.type === "turnkeyAuth";
|
|
215
|
-
const isTurnkeyPrimary = process.env.NEXT_PUBLIC_TURNKEY_PRIMARY === "true";
|
|
216
|
-
const shouldShowTurnkeyModal = enableTurnkey &&
|
|
217
|
-
!isTurnkeyPrimary &&
|
|
218
|
-
user &&
|
|
219
|
-
!turnkeyAuthCompleted &&
|
|
220
|
-
!isTurnkeyModalCurrentlyOpen &&
|
|
221
|
-
(!hasTurnkeyId || (hasTurnkeyId && hasTurnkeyEmail));
|
|
222
|
-
if (shouldShowTurnkeyModal) {
|
|
223
|
-
// Extract email from user object - check partnerIds.turnkeyEmail first, then twProfiles, then user.email
|
|
224
|
-
const email = user?.email || user?.twProfiles?.find((profile) => profile.details?.email)?.details?.email;
|
|
225
|
-
// Open Turnkey modal through the modal store
|
|
226
|
-
setB3ModalContentType({
|
|
227
|
-
type: "turnkeyAuth",
|
|
228
|
-
onSuccess: handleTurnkeySuccess,
|
|
229
|
-
onClose: () => {
|
|
230
|
-
// After closing Turnkey modal, continue with the rest of the flow
|
|
231
|
-
setTurnkeyAuthCompleted(true);
|
|
232
|
-
debug("Turnkey modal closed, running post-Turnkey flow");
|
|
233
|
-
handlePostTurnkeyFlow();
|
|
234
|
-
},
|
|
235
|
-
initialEmail: email,
|
|
236
|
-
skipToOtp: !!(hasTurnkeyId && hasTurnkeyEmail),
|
|
237
|
-
closable: false, // Turnkey modal cannot be closed until auth is complete
|
|
238
|
-
});
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
// Normal flow continues after Turnkey auth is complete (or if not needed)
|
|
242
|
-
handlePostTurnkeyFlow();
|
|
147
|
+
// Normal flow continues
|
|
148
|
+
handlePostAuthFlow();
|
|
243
149
|
}
|
|
244
150
|
},
|
|
245
151
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -260,11 +166,8 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
260
166
|
isAuthenticated,
|
|
261
167
|
isOpen,
|
|
262
168
|
user,
|
|
263
|
-
enableTurnkey,
|
|
264
|
-
turnkeyAuthCompleted,
|
|
265
|
-
// handleTurnkeySuccess, // This is causing infinite loops
|
|
266
169
|
contentType,
|
|
267
|
-
|
|
170
|
+
handlePostAuthFlow,
|
|
268
171
|
]);
|
|
269
172
|
debug("render", {
|
|
270
173
|
step,
|
|
@@ -328,58 +231,22 @@ function SignInWithB3Flow({ strategies, onLoginSuccess, onSessionKeySuccess, onE
|
|
|
328
231
|
content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "p-4 text-center text-red-500", children: refetchError }) }));
|
|
329
232
|
}
|
|
330
233
|
else if (step === "login") {
|
|
331
|
-
//
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
const shouldShowTurnkeyFirst = isTurnkeyPrimary && !turnkeyAuthCompleted;
|
|
335
|
-
if (shouldShowTurnkeyFirst) {
|
|
336
|
-
// Don't show loading spinner for Turnkey - let the modal handle its own loading state
|
|
337
|
-
// This prevents the infinite loop where isAuthenticating causes the modal to be replaced
|
|
338
|
-
debug("Showing Turnkey as primary authentication option", {
|
|
339
|
-
isTurnkeyPrimary,
|
|
340
|
-
turnkeyAuthCompleted,
|
|
341
|
-
isAuthenticated,
|
|
342
|
-
});
|
|
343
|
-
// Show Turnkey authentication as primary option
|
|
344
|
-
content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)(TurnkeyAuthModal_1.TurnkeyAuthModal, { onSuccess: async (authenticatedUser) => {
|
|
345
|
-
debug("Turnkey authentication successful in primary flow", { authenticatedUser });
|
|
346
|
-
setTurnkeyAuthCompleted(true);
|
|
347
|
-
// User is now authenticated via Turnkey
|
|
348
|
-
// Set both isAuthenticated and isConnected to true so UI updates properly
|
|
349
|
-
// Wallet connection is optional and can happen later for signing transactions
|
|
350
|
-
setIsAuthenticated(true);
|
|
351
|
-
setIsConnected(true);
|
|
352
|
-
setJustCompletedLogin(true);
|
|
353
|
-
// Call the login success callback
|
|
354
|
-
onLoginSuccess?.({});
|
|
355
|
-
// Call the onTurnkeyConnect callback
|
|
356
|
-
onTurnkeyConnect?.(authenticatedUser);
|
|
357
|
-
// After Turnkey auth, refetch user to get the full user object
|
|
358
|
-
// TODO: See why sometimes this fails with "No wallet found during auto-connect"
|
|
359
|
-
await refetchUser();
|
|
360
|
-
}, onClose: () => {
|
|
361
|
-
// If user closes Turnkey modal, they can still use wallet connection as fallback
|
|
362
|
-
setTurnkeyAuthCompleted(true);
|
|
363
|
-
}, initialEmail: "", skipToOtp: false }) }));
|
|
234
|
+
// Show loading spinner
|
|
235
|
+
if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
|
|
236
|
+
content = ((0, jsx_runtime_1.jsx)(LoginStep_1.LoginStepContainer, { partnerId: partnerId, children: (0, jsx_runtime_1.jsx)("div", { className: "my-8 flex min-h-[350px] items-center justify-center", children: (0, jsx_runtime_1.jsx)(react_1.Loading, { variant: "white", size: "lg" }) }) }));
|
|
364
237
|
}
|
|
365
238
|
else {
|
|
366
|
-
//
|
|
367
|
-
if (
|
|
368
|
-
content = (
|
|
239
|
+
// Custom strategy
|
|
240
|
+
if (strategies?.[0] === "privy") {
|
|
241
|
+
content = (0, jsx_runtime_1.jsx)(SignInWithB3Privy_1.SignInWithB3Privy, { onSuccess: handleLoginSuccess, chain: chain });
|
|
242
|
+
}
|
|
243
|
+
else if (strategies) {
|
|
244
|
+
// Strategies are explicitly provided
|
|
245
|
+
content = ((0, jsx_runtime_1.jsx)(LoginStepCustom_1.LoginStepCustom, { strategies: strategies, chain: chain, onSuccess: handleLoginSuccess, onError: onError, automaticallySetFirstEoa: !!automaticallySetFirstEoa }));
|
|
369
246
|
}
|
|
370
247
|
else {
|
|
371
|
-
//
|
|
372
|
-
|
|
373
|
-
content = (0, jsx_runtime_1.jsx)(SignInWithB3Privy_1.SignInWithB3Privy, { onSuccess: handleLoginSuccess, chain: chain });
|
|
374
|
-
}
|
|
375
|
-
else if (strategies) {
|
|
376
|
-
// Strategies are explicitly provided
|
|
377
|
-
content = ((0, jsx_runtime_1.jsx)(LoginStepCustom_1.LoginStepCustom, { strategies: strategies, chain: chain, onSuccess: handleLoginSuccess, onError: onError, automaticallySetFirstEoa: !!automaticallySetFirstEoa }));
|
|
378
|
-
}
|
|
379
|
-
else {
|
|
380
|
-
// Default to handle all strategies we support
|
|
381
|
-
content = (0, jsx_runtime_1.jsx)(LoginStep_1.LoginStep, { chain: chain, onSuccess: handleLoginSuccess, onError: onError });
|
|
382
|
-
}
|
|
248
|
+
// Default to handle all strategies we support
|
|
249
|
+
content = (0, jsx_runtime_1.jsx)(LoginStep_1.LoginStep, { chain: chain, onSuccess: handleLoginSuccess, onError: onError });
|
|
383
250
|
}
|
|
384
251
|
}
|
|
385
252
|
}
|
|
@@ -13,7 +13,6 @@ export { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
|
13
13
|
export { SignInWithB3Privy } from "./SignInWithB3/SignInWithB3Privy";
|
|
14
14
|
export { LoginStepContainer } from "./SignInWithB3/steps/LoginStep";
|
|
15
15
|
export { getConnectOptionsFromStrategy, isWalletType, type AllowedStrategy } from "./SignInWithB3/utils/signInUtils";
|
|
16
|
-
export { TurnkeyAuthModal } from "./TurnkeyAuthModal";
|
|
17
16
|
export { ManageAccount } from "./ManageAccount/ManageAccount";
|
|
18
17
|
export { Deposit } from "./Deposit/Deposit";
|
|
19
18
|
export { Send } from "./Send/Send";
|
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DialogContent = exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.SingleUserSearchSelector = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.IPFSMediaRenderer = exports.Send = exports.Deposit = exports.ManageAccount = exports.
|
|
7
|
-
exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DropdownMenuTrigger = exports.DropdownMenuSeparator = exports.DropdownMenuItem = exports.DropdownMenuContent = exports.DropdownMenu = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter =
|
|
8
|
-
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast =
|
|
6
|
+
exports.DialogDescription = exports.DialogContent = exports.DialogClose = exports.Dialog = exports.CommandShortcut = exports.CommandSeparator = exports.CommandList = exports.CommandItem = exports.CommandInput = exports.CommandGroup = exports.CommandEmpty = exports.CommandDialog = exports.Command = exports.buttonVariants = exports.Button = exports.badgeVariants = exports.Badge = exports.WalletConnectorIcon = exports.StaggeredFadeLoader = exports.CopyToClipboard = exports.ClientOnly = exports.customButtonVariants = exports.CustomButton = exports.SingleUserSearchSelector = exports.SendERC20Button = exports.SendETHButton = exports.MintButton = exports.AccountAssets = exports.RequestPermissionsButton = exports.RequestPermissions = exports.IPFSMediaRenderer = exports.Send = exports.Deposit = exports.ManageAccount = exports.isWalletType = exports.getConnectOptionsFromStrategy = exports.LoginStepContainer = exports.SignInWithB3Privy = exports.SignInWithB3Flow = exports.SignInWithB3 = exports.WalletRow = exports.PermissionItem = exports.AuthButton = exports.StyleRoot = exports.useB3Config = exports.useB3Account = exports.useB3 = exports.RelayKitProviderWrapper = exports.B3Provider = exports.B3DynamicModal = void 0;
|
|
7
|
+
exports.toast = exports.AnimatedLottie = exports.TransitionPanel = exports.TooltipTrigger = exports.TooltipProvider = exports.TooltipContent = exports.Tooltip = exports.TextShimmer = exports.TextLoop = exports.TabTrigger = exports.TabsTransitionWrapper = exports.TabsList = exports.TabsContent = exports.Tabs = exports.TabTriggerPrimitive = exports.TabsPrimitive = exports.TabsListPrimitive = exports.TabsContentPrimitive = exports.Skeleton = exports.ShinyButton = exports.ScrollBar = exports.ScrollArea = exports.PopoverTrigger = exports.PopoverContent = exports.Popover = exports.Loading = exports.Input = exports.GlareCardRounded = exports.GlareCard = exports.DropdownMenuTrigger = exports.DropdownMenuSeparator = exports.DropdownMenuItem = exports.DropdownMenuContent = exports.DropdownMenu = exports.DrawerTrigger = exports.DrawerTitle = exports.DrawerPortal = exports.DrawerOverlay = exports.DrawerHeader = exports.DrawerFooter = exports.DrawerDescription = exports.DrawerContent = exports.DrawerClose = exports.Drawer = exports.DialogTrigger = exports.DialogTitle = exports.DialogPortal = exports.DialogOverlay = exports.DialogHeader = exports.DialogFooter = void 0;
|
|
8
|
+
exports.WalletImage = exports.useToastContext = exports.ToastProvider = exports.ToastContainer = exports.Toast = void 0;
|
|
9
9
|
// TODO woj: Barrel file for all components, this might be reason of bundle size issues
|
|
10
10
|
// Core Components
|
|
11
11
|
var B3DynamicModal_1 = require("./B3DynamicModal");
|
|
@@ -40,9 +40,6 @@ Object.defineProperty(exports, "LoginStepContainer", { enumerable: true, get: fu
|
|
|
40
40
|
var signInUtils_1 = require("./SignInWithB3/utils/signInUtils");
|
|
41
41
|
Object.defineProperty(exports, "getConnectOptionsFromStrategy", { enumerable: true, get: function () { return signInUtils_1.getConnectOptionsFromStrategy; } });
|
|
42
42
|
Object.defineProperty(exports, "isWalletType", { enumerable: true, get: function () { return signInUtils_1.isWalletType; } });
|
|
43
|
-
// Turnkey Components
|
|
44
|
-
var TurnkeyAuthModal_1 = require("./TurnkeyAuthModal");
|
|
45
|
-
Object.defineProperty(exports, "TurnkeyAuthModal", { enumerable: true, get: function () { return TurnkeyAuthModal_1.TurnkeyAuthModal; } });
|
|
46
43
|
// ManageAccount Components
|
|
47
44
|
var ManageAccount_1 = require("./ManageAccount/ManageAccount");
|
|
48
45
|
Object.defineProperty(exports, "ManageAccount", { enumerable: true, get: function () { return ManageAccount_1.ManageAccount; } });
|
|
@@ -41,7 +41,6 @@ export { useTokenFromUrl } from "./useTokenFromUrl";
|
|
|
41
41
|
export { useTokenPrice } from "./useTokenPrice";
|
|
42
42
|
export { useTokenPriceWithFallback } from "./useTokenPriceWithFallback";
|
|
43
43
|
export { useTokensFromAddress } from "./useTokensFromAddress";
|
|
44
|
-
export { useTurnkeyAuth } from "./useTurnkeyAuth";
|
|
45
44
|
export { useUnifiedChainSwitchAndExecute } from "./useUnifiedChainSwitchAndExecute";
|
|
46
45
|
export { useURLParams } from "./useURLParams";
|
|
47
46
|
export { useUser } from "./useUser";
|
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.useUser =
|
|
17
|
+
exports.useURLParams = exports.useUnifiedChainSwitchAndExecute = exports.useTokensFromAddress = exports.useTokenPriceWithFallback = exports.useTokenPrice = exports.useTokenFromUrl = exports.useTokenData = exports.useTokenBalancesByChain = exports.useTokenBalanceDirect = exports.useTokenBalance = exports.useSiwe = exports.useSimCollectibles = exports.useSimTokenBalance = exports.useSimSvmBalance = exports.useSimBalance = exports.useSearchParamsSSR = exports.useRouter = exports.useRemoveSessionKey = exports.useQueryBSMNT = exports.useQueryB3 = exports.useProfileSettings = exports.useProfilePreference = exports.useProfile = exports.useDisplayName = exports.useOneBalance = exports.useNotifications = exports.useNativeBalanceFromRPC = exports.useNativeBalance = exports.useMediaQuery = exports.useIsomorphicLayoutEffect = exports.useIsMobile = exports.useHasMounted = exports.useHandleConnectWithPrivy = exports.useGlobalAccount = exports.useGetGeo = exports.useGetAllTWSigners = exports.useFirstEOA = exports.useExchangeRate = exports.useConnect = exports.useClient = exports.useChainSwitchWithAction = exports.useB3EnsName = exports.useB3BalanceFromAddresses = exports.useAuthentication = exports.useAuth = exports.useAnalytics = exports.useAddTWSessionKey = exports.useAccountWallet = exports.useAccountAssets = exports.createWagmiConfig = void 0;
|
|
18
|
+
exports.useUser = void 0;
|
|
19
19
|
var createWagmiConfig_1 = require("../utils/createWagmiConfig");
|
|
20
20
|
Object.defineProperty(exports, "createWagmiConfig", { enumerable: true, get: function () { return createWagmiConfig_1.createWagmiConfig; } });
|
|
21
21
|
var useAccountAssets_1 = require("./useAccountAssets");
|
|
@@ -107,8 +107,6 @@ var useTokenPriceWithFallback_1 = require("./useTokenPriceWithFallback");
|
|
|
107
107
|
Object.defineProperty(exports, "useTokenPriceWithFallback", { enumerable: true, get: function () { return useTokenPriceWithFallback_1.useTokenPriceWithFallback; } });
|
|
108
108
|
var useTokensFromAddress_1 = require("./useTokensFromAddress");
|
|
109
109
|
Object.defineProperty(exports, "useTokensFromAddress", { enumerable: true, get: function () { return useTokensFromAddress_1.useTokensFromAddress; } });
|
|
110
|
-
var useTurnkeyAuth_1 = require("./useTurnkeyAuth");
|
|
111
|
-
Object.defineProperty(exports, "useTurnkeyAuth", { enumerable: true, get: function () { return useTurnkeyAuth_1.useTurnkeyAuth; } });
|
|
112
110
|
var useUnifiedChainSwitchAndExecute_1 = require("./useUnifiedChainSwitchAndExecute");
|
|
113
111
|
Object.defineProperty(exports, "useUnifiedChainSwitchAndExecute", { enumerable: true, get: function () { return useUnifiedChainSwitchAndExecute_1.useUnifiedChainSwitchAndExecute; } });
|
|
114
112
|
var useURLParams_1 = require("./useURLParams");
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Wallet } from "thirdweb/wallets";
|
|
2
2
|
import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
3
3
|
/**
|
|
4
|
-
* Unified authentication hook
|
|
5
|
-
* This replaces the previous Thirdweb-based authentication
|
|
4
|
+
* Unified authentication hook for B3
|
|
6
5
|
*
|
|
7
6
|
* This hook provides 1:1 feature parity with useAuthentication.ts
|
|
8
7
|
*/
|
|
9
8
|
export declare function useAuth(): {
|
|
10
|
-
authenticate: (
|
|
9
|
+
authenticate: (accessToken: string, partnerId: string, strategy?: string) => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
11
10
|
reAuthenticate: () => Promise<import("@feathersjs/authentication").AuthenticationResult>;
|
|
12
11
|
logout: (callback?: () => void) => Promise<void>;
|
|
13
12
|
isAuthenticated: boolean;
|