@b3dotfun/sdk 0.0.83-test.0 → 0.0.84-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/anyspend/constants/index.d.ts +1 -1
- package/dist/cjs/anyspend/constants/index.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpend.js +21 -12
- package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +1 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +4 -6
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +2 -4
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +47 -177
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +28 -0
- package/dist/cjs/anyspend/react/components/common/InsufficientDepositPayment.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderDetails.js +5 -4
- package/dist/cjs/anyspend/react/components/common/OrderToken.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmount.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountFiat.js +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderTokenAmountNew.js +2 -2
- package/dist/cjs/anyspend/react/components/common/PaymentStripeWeb2.js +4 -6
- package/dist/cjs/anyspend/react/components/common/PaymentVendorUI.js +41 -2
- package/dist/cjs/anyspend/react/components/common/TransferCryptoDetails.js +1 -1
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +2 -3
- package/dist/cjs/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/index.js +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +0 -3
- package/dist/cjs/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
- package/dist/cjs/anyspend/react/hooks/useConnectedUserProfile.js +5 -8
- package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
- package/dist/cjs/anyspend/react/hooks/useConnectedWalletDisplay.js +2 -12
- package/dist/cjs/anyspend/react/hooks/useHyperliquidTransfer.d.ts +37 -0
- package/dist/cjs/anyspend/react/hooks/useHyperliquidTransfer.js +133 -0
- package/dist/cjs/anyspend/react/providers/AnyspendProvider.js +1 -13
- package/dist/cjs/anyspend/types/chain.d.ts +10 -2
- package/dist/cjs/anyspend/types/chain.js +1 -0
- package/dist/cjs/anyspend/utils/address.d.ts +11 -0
- package/dist/cjs/anyspend/utils/address.js +15 -0
- package/dist/cjs/anyspend/utils/chain.d.ts +58 -1
- package/dist/cjs/anyspend/utils/chain.js +94 -4
- package/dist/cjs/anyspend/utils/token.d.ts +4 -0
- package/dist/cjs/anyspend/utils/token.js +35 -6
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +1 -1
- package/dist/cjs/global-account/react/components/SignInWithB3/SignIn.js +3 -4
- package/dist/cjs/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +12 -57
- package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/cjs/global-account/react/hooks/index.d.ts +0 -2
- package/dist/cjs/global-account/react/hooks/index.js +1 -5
- package/dist/cjs/global-account/react/hooks/useAccountWallet.js +11 -10
- package/dist/cjs/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +63 -72
- package/dist/cjs/global-account/react/hooks/useTWAuth.d.ts +0 -3
- package/dist/cjs/global-account/react/hooks/useTWAuth.js +0 -8
- package/dist/cjs/global-account/react/hooks/useTurnkeyAuth.js +24 -54
- package/dist/cjs/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/cjs/shared/utils/payment.utils.d.ts +1 -0
- package/dist/cjs/shared/utils/payment.utils.js +9 -0
- package/dist/esm/anyspend/constants/index.d.ts +1 -1
- package/dist/esm/anyspend/constants/index.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +22 -13
- package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +5 -7
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +4 -6
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +45 -175
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethodDisplay.js +25 -0
- package/dist/esm/anyspend/react/components/common/InsufficientDepositPayment.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderDetails.js +6 -5
- package/dist/esm/anyspend/react/components/common/OrderToken.js +3 -3
- package/dist/esm/anyspend/react/components/common/OrderTokenAmount.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountFiat.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderTokenAmountNew.js +3 -3
- package/dist/esm/anyspend/react/components/common/PaymentStripeWeb2.js +2 -4
- package/dist/esm/anyspend/react/components/common/PaymentVendorUI.js +9 -3
- package/dist/esm/anyspend/react/components/common/TransferCryptoDetails.js +2 -2
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +3 -4
- package/dist/esm/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/index.js +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +0 -3
- package/dist/esm/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
- package/dist/esm/anyspend/react/hooks/useConnectedUserProfile.js +6 -9
- package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
- package/dist/esm/anyspend/react/hooks/useConnectedWalletDisplay.js +2 -12
- package/dist/esm/anyspend/react/hooks/useHyperliquidTransfer.d.ts +37 -0
- package/dist/esm/anyspend/react/hooks/useHyperliquidTransfer.js +127 -0
- package/dist/esm/anyspend/react/providers/AnyspendProvider.js +1 -13
- package/dist/esm/anyspend/types/chain.d.ts +10 -2
- package/dist/esm/anyspend/types/chain.js +1 -0
- package/dist/esm/anyspend/utils/address.d.ts +11 -0
- package/dist/esm/anyspend/utils/address.js +14 -0
- package/dist/esm/anyspend/utils/chain.d.ts +58 -1
- package/dist/esm/anyspend/utils/chain.js +91 -4
- package/dist/esm/anyspend/utils/token.d.ts +4 -0
- package/dist/esm/anyspend/utils/token.js +32 -6
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +2 -2
- package/dist/esm/global-account/react/components/SignInWithB3/SignIn.js +4 -5
- package/dist/esm/global-account/react/components/SignInWithB3/SignInWithB3Flow.js +12 -57
- package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStep.js +1 -1
- package/dist/esm/global-account/react/hooks/index.d.ts +0 -2
- package/dist/esm/global-account/react/hooks/index.js +0 -2
- package/dist/esm/global-account/react/hooks/useAccountWallet.js +11 -10
- package/dist/esm/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +63 -72
- package/dist/esm/global-account/react/hooks/useTWAuth.d.ts +0 -3
- package/dist/esm/global-account/react/hooks/useTWAuth.js +0 -8
- package/dist/esm/global-account/react/hooks/useTurnkeyAuth.js +24 -54
- package/dist/esm/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/esm/shared/utils/payment.utils.d.ts +1 -0
- package/dist/esm/shared/utils/payment.utils.js +9 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/constants/index.d.ts +1 -1
- package/dist/types/anyspend/react/components/common/CryptoPaymentMethodDisplay.d.ts +15 -0
- package/dist/types/anyspend/react/hooks/index.d.ts +1 -0
- package/dist/types/anyspend/react/hooks/useConnectedUserProfile.d.ts +2 -1
- package/dist/types/anyspend/react/hooks/useConnectedWalletDisplay.d.ts +0 -2
- package/dist/types/anyspend/react/hooks/useHyperliquidTransfer.d.ts +37 -0
- package/dist/types/anyspend/types/chain.d.ts +10 -2
- package/dist/types/anyspend/utils/address.d.ts +11 -0
- package/dist/types/anyspend/utils/chain.d.ts +58 -1
- package/dist/types/anyspend/utils/token.d.ts +4 -0
- package/dist/types/global-account/react/hooks/index.d.ts +0 -2
- package/dist/types/global-account/react/hooks/useAuthentication.d.ts +2 -2
- package/dist/types/global-account/react/hooks/useTWAuth.d.ts +0 -3
- package/dist/types/global-account/react/hooks/useUserQuery.d.ts +1 -1
- package/dist/types/shared/utils/payment.utils.d.ts +1 -0
- package/package.json +1 -1
- package/src/anyspend/constants/index.ts +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +31 -13
- package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +1 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +9 -29
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +7 -30
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +22 -253
- package/src/anyspend/react/components/common/CryptoPaymentMethodDisplay.tsx +64 -0
- package/src/anyspend/react/components/common/InsufficientDepositPayment.tsx +2 -2
- package/src/anyspend/react/components/common/OrderDetails.tsx +6 -5
- package/src/anyspend/react/components/common/OrderToken.tsx +5 -5
- package/src/anyspend/react/components/common/OrderTokenAmount.tsx +3 -3
- package/src/anyspend/react/components/common/OrderTokenAmountFiat.tsx +3 -3
- package/src/anyspend/react/components/common/OrderTokenAmountNew.tsx +6 -6
- package/src/anyspend/react/components/common/PaymentStripeWeb2.tsx +3 -5
- package/src/anyspend/react/components/common/PaymentVendorUI.tsx +26 -2
- package/src/anyspend/react/components/common/TransferCryptoDetails.tsx +2 -2
- package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +3 -5
- package/src/anyspend/react/hooks/index.ts +1 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +0 -4
- package/src/anyspend/react/hooks/useConnectedUserProfile.ts +7 -10
- package/src/anyspend/react/hooks/useConnectedWalletDisplay.ts +2 -15
- package/src/anyspend/react/hooks/useHyperliquidTransfer.ts +152 -0
- package/src/anyspend/react/providers/AnyspendProvider.tsx +7 -22
- package/src/anyspend/types/chain.ts +10 -1
- package/src/anyspend/utils/address.ts +15 -0
- package/src/anyspend/utils/chain.ts +115 -5
- package/src/anyspend/utils/token.ts +36 -7
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +6 -2
- package/src/global-account/react/components/SignInWithB3/SignIn.tsx +4 -6
- package/src/global-account/react/components/SignInWithB3/SignInWithB3Flow.tsx +22 -77
- package/src/global-account/react/components/SignInWithB3/steps/LoginStep.tsx +1 -1
- package/src/global-account/react/hooks/index.ts +0 -2
- package/src/global-account/react/hooks/useAccountWallet.tsx +12 -11
- package/src/global-account/react/hooks/useAuthentication.ts +85 -88
- package/src/global-account/react/hooks/useTWAuth.tsx +0 -10
- package/src/global-account/react/hooks/useTurnkeyAuth.ts +26 -59
- package/src/shared/utils/payment.utils.ts +10 -1
- package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +0 -10
- package/dist/cjs/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +0 -73
- package/dist/cjs/global-account/react/hooks/useAuth.d.ts +0 -76
- package/dist/cjs/global-account/react/hooks/useAuth.js +0 -338
- package/dist/cjs/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
- package/dist/cjs/global-account/react/hooks/useBestTransactionPath.js +0 -148
- package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +0 -10
- package/dist/esm/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.js +0 -70
- package/dist/esm/global-account/react/hooks/useAuth.d.ts +0 -76
- package/dist/esm/global-account/react/hooks/useAuth.js +0 -332
- package/dist/esm/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
- package/dist/esm/global-account/react/hooks/useBestTransactionPath.js +0 -145
- package/dist/types/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.d.ts +0 -10
- package/dist/types/global-account/react/hooks/useAuth.d.ts +0 -76
- package/dist/types/global-account/react/hooks/useBestTransactionPath.d.ts +0 -41
- package/src/anyspend/react/hooks/useAutoSetActiveWalletFromWagmi.ts +0 -80
- package/src/global-account/react/hooks/useAuth.ts +0 -380
- package/src/global-account/react/hooks/useBestTransactionPath.tsx +0 -201
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RELAY_ETH_ADDRESS, RELAY_SOL_ADDRESS, RELAY_SOLANA_MAINNET_CHAIN_ID } from "@b3dotfun/sdk/anyspend/constants";
|
|
1
|
+
import { RELAY_SOL_ADDRESS, RELAY_SOLANA_MAINNET_CHAIN_ID, ZERO_ADDRESS } from "@b3dotfun/sdk/anyspend/constants";
|
|
3
2
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
3
|
+
import { avalanche, bsc, polygon } from "viem/chains";
|
|
4
|
+
|
|
5
|
+
export const HYPERLIQUID_CHAIN_ID = 1337;
|
|
6
|
+
export const HYPEREVM_CHAIN_ID = 999;
|
|
4
7
|
|
|
5
8
|
export function isNativeToken(address: string): boolean {
|
|
6
|
-
return address.toLowerCase() ===
|
|
9
|
+
return address.toLowerCase() === ZERO_ADDRESS || address.toLowerCase() === RELAY_SOL_ADDRESS;
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
export function getSolanaToken(): components["schemas"]["Token"] {
|
|
@@ -22,7 +25,7 @@ export function getSolanaToken(): components["schemas"]["Token"] {
|
|
|
22
25
|
export function getEthToken(chainId: number): components["schemas"]["Token"] {
|
|
23
26
|
return {
|
|
24
27
|
chainId: chainId,
|
|
25
|
-
address:
|
|
28
|
+
address: ZERO_ADDRESS,
|
|
26
29
|
symbol: "ETH",
|
|
27
30
|
name: "Ethereum",
|
|
28
31
|
decimals: 18,
|
|
@@ -35,7 +38,7 @@ export function getEthToken(chainId: number): components["schemas"]["Token"] {
|
|
|
35
38
|
export function getPolToken(): components["schemas"]["Token"] {
|
|
36
39
|
return {
|
|
37
40
|
chainId: polygon.id,
|
|
38
|
-
address:
|
|
41
|
+
address: ZERO_ADDRESS,
|
|
39
42
|
symbol: "POL",
|
|
40
43
|
name: "Polygon",
|
|
41
44
|
decimals: 18,
|
|
@@ -48,7 +51,7 @@ export function getPolToken(): components["schemas"]["Token"] {
|
|
|
48
51
|
export function getBnbToken(): components["schemas"]["Token"] {
|
|
49
52
|
return {
|
|
50
53
|
chainId: bsc.id,
|
|
51
|
-
address:
|
|
54
|
+
address: ZERO_ADDRESS,
|
|
52
55
|
symbol: "BNB",
|
|
53
56
|
name: "BNB",
|
|
54
57
|
decimals: 18,
|
|
@@ -61,7 +64,7 @@ export function getBnbToken(): components["schemas"]["Token"] {
|
|
|
61
64
|
export function getAvaxToken(): components["schemas"]["Token"] {
|
|
62
65
|
return {
|
|
63
66
|
chainId: avalanche.id,
|
|
64
|
-
address:
|
|
67
|
+
address: ZERO_ADDRESS,
|
|
65
68
|
symbol: "AVAX",
|
|
66
69
|
name: "AVAX",
|
|
67
70
|
decimals: 18,
|
|
@@ -70,3 +73,29 @@ export function getAvaxToken(): components["schemas"]["Token"] {
|
|
|
70
73
|
},
|
|
71
74
|
};
|
|
72
75
|
}
|
|
76
|
+
|
|
77
|
+
export function getHyperEVMNativeToken(): components["schemas"]["Token"] {
|
|
78
|
+
return {
|
|
79
|
+
chainId: HYPEREVM_CHAIN_ID,
|
|
80
|
+
address: ZERO_ADDRESS,
|
|
81
|
+
symbol: "HYPE",
|
|
82
|
+
name: "HYPE",
|
|
83
|
+
decimals: 18,
|
|
84
|
+
metadata: {
|
|
85
|
+
logoURI: "https://s2.coinmarketcap.com/static/img/coins/64x64/32196.png",
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function getHyperliquidUSDCToken(): components["schemas"]["Token"] {
|
|
91
|
+
return {
|
|
92
|
+
chainId: HYPERLIQUID_CHAIN_ID,
|
|
93
|
+
address: ZERO_ADDRESS,
|
|
94
|
+
symbol: "USDC",
|
|
95
|
+
name: "USD Coin",
|
|
96
|
+
decimals: 6,
|
|
97
|
+
metadata: {
|
|
98
|
+
logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
@@ -12,7 +12,7 @@ import { loadGA4Script } from "@b3dotfun/sdk/global-account/utils/analytics";
|
|
|
12
12
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
13
13
|
import "@relayprotocol/relay-kit-ui/styles.css";
|
|
14
14
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
15
|
-
import { useCallback, useEffect, useState } from "react";
|
|
15
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
16
16
|
import {
|
|
17
17
|
getLastAuthProvider,
|
|
18
18
|
ThirdwebProvider,
|
|
@@ -92,7 +92,11 @@ export function B3Provider({
|
|
|
92
92
|
useEffect(() => {
|
|
93
93
|
setClientType(clientType);
|
|
94
94
|
}, [clientType]);
|
|
95
|
-
|
|
95
|
+
|
|
96
|
+
const wagmiConfig = useMemo(
|
|
97
|
+
() => createWagmiConfig({ partnerId, rpcUrls, connectors, overrideDefaultConnectors }),
|
|
98
|
+
[partnerId, rpcUrls, connectors, overrideDefaultConnectors],
|
|
99
|
+
);
|
|
96
100
|
|
|
97
101
|
return (
|
|
98
102
|
<ThirdwebProvider>
|
|
@@ -13,8 +13,7 @@ import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
|
|
|
13
13
|
import { cn, truncateAddress } from "@b3dotfun/sdk/shared/utils";
|
|
14
14
|
import { Menu, MenuButton, MenuItems, Transition } from "@headlessui/react";
|
|
15
15
|
import { ReactNode, useEffect } from "react";
|
|
16
|
-
import { useConnectedWallets, useSetActiveWallet } from "thirdweb/react";
|
|
17
|
-
import { useAccountWalletImage } from "../../hooks/useAccountWallet";
|
|
16
|
+
import { useConnectedWallets, useSetActiveWallet, useWalletImage } from "thirdweb/react";
|
|
18
17
|
import { ManageAccountButton } from "../custom/ManageAccountButton";
|
|
19
18
|
|
|
20
19
|
type SignInProps = {
|
|
@@ -40,9 +39,10 @@ export function SignIn(props: SignInWithB3Props) {
|
|
|
40
39
|
isActiveSmartWallet,
|
|
41
40
|
isActiveEOAWallet,
|
|
42
41
|
smartWalletIcon,
|
|
43
|
-
eoaWalletIcon,
|
|
44
42
|
} = useAccountWallet();
|
|
45
43
|
|
|
44
|
+
const { data: walletImage } = useWalletImage(connectedEOAWallet?.id);
|
|
45
|
+
|
|
46
46
|
const isMobile = useIsMobile();
|
|
47
47
|
const { logout } = useAuthentication(partnerId);
|
|
48
48
|
const onDisconnect = async (): Promise<void> => {
|
|
@@ -72,8 +72,6 @@ export function SignIn(props: SignInWithB3Props) {
|
|
|
72
72
|
}
|
|
73
73
|
}, [connectedEOAWallet, isActiveEOAWallet, setActiveWallet, automaticallySetFirstEoa]);
|
|
74
74
|
|
|
75
|
-
const walletImage = useAccountWalletImage();
|
|
76
|
-
|
|
77
75
|
// Desktop version - original dropdown menu
|
|
78
76
|
return (
|
|
79
77
|
<StyleRoot>
|
|
@@ -115,7 +113,7 @@ export function SignIn(props: SignInWithB3Props) {
|
|
|
115
113
|
<div className="flex items-center">
|
|
116
114
|
<img
|
|
117
115
|
className="bg-b3-react-primary h-16 w-16 rounded-full opacity-100"
|
|
118
|
-
src={
|
|
116
|
+
src={walletImage}
|
|
119
117
|
alt={connectedEOAWallet?.id}
|
|
120
118
|
/>
|
|
121
119
|
<div className="ml-4 grow">
|
|
@@ -10,7 +10,6 @@ import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
|
10
10
|
import { useCallback, useEffect, useState } from "react";
|
|
11
11
|
import { useActiveAccount } from "thirdweb/react";
|
|
12
12
|
import { Account } from "thirdweb/wallets";
|
|
13
|
-
import { TurnkeyAuthModal } from "../TurnkeyAuthModal";
|
|
14
13
|
import { SignInWithB3Privy } from "./SignInWithB3Privy";
|
|
15
14
|
import { LoginStep, LoginStepContainer } from "./steps/LoginStep";
|
|
16
15
|
import { LoginStepCustom } from "./steps/LoginStepCustom";
|
|
@@ -41,9 +40,7 @@ export function SignInWithB3Flow({
|
|
|
41
40
|
const account = useActiveAccount();
|
|
42
41
|
const isAuthenticating = useAuthStore(state => state.isAuthenticating);
|
|
43
42
|
const isAuthenticated = useAuthStore(state => state.isAuthenticated);
|
|
44
|
-
const setIsAuthenticated = useAuthStore(state => state.setIsAuthenticated);
|
|
45
43
|
const isConnected = useAuthStore(state => state.isConnected);
|
|
46
|
-
const setIsConnected = useAuthStore(state => state.setIsConnected);
|
|
47
44
|
const setJustCompletedLogin = useAuthStore(state => state.setJustCompletedLogin);
|
|
48
45
|
const [refetchCount, setRefetchCount] = useState(0);
|
|
49
46
|
const [refetchError, setRefetchError] = useState<string | null>(null);
|
|
@@ -157,11 +154,6 @@ export function SignInWithB3Flow({
|
|
|
157
154
|
await refetchUser();
|
|
158
155
|
debug("User refetched successfully");
|
|
159
156
|
|
|
160
|
-
// Set authentication and connection state so UI updates properly
|
|
161
|
-
setIsAuthenticated(true);
|
|
162
|
-
setIsConnected(true);
|
|
163
|
-
setJustCompletedLogin(true);
|
|
164
|
-
|
|
165
157
|
// After user data is refreshed, close Turnkey modal and go back to sign-in flow
|
|
166
158
|
debug("Switching back to signInWithB3 modal");
|
|
167
159
|
setB3ModalContentType({
|
|
@@ -192,9 +184,6 @@ export function SignInWithB3Flow({
|
|
|
192
184
|
closeAfterLogin,
|
|
193
185
|
source,
|
|
194
186
|
signersEnabled,
|
|
195
|
-
setIsAuthenticated,
|
|
196
|
-
setIsConnected,
|
|
197
|
-
setJustCompletedLogin,
|
|
198
187
|
],
|
|
199
188
|
);
|
|
200
189
|
|
|
@@ -351,76 +340,32 @@ export function SignInWithB3Flow({
|
|
|
351
340
|
<div className="p-4 text-center text-red-500">{refetchError}</div>
|
|
352
341
|
</LoginStepContainer>
|
|
353
342
|
);
|
|
343
|
+
} else if (isAuthenticating || (isFetchingSigners && step === "login") || source === "requestPermissions") {
|
|
344
|
+
content = (
|
|
345
|
+
<LoginStepContainer partnerId={partnerId}>
|
|
346
|
+
<div className="my-8 flex min-h-[350px] items-center justify-center">
|
|
347
|
+
<Loading variant="white" size="lg" />
|
|
348
|
+
</div>
|
|
349
|
+
</LoginStepContainer>
|
|
350
|
+
);
|
|
354
351
|
} else if (step === "login") {
|
|
355
|
-
//
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
// Don't show loading spinner for Turnkey - let the modal handle its own loading state
|
|
361
|
-
// This prevents the infinite loop where isAuthenticating causes the modal to be replaced
|
|
362
|
-
debug("Showing Turnkey as primary authentication option", {
|
|
363
|
-
enableTurnkey,
|
|
364
|
-
turnkeyAuthCompleted,
|
|
365
|
-
isAuthenticated,
|
|
366
|
-
});
|
|
367
|
-
// Show Turnkey authentication as primary option
|
|
352
|
+
// Custom strategy
|
|
353
|
+
if (strategies?.[0] === "privy") {
|
|
354
|
+
content = <SignInWithB3Privy onSuccess={handleLoginSuccess} chain={chain} />;
|
|
355
|
+
} else if (strategies) {
|
|
356
|
+
// Strategies are explicitly provided
|
|
368
357
|
content = (
|
|
369
|
-
<
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
// User is now authenticated via Turnkey
|
|
377
|
-
// Set both isAuthenticated and isConnected to true so UI updates properly
|
|
378
|
-
// Wallet connection is optional and can happen later for signing transactions
|
|
379
|
-
setIsAuthenticated(true);
|
|
380
|
-
setIsConnected(true);
|
|
381
|
-
setJustCompletedLogin(true);
|
|
382
|
-
// Call the login success callback
|
|
383
|
-
onLoginSuccess?.({} as Account);
|
|
384
|
-
}}
|
|
385
|
-
onClose={() => {
|
|
386
|
-
// If user closes Turnkey modal, they can still use wallet connection as fallback
|
|
387
|
-
setTurnkeyAuthCompleted(true);
|
|
388
|
-
}}
|
|
389
|
-
initialEmail=""
|
|
390
|
-
skipToOtp={false}
|
|
391
|
-
/>
|
|
392
|
-
</LoginStepContainer>
|
|
358
|
+
<LoginStepCustom
|
|
359
|
+
strategies={strategies}
|
|
360
|
+
chain={chain}
|
|
361
|
+
onSuccess={handleLoginSuccess}
|
|
362
|
+
onError={onError}
|
|
363
|
+
automaticallySetFirstEoa={!!automaticallySetFirstEoa}
|
|
364
|
+
/>
|
|
393
365
|
);
|
|
394
366
|
} else {
|
|
395
|
-
//
|
|
396
|
-
|
|
397
|
-
content = (
|
|
398
|
-
<LoginStepContainer partnerId={partnerId}>
|
|
399
|
-
<div className="my-8 flex min-h-[350px] items-center justify-center">
|
|
400
|
-
<Loading variant="white" size="lg" />
|
|
401
|
-
</div>
|
|
402
|
-
</LoginStepContainer>
|
|
403
|
-
);
|
|
404
|
-
} else {
|
|
405
|
-
// Custom strategy
|
|
406
|
-
if (strategies?.[0] === "privy") {
|
|
407
|
-
content = <SignInWithB3Privy onSuccess={handleLoginSuccess} chain={chain} />;
|
|
408
|
-
} else if (strategies) {
|
|
409
|
-
// Strategies are explicitly provided
|
|
410
|
-
content = (
|
|
411
|
-
<LoginStepCustom
|
|
412
|
-
strategies={strategies}
|
|
413
|
-
chain={chain}
|
|
414
|
-
onSuccess={handleLoginSuccess}
|
|
415
|
-
onError={onError}
|
|
416
|
-
automaticallySetFirstEoa={!!automaticallySetFirstEoa}
|
|
417
|
-
/>
|
|
418
|
-
);
|
|
419
|
-
} else {
|
|
420
|
-
// Default to handle all strategies we support
|
|
421
|
-
content = <LoginStep chain={chain} onSuccess={handleLoginSuccess} onError={onError} />;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
367
|
+
// Default to handle all strategies we support
|
|
368
|
+
content = <LoginStep chain={chain} onSuccess={handleLoginSuccess} onError={onError} />;
|
|
424
369
|
}
|
|
425
370
|
}
|
|
426
371
|
|
|
@@ -40,7 +40,7 @@ export function LoginStepContainer({ children, partnerId }: LoginStepContainerPr
|
|
|
40
40
|
const partnerLogo = partner?.data?.[0]?.loginCustomization?.logoUrl;
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
|
-
<div className="flex flex-col items-center justify-center pt-6">
|
|
43
|
+
<div className="bg-b3-react-background flex flex-col items-center justify-center pt-6">
|
|
44
44
|
{partnerLogo && (
|
|
45
45
|
<img src={partnerLogo} alt="Partner Logo" className="partner-logo mb-6 h-12 w-auto object-contain" />
|
|
46
46
|
)}
|
|
@@ -3,11 +3,9 @@ export { useAccountAssets } from "./useAccountAssets";
|
|
|
3
3
|
export { useAccountWallet } from "./useAccountWallet";
|
|
4
4
|
export { useAddTWSessionKey } from "./useAddTWSessionKey";
|
|
5
5
|
export { useAnalytics } from "./useAnalytics";
|
|
6
|
-
export { useAuth } from "./useAuth";
|
|
7
6
|
export { useAuthentication } from "./useAuthentication";
|
|
8
7
|
export { useB3BalanceFromAddresses } from "./useB3BalanceFromAddresses";
|
|
9
8
|
export { useB3EnsName } from "./useB3EnsName";
|
|
10
|
-
export { useBestTransactionPath } from "./useBestTransactionPath";
|
|
11
9
|
export { useChainSwitchWithAction } from "./useChainSwitchWithAction";
|
|
12
10
|
export * from "./useClaim";
|
|
13
11
|
export { useClient } from "./useClient";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useB3, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
2
2
|
import { ecosystemWalletId } from "@b3dotfun/sdk/shared/constants";
|
|
3
3
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
4
|
-
import { getIpfsUrl } from "@b3dotfun/sdk/shared/utils/ipfs";
|
|
5
4
|
import { useEffect, useMemo, useState } from "react";
|
|
6
5
|
import { getLastAuthProvider, useActiveWallet, useConnectedWallets, useWalletImage } from "thirdweb/react";
|
|
7
6
|
import { Account, Wallet } from "thirdweb/wallets";
|
|
@@ -44,7 +43,13 @@ export function useAccountWallet(): {
|
|
|
44
43
|
eoaWalletIcon?: string;
|
|
45
44
|
smartWalletIcon?: string;
|
|
46
45
|
} {
|
|
47
|
-
|
|
46
|
+
// WOJ: --------------------
|
|
47
|
+
// values from in useB3:
|
|
48
|
+
// const activeAccount = useActiveAccount();
|
|
49
|
+
// const effectiveAccount = isAuthenticated ? accountOverride || activeAccount : undefined;
|
|
50
|
+
// can we possibly just use useActiveAccount here?
|
|
51
|
+
// --------------------
|
|
52
|
+
const { account } = useB3();
|
|
48
53
|
|
|
49
54
|
const activeWallet = useActiveWallet();
|
|
50
55
|
const connectedWallets = useConnectedWallets();
|
|
@@ -61,8 +66,6 @@ export function useAccountWallet(): {
|
|
|
61
66
|
debug("isActiveSmartWallet", isActiveSmartWallet);
|
|
62
67
|
debug("isActiveEOAWallet", isActiveEOAWallet);
|
|
63
68
|
|
|
64
|
-
const { data: walletImage } = useWalletImage(connectedEOAWallet?.id);
|
|
65
|
-
|
|
66
69
|
// If not EOA sign in, then we need to show the smart wallet icon
|
|
67
70
|
const lastAuthProvider = useLastAuthProvider();
|
|
68
71
|
|
|
@@ -73,7 +76,6 @@ export function useAccountWallet(): {
|
|
|
73
76
|
|
|
74
77
|
const { data: profileData } = useProfile({ address: account?.address });
|
|
75
78
|
const ensName = profileData?.displayName?.replace(/\.b3\.fun/g, "");
|
|
76
|
-
const avatarUrl = user?.avatar ? getIpfsUrl(user?.avatar) : profileData?.avatar;
|
|
77
79
|
|
|
78
80
|
const res = useMemo(
|
|
79
81
|
() => ({
|
|
@@ -81,7 +83,7 @@ export function useAccountWallet(): {
|
|
|
81
83
|
...account,
|
|
82
84
|
ensName,
|
|
83
85
|
meta: {
|
|
84
|
-
icon:
|
|
86
|
+
icon: "", // deprecated
|
|
85
87
|
},
|
|
86
88
|
},
|
|
87
89
|
|
|
@@ -95,18 +97,16 @@ export function useAccountWallet(): {
|
|
|
95
97
|
isActiveEOAWallet: isActiveEOAWallet,
|
|
96
98
|
|
|
97
99
|
smartWalletIcon: smartWalletIcon,
|
|
98
|
-
eoaWalletIcon:
|
|
100
|
+
eoaWalletIcon: "", // deprecated
|
|
99
101
|
}),
|
|
100
102
|
[
|
|
101
103
|
account,
|
|
102
|
-
avatarUrl,
|
|
103
104
|
connectedEOAWallet,
|
|
104
105
|
connectedSmartWallet,
|
|
105
106
|
ensName,
|
|
106
107
|
isActiveEOAWallet,
|
|
107
108
|
isActiveSmartWallet,
|
|
108
109
|
smartWalletIcon,
|
|
109
|
-
walletImage,
|
|
110
110
|
],
|
|
111
111
|
);
|
|
112
112
|
|
|
@@ -114,7 +114,7 @@ export function useAccountWallet(): {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
export function useAccountWalletImage(): string {
|
|
117
|
-
const { account
|
|
117
|
+
const { account } = useB3();
|
|
118
118
|
|
|
119
119
|
const activeWallet = useActiveWallet();
|
|
120
120
|
const connectedWallets = useConnectedWallets();
|
|
@@ -134,7 +134,8 @@ export function useAccountWalletImage(): string {
|
|
|
134
134
|
: "https://gradvatar.com/0x0000000000000000000000000000000000000000"; // show smart wallet of eoa wallet is gradvatar
|
|
135
135
|
|
|
136
136
|
const { data: profileData } = useProfile({ address: account?.address });
|
|
137
|
-
|
|
137
|
+
|
|
138
|
+
const avatarUrl = profileData?.avatar;
|
|
138
139
|
|
|
139
140
|
return avatarUrl || (isActiveSmartWallet ? smartWalletIcon : walletImage) || "";
|
|
140
141
|
}
|
|
@@ -19,7 +19,7 @@ import { preAuthenticate } from "thirdweb/wallets/in-app";
|
|
|
19
19
|
import { useAccount, useConnect, useSwitchAccount } from "wagmi";
|
|
20
20
|
import { LocalSDKContext } from "../components/B3Provider/LocalSDKProvider";
|
|
21
21
|
import { createWagmiConfig } from "../utils/createWagmiConfig";
|
|
22
|
-
import {
|
|
22
|
+
import { useTWAuth } from "./useTWAuth";
|
|
23
23
|
import { useUserQuery } from "./useUserQuery";
|
|
24
24
|
|
|
25
25
|
const debug = debugB3React("useAuthentication");
|
|
@@ -39,7 +39,7 @@ export function useAuthentication(partnerId: string) {
|
|
|
39
39
|
const setHasStartedConnecting = useAuthStore(state => state.setHasStartedConnecting);
|
|
40
40
|
const setActiveWallet = useSetActiveWallet();
|
|
41
41
|
const hasStartedConnecting = useAuthStore(state => state.hasStartedConnecting);
|
|
42
|
-
const {
|
|
42
|
+
const { authenticate } = useTWAuth();
|
|
43
43
|
const { user, setUser } = useUserQuery();
|
|
44
44
|
const useAutoConnectLoadingPrevious = useRef(false);
|
|
45
45
|
const wagmiConfig = createWagmiConfig({ partnerId });
|
|
@@ -106,104 +106,49 @@ export function useAuthentication(partnerId: string) {
|
|
|
106
106
|
syncWagmi();
|
|
107
107
|
}, [wallets, syncWagmi]);
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
* Wallets are still used for signing transactions, but authentication is done via Turnkey email OTP.
|
|
113
|
-
*
|
|
114
|
-
* For backward compatibility, this function still accepts a wallet parameter,
|
|
115
|
-
* but it's not used for authentication anymore.
|
|
116
|
-
*/
|
|
117
|
-
const authenticateUser = useCallback(async () => {
|
|
118
|
-
setHasStartedConnecting(true);
|
|
119
|
-
|
|
120
|
-
// Try to re-authenticate first
|
|
121
|
-
try {
|
|
122
|
-
const userAuth = await reAuthenticate();
|
|
123
|
-
setUser(userAuth.user);
|
|
124
|
-
setIsAuthenticated(true);
|
|
125
|
-
setIsAuthenticating(false);
|
|
126
|
-
debug("Re-authenticated successfully", { userAuth });
|
|
127
|
-
|
|
128
|
-
// Authenticate on BSMNT with B3 JWT
|
|
129
|
-
const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
|
|
130
|
-
debug("@@b3Jwt", b3Jwt);
|
|
131
|
-
|
|
132
|
-
return userAuth;
|
|
133
|
-
} catch (error) {
|
|
134
|
-
// If re-authentication fails, user needs to authenticate via Turnkey
|
|
135
|
-
// This should be handled by the Turnkey auth modal/flow
|
|
136
|
-
debug("Re-authentication failed. User needs to authenticate via Turnkey.", error);
|
|
137
|
-
setIsAuthenticated(false);
|
|
138
|
-
setIsAuthenticating(false);
|
|
139
|
-
throw new Error("Authentication required. Please authenticate via Turnkey.");
|
|
140
|
-
}
|
|
141
|
-
}, [reAuthenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting]);
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Handle wallet connection
|
|
145
|
-
* Note: With Turnkey migration, wallet connection is primarily for signing transactions,
|
|
146
|
-
* not for authentication. Authentication should be done separately via Turnkey email OTP.
|
|
147
|
-
*/
|
|
148
|
-
const onConnect = useCallback(
|
|
149
|
-
async (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => {
|
|
150
|
-
debug("@@useAuthentication:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
|
|
151
|
-
|
|
152
|
-
const wallet = allConnectedWallets.find(wallet => wallet.id.startsWith("ecosystem."));
|
|
109
|
+
const authenticateUser = useCallback(
|
|
110
|
+
async (wallet?: Wallet) => {
|
|
111
|
+
setHasStartedConnecting(true);
|
|
153
112
|
|
|
154
113
|
if (!wallet) {
|
|
155
|
-
throw new Error("No
|
|
114
|
+
throw new Error("No wallet found during auto-connect");
|
|
156
115
|
}
|
|
157
116
|
|
|
158
|
-
|
|
117
|
+
const account = wallet ? wallet.getAccount() : activeWallet?.getAccount();
|
|
118
|
+
if (!account) {
|
|
119
|
+
throw new Error("No account found during auto-connect");
|
|
120
|
+
}
|
|
159
121
|
|
|
122
|
+
// Try to re-authenticate first
|
|
160
123
|
try {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
124
|
+
const userAuth = await app.reAuthenticate();
|
|
125
|
+
setUser(userAuth.user);
|
|
126
|
+
setIsAuthenticated(true);
|
|
127
|
+
setIsAuthenticating(false);
|
|
128
|
+
debug("Re-authenticated successfully", { userAuth });
|
|
165
129
|
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const userAuth = await authenticateUser();
|
|
130
|
+
// Authenticate on BSMNT with B3 JWT
|
|
131
|
+
const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
|
|
132
|
+
debug("@@b3Jwt", b3Jwt);
|
|
170
133
|
|
|
171
|
-
|
|
172
|
-
await onConnectCallback(wallet, userAuth.accessToken);
|
|
173
|
-
}
|
|
174
|
-
} catch (authError) {
|
|
175
|
-
// Authentication failed - this is expected if user hasn't authenticated via Turnkey yet
|
|
176
|
-
// The Turnkey auth modal should handle this
|
|
177
|
-
debug("@@useAuthentication:onConnect:authFailed", { authError });
|
|
178
|
-
// Don't set isAuthenticated to false here - let the Turnkey flow handle it
|
|
179
|
-
}
|
|
134
|
+
return userAuth;
|
|
180
135
|
} catch (error) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
136
|
+
// If re-authentication fails, try fresh authentication
|
|
137
|
+
debug("Re-authentication failed, attempting fresh authentication");
|
|
138
|
+
const userAuth = await authenticate(wallet, partnerId);
|
|
139
|
+
setUser(userAuth.user);
|
|
140
|
+
setIsAuthenticated(true);
|
|
185
141
|
setIsAuthenticating(false);
|
|
186
|
-
|
|
142
|
+
debug("Fresh authentication successful", { userAuth });
|
|
187
143
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
144
|
+
// Authenticate on BSMNT with B3 JWT
|
|
145
|
+
const b3Jwt = await authenticateWithB3JWT(userAuth.accessToken);
|
|
146
|
+
debug("@@b3Jwt", b3Jwt);
|
|
147
|
+
|
|
148
|
+
return userAuth;
|
|
149
|
+
}
|
|
193
150
|
},
|
|
194
|
-
[
|
|
195
|
-
onConnectCallback,
|
|
196
|
-
authenticateUser,
|
|
197
|
-
isAuthenticated,
|
|
198
|
-
isAuthenticating,
|
|
199
|
-
isConnected,
|
|
200
|
-
setActiveWallet,
|
|
201
|
-
setHasStartedConnecting,
|
|
202
|
-
setIsAuthenticated,
|
|
203
|
-
setIsAuthenticating,
|
|
204
|
-
setIsConnected,
|
|
205
|
-
setUser,
|
|
206
|
-
],
|
|
151
|
+
[activeWallet, partnerId, authenticate, setIsAuthenticated, setIsAuthenticating, setUser, setHasStartedConnecting],
|
|
207
152
|
);
|
|
208
153
|
|
|
209
154
|
const logout = useCallback(
|
|
@@ -240,6 +185,58 @@ export function useAuthentication(partnerId: string) {
|
|
|
240
185
|
[activeWallet, disconnect, wallets, setIsAuthenticated, setUser, setIsConnected],
|
|
241
186
|
);
|
|
242
187
|
|
|
188
|
+
const onConnect = useCallback(
|
|
189
|
+
async (_walleAutoConnectedWith: Wallet, allConnectedWallets: Wallet[]) => {
|
|
190
|
+
debug("@@useAuthentication:onConnect", { _walleAutoConnectedWith, allConnectedWallets });
|
|
191
|
+
try {
|
|
192
|
+
const wallet = allConnectedWallets.find(wallet => wallet.id.startsWith("ecosystem."));
|
|
193
|
+
|
|
194
|
+
if (!wallet) {
|
|
195
|
+
throw new Error("No smart wallet found during auto-connect");
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
debug("@@useAuthentication:onConnect", { wallet });
|
|
199
|
+
setHasStartedConnecting(true);
|
|
200
|
+
setIsConnected(true);
|
|
201
|
+
setIsAuthenticating(true);
|
|
202
|
+
await setActiveWallet(wallet);
|
|
203
|
+
const userAuth = await authenticateUser(wallet);
|
|
204
|
+
|
|
205
|
+
if (userAuth && onConnectCallback) {
|
|
206
|
+
await onConnectCallback(wallet, userAuth.accessToken);
|
|
207
|
+
}
|
|
208
|
+
} catch (error) {
|
|
209
|
+
debug("@@useAuthentication:onConnect:failed", { error });
|
|
210
|
+
setIsAuthenticated(false);
|
|
211
|
+
setUser(undefined);
|
|
212
|
+
|
|
213
|
+
await logout();
|
|
214
|
+
} finally {
|
|
215
|
+
setIsAuthenticating(false);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
debug({
|
|
219
|
+
isAuthenticated,
|
|
220
|
+
isAuthenticating,
|
|
221
|
+
isConnected,
|
|
222
|
+
});
|
|
223
|
+
},
|
|
224
|
+
[
|
|
225
|
+
isAuthenticated,
|
|
226
|
+
isAuthenticating,
|
|
227
|
+
isConnected,
|
|
228
|
+
setHasStartedConnecting,
|
|
229
|
+
setIsConnected,
|
|
230
|
+
setIsAuthenticating,
|
|
231
|
+
setActiveWallet,
|
|
232
|
+
authenticateUser,
|
|
233
|
+
onConnectCallback,
|
|
234
|
+
setIsAuthenticated,
|
|
235
|
+
setUser,
|
|
236
|
+
logout,
|
|
237
|
+
],
|
|
238
|
+
);
|
|
239
|
+
|
|
243
240
|
const { isLoading: useAutoConnectLoading } = useAutoConnect({
|
|
244
241
|
client,
|
|
245
242
|
wallets: [wallet],
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated This hook is deprecated. Use useAuth() with Turnkey authentication instead.
|
|
3
|
-
* This file is kept for backward compatibility but should not be used in new code.
|
|
4
|
-
*/
|
|
5
1
|
import app from "@b3dotfun/sdk/global-account/app";
|
|
6
2
|
import debug from "@b3dotfun/sdk/shared/utils/debug";
|
|
7
3
|
import { useCallback } from "react";
|
|
8
4
|
import { Wallet } from "thirdweb/wallets";
|
|
9
5
|
import { useSearchParam } from "./useSearchParamsSSR";
|
|
10
6
|
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Use useAuth() with Turnkey authentication instead
|
|
13
|
-
*/
|
|
14
7
|
export function useTWAuth() {
|
|
15
|
-
console.warn(
|
|
16
|
-
"useTWAuth is deprecated. Please migrate to useAuth() with Turnkey authentication. See useTurnkeyAuth.ts for the new implementation.",
|
|
17
|
-
);
|
|
18
8
|
const referralCode = useSearchParam("referralCode");
|
|
19
9
|
|
|
20
10
|
const authenticate = useCallback(
|