Skip to content

Commit 68950c8

Browse files
committed
Fixes
1 parent eb4e165 commit 68950c8

12 files changed

Lines changed: 164 additions & 85 deletions

File tree

embedded-wallets/connect-blockchain/evm/README.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ With Embedded Wallets v11 onward, chains are already added to the dashboard. You
2222

2323
::::
2424

25-
The Embedded Wallets Web SDK(`@web3auth/modal`) from v11 onward does not need any additional setup on the code side for blockchain connections. All of it is handled on the dashboard. We can use any chain from the extensive list of predefined chains and add more if we need.
25+
The Embedded Wallets Web SDK (`@web3auth/modal`) does not need any additional setup on the code side for standard EVM connections. Chains enabled in the dashboard are loaded automatically
26+
at runtime.
27+
28+
You can still pass a `chains` array in `web3AuthOptions` when you need custom RPC endpoints, local testing overrides, or patterns shown in SDK demo apps. Prefer [dashboard chain configuration](/embedded-wallets/dashboard/chains-and-networks/) for production.
2629

2730
![Chains on Dashboard](https://i.ibb.co/4nCD2GTJ/chains.gif)

embedded-wallets/migration-guides/web.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,22 +543,25 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
543543
)
544544
```
545545
546-
Optional React-only config (from the v11 quick-start example):
546+
Optional React-only config (from the [v11 React quick start](https://github.com/Web3Auth/web3auth-examples/tree/main/quick-starts/react-quick-start)):
547547
548548
```tsx title="web3authContext.tsx"
549-
import { CONNECTOR_INITIAL_AUTHENTICATION_MODE, WEB3AUTH_NETWORK } from '@web3auth/modal'
549+
import { WEB3AUTH_NETWORK } from '@web3auth/modal'
550550
import { type Web3AuthContextConfig } from '@web3auth/modal/react'
551551

