@@ -14,10 +14,12 @@ import type { ConnectEmbedProps } from "../../../core/hooks/connection/ConnectEm
14
14
import { useActiveAccount } from "../../../core/hooks/wallets/useActiveAccount.js" ;
15
15
import { useActiveWallet } from "../../../core/hooks/wallets/useActiveWallet.js" ;
16
16
import { useDisconnect } from "../../../core/hooks/wallets/useDisconnect.js" ;
17
+ import { useIsAutoConnecting } from "../../../core/hooks/wallets/useIsAutoConnecting.js" ;
17
18
import { useConnectionManager } from "../../../core/providers/connection-manager.js" ;
18
19
import { useWalletInfo } from "../../../core/utils/wallet.js" ;
19
20
import { radius , spacing } from "../../design-system/index.js" ;
20
21
import { getDefaultWallets } from "../../wallets/defaultWallets.js" ;
22
+ import { AutoConnect } from "../AutoConnect/AutoConnect.js" ;
21
23
import { ThemedButton , ThemedButtonWithIcon } from "../components/button.js" ;
22
24
import { type ContainerType , Header } from "../components/Header.js" ;
23
25
import { RNImage } from "../components/RNImage.js" ;
@@ -32,6 +34,7 @@ import { TW_ICON, WALLET_ICON } from "../icons/svgs.js";
32
34
import { ErrorView } from "./ErrorView.js" ;
33
35
import { AllWalletsList , ExternalWalletsList } from "./ExternalWalletsList.js" ;
34
36
import { InAppWalletUI , OtpLogin , PasskeyView } from "./InAppWalletUI.js" ;
37
+ import { LoadingView } from "./LoadingView.js" ;
35
38
import WalletLoadingThumbnail from "./WalletLoadingThumbnail.js" ;
36
39
37
40
export type ModalState =
@@ -74,14 +77,43 @@ export function ConnectEmbed(props: ConnectEmbedProps) {
74
77
...props ,
75
78
connectModal : { ...props } ,
76
79
} as ConnectButtonProps ;
77
- return isConnected ? null : (
78
- < ConnectModal
79
- { ...adaptedProps }
80
- containerType = "embed"
80
+ const isAutoConnecting = useIsAutoConnecting ( ) ;
81
+ const wallets = props . wallets || getDefaultWallets ( props ) ;
82
+
83
+ const autoConnectComp = props . autoConnect !== false && (
84
+ < AutoConnect
85
+ accountAbstraction = { props . accountAbstraction }
86
+ appMetadata = { props . appMetadata }
87
+ chain = { props . chain }
88
+ client = { props . client }
89
+ onConnect = { props . onConnect }
81
90
siweAuth = { siweAuth }
82
- theme = { theme }
91
+ timeout = {
92
+ typeof props . autoConnect === "boolean"
93
+ ? undefined
94
+ : props . autoConnect ?. timeout
95
+ }
96
+ wallets = { wallets }
83
97
/>
84
98
) ;
99
+
100
+ if ( isAutoConnecting ) {
101
+ return < LoadingView theme = { theme } /> ;
102
+ }
103
+
104
+ return isConnected ? (
105
+ autoConnectComp
106
+ ) : (
107
+ < >
108
+ < ConnectModal
109
+ { ...adaptedProps }
110
+ containerType = "embed"
111
+ siweAuth = { siweAuth }
112
+ theme = { theme }
113
+ />
114
+ { autoConnectComp }
115
+ </ >
116
+ ) ;
85
117
}
86
118
87
119
export function ConnectModal (
0 commit comments