Skip to content

Commit ebc48fc

Browse files
committed
added migration guide for no modal and edited modal one
1 parent 7d8bba6 commit ebc48fc

File tree

3 files changed

+355
-60
lines changed

3 files changed

+355
-60
lines changed

docs/migration-guides/modal-v9-to-v10.mdx

Lines changed: 117 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ description: "PnP Modal SDK - v9 to v10 | Documentation - Web3Auth"
44
sidebar_label: v9 to v10
55
---
66

7-
This migration guide provides steps for upgrading from version v9 to v10 of the Web3Auth PnP Modal SDK. Version 10 introduces a simpler architecture by eliminating verifiers and adapters from the frontend codebase, consolidating all configurations within the Web3Auth Developer Dashboard.
7+
This migration guide provides steps for upgrading from version v9 to v10 of the Web3Auth PnP Modal
8+
SDK. Version 10 introduces a simplified architecture by removing adapters and verifiers from your
9+
frontend code, and centralizing all configurations via the Web3Auth Developer Dashboard.
810

911
## Breaking Changes
1012

1113
### 1. `verifier` and `verifierSubIdentifier` replaced with `authConnectionId` and `groupedAuthConnectionId`
1214

13-
In v9, aggregating social logins to return the same account (for the same user email) required using an aggregate verifier with `verifierSubIdentifier`:
15+
In v9, account linking across login methods (e.g., Google and GitHub using the same email) required
16+
setting up an aggregate verifier with a `verifierSubIdentifier`:
1417

1518
```ts title="v9 - Before"
1619
loginConfig: {
@@ -29,7 +32,8 @@ loginConfig: {
2932
}
3033
```
3134

32-
In v10, this logic is now abstracted to the dashboard. Use `authConnectionId` for each provider and group them using the new `groupedAuthConnectionId`:
35+
In v10, this logic has been moved to the Web3Auth Dashboard using grouped connections. You now use
36+
`authConnectionId` and a common `groupedAuthConnectionId`:
3337

3438
```ts title="v10 - After"
3539
modalConfig: {
@@ -53,13 +57,14 @@ modalConfig: {
5357
}
5458
```
5559

56-
> ✅ This results in the same user account when logging in with Google or GitHub using the same email, no additional setup needed in code.
60+
> ✅ This ensures the same wallet address is returned when the same email is used across providers —
61+
> no manual linking logic needed in code.
5762
5863
---
5964

6065
### 2. `adapters` are fully removed — use `connectors` instead
6166

62-
In v9, adapters had to be manually configured:
67+
In v9, you had to manually configure and register adapters like `AuthAdapter`:
6368

6469
```ts title="v9 - Before"
6570
import { AuthAdapter } from "@web3auth/auth-adapter";
@@ -68,7 +73,7 @@ const authAdapter = new AuthAdapter(adapterSettings);
6873
web3auth.configureAdapter(authAdapter);
6974
```
7075

71-
In v10, connectors replace adapters entirely:
76+
In v10, this is fully replaced by connectors declared inside the `modalConfig`:
7277

7378
```ts title="v10 - After"
7479
modalConfig: {
@@ -86,13 +91,13 @@ modalConfig: {
8691
}
8792
```
8893

89-
> No need to configure or import adapters anymore.
94+
> Cleaner structure. No adapter imports or manual configuration.
9095
9196
---
9297

9398
### 3. `privateKeyProvider` and `chainConfig` are deprecated
9499

95-
In v9, you had to manually pass chain config and instantiate a private key provider:
100+
In v9, you had to explicitly configure chain settings and pass a private key provider:
96101

97102
```ts title="v9 - Before"
98103
const chainConfig = getEvmChainConfig(chainId, clientId);
@@ -105,43 +110,30 @@ const web3auth = new Web3Auth({
105110
});
106111
```
107112

108-
In v10, all chain settings are handled via the dashboard. These parameters are no longer required or accepted:
113+
In v10, chain setup is fully abstracted behind the Web3Auth Dashboard configuration:
109114

110115
```ts title="v10 - After"
111116
const web3auth = new Web3Auth({
112117
clientId,
113118
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
114-
modalConfig: {
115-
connectors: {
116-
[WALLET_CONNECTORS.AUTH]: {
117-
label: "auth",
118-
loginMethods: {
119-
google: {
120-
authConnection: AUTH_CONNECTION.GOOGLE,
121-
authConnectionId: "w3a-google",
122-
},
123-
},
124-
},
125-
},
126-
},
119+
modalConfig: { ... },
127120
});
128121
```
129122