552552
const web3AuthContextConfig: Web3AuthContextConfig = {
553553
web3AuthOptions: {
554554
clientId: import.meta.env.VITE_WEB3AUTH_CLIENT_ID,
555555
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
556-
initialAuthenticationMode: CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_AND_SIGN,
557556
authBuildEnv: 'production',
558557
},
559558
}
560559
```
561560
561+
You can also set `initialAuthenticationMode` (import `CONNECTOR_INITIAL_AUTHENTICATION_MODE` from
562+
`@web3auth/modal`) when you need a specific connector auth flow; the official quick start does not
563+
require it.
564+
562565
</TabItem>
563566
<TabItem value="vue" label="Vue">
564567

embedded-wallets/sdk/_common/_web3auth-options.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ import Tabs from '@theme/Tabs'
2727

2828
<TabItem value="advanced">
2929

30-
| Parameter | Description |
31-
| --------------------------- | -------------------------------------------------------------------------------------------------------- |
32-
| `chains?` | (Fetched automatically from dashboard) Multiple chain configurations, only provided chains will be used. |
33-
| `uiConfig?` | (Fetched automatically from dashboard) Config for configuring UI display properties. |
34-
| `modalConfig?` | Helps you customize the modal UI elements and authentication methods. |
35-
| `accountAbstractionConfig?` | (Fetched automatically from Dashboard) Account abstraction config for your chain namespace. |
36-
| `useAAWithExternalWallet?` | (Fetched automatically from Dashboard) Whether to use AA with external wallet. |
37-
| `walletServicesConfig?` | (Fetched automatically from Dashboard) Configure any parameter related to Wallet Services plugin |
38-
| `ssr?` | Whether to enable SSR mode. |
39-
| `mfaSettings?` | MFA settings for the auth connector. |
40-
| `mfaLevel?` | MFA level for the auth connector. |
41-
| `privateKeyProvider?` | Private key provider for your chain namespace. |
30+
| Parameter | Description |
31+
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
32+
| `chains?` | Optional in-code chain list. By default, chains are fetched from the [dashboard](/embedded-wallets/dashboard/chains-and-networks/). Pass `chains` only for custom RPC, demos, or overrides. |
33+
| `uiConfig?` | (Fetched automatically from dashboard) Config for configuring UI display properties. |
34+
| `modalConfig?` | Helps you customize the modal UI elements and authentication methods. |
35+
| `accountAbstractionConfig?` | (Fetched automatically from Dashboard) Account abstraction config for your chain namespace. |
36+
| `useAAWithExternalWallet?` | (Fetched automatically from Dashboard) Whether to use AA with external wallet. |
37+
| `walletServicesConfig?` | (Fetched automatically from Dashboard) Configure any parameter related to Wallet Services plugin |
38+
| `ssr?` | Whether to enable SSR mode. |
39+
| `mfaSettings?` | MFA settings for the auth connector. |
40+
| `mfaLevel?` | MFA level for the auth connector. |
41+
| `privateKeyProvider?` | Private key provider for your chain namespace. |
4242

4343
</TabItem>
4444

embedded-wallets/sdk/js/README.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ sidebar_label: Get started
44
description: 'Embedded Wallets Web SDK (formerly Web3Auth Plug and Play)'
55
---
66

7-
import ExampleCards from '@theme/ExampleCards'
8-
import { webExamples, QUICK_START } from '@site/src/utils/example-maps'
97
import TabItem from '@theme/TabItem'
108
import Tabs from '@theme/Tabs'
119
import SdkTroubleshootingIntro from '../_common/_sdk-troubleshooting-intro.mdx'

embedded-wallets/sdk/js/events.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Embedded Wallets events and status
33
sidebar_label: SDK events
4-
description: '@web3auth/no-modal Native Account Abstraction | Embedded Wallets'
4+
description: '@web3auth/modal SDK events and connection lifecycle | Embedded Wallets'
55
---
66

77
import Tabs from '@theme/Tabs'

embedded-wallets/sdk/react-native/README.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ sidebar_label: Get started
44
description: 'MetaMask Embedded Wallets SDK for React Native | Web3Auth Plug and Play for React Native'
55
---
66

7-
import ExampleCards from '@theme/ExampleCards'
8-
import { webExamples, QUICK_START } from '@site/src/utils/example-maps'
97
import TabItem from '@theme/TabItem'
108
import Tabs from '@theme/Tabs'
119
import SdkTroubleshootingIntro from '../_common/_sdk-troubleshooting-intro.mdx'

embedded-wallets/sdk/react/README.mdx

Lines changed: 82 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,24 @@ sidebar_label: Get started
44
description: 'MetaMask Embedded Wallets SDK for React | Web3Auth Plug and Play for React'
55
---
66

7-
import ExampleCards from '@theme/ExampleCards'
8-
import { webExamples, QUICK_START } from '@site/src/utils/example-maps'
97
import TabItem from '@theme/TabItem'
108
import Tabs from '@theme/Tabs'
119
import SdkTroubleshootingIntro from '../_common/_sdk-troubleshooting-intro.mdx'
1210

1311
## Overview
1412

15-
MetaMask Embedded Wallets SDK (formerly Web3Auth Plug and Play) provides a seamless authentication experience for React applications with social logins, external wallets, and more. Our React Hooks simplifies how you connect users to their preferred wallets and manage authentication state.
13+
MetaMask Embedded Wallets SDK (formerly Web3Auth Plug and Play) provides a seamless authentication
14+
experience for React applications with social logins, external wallets, and more. React hooks
15+
simplify how you connect users to their preferred wallets and manage authentication state.
16+
17+
For a complete working project, see the
18+
[React quick start example](https://github.com/Web3Auth/web3auth-examples/tree/main/quick-starts/react-quick-start)
19+
on GitHub.
1620

1721
## Requirements
1822

1923
- This is a frontend SDK and must be used in a browser environment.
24+
- Node.js 20+ and npm (or yarn).
2025
- Basic knowledge of JavaScript and React.
2126

2227
## Prerequisites
@@ -31,55 +36,96 @@ See the [dashboard setup](../../dashboard/README.mdx) guide to learn more.
3136

3237
## Installation
3338

34-
Install the Web3Auth Modal SDK using npm or yarn:
39+
Install the Web3Auth Modal SDK and Wagmi dependencies:
3540

3641
```bash npm2yarn
37-
npm install --save @web3auth/modal
42+
npm install --save @web3auth/modal wagmi@3 @tanstack/react-query
3843
```
3944

4045
### 1. Configuration
4146

42-
Create a configuration file for Web3Auth. This file will contain your Web3Auth Client ID and Network details from the [Embedded Wallets dashboard](https://developer.metamask.io/).
47+
Create a configuration file with your Client ID and Sapphire network from the
48+
[Embedded Wallets dashboard](https://developer.metamask.io/).
49+
50+
Use **Sapphire Devnet** for local development (`http://localhost`). Sapphire Mainnet does not allow
51+
localhost origins.
4352

