Skip to content

Commit 153eb34

Browse files
committed
Merge branch 'main' into 1566-multichain
# Conflicts: # docs/whats-new.md
2 parents f00169c + 3214817 commit 153eb34

File tree

859 files changed

+4034
-1519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

859 files changed

+4034
-1519
lines changed

developer-tools/dashboard/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import Banner from '@site/src/components/Banner'
99

1010
# Developer dashboard documentation
1111

12-
The MetaMask Developer dashboard provides developers with a comprehensive overview and control of their
13-
Infura service. It serves as a central hub for managing API keys and access, monitoring
14-
usage, and accessing account and billing information.
12+
The [MetaMask Developer dashboard](https://developer.metamask.io/) provides developers with a
13+
comprehensive overview and control of their Infura service.
14+
It serves as a central hub for managing API keys and access, monitoring usage, and accessing
15+
account and billing information.
1516

1617
<Banner>
1718
Don't have an API key? Sign up for a free plan and start using the Infura service!

docs/whats-new.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ of the [MetaMask developer page](https://metamask.io/developer/).
1414
- Documented Multichain API [guide](/wallet/how-to/manage-networks/use-multichain),
1515
[concept](/wallet/concepts/multichain-api), and [reference](/wallet/reference/multichain-api).
1616
([#1621](https://github.com/MetaMask/metamask-docs/pull/1621))
17+
- Documented [Solana](/wallet/how-to/use-non-evm-networks/solana) dapp support via the Wallet Standard and third-party libraries.
18+
([#1940](https://github.com/MetaMask/metamask-docs/pull/1940))
19+
- Documented [MetaMask SDK + Web3Auth SDK integration](/sdk/quickstart/javascript-web3auth).
20+
([#2029](https://github.com/MetaMask/metamask-docs/pull/2029))
21+
- Documented [how to use the Snaps sandbox](/snaps/how-to/test-a-snap/#test-in-the-sandbox).
22+
([#2030](https://github.com/MetaMask/metamask-docs/pull/2030))
1723
- Documented how to use the SDK CLI to set up a [JavaScript + Wagmi](/sdk/quickstart/javascript-wagmi) or [Dynamic SDK](/sdk/quickstart/javascript-dynamic) project.
1824
([#2010](https://github.com/MetaMask/metamask-docs/pull/2010))
1925
- Documented [how to send batch transactions via EIP-5792 and EIP-7702](/wallet/how-to/send-transactions/send-batch-transactions).

docusaurus.config.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @ts-check
22
// Note: type annotations allow type checking and IDEs autocompletion
33

4+
import fs from "fs";
45
require('dotenv').config()
56
const { themes } = require('prism-react-renderer')
67
const { REF_ALLOW_LOGIN_PATH } = require('./src/lib/constants')
@@ -13,7 +14,7 @@ const {
1314
const codeTheme = themes.dracula
1415
const remarkCodesandbox = require('remark-codesandbox')
1516
const isProd = process.env.NODE_ENV === 'production'
16-
17+
const helpDropdown = fs.readFileSync("./src/components/NavDropdown/DeveloperTools.html", "utf-8");
1718
/** @type {import('@docusaurus/types').Config} */
1819
const config = {
1920
title: 'MetaMask developer documentation',
@@ -212,14 +213,11 @@ const config = {
212213
{
213214
type: 'dropdown',
214215
label: 'Developer tools',
216+
to: 'developer-tools/dashboard',
215217
items: [
216218
{
217-
label: 'Developer dashboard',
218-
to: 'developer-tools/dashboard',
219-
},
220-
{
221-
label: 'Faucet',
222-
to: 'developer-tools/faucet',
219+
type: "html",
220+
value: helpDropdown,
223221
},
224222
],
225223
},

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"stylelint": "^15.0.0 ",
8888
"stylelint-config-standard": "^34.0.0",
8989
"tsc-files": "^1.1.4",
90-
"typescript": "^5.8.2"
90+
"typescript": "^5.8.3"
9191
},
9292
"overrides": {
9393
"react-alert": {

sdk-sidebar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const sidebar = {
2929
'quickstart/javascript-wagmi',
3030
'quickstart/javascript',
3131
'quickstart/javascript-dynamic',
32+
'quickstart/javascript-web3auth',
3233
'quickstart/react-native',
3334
],
3435
},

sdk/quickstart/javascript-dynamic.md

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ You can set up the SDKs in the following ways:
1919

2020
Features include:
2121

22-
- **Dual SDK integration** - Seamlessly combine MetaMask and Dynamic SDKs.
22+
- **MetaMask SDK built into Dynamic** - Use MetaMask SDK features directly within the Dynamic SDK.
2323
- **Wallet connection** - Connect to MetaMask wallet with enhanced features.
2424
- **Mobile experience** - Optimized for both desktop and mobile users.
2525
- **TypeScript support** - Full type safety and modern development experience.
@@ -43,10 +43,11 @@ The project you will set up has the following structure:
4343

4444
## Prerequisites
4545

46-
- [Node.js](https://nodejs.org/) version 19 or later
47-
- [pnpm](https://pnpm.io/installation)
48-
- [MetaMask](https://metamask.io/) installed in your browser or on mobile
49-
- A [Dynamic Environment ID](https://app.dynamic.xyz/)
46+
- [Node.js](https://nodejs.org/) version 19 or later installed.
47+
- A package manager installed.
48+
The examples in this quickstart use [pnpm](https://pnpm.io/installation).
49+
- [MetaMask](https://metamask.io/) installed in your browser or on mobile.
50+
- A [Dynamic Environment ID](https://app.dynamic.xyz/).
5051

5152
## Set up using the CLI
5253

@@ -161,34 +162,16 @@ Set up your providers in `app/providers.tsx`:
161162
"use client";
162163
163164
import { DynamicContextProvider } from "@dynamic-labs/sdk-react-core";
164-
import { EthereumWalletConnectors, IEthereum } from "@dynamic-labs/ethereum";
165+
import { EthereumWalletConnectors } from "@dynamic-labs/ethereum";
165166
import { DynamicWagmiConnector } from "@dynamic-labs/wagmi-connector";
166-
import { MetaMaskSDK } from "@metamask/sdk";
167167
import { WagmiProvider } from "wagmi";
168168
import { config } from "@/wagmi.config";
169169
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
170-
import { useEffect } from "react";
171170
172171
export function Providers({ children }: { children: React.ReactNode }) {
173172
174173
const queryClient = new QueryClient();
175174
176-
useEffect(() => {
177-
if (typeof window === "undefined") return;
178-
179-
const MMSDK = new MetaMaskSDK({
180-
dappMetadata: {
181-
name: "MetaMask Dynamic Integration",
182-
url: window.location.href,
183-
},
184-
});
185-
186-
const ethereum = MMSDK.getProvider();
187-
if (ethereum) {
188-
window.ethereum = ethereum as unknown as IEthereum;
189-
}
190-
}, []);
191-
192175
return (
193176
<DynamicContextProvider
194177
settings={{

sdk/quickstart/javascript-wagmi.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ The project you will set up has the following structure:
4343

4444
## Prerequisites
4545

46-
- [Node.js](https://nodejs.org/) version 19 or later
47-
- [pnpm](https://pnpm.io/installation)
48-
- [MetaMask](https://metamask.io/) installed in your browser or on mobile
46+
- [Node.js](https://nodejs.org/) version 19 or later installed.
47+
- A package manager installed.
48+
The examples in this quickstart use [pnpm](https://pnpm.io/installation).
49+
- [MetaMask](https://metamask.io/) installed in your browser or on mobile.
4950

5051
## Set up using the CLI
5152

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
---
2+
sidebar_label: Web3Auth SDK integration
3+
description: MetaMask + Web3Auth SDK Integration
4+
toc_max_heading_level: 2
5+
---
6+
7+
# MetaMask SDK + Web3Auth SDK integration
8+
9+
Get started with MetaMask SDK and [Web3Auth SDK](https://web3auth.io/docs/).
10+
You can set up the SDKs in the following ways:
11+
12+
- [Quickstart template](#set-up-using-a-template) - Clone the template to set up a Next.js and Web3Auth dapp with both SDKs.
13+
- [Manual setup](#set-up-manually) - Set up Web3Auth SDK in an existing dapp.
14+
15+
Features include:
16+
17+
- **MetaMask SDK built into Web3Auth** - Use MetaMask SDK features directly within the Web3Auth SDK.
18+
- **Web3Auth social login** - Enable users to sign in with an email or social media account.
19+
- **Wallet connection** - Connect to MetaMask wallet with enhanced features.
20+
- **Mobile experience** - Optimized for both desktop and mobile users.
21+
- **TypeScript support** - Full type safety and modern development experience.
22+
- **Next.js integration** - Built with Next.js 15 and App Router.
23+
24+
## Prerequisites
25+
26+
- [Node.js](https://nodejs.org/) version 19 or later installed.
27+
- A package manager installed.
28+
The examples in this quickstart use [pnpm](https://pnpm.io/installation).
29+
- [MetaMask](https://metamask.io/) installed in your browser or on mobile.
30+
- A [Web3Auth Client ID](https://web3auth.io/docs/dashboard/create-new-project#get-the-client-id).
31+
32+
## Set up using a template
33+
34+
1. Download the [MetaMask SDK + Web3Auth SDK template](https://github.com/MetaMask/metamask-web3auth):
35+
36+
```bash
37+
git clone https://github.com/MetaMask/metamask-web3auth
38+
```
39+
40+
2. Navigate into the repository:
41+
42+
```bash
43+
cd metamask-web3auth
44+
```
45+
46+
3. Install dependencies:
47+
48+
```bash
49+
pnpm install
50+
```
51+
52+
4. Create a `.env.local` file:
53+
54+
```bash
55+
touch .env.local
56+
```
57+
58+
5. In `.env.local`, add a `NEXT_PUBLIC_WEB3AUTH_CLIENT_ID` environment variable, replacing `<YOUR-CLIENT-ID>` with your Web3Auth Client ID:
59+
60+
```text title=".env.local"
61+
NEXT_PUBLIC_WEB3AUTH_CLIENT_ID=<YOUR-CLIENT-ID>
62+
```
63+
64+
6. Run the project:
65+
66+
```bash
67+
pnpm dev
68+
```
69+
70+
You've successfully set up MetaMask SDK and Web3Auth SDK.
71+
See how to [use the combined SDKs](#usage).
72+
73+
## Set up manually
74+
75+
### 1. Install dependencies
76+
77+
Install the SDK and the required dependencies to an existing project:
78+
79+
```bash
80+
pnpm i viem wagmi @tanstack/react-query @web3auth/modal@10
81+
```
82+
83+
### 2. Configure providers
84+
85+
Set up your providers in `app/providers.tsx`:
86+
87+
```typescript title="providers.tsx"
88+
"use client";
89+
90+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
91+
import { type ReactNode, useState } from "react";
92+
import { Web3AuthProvider } from "@web3auth/modal/react";
93+
import { WagmiProvider } from "@web3auth/modal/react/wagmi";
94+
95+
type Props = {
96+
children: ReactNode;
97+
};
98+
99+
export function Providers({ children }: Props) {
100+
const [queryClient] = useState(() => new QueryClient());
101+
102+
return (
103+
<Web3AuthProvider
104+
config={{
105+
web3AuthOptions: {
106+
clientId: process.env.NEXT_PUBLIC_WEB3AUTH_CLIENT_ID!,
107+
web3AuthNetwork: "sapphire_devnet"
108+
},
109+
}}
110+
>
111+
<QueryClientProvider client={queryClient}>
112+
<WagmiProvider>
113+
<div className="container">{children}</div>
114+
</WagmiProvider>
115+
</QueryClientProvider>
116+
</Web3AuthProvider>
117+
);
118+
}
119+
```
120+
121+
### 3. Set up environment variables
122+
123+
Create a `.env.local` file.
124+
In `.env.local`, add a `NEXT_PUBLIC_WEB3AUTH_CLIENT_ID` environment variable, replacing `<YOUR-CLIENT-ID>` with your Web3Auth Client ID:
125+
126+
```text title=".env.local"
127+
NEXT_PUBLIC_WEB3AUTH_CLIENT_ID=<YOUR-CLIENT-ID>
128+
```
129+
130+
You can now test your dapp by running `pnpm run dev`.
131+
132+
## Usage
133+
134+
### Connect or sign in
135+
136+
Use the `useWeb3AuthConnect` hook to enable users to connect or sign in to their wallet:
137+
138+
```typescript
139+
"use client";
140+
141+
import { useWeb3AuthConnect } from "@web3auth/modal/react";
142+
143+
export const Navbar = () => {
144+
const { connect } = useWeb3AuthConnect();
145+
146+
return (
147+
<nav>
148+
<button onClick={() => connect()}>Connect or Sign in</button>;
149+
</nav>
150+
);
151+
};
152+
```
153+
154+
### Check wallet status
155+
156+
Use the `useAccount` hook from Wagmi to check the wallet status:
157+
158+
```typescript
159+
"use client";
160+
161+
import { useAccount } from "wagmi";
162+
163+
export const Hero = () => {
164+
const { address, isConnected } = useAccount();
165+
166+
return (
167+
<div>
168+
{isConnected ? <p>Connected: {address}</p> : <p>Not connected</p>}
169+
</div>
170+
);
171+
};
172+
```
173+
174+
### Send a transaction
175+
176+
Use the `useSendTransaction` hook from Wagmi to send a transaction:
177+
178+
```typescript
179+
"use client";
180+
181+
import { useSendTransaction } from "wagmi";
182+
import { parseEther } from "viem";
183+
184+
export const SendTransaction = () => {
185+
const { sendTransaction } = useSendTransaction();
186+
187+
return (
188+
<button
189+
onClick={() =>
190+
sendTransaction({
191+
to: "0xd2135CfB216b74109775236E36d4b433F1DF507B",
192+
value: parseEther("0.001"),
193+
})
194+
}
195+
>
196+
Send transaction
197+
</button>
198+
);
199+
};
200+
```

0 commit comments

Comments
 (0)