130-
> Cleaner setup, with all chain management handled through the dashboard.
123+
> No chainConfig, no manual key provider setup — just use your Dashboard settings.
131124
132125
---
133126

134127
### 4. Modal configuration is now part of the constructor
135128

136-
In v9, you had to call `initModal()` and pass `modalConfig` separately:
129+
In v9, you passed `modalConfig` to `initModal()` after instantiating the SDK:
137130

138131
```ts title="v9 - Before"
139132
await web3auth.initModal({
140133
modalConfig: {
141134
[WALLET_ADAPTERS.AUTH]: {
142135
loginMethods: {
143136
google: {
144-
name: "google",
145137
showOnModal: true,
146138
},
147139
},
@@ -150,7 +142,8 @@ await web3auth.initModal({
150142
});
151143
```
152144

153-
In v10, the configuration is moved into the constructor. `initModal()` is still required but without parameters:
145+
In v10, the same configuration is now included in the constructor. You still call `initModal()`, but
146+
without parameters:
154147

155148
```ts title="v10 - After"
156149
const web3auth = new Web3Auth({
@@ -174,39 +167,101 @@ const web3auth = new Web3Auth({
174167
await web3auth.initModal();
175168
```
176169

177-
> ✅ Setup is now centralized and more intuitive.
170+
> ✅ Setup is now centralized at construction time.
178171
179172
---
180173

181-
### 5. Changes to Modal Hooks (`useWeb3Auth`)
174+
### 5. React SDK must use hooks
182175

183-
In v9, you had to create a full `Web3AuthContextConfig` and pass `adapters`, `plugins`, and `privateKeyProvider`:
176+
In v10, all React-based usage must switch to hooks via `@web3auth/modal/react`.
177+
178+
In v9:
184179

185180
```ts title="v9 - Before"
186-
const web3AuthContextConfig: Web3AuthContextConfig = {
181+
const web3auth = new Web3Auth({ ... });
182+
await web3auth.initModal();
183+
await web3auth.connect();
184+
```
185+
186+
In v10, you use the hooks provided:
187+
188+
```ts title="v10 - After"
189+
const { connect, disconnect, isConnected } = useWeb3AuthConnect();
190+
191+
await connect(WALLET_CONNECTORS.AUTH, {
192+
authConnection: AUTH_CONNECTION.GOOGLE,
193+
authConnectionId: "w3a-google",
194+
});
195+
```
196+
197+
> ✅ All SDK methods are exposed via hooks — cleaner, reactive, and consistent.
198+
199+
---
200+
201+
### 6. Non-React usage still supports class-based Web3Auth
202+
203+
React apps must use the new hooks approach, but non-React frameworks like Angular or Vanilla JS can
204+
continue using the `Web3Auth` class directly:
205+
206+
```ts title="Angular or Vanilla - v10"
207+
const web3auth = new Web3Auth({
208+
clientId,
209+
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
210+
modalConfig: { ... },
211+
});
212+
213+
await web3auth.initModal();
214+
await web3auth.connect();
215+
```
216+
217+
> ✅ No breaking change for non-React usage.
218+
219+
---
220+
221+
### 7. Blockchain RPC usage (React) should migrate to Wagmi
222+
223+
In v9, blockchain interactions were handled via custom RPC files using `viem`, `ethers`, or `web3`:
224+
225+
```ts title="v9 - Before"
226+
const rpc = new EthereumRpc(provider);
227+
await rpc.getAccounts();
228+
await rpc.signMessage();
229+
```
230+
231+
In v10 React projects, use Wagmi hooks instead:
232+
233+
```ts title="v10 - After"
234+
import { useAccount, useSignMessage, useSendTransaction } from "wagmi";
235+
236+
const { address } = useAccount();
237+
const { data: hash, sendTransaction } = useSendTransaction();
238+
const { signMessage } = useSignMessage();
239+
```
240+
241+
> ✅ No need to pass around `provider`; Wagmi handles everything via context.
242+
243+
---
244+
245+
### 8. `web3authContext.tsx` is simplified
246+
247+
In v9, the context required full config including adapters, plugins, and privateKeyProvider:
248+
249+
```ts title="v9 - Before"
250+
const web3AuthContextConfig = {
187251
web3AuthOptions: {
188252
clientId,
189-
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
190253
privateKeyProvider,
191-
},
192-
modalConfig: {
193-
[WALLET_ADAPTERS.AUTH]: {
194-
loginMethods: {
195-
google: {
196-
showOnModal: true,
197-
},
198-
},
199-
},
254+
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
200255
},
201256
adapters: [authAdapter],
202257
plugins: [walletServicesPlugin],
203258
};
204259
```
205260

