Skip to content

Commit eb67cf0

Browse files
Update SDK guides (#2117)
1 parent c9d0d3f commit eb67cf0

File tree

7 files changed

+58
-69
lines changed

7 files changed

+58
-69
lines changed

sdk/connect/javascript-dynamic.md

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,17 @@ keywords: [connect, MetaMask, Dynamic, SDK, dapp]
88
# Connect to MetaMask using Dynamic SDK
99

1010
Get started with MetaMask SDK and [Dynamic SDK](https://docs.dynamic.xyz/introduction/welcome).
11-
You can set up the SDKs in the following ways:
11+
You can use MetaMask SDK features directly within Dynamic SDK.
12+
Set up the SDKs in one of the following ways:
1213

13-
- [SDK CLI](#set-up-using-the-cli) - Use the CLI to scaffold a Next.js and Wagmi dapp with both SDKs.
14-
- [Quickstart template](#set-up-using-a-template) - Clone the template to set up a Next.js and Wagmi dapp with both SDKs.
15-
- [Manual setup](#set-up-manually) - Set up both SDKs in an existing dapp.
14+
- [SDK CLI](#set-up-using-the-cli) - Use the CLI to scaffold a Next.js and Dynamic dapp.
15+
- [Quickstart template](#set-up-using-a-template) - Clone the template to set up a Next.js and Dynamic dapp.
16+
- [Manual setup](#set-up-manually) - Set up Dynamic SDK in an existing dapp.
1617

17-
<p align="center">
18-
<img src={require("../_assets/quickstart-dynamic.png").default} alt="Dynamic SDK Quickstart" width="450px" />
19-
</p>
20-
21-
Features include:
22-
23-
- **MetaMask SDK built into Dynamic** - Use MetaMask SDK features directly within Dynamic SDK.
24-
- **Wallet connection** - Connect to MetaMask wallet with enhanced features.
25-
- **Mobile experience** - Optimized for both desktop and mobile users.
26-
- **TypeScript support** - Full type safety and modern development experience.
27-
- **Next.js integration** - Built with Next.js 14 and App Router.
28-
29-
:::note Project structure
30-
The project you will set up has the following structure:
18+
<details>
19+
<summary>Project structure</summary>
20+
<div>
21+
The project you set up using the CLI or template has the following structure:
3122

3223
```text
3324
├── app/
@@ -40,7 +31,12 @@ The project you will set up has the following structure:
4031
├── next.config.ts # Next.js configuration
4132
└── package.json # Project dependencies
4233
```
43-
:::
34+
</div>
35+
</details>
36+
37+
<p align="center">
38+
<img src={require("../_assets/quickstart-dynamic.png").default} alt="Dynamic SDK Quickstart" width="600px" />
39+
</p>
4440

4541
## Prerequisites
4642

sdk/connect/javascript-wagmi.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,10 @@ You can set up the SDK in the following ways:
1414
- [Quickstart template](#set-up-using-a-template) - Clone the template to set up a Next.js and Wagmi dapp.
1515
- [Manual setup](#set-up-manually) - Set up the SDK in an existing dapp.
1616

17-
<p align="center">
18-
<a href="https://metamask-sdk-examples.vercel.app/" target="_blank">
19-
<img src={require("../_assets/quickstart.jpg").default} alt="Quickstart" width="450px" />
20-
</a>
21-
</p>
22-
23-
Features include:
24-
25-
- **Wallet connection** - Connect to the MetaMask wallet seamlessly.
26-
- **Network switching** - Switch between Ethereum networks like Linea Sepolia, Linea, and Mainnet.
27-
- **Interactive UI** - Responsive design with interactive cards guiding users.
28-
- **Modular components** - Easy-to-understand and customizable components.
29-
30-
:::note Project structure
31-
The project you will set up has the following structure:
17+
<details>
18+
<summary>Project structure</summary>
19+
<div>
20+
The project you set up using the CLI or template has the following structure:
3221

3322
```text
3423
├── app/
@@ -41,7 +30,15 @@ The project you will set up has the following structure:
4130
├── next.config.ts # Next.js configuration
4231
└── package.json # Project dependencies
4332
```
44-
:::
33+
</div>
34+
</details>
35+
36+
<p align="center">
37+
<a href="https://metamask-sdk-examples.vercel.app/" target="_blank">
38+
<img src={require("../_assets/quickstart.jpg").default} alt="Quickstart" width="600px" />
39+
</a>
40+
</p>
41+
4542

4643
## Prerequisites
4744

sdk/connect/javascript-web3auth.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,19 @@ keywords: [connect, MetaMask, Web3Auth, SDK, dapp]
77

88
# Connect to MetaMask using Web3Auth SDK
99

10-
Get started with MetaMask SDK and [Web3Auth SDK](https://web3auth.io/docs/).
11-
You can set up the SDKs in the following ways:
10+
Get started with MetaMask SDK and [Web3Auth SDK](https://web3auth.io/docs/),
11+
enabling users to sign in with an email or social media account.
12+
You can use MetaMask SDK features directly within Web3Auth SDK.
13+
Set up the SDKs in one of the following ways:
1214

13-
- [Quickstart template](#set-up-using-a-template) - Clone the template to set up a Next.js and Web3Auth dapp that uses MetaMask SDK.
15+
- [SDK CLI](#set-up-using-the-cli) - Use the CLI to scaffold a Next.js and Web3Auth dapp.
16+
- [Quickstart template](#set-up-using-a-template) - Clone the template to set up a Next.js and Web3Auth dapp.
1417
- [Manual setup](#set-up-manually) - Set up Web3Auth SDK in an existing dapp.
1518

1619
<p align="center">
17-
<img src={require("../_assets/quickstart-web3auth.png").default} alt="Web3Auth SDK Quickstart" width="450px" />
20+
<img src={require("../_assets/quickstart-web3auth.png").default} alt="Web3Auth SDK Quickstart" width="600px" />
1821
</p>
1922

20-
Features include:
21-
22-
- **MetaMask SDK built into Web3Auth** - Use MetaMask SDK features directly within Web3Auth SDK.
23-
- **Web3Auth social login** - Enable users to sign in with an email or social media account.
24-
- **Wallet connection** - Connect to MetaMask wallet with enhanced features.
25-
- **Mobile experience** - Optimized for both desktop and mobile users.
26-
- **TypeScript support** - Full type safety and modern development experience.
27-
- **Next.js integration** - Built with Next.js 15 and App Router.
28-
2923
## Prerequisites
3024

3125
- [Node.js](https://nodejs.org/) version 19 or later installed.

sdk/guides/authenticate-users.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ function WatchAccount() {
8585

8686
## Use Vanilla JavaScript
8787

88-
You can implement user authentication directly in Vanilla JavaScript.
88+
You can implement user authentication directly in Vanilla JavaScript, using the
89+
[`eth_requestAccounts`](/wallet/reference/json-rpc-methods/eth_requestaccounts) RPC method
90+
and [`accountsChanged`](/wallet/reference/provider-api/#accountschanged) provider event.
8991
For example:
9092

9193
```javascript
@@ -149,10 +151,6 @@ Display connect and disconnect buttons in HTML:
149151
</div>
150152
```
151153

152-
:::info
153-
See the [Provider API](/wallet/reference/provider-api) reference for more information.
154-
:::
155-
156154
## Best practices
157155

158156
Follow these best practices when authenticating users.

sdk/guides/handle-transactions.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ The following are examples of sending a [basic transaction](#basic-transaction-1
111111

112112
### Basic transaction
113113

114+
The basic transaction uses the [`eth_requestAccounts`](/wallet/reference/json-rpc-methods/eth_requestaccounts),
115+
[`eth_sendTransaction`](/wallet/reference/json-rpc-methods/eth_sendtransaction), and
116+
[`eth_getTransactionReceipt`](/wallet/reference/json-rpc-methods/eth_gettransactionreceipt)
117+
RPC methods.
118+
114119
```javascript
115120
async function sendTransaction(recipientAddress, amount) {
116121
try {
@@ -209,6 +214,9 @@ async function handleSend() {
209214

210215
### Advanced transaction with gas estimation
211216

217+
To add gas estimation, use the [`eth_estimateGas`](/wallet/reference/json-rpc-methods/eth_estimategas)
218+
RPC method.
219+
212220
```javascript
213221
async function estimateGas(transaction) {
214222
try {
@@ -226,10 +234,6 @@ async function estimateGas(transaction) {
226234
}
227235
```
228236

229-
:::info
230-
See the [Provider API](/wallet/reference/provider-api) reference and [JSON-RPC API](/wallet/reference/json-rpc-methods) reference for more information.
231-
:::
232-
233237
## Best practices
234238

235239
Follow these best practices when handling transactions.

sdk/guides/interact-with-contracts.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function MintNFT() {
116116

117117
You can implement smart contract interactions directly in Vanilla JavaScript.
118118

119-
For example, read contract data:
119+
The following example reads contract data using the [`eth_call`](/wallet/reference/json-rpc-methods/eth_call) RPC method:
120120

121121
```javascript
122122
async function getBalance(contractAddress, userAddress) {
@@ -156,7 +156,10 @@ async function displayBalance() {
156156
}
157157
```
158158

159-
Write to contracts:
159+
The following example writes to contracts using the [`eth_requestAccounts`](/wallet/reference/json-rpc-methods/eth_requestaccounts),
160+
[`eth_sendTransaction`](/wallet/reference/json-rpc-methods/eth_sendtransaction), and
161+
[`eth_getTransactionReceipt`](/wallet/reference/json-rpc-methods/eth_gettransactionreceipt)
162+
RPC methods:
160163

161164
```javascript
162165
async function mintNFT(contractAddress, tokenId) {
@@ -246,10 +249,6 @@ async function handleMint() {
246249
</script>
247250
```
248251

249-
:::info
250-
See the [Provider API](/wallet/reference/provider-api) reference and [JSON-RPC API](/wallet/reference/json-rpc-methods) reference for more information.
251-
:::
252-
253252
## Best practices
254253

255254
Follow these best practices when interacting with smart contracts.

sdk/guides/manage-networks.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ function NetworkWatcher() {
9393

9494
You can implement network management directly in Vanilla JavaScript.
9595

96-
For example, detect the current network:
96+
The following example detects the current network using the
97+
[`eth_chainId`](/wallet/reference/json-rpc-methods/eth_chainid) RPC method and
98+
[`chainChanged`](/wallet/reference/provider-api/#chainchanged) provider event:
9799

98100
```javascript
99101
// Get current chain ID
@@ -117,7 +119,10 @@ ethereum.on("chainChanged", (chainId) => {
117119
});
118120
```
119121

120-
Switch networks:
122+
The following example switches networks using the
123+
[`wallet_switchEthereumChain`](/wallet/reference/json-rpc-methods/wallet_switchethereumchain)
124+
and [`wallet_addEthereumChain`](/wallet/reference/json-rpc-methods/wallet_addethereumchain)
125+
RPC methods:
121126

122127
```javascript
123128
// Network configurations
@@ -182,10 +187,6 @@ Display the current network and a switch network button in HTML:
182187
</div>
183188
```
184189

185-
:::info
186-
See the [Provider API](/wallet/reference/provider-api) reference and [JSON-RPC API](/wallet/reference/json-rpc-methods) reference for more information.
187-
:::
188-
189190
## Best practices
190191

191192
Follow these best practices when managing networks.

0 commit comments

Comments
 (0)