4453
```tsx title="web3authContext.tsx"
4554
import { type Web3AuthContextConfig } from '@web3auth/modal/react'
46-
import { WEB3AUTH_NETWORK, type Web3AuthOptions } from '@web3auth/modal'
55+
import { WEB3AUTH_NETWORK } from '@web3auth/modal'
4756

48-
const web3AuthOptions: Web3AuthOptions = {
49-
clientId: 'YOUR_WEB3AUTH_CLIENT_ID', // Pass your Web3Auth Client ID, ideally using an environment variable // Get your Client ID from MetaMask Developer Dashboard
50-
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, // or WEB3AUTH_NETWORK.SAPPHIRE_DEVNET
51-
}
57+
const clientId = import.meta.env.VITE_WEB3AUTH_CLIENT_ID // or your env prefix
5258

5359
const web3AuthContextConfig: Web3AuthContextConfig = {
54-
web3AuthOptions,
60+
web3AuthOptions: {
61+
clientId,
62+
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET, // use SAPPHIRE_MAINNET in production
63+
authBuildEnv: 'production',
64+
},
5565
}
5666

5767
export default web3AuthContextConfig
5868
```
5969

60-
### 2. Setup Web3Auth provider
70+
### 2. Set up providers
6171

62-
In your main entry file (generally `index.tsx` or `main.tsx`), import the `Web3AuthProvider` component and wrap your application with it:
72+
In your main entry file (`main.tsx` or `index.tsx`), wrap your app with `Web3AuthProvider`,
73+
`QueryClientProvider`, and the Embedded Wallets `WagmiProvider`:
6374

6475
```tsx title="main.tsx"
6576
import './index.css'
6677

6778
import ReactDOM from 'react-dom/client'
68-
// focus-start
6979
import { Web3AuthProvider } from '@web3auth/modal/react'
80+
import { WagmiProvider } from '@web3auth/modal/react/wagmi'
81+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
7082
import web3AuthContextConfig from './web3authContext'
71-
// focus-end
7283
import App from './App'
7384

85+
const queryClient = new QueryClient()
86+
7487
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
75-
// focus-start
7688
<Web3AuthProvider config={web3AuthContextConfig}>
77-
<App />
89+
<QueryClientProvider client={queryClient}>
90+
<WagmiProvider>
91+
<App />
92+
</WagmiProvider>
93+
</QueryClientProvider>
7894
</Web3AuthProvider>
79-
// focus-end
8095
)
8196
```
8297

