Skip to content

Commit fa23c59

Browse files
authored
Added hooks part
1 parent 3096ece commit fa23c59

1 file changed

Lines changed: 62 additions & 15 deletions

File tree

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

Lines changed: 62 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ 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
8-
SDK. Version 10 introduces a simpler architecture by eliminating verifiers and adapters from the
9-
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 SDK. Version 10 introduces a simpler architecture by eliminating verifiers and adapters from the frontend codebase, consolidating all configurations within the Web3Auth Developer Dashboard.
108

119
## Breaking Changes
1210

1311
### 1. `verifier` and `verifierSubIdentifier` replaced with `authConnectionId` and `groupedAuthConnectionId`
1412

15-
In v9, aggregating social logins to return the same account (for the same user email) required using
16-
an aggregate verifier with `verifierSubIdentifier`:
13+
In v9, aggregating social logins to return the same account (for the same user email) required using an aggregate verifier with `verifierSubIdentifier`:
1714

1815
```ts title="v9 - Before"
1916
loginConfig: {
@@ -32,8 +29,7 @@ loginConfig: {
3229
}
3330
```
3431

35-
In v10, this logic is now abstracted to the dashboard. Use `authConnectionId` for each provider and
36-
group them using the new `groupedAuthConnectionId`:
32+
In v10, this logic is now abstracted to the dashboard. Use `authConnectionId` for each provider and group them using the new `groupedAuthConnectionId`:
3733

3834
```ts title="v10 - After"
3935
modalConfig: {
@@ -57,8 +53,7 @@ modalConfig: {
5753
}
5854
```
5955

60-
> ✅ This results in the same user account when logging in with Google or GitHub using the same
61-
> email, no additional setup needed in code.
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.
6257
6358
---
6459

@@ -110,8 +105,7 @@ const web3auth = new Web3Auth({
110105
});
111106
```
112107

113-
In v10, all chain settings are handled via the dashboard. These parameters are no longer required or
114-
accepted:
108+
In v10, all chain settings are handled via the dashboard. These parameters are no longer required or accepted:
115109

116110
```ts title="v10 - After"
117111
const web3auth = new Web3Auth({
@@ -156,8 +150,7 @@ await web3auth.initModal({
156150
});
157151
```
158152

159-
In v10, the configuration is moved into the constructor. `initModal()` is still required but without
160-
parameters:
153+
In v10, the configuration is moved into the constructor. `initModal()` is still required but without parameters:
161154

162155
```ts title="v10 - After"
163156
const web3auth = new Web3Auth({
@@ -185,6 +178,59 @@ await web3auth.initModal();
185178
186179
---
187180

181+
### 5. Changes to Modal Hooks (`useWeb3Auth`)
182+
183+
In v9, you had to create a full `Web3AuthContextConfig` and pass `adapters`, `plugins`, and `privateKeyProvider`:
184+
185+
```ts title="v9 - Before"
186+
const web3AuthContextConfig: Web3AuthContextConfig = {
187+
web3AuthOptions: {
188+
clientId,
189+
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
190+
privateKeyProvider,
191+
},
192+
modalConfig: {
193+
[WALLET_ADAPTERS.AUTH]: {
194+
loginMethods: {
195+
google: {
196+
showOnModal: true,
197+
},
198+
},
199+
},
200+
},
201+
adapters: [authAdapter],
202+
plugins: [walletServicesPlugin],
203+
};
204+
```
205+
206+
In v10, all complexity is removed. Just pass connectors directly inside `modalConfig`:
207+
208+
```ts title="v10 - After"
209+
const web3AuthContextConfig: Web3AuthContextConfig = {
210+
web3AuthOptions: {
211+
clientId,
212+
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
213+
},
214+
modalConfig: {
215+
connectors: {
216+
[WALLET_CONNECTORS.AUTH]: {
217+
label: "Social Login",
218+
loginMethods: {
219+
google: {
220+
authConnection: AUTH_CONNECTION.GOOGLE,
221+
authConnectionId: "w3a-google",
222+
},
223+
},
224+
},
225+
},
226+
},
227+
};
228+
```
229+
230+
> ✅ Fewer props, no adapters/plugins, and modal config becomes declarative.
231+
232+
---
233+
188234
## Summary of Key Migration Steps
189235

190236
| Feature | v9 | v10 |
@@ -195,12 +241,13 @@ await web3auth.initModal();
195241
| Chain Configuration | Required in code | ✅ Handled via dashboard |
196242
| Private Key Provider | Required | ⛔ No longer needed |
197243
| Modal Config Setup | Inside `initModal()` | ✅ Now in constructor |
244+
| Hook Setup Context | Verbose with adapters/plugins | ✅ Minimal with `connectors` only |
198245

199246
---
200247

201-
For examples, check out:
248+
For SDK reference and examples, check out:
202249

203250
- [Web3Auth Docs](https://web3auth.io/docs/sdk/pnp/web/modal)
204251
- [Web3Auth Pnp Examples](https://github.com/web3auth/web3auth-pnp-examples)
205252

206-
Need help? Reach out on [Web3Auth Community](https://web3auth.io/community)
253+
Need help? Reach out on [Web3Auth Community](https://web3auth.io/community)

0 commit comments

Comments
 (0)