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
34
*
32
35
* ### Enable smart accounts and sponsor gas for your users:
33
36
*
37
+
* With the `executionMode` option, you can enable smart accounts and sponsor gas for your users.
38
+
*
39
+
* **Using EIP-7702** (recommended):
40
+
*
41
+
* 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.
42
+
*
34
43
* ```ts
35
44
* import { inAppWallet } from "thirdweb/wallets";
36
45
* import { sepolia } from "thirdweb/chains";
37
46
*
38
47
* const wallet = inAppWallet({
39
-
* smartAccount: {
40
-
* chain: sepolia,
48
+
* executionMode: {
49
+
* mode: "EIP7702",
41
50
* sponsorGas: true,
42
-
* },
51
+
* },
43
52
* });
44
53
*
45
54
* // account will be a smart account with sponsored gas enabled
@@ -49,8 +58,28 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
49
58
* });
50
59
* ```
51
60
*
61
+
* **Using EIP-4337**:
62
+
*
63
+
* 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.
64
+
*
65
+
* ```ts
66
+
* import { inAppWallet } from "thirdweb/wallets/in-app";
67
+
*
68
+
* const wallet = inAppWallet({
69
+
* executionMode: {
70
+
* mode: "EIP4337",
71
+
* smartAccount: {
72
+
* chain: sepolia, // chain required for EIP-4337
73
+
* sponsorGas: true,
74
+
* }
75
+
* },
76
+
* });
77
+
* ```
78
+
*
52
79
* ### Login with email
53
80
*
81
+
* 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.
82
+
*
54
83
* ```ts
55
84
* import { inAppWallet, preAuthenticate } from "thirdweb/wallets/in-app";
56
85
*
@@ -73,22 +102,10 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
73
102
* });
74
103
* ```
75
104
*
76
-
* ### Login with SIWE
77
-
* ```ts
78
-
* import { inAppWallet, createWallet } from "thirdweb/wallets";
79
-
*
80
-
* const rabby = createWallet("io.rabby");
81
-
* const inAppWallet = inAppWallet();
105
+
* ### Login with phone number
82
106
*
83
-
* const account = await inAppWallet.connect({
84
-
* strategy: "wallet",
85
-
* chain: mainnet,
86
-
* wallet: rabby,
87
-
* client: MY_CLIENT
88
-
* });
89
-
* ```
107
+
* 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
108
*
91
-
* ### Login with phone number
92
109
* ```ts
93
110
* import { inAppWallet, preAuthenticate } from "thirdweb/wallets/in-app";
94
111
*
@@ -111,8 +128,28 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
111
128
* });
112
129
* ```
113
130
*
131
+
* ### Login with another wallet (SIWE)
132
+
*
133
+
* You can also login to the in-app wallet with another existing wallet by signing a standard Sign in with Ethereum (SIWE) message.
134
+
*
135
+
* ```ts
136
+
* import { inAppWallet, createWallet } from "thirdweb/wallets";
137
+
*
138
+
* const rabby = createWallet("io.rabby");
139
+
* const inAppWallet = inAppWallet();
140
+
*
141
+
* const account = await inAppWallet.connect({
142
+
* strategy: "wallet",
143
+
* chain: mainnet,
144
+
* wallet: rabby,
145
+
* client: MY_CLIENT
146
+
* });
147
+
* ```
148
+
*
114
149
* ### Login with passkey
115
150
*
151
+
* 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.
152
+
*
116
153
* ```ts
117
154
* import { inAppWallet, hasStoredPasskey } from "thirdweb/wallets/in-app";
118
155
*
@@ -128,6 +165,11 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
128
165
* ```
129
166
*
130
167
* ### Connect to a guest account
168
+
*
169
+
* 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.
170
+
*
171
+
* 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.
172
+
*
131
173
* ```ts
132
174
* import { inAppWallet } from "thirdweb/wallets";
133
175
*
@@ -141,19 +183,19 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
141
183
*
142
184
* ### Connect to a backend account
143
185
*
144
-
* for usage in backends, you might also need to provide a 'storage' to store auth tokens. In-memory usually works for most purposes.
186
+
* For usage in backends, you can create wallets with the `backend` strategy and a stable walletSecret.
187
+
*
188
+
* Make sure to keep that walletSecret safe as it is the key to access that wallet, never expose it to the client.
145
189
*
146
190
* ```ts
147
191
* import { inAppWallet } from "thirdweb/wallets";
148
192
*
149
-
* const wallet = inAppWallet({
150
-
* storage: inMemoryStorage, // for usage in backends/scripts
151
-
* });
193
+
* const wallet = inAppWallet();
152
194
*
153
195
* const account = await wallet.connect({
154
196
* client,
155
197
* strategy: "backend",
156
-
* walletSecret: "...", // Provided by your app
198
+
* walletSecret: "...", // Your own secret, keep it safe
157
199
* });
158
200
* ```
159
201
*
@@ -189,23 +231,30 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
189
231
* });
190
232
* ```
191
233
*
192
-
* ### Specify a logo for your login page (Connect UI)
234
+
* ### Specify a logo, icon and name for your login page (Connect UI)
235
+
*
236
+
* 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).
237
+
*
193
238
* ```ts
194
239
* import { inAppWallet } from "thirdweb/wallets";
195
240
* const wallet = inAppWallet({
196
241
* metadata: {
197
-
* image: {
198
-
* src: "https://example.com/logo.png",
199
-
* alt: "My logo",
200
-
* width: 100,
201
-
* height: 100,
242
+
* name: "My App",
243
+
* icon: "https://example.com/icon.png",
244
+
* image: {
245
+
* src: "https://example.com/logo.png",
246
+
* alt: "My logo",
247
+
* width: 100,
248
+
* height: 100,
202
249
* },
203
250
* },
204
251
* });
205
252
* ```
206
253
*
207
254
* ### Hide the ability to export the private key within the Connect Modal UI
208
255
*
256
+
* 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`.
257
+
*
209
258
* ```ts
210
259
* import { inAppWallet } from "thirdweb/wallets";
211
260
* const wallet = inAppWallet({
@@ -228,7 +277,7 @@ import type { InAppWalletCreationOptions } from "../core/wallet/types.js";
228
277
*
229
278
* ### Override storage for the wallet state
230
279
*
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.
280
+
* 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