98+
### 3. Connect users
99+
100+
Use [`useWeb3AuthConnect`](./hooks/useWeb3AuthConnect.mdx) to open the pre-built modal or connect to a
101+
specific login method:
102+
103+
```tsx title="App.tsx"
104+
import { useWeb3AuthConnect, useWeb3AuthDisconnect } from '@web3auth/modal/react'
105+
import { useAccount } from 'wagmi'
106+
107+
function App() {
108+
const { connect, loading, isConnected, error } = useWeb3AuthConnect()
109+
const { disconnect } = useWeb3AuthDisconnect()
110+
const { address } = useAccount()
111+
112+
if (!isConnected) {
113+
return (
114+
<button onClick={() => connect()} disabled={loading}>
115+
{loading ? 'Connecting...' : 'Login'}
116+
</button>
117+
)
118+
}
119+
120+
return (
121+
<div>
122+
<p>{address}</p>
123+
<button onClick={() => disconnect()}>Log out</button>
124+
</div>
125+
)
126+
}
127+
```
128+
83129
## Advanced configuration
84130

85131
The Web3Auth Modal SDK offers a rich set of advanced configuration options:
@@ -108,15 +154,14 @@ See the [advanced configuration](./advanced/README.mdx) section to learn more ab
108154

109155
```ts
110156
import { type Web3AuthContextConfig } from '@web3auth/modal/react'
111-
import { WEB3AUTH_NETWORK, type Web3AuthOptions } from '@web3auth/modal'
112-
113-
const web3AuthOptions: Web3AuthOptions = {
114-
clientId: 'YOUR_WEB3AUTH_CLIENT_ID', // Pass your Web3Auth Client ID, ideally using an environment variable
115-
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET, // or WEB3AUTH_NETWORK.SAPPHIRE_DEVNET
116-
}
157+
import { WEB3AUTH_NETWORK } from '@web3auth/modal'
117158

118159
const web3AuthContextConfig: Web3AuthContextConfig = {
119-
web3AuthOptions,
160+
web3AuthOptions: {
161+
clientId: import.meta.env.VITE_WEB3AUTH_CLIENT_ID,
162+
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
163+
authBuildEnv: 'production',
164+
},
120165
}
121166
```
122167

@@ -134,8 +179,9 @@ import {
134179
} from '@web3auth/modal'
135180

