You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* [View all available social auth methods](https://portal.thirdweb.com/connect/wallet/sign-in-methods/configure)
31
31
*
32
32
* ### Enable smart accounts and sponsor gas for your users:
33
33
*
34
+
* With the `executionMode` option, you can enable smart accounts and sponsor gas for your users.
35
+
*
36
+
* **Using EIP-7702** (recommended):
37
+
*
38
+
* On chains with EIP-7702 enabled, you can upgrade the inapp wallet to a smart account, keeping the same address and performance as the regular EOA.
39
+
*
34
40
* ```ts
35
41
* import { inAppWallet } from "thirdweb/wallets";
36
42
* import { sepolia } from "thirdweb/chains";
37
43
*
38
44
* const wallet = inAppWallet({
39
-
* smartAccount: {
40
-
* chain: sepolia,
45
+
* executionMode: {
46
+
* mode: "EIP7702",
41
47
* sponsorGas: true,
42
-
* },
48
+
* },
43
49
* });
44
50
*
45
51
* // account will be a smart account with sponsored gas enabled
@@ -49,8 +55,28 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
49
55
* });
50
56
* ```
51
57
*
58
+
* **Using EIP-4337**:
59
+
*
60
+
* On chains without EIP-7702 enabled, you can still use smart accounts using EIP-4337, this will return a different address (the smart contract address) than the regular EOA.
61
+
*
62
+
* ```ts
63
+
* import { inAppWallet } from "thirdweb/wallets/in-app";
64
+
*
65
+
* const wallet = inAppWallet({
66
+
* executionMode: {
67
+
* mode: "EIP4337",
68
+
* smartAccount: {
69
+
* chain: sepolia, // chain required for EIP-4337
70
+
* sponsorGas: true,
71
+
* }
72
+
* },
73
+
* });
74
+
* ```
75
+
*
52
76
* ### Login with email
53
77
*
78
+
* To login with email, you can use the `preAuthenticate` function to first send a verification code to the user's email, then login with the verification code.
79
+
*
54
80
* ```ts
55
81
* import { inAppWallet, preAuthenticate } from "thirdweb/wallets/in-app";
56
82
*
@@ -73,22 +99,10 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
73
99
* });
74
100
* ```
75
101
*
76
-
* ### Login with SIWE
77
-
* ```ts
78
-
* import { inAppWallet, createWallet } from "thirdweb/wallets";
79
-
*
80
-
* const rabby = createWallet("io.rabby");
81
-
* const inAppWallet = inAppWallet();
102
+
* ### Login with phone number
82
103
*
83
-
* const account = await inAppWallet.connect({
84
-
* strategy: "wallet",
85
-
* chain: mainnet,
86
-
* wallet: rabby,
87
-
* client: MY_CLIENT
88
-
* });
89
-
* ```
104
+
* Similar to email, you can login with a phone number by first sending a verification code to the user's phone number, then login with the verification code.
90
105
*
91
-
* ### Login with phone number
92
106
* ```ts
93
107
* import { inAppWallet, preAuthenticate } from "thirdweb/wallets/in-app";
94
108
*
@@ -111,8 +125,28 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
111
125
* });
112
126
* ```
113
127
*
128
+
* ### Login with another wallet (SIWE)
129
+
*
130
+
* You can also login to the in-app wallet with another existing wallet by signing a standard Sign in with Ethereum (SIWE) message.
131
+
*
132
+
* ```ts
133
+
* import { inAppWallet, createWallet } from "thirdweb/wallets";
134
+
*
135
+
* const rabby = createWallet("io.rabby");
136
+
* const inAppWallet = inAppWallet();
137
+
*
138
+
* const account = await inAppWallet.connect({
139
+
* strategy: "wallet",
140
+
* chain: mainnet,
141
+
* wallet: rabby,
142
+
* client: MY_CLIENT
143
+
* });
144
+
* ```
145
+
*
114
146
* ### Login with passkey
115
147
*
148
+
* You can also login with a passkey. This mode requires specifying whether it should create a new passkey, or sign in with an existing passkey. We recommend checking if the user has a passkey stored in their browser to automatically login with it.
149
+
*
116
150
* ```ts
117
151
* import { inAppWallet, hasStoredPasskey } from "thirdweb/wallets/in-app";
118
152
*
@@ -128,6 +162,11 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
128
162
* ```
129
163
*
130
164
* ### Connect to a guest account
165
+
*
166
+
* You can also connect to a guest account, this will create a new account for the user instantly and store it in the browser's local storage.
167
+
*
168
+
* You can later "upgrade" this account by linking another auth method, like email or phone for example. This will preserve the account's address and history.
169
+
*
131
170
* ```ts
132
171
* import { inAppWallet } from "thirdweb/wallets";
133
172
*
@@ -141,19 +180,19 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
141
180
*
142
181
* ### Connect to a backend account
143
182
*
144
-
* for usage in backends, you might also need to provide a 'storage' to store auth tokens. In-memory usually works for most purposes.
183
+
* For usage in backends, you can create wallets with the `backend` strategy and a stable walletSecret.
184
+
*
185
+
* Make sure to keep that walletSecret safe as it is the key to access that wallet, never expose it to the client.
145
186
*
146
187
* ```ts
147
188
* import { inAppWallet } from "thirdweb/wallets";
148
189
*
149
-
* const wallet = inAppWallet({
150
-
* storage: inMemoryStorage, // for usage in backends/scripts
151
-
* });
190
+
* const wallet = inAppWallet();
152
191
*
153
192
* const account = await wallet.connect({
154
193
* client,
155
194
* strategy: "backend",
156
-
* walletSecret: "...", // Provided by your app
195
+
* walletSecret: "...", // Your own secret, keep it safe
157
196
* });
158
197
* ```
159
198
*
@@ -189,23 +228,30 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
189
228
* });
190
229
* ```
191
230
*
192
-
* ### Specify a logo for your login page (Connect UI)
231
+
* ### Specify a logo, icon and name for your login page (Connect UI)
232
+
*
233
+
* You can specify a logo, icon and name for your login page to customize how in-app wallets are displayed in the Connect UI components (ConnectButton and ConnectEmbed).
234
+
*
193
235
* ```ts
194
236
* import { inAppWallet } from "thirdweb/wallets";
195
237
* const wallet = inAppWallet({
196
238
* metadata: {
197
-
* image: {
198
-
* src: "https://example.com/logo.png",
199
-
* alt: "My logo",
200
-
* width: 100,
201
-
* height: 100,
239
+
* name: "My App",
240
+
* icon: "https://example.com/icon.png",
241
+
* image: {
242
+
* src: "https://example.com/logo.png",
243
+
* alt: "My logo",
244
+
* width: 100,
245
+
* height: 100,
202
246
* },
203
247
* },
204
248
* });
205
249
* ```
206
250
*
207
251
* ### Hide the ability to export the private key within the Connect Modal UI
208
252
*
253
+
* By default, the Connect Modal will show a button to export the private key of the wallet. You can hide this button by setting the `hidePrivateKeyExport` option to `true`.
254
+
*
209
255
* ```ts
210
256
* import { inAppWallet } from "thirdweb/wallets";
211
257
* const wallet = inAppWallet({
@@ -228,7 +274,7 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
228
274
*
229
275
* ### Override storage for the wallet state
230
276
*
231
-
* By default, wallet state is stored in the browser's local storage. You can override this behavior by providing a custom storage object, useful for server side integrations.
277
+
* By default, wallet state is stored in the browser's local storage if in the browser, or in-memory storage if not in the browser. You can override this behavior by providing a custom storage object, useful for server side and CLI integrations.
0 commit comments