|
| 1 | +--- |
| 2 | +title: Migrating to the Web3Auth PnP Web SDK v10 from v7 (No-Modal) |
| 3 | +description: |
| 4 | + Learn how to migrate from Web3Auth No-Modal v7 to the unified v10 SDK with connectTo functionality |
| 5 | + for custom UI implementations. |
| 6 | +sidebar_label: v7 to v10 |
| 7 | +--- |
| 8 | + |
| 9 | +import Tabs from "@theme/Tabs"; |
| 10 | +import TabItem from "@theme/TabItem"; |
| 11 | + |
| 12 | +# Web3Auth No-Modal v7 to v10 Migration Guide |
| 13 | + |
| 14 | +:::info Recommended: Switch to Modal SDK |
| 15 | + |
| 16 | +While the `@web3auth/no-modal` package continues to receive updates, it now primarily serves as an |
| 17 | +internal SDK to power the modal SDK. **We strongly recommend migrating to the `@web3auth/modal` |
| 18 | +package** for the best developer experience. |
| 19 | + |
| 20 | +The Modal SDK offers everything you need: pre-built UI components for quick integration AND full |
| 21 | +custom UI control via `connectTo` for advanced use cases. Plus, you'll get priority documentation, |
| 22 | +examples, and community support. |
| 23 | + |
| 24 | +::: |
| 25 | + |
| 26 | +This guide will help you upgrade your Web3Auth No-Modal SDK integration from v7 to the **unified |
| 27 | +Web3Auth PnP Web SDK v10**, which consolidates both modal and no-modal functionality into a single |
| 28 | +package. |
| 29 | + |
| 30 | +## Why Migrate to v10? |
| 31 | + |
| 32 | +Web3Auth v10 unifies the modal and no-modal SDKs into a single powerful package. Whether you want a |
| 33 | +pre-built modal UI or a custom implementation, you now use the same `@web3auth/modal` package with |
| 34 | +`connectTo` for no-modal-like functionality. |
| 35 | + |
| 36 | +Key improvements from v7 no-modal to v10: |
| 37 | + |
| 38 | +- **Unified SDK Package:** Single `@web3auth/modal` package replaces `@web3auth/no-modal` |
| 39 | +- **Dashboard-Centric Configuration:** Chain configurations managed via Web3Auth Developer Dashboard |
| 40 | +- **Simplified Integration:** No more manual `OpenLoginAdapter` registration and configuration |
| 41 | +- **Enhanced Developer Experience:** Cleaner API with better TypeScript support |
| 42 | +- **Custom UI Support:** Use `connectTo` for seamless custom UI implementations |
| 43 | + |
| 44 | +## Installation |
| 45 | + |
| 46 | +Update to the unified v10 SDK package: |
| 47 | + |
| 48 | +```bash npm2yarn |
| 49 | +npm uninstall @web3auth/no-modal @web3auth/openlogin-adapter @web3auth/wallet-services-plugin |
| 50 | +npm install @web3auth/modal |
| 51 | +``` |
| 52 | + |
| 53 | +For custom blockchain configurations: |
| 54 | + |
| 55 | +```bash npm2yarn |
| 56 | +npm install @web3auth/ethereum-provider |
| 57 | +``` |
| 58 | + |
| 59 | +## Breaking Changes from v7 to v10 |
| 60 | + |
| 61 | +### 1. Package Migration: No-Modal → Modal |
| 62 | + |
| 63 | +**v7 used separate no-modal package:** |
| 64 | + |
| 65 | +```typescript |
| 66 | +// remove-start |
| 67 | +import { Web3AuthNoModal } from "@web3auth/no-modal"; |
| 68 | +import { OpenloginAdapter } from "@web3auth/openlogin-adapter"; |
| 69 | +import { WalletServicesPlugin } from "@web3auth/wallet-services-plugin"; |
| 70 | +// remove-end |
| 71 | +``` |
| 72 | + |
| 73 | +**v10 uses unified modal package:** |
| 74 | + |
| 75 | +```typescript |
| 76 | +// add-start |
| 77 | +import { Web3Auth } from "@web3auth/modal"; |
| 78 | +// Most functionality is now built-in - no separate adapters needed for basic use cases |
| 79 | +// add-end |
| 80 | +``` |
| 81 | + |
| 82 | +### 2. Class Name Change: Web3AuthNoModal → Web3Auth |
| 83 | + |
| 84 | +**v7 initialization:** |
| 85 | + |
| 86 | +```typescript |
| 87 | +// remove-start |
| 88 | +import { Web3AuthNoModal } from "@web3auth/no-modal"; |
| 89 | + |
| 90 | +const web3auth = new Web3AuthNoModal({ |
| 91 | + clientId: "YOUR_CLIENT_ID", |
| 92 | + web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, |
| 93 | + chainConfig, |
| 94 | + privateKeyProvider, |
| 95 | +}); |
| 96 | +// remove-end |
| 97 | +``` |
| 98 | + |
| 99 | +**v10 initialization:** |
| 100 | + |
| 101 | +```typescript |
| 102 | +// add-start |
| 103 | +import { Web3Auth } from "@web3auth/modal"; |
| 104 | + |
| 105 | +const web3auth = new Web3Auth({ |
| 106 | + clientId: "YOUR_CLIENT_ID", |
| 107 | + web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, |
| 108 | + // Chain configuration managed via Web3Auth Developer Dashboard |
| 109 | +}); |
| 110 | +// add-end |
| 111 | +``` |
| 112 | + |
| 113 | +### 3. No-Modal Functionality: Direct Connection → connectTo |
| 114 | + |
| 115 | +**v7 approach for custom UI:** |
| 116 | + |
| 117 | +```typescript |
| 118 | +// remove-start |
| 119 | +const openloginAdapter = new OpenloginAdapter({ |
| 120 | + adapterSettings: { |
| 121 | + loginConfig: { |
| 122 | + google: { |
| 123 | + verifier: "YOUR_GOOGLE_VERIFIER_NAME", |
| 124 | + typeOfLogin: "google", |
| 125 | + clientId: "YOUR_GOOGLE_CLIENT_ID.apps.googleusercontent.com", |
| 126 | + }, |
| 127 | + }, |
| 128 | + }, |
| 129 | +}); |
| 130 | + |
| 131 | +web3auth.configureAdapter(openloginAdapter); |
| 132 | +await web3auth.init(); |
| 133 | + |
| 134 | +// Custom UI - connect directly |
| 135 | +await web3auth.connectTo("openlogin", { |
| 136 | + loginProvider: "google", |
| 137 | +}); |
| 138 | +// remove-end |
| 139 | +``` |
| 140 | + |
| 141 | +**v10 approach for custom UI:** |
| 142 | + |
| 143 | +```typescript |
| 144 | +// add-start |
| 145 | +await web3auth.init(); |
| 146 | + |
| 147 | +// Custom UI - use connectTo |
| 148 | +await web3auth.connectTo(WALLET_CONNECTORS.AUTH, { |
| 149 | + authConnection: AUTH_CONNECTION.GOOGLE, |
| 150 | +}); |
| 151 | + |
| 152 | +// Or with custom verifiers/connections |
| 153 | +await web3auth.connectTo(WALLET_CONNECTORS.AUTH, { |
| 154 | + authConnection: AUTH_CONNECTION.GOOGLE, |
| 155 | + authConnectionId: "YOUR_GOOGLE_AUTH_CONNECTION_ID", |
| 156 | +}); |
| 157 | +// add-end |
| 158 | +``` |
| 159 | + |
| 160 | +### 4. Chain Configuration Centralization |
| 161 | + |
| 162 | +**v7 required manual chain and provider configuration:** |
| 163 | + |
| 164 | +```typescript |
| 165 | +// remove-start |
| 166 | +import { EthereumPrivateKeyProvider } from "@web3auth/ethereum-provider"; |
| 167 | + |
| 168 | +const chainConfig = { |
| 169 | + chainNamespace: "eip155", |
| 170 | + chainId: "0x1", |
| 171 | + rpcTarget: "https://rpc.ethereum.org", |
| 172 | + displayName: "Ethereum Mainnet", |
| 173 | + blockExplorer: "https://etherscan.io/", |
| 174 | + ticker: "ETH", |
| 175 | + tickerName: "Ethereum", |
| 176 | +}; |
| 177 | + |
| 178 | +const privateKeyProvider = new EthereumPrivateKeyProvider({ |
| 179 | + config: { chainConfig }, |
| 180 | +}); |
| 181 | + |
| 182 | +const web3auth = new Web3AuthNoModal({ |
| 183 | + clientId: "YOUR_CLIENT_ID", |
| 184 | + web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, |
| 185 | + privateKeyProvider, |
| 186 | +}); |
| 187 | +// remove-end |
| 188 | +``` |
| 189 | + |
| 190 | +**v10 handles standard chains automatically via dashboard:** |
| 191 | + |
| 192 | +```typescript |
| 193 | +// add-start |
| 194 | +const web3auth = new Web3Auth({ |
| 195 | + clientId: "YOUR_CLIENT_ID", |
| 196 | + web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, |
| 197 | + // Chain configuration managed via Web3Auth Developer Dashboard |
| 198 | +}); |
| 199 | +// add-end |
| 200 | +``` |
| 201 | + |
| 202 | +Configure your chains on the [Web3Auth Developer Dashboard](https://dashboard.web3auth.io) instead |
| 203 | +of in code. |
| 204 | + |
| 205 | +## Next Steps |
| 206 | + |
| 207 | +1. Update your package dependencies |
| 208 | +2. Migrate your initialization code to use `Web3Auth` from `@web3auth/modal` |
| 209 | +3. Replace direct adapter methods with `connectTo` calls |
| 210 | +4. Configure your chains and branding on the Web3Auth Developer Dashboard |
| 211 | +5. Test your custom UI implementation with the new `connectTo` API |
| 212 | + |
| 213 | +For any specific migration challenges, consult the |
| 214 | +[Web3Auth documentation](https://web3auth.io/docs/). |
0 commit comments