206-
In v10, all complexity is removed. Just pass connectors directly inside `modalConfig`:
261+
In v10, it’s just a basic config — hooks and connectors take care of the rest:
207262

208263
```ts title="v10 - After"
209-
const web3AuthContextConfig: Web3AuthContextConfig = {
264+
const web3AuthContextConfig = {
210265
web3AuthOptions: {
211266
clientId,
212267
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
@@ -227,47 +282,49 @@ const web3AuthContextConfig: Web3AuthContextConfig = {
227282
};
228283
```
229284

230-
> Fewer props, no adapters/plugins, and modal config becomes declarative.
285+
> No adapters, plugins, or manual providers needed.
231286
232287
---
233288

289+
### 9. `@web3auth/base` is deprecated — use `@web3auth/modal` only
234290

235-
### 6. `@web3auth/base` is deprecated — use `@web3auth/modal` instead
236-
237-
In v9, imports were often split across `@web3auth/base`, `@web3auth/modal`, and other packages:
291+
In v9, you often had to mix imports:
238292

239293
```ts title="v9 - Before"
240294
import { Web3Auth } from "@web3auth/modal";
241-
import { WALLET_ADAPTERS, WEB3AUTH_NETWORK } from "@web3auth/base";
295+
import { WALLET_ADAPTERS } from "@web3auth/base";
242296
```
243297

244-
In v10, everything you need is available directly from `@web3auth/modal`. The `@web3auth/base` package is deprecated and should no longer be used:
298+
In v10, everything you need comes from `@web3auth/modal`:
245299

246300
```ts title="v10 - After"
247301
import { Web3Auth, WALLET_CONNECTORS, WEB3AUTH_NETWORK, AUTH_CONNECTION } from "@web3auth/modal";
248302
```
249303

250-
> Cleaner import structure — use `@web3auth/modal` for everything.
304+
> One package, no fragmentation.
251305
252306
---
253307

254308
## Summary of Key Migration Steps
255309

256-
| Feature | v9 | v10 |
257-
| -------------------- | ----------------------------------- | ------------------------------------------ |
258-
| Verifier | `verifier`, `verifierSubIdentifier` | ⛔ Removed, use `authConnectionId` instead |
259-
| Account Linking | Manual via aggregate verifiers | ✅ Automatic via `groupedAuthConnectionId` |
260-
| Adapter Setup | Required (`AuthAdapter`, etc.) | ⛔ Removed, use `connectors` only |
261-
| Chain Configuration | Required in code | ✅ Handled via dashboard |
262-
| Private Key Provider | Required | ⛔ No longer needed |
263-
| Modal Config Setup | Inside `initModal()` | ✅ Now in constructor |
264-
| Base Package Usage | `@web3auth/base` + `@web3auth/modal`| ✅ Use only `@web3auth/modal` |
310+
| Feature | v9 | v10 |
311+
| ---------------------- | --------------------------------------- | ------------------------------------------ |
312+
| Verifier | `verifier`, `verifierSubIdentifier` | ⛔ Removed — use `authConnectionId` |
313+
| Account Linking | Manual via aggregate verifiers | ✅ Automatic via `groupedAuthConnectionId` |
314+
| Adapter Setup | Required (`AuthAdapter`, etc.) | ⛔ Removed — use `connectors` only |
315+
| Chain Configuration | Required (`getEvmChainConfig`, etc.) | ✅ Handled via dashboard |
316+
| Private Key Provider | Required (`EthereumPrivateKeyProvider`) | ⛔ Not needed anymore |
317+
| Modal Config | Inside `initModal()` | ✅ Passed in constructor |
318+
| React Usage | Class-based or hooks | ✅ Hooks only via `@web3auth/modal/react` |
319+
| Non-React Usage | ✅ Supported | ✅ Still supported |
320+
| Blockchain RPC (React) | Manual via RPC helper class | ✅ Use Wagmi hooks |
321+
| Base Package | `@web3auth/base` used | ✅ Only `@web3auth/modal` used |
265322

266323
---
267324

268-
For SDK reference and examples, check out:
325+
For examples and reference:
269326

270327
- [Web3Auth Docs](https://web3auth.io/docs/sdk/pnp/web/modal)
271328
- [Web3Auth Pnp Examples](https://github.com/web3auth/web3auth-pnp-examples)
272329

273-
Need help? Reach out on [Web3Auth Community](https://web3auth.io/community)
330+
Need help? [Join the Community](https://web3auth.io/community)

0 commit comments

Comments
 (0)