136181
const web3AuthOptions: Web3AuthOptions = {
137-
clientId: 'YOUR_WEB3AUTH_CLIENT_ID', // Pass your Web3Auth Client ID, ideally using an environment variable
182+
clientId: import.meta.env.VITE_WEB3AUTH_CLIENT_ID,
138183
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
184+
authBuildEnv: 'production',
139185
modalConfig: {
140186
connectors: {
141187
[WALLET_CONNECTORS.AUTH]: {
@@ -179,18 +225,23 @@ const web3AuthContextConfig: Web3AuthContextConfig = {
179225

180226
## Blockchain integration
181227

182-
Web3Auth is blockchain agnostic, enabling integration with any blockchain network. Out of the box, Web3Auth offers robust support for both **Solana** and **Ethereum**, each with dedicated React hooks.
228+
Web3Auth is blockchain agnostic, enabling integration with any blockchain network. Out of the box,
229+
Web3Auth offers robust support for both **Solana** and **Ethereum**, each with dedicated React hooks.
183230

184231
### Solana integration
185232

186-
Solana hooks are included natively within the `@web3auth/modal` package. No additional setup is required—simply use the provided hooks to interact with Solana networks.
233+
Solana hooks are included natively within the `@web3auth/modal` package. Install
234+
[`@solana/kit`](https://www.npmjs.com/package/@solana/kit) and use hooks from
235+
`@web3auth/modal/react/solana`.
187236

188237
For detailed usage and examples, see the [**Solana hooks**](./solana-hooks/README.mdx) section.
189238

190239
### Ethereum integration
191240

192-
Ethereum hooks are provided through the popular `wagmi` library, which works seamlessly with Web3Auth. This allows you to leverage a wide range of Ethereum hooks for account management, transactions, and more.
241+
Ethereum wallet operations use [Wagmi](https://wagmi.sh/) hooks after the provider setup above.
242+
Configure EVM chains in the [Embedded Wallets dashboard](../../dashboard/chains-and-networks/); no
243+
in-app chain list is required for standard integrations.
193244

194-
For implementation details and examples, refer to the [**Ethereum Hooks**](./ethereum-hooks.mdx) section.
245+
For implementation details and examples, refer to the [**Ethereum hooks**](./ethereum-hooks.mdx) section.
195246

196247
<SdkTroubleshootingIntro />

embedded-wallets/sdk/react/hooks/useWeb3Auth.mdx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,49 @@ import { useWeb3Auth } from '@web3auth/modal/react'
1818
import { useWeb3Auth } from '@web3auth/modal/react'
1919

2020
function App() {
21-
const { web3Auth, isConnected, isInitializing, provider, status, initError } = useWeb3Auth()
21+
const { web3Auth, isConnected, isInitializing, connection, status, initError } = useWeb3Auth()
2222

2323
if (isConnected) {
24-
// User is connected
25-
console.log('Connected with provider:', provider)
24+
console.log('Connected via:', connection?.connectorName)
2625
}
2726
if (isInitializing) {
28-
// Web3Auth is initializing
2927
console.log('Web3Auth is initializing')
3028
}
31-
if (provider) {
32-
// Web3Auth provider is connected
33-
console.log('Web3Auth provider is connected')
29+
if (connection?.ethereumProvider) {
30+
// Use for JSON-RPC edge cases; prefer Wagmi hooks for standard EVM flows
31+
console.log('Ethereum provider available')
3432
}
3533
if (status) {
36-
// Web3Auth status
3734
console.log('Web3Auth status:', status)
3835
}
3936
if (initError) {
40-
// Web3Auth initialization error
4137
console.log('Web3Auth initialization error:', initError)
4238
}
4339
}
4440
```
4541

42+
:::info
43+
44+
For EVM wallet operations, use [Wagmi hooks](../ethereum-hooks.mdx) (`useAccount`, `useBalance`,
45+
`useSendTransaction`) after setting up `WagmiProvider`.
46+
Use `connection.ethereumProvider` only for JSON-RPC methods Wagmi does not cover.
47+
See the [Web SDK v11 migration guide](/embedded-wallets/migration-guides/web#provider-api-changes-all-frameworks).
48+
49+
:::
50+
4651
### Return type
4752

4853
```tsx
4954
import { type IUseWeb3Auth } from '@web3auth/modal/react'
5055
```
5156

57+
#### `connection`
58+
59+
`{ ethereumProvider, solanaWallet, connectorName } | null`
60+
61+
Active wallet connection after sign-in. `ethereumProvider` is an EIP-1193 provider for EVM;
62+
`solanaWallet` exposes Solana wallet utilities.
63+
5264
#### `initError`
5365

5466
`Error | null`
@@ -73,19 +85,13 @@ Whether Web3Auth has completed initialization.
7385

7486
Whether Web3Auth is currently initializing.
7587

76-
#### `provider`
77-
78-
`IProvider | null`
79-
80-
Connected provider from Web3Auth.
81-
8288
#### `status`
8389

8490
`string`
8591

8692
Current status of the Web3Auth connection.
8793

88-
#### `web3auth`
94+
#### `web3Auth`
8995

9096
`Web3Auth`
9197

embedded-wallets/sdk/vue/README.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ sidebar_label: Get started
44
description: 'Embedded Wallets Vue SDK (formerly Web3Auth Plug and Play)'
55
---
66

7-
import ExampleCards from '@theme/ExampleCards'
8-
import { webExamples, QUICK_START } from '@site/src/utils/example-maps'
97
import TabItem from '@theme/TabItem'
108
import Tabs from '@theme/Tabs'
119
import SdkTroubleshootingIntro from '../_common/_sdk-troubleshooting-intro.mdx'

0 commit comments

Comments
 (0)