Skip to content

Commit ca59def

Browse files
committed
Update tutorials
1 parent 4f05de7 commit ca59def

File tree

60 files changed

+88
-937
lines changed

Some content is hidden

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

60 files changed

+88
-937
lines changed

embedded-wallets/infrastructure/nodes-and-dkg.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The architecture consists of four parts:‌
1313
- A private BFT network between nodes
1414
- A front-end client/SDK that interacts with nodes
1515

16-
![Architecture](/guides/graph-6-final.png)
16+
![Architecture](/img/guides/graph-6-final.png)
1717

1818
A smart contract is used for node discovery. Nodes are selected, operate for a fixed period, and generate a set of keys via DKG.‌
1919

@@ -67,7 +67,7 @@ The keys are assigned to a combination of `verifier` \(e.g., Google, Reddit, Dis
6767

6868
The fundamental flow for Torus sign-in is as follows:
6969

70-
![Standard login with OAuth2 (Google, Facebook, Apple, Reddit, Discord, Twitch)](/guides/login-key-assignments.png)
70+
![Standard login with OAuth2 (Google, Facebook, Apple, Reddit, Discord, Twitch)](/img/guides/login-key-assignments.png)
7171

7272
1. Your application gets the user to sign-in via their preferred method \(OAuth / email password / passwordless / verification code\).
7373
2. After the user gives consent/verifies his/her email, Torus SDK will receive an ID token and assign a key to the user depending on User Verifier ID from ID Token.

embedded-wallets/sdk/_common/_whitelabel_showcase.mdx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import Image4 from "@site/static/guides/whitelabel-web3auth-openlogin-dark.png";
2-
import Image7 from "@site/static/guides/whitelabel-web3auth-openlogin-language.png";
3-
import Image3 from "@site/static/guides/whitelabel-web3auth-openlogin-light.png";
4-
import Image9 from "@site/static/guides/whitelabel-web3auth-openlogin-logo-dark.png";
5-
import Image8 from "@site/static/guides/whitelabel-web3auth-openlogin-logo-light.png";
6-
import DashboardImage from "@site/static/guides/whitelabel-web3auth-openlogin-theme1.png";
7-
import Image6 from "@site/static/guides/whitelabel-web3auth-openlogin-theme2.png";
1+
import Image4 from '@site/static/img/guides/whitelabel-web3auth-openlogin-dark.png'
2+
import Image7 from '@site/static/img/guides/whitelabel-web3auth-openlogin-language.png'
3+
import Image3 from '@site/static/img/guides/whitelabel-web3auth-openlogin-light.png'
4+
import Image9 from '@site/static/img/guides/whitelabel-web3auth-openlogin-logo-dark.png'
5+
import Image8 from '@site/static/img/guides/whitelabel-web3auth-openlogin-logo-light.png'
6+
import DashboardImage from '@site/static/img/guides/whitelabel-web3auth-openlogin-theme1.png'
7+
import Image6 from '@site/static/img/guides/whitelabel-web3auth-openlogin-theme2.png'
88

99
### `name`
1010

@@ -16,7 +16,7 @@ The name of the application. This will be displayed in the key reconstruction pa
1616
Standard screen <strong>without</strong> any change
1717
</h4>
1818
<img
19-
style={{ display: "block", maxHeight: "500px", alignSelf: "center" }}
19+
style={{ display: 'block', maxHeight: '500px', alignSelf: 'center' }}
2020
src={DashboardImage}
2121
alt="Standard screen without any change"
2222
/>
@@ -26,7 +26,7 @@ The name of the application. This will be displayed in the key reconstruction pa
2626
Name changed to <code>Formidable Duo</code>
2727
</h4>
2828
<img
29-
style={{ display: "block", maxHeight: "500px", alignSelf: "center" }}
29+
style={{ display: 'block', maxHeight: '500px', alignSelf: 'center' }}
3030
src={Image6}
3131
alt="Name changed to Formidable Duo"
3232
/>
@@ -45,7 +45,7 @@ in the key reconstruction page.
4545
<code>logoLight</code> on dark mode
4646
</h4>
4747
<img
48-
style={{ display: "block", maxHeight: "500px", alignSelf: "center" }}
48+
style={{ display: 'block', maxHeight: '500px', alignSelf: 'center' }}
4949
src={Image8}
5050
alt="logoLight on dark mode"
5151
/>
@@ -55,7 +55,7 @@ in the key reconstruction page.
5555
<code>logoDark</code> on light mode
5656
</h4>
5757
<img
58-
style={{ display: "block", maxHeight: "500px", alignSelf: "center" }}
58+
style={{ display: 'block', maxHeight: '500px', alignSelf: 'center' }}
5959
src={Image9}
6060
alt="logoDark on light mode"
6161
/>
@@ -68,7 +68,7 @@ in the key reconstruction page.
6868
Default language will set the language used on all OpenLogin screens. The supported languages are:
6969

7070
<div className="text-image-column">
71-
<div style={{ flexGrow: "1", minWidth: "200px" }}>
71+
<div style={{ flexGrow: '1', minWidth: '200px' }}>
7272
<ul>
7373
<li>
7474
<code>en</code> - English (default)
@@ -103,7 +103,7 @@ Default language will set the language used on all OpenLogin screens. The suppor
103103
</ul>
104104
</div>
105105
<div>
106-
<img style={{ width: "100%", maxWidth: "500px" }} src={Image7} alt="default Language screen" />
106+
<img style={{ width: '100%', maxWidth: '500px' }} src={Image7} alt="default Language screen" />
107107
</div>
108108
</div>
109109
<br />
@@ -120,7 +120,7 @@ Can be set to `true` or `false` with default set to `false`.
120120
For Light: <code>dark: false</code>
121121
</h4>
122122
<img
123-
style={{ display: "block", maxHeight: "500px", alignSelf: "center" }}
123+
style={{ display: 'block', maxHeight: '500px', alignSelf: 'center' }}
124124
src={Image3}
125125
alt="light theme"
126126
/>
@@ -130,7 +130,7 @@ Can be set to `true` or `false` with default set to `false`.
130130
For Dark: <code>dark: true</code>
131131
</h4>
132132
<img
133-
style={{ display: "block", maxHeight: "500px", alignSelf: "center" }}
133+
style={{ display: 'block', maxHeight: '500px', alignSelf: 'center' }}
134134
src={Image4}
135135
alt="dark theme"
136136
/>
@@ -151,7 +151,7 @@ Examples below.
151151
Standard color <code>#0364FF</code>
152152
</h4>
153153
<img
154-
style={{ display: "block", maxHeight: "500px", alignSelf: "center" }}
154+
style={{ display: 'block', maxHeight: '500px', alignSelf: 'center' }}
155155
src={DashboardImage}
156156
alt="Theme is a record of colors that can be configured."
157157
/>
@@ -161,7 +161,7 @@ Examples below.
161161
Color changed to <code>#D72F7A</code>
162162
</h4>
163163
<img
164-
style={{ display: "block", maxHeight: "500px", alignSelf: "center" }}
164+
style={{ display: 'block', maxHeight: '500px', alignSelf: 'center' }}
165165
src={Image6}
166166
alt="Theme affects icons and links."
167167
/>

sdk-sidebar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ const sidebar = {
3737
],
3838
},
3939
{
40-
type:'category',
40+
type: 'category',
4141
label: 'Tutorials',
4242
collapsible: false,
4343
collapsed: false,
4444
items: [
45-
'tutorials/create-wallet-ai-agent',
46-
'tutorials/upgrade-eoa-to-smart-account',
45+
{ type: "link", label: "Create a Wallet AI Agent", href: "/tutorials/create-wallet-ai-agent" },
46+
{ type: "link", label: "Upgrade an EOA to a Smart Account", href: "/tutorials/upgrade-eoa-to-smart-account" },
4747
],
4848
},
4949
{

src/components/Badge/badge.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
--badge-error-bg-color: rgba(215, 56, 71, 0.1);
99
}
1010

11-
:root[data-theme="dark"] {
11+
:root[data-theme='dark'] {
1212
--badge-default-color: #bbc0c5;
1313
--badge-default-bg-color: #24272a;
1414
--badge-default-border-color: #bbc0c5;
@@ -30,7 +30,7 @@
3030
padding: 2px 8px;
3131
color: var(--badge-default-color);
3232
background-color: var(--badge-default-bg-color);
33-
text-transform: capitalize;
33+
text-transform: none;
3434

3535
&.success {
3636
color: var(--badge-success-color);

src/components/GuidesPage/GuideCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default function GuideCard({
100100
{tags.map(tag => (
101101
<Badge
102102
key={tag}
103-
label={tag}
103+
label={tag.toLowerCase()}
104104
variant={activeTags.includes(tag) ? 'success' : 'default'}
105105
/>
106106
))}

src/components/SubNavBar/configs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const EMBEDDED_WALLETS_SUBNAV_CONFIG: SubNavBarConfig = {
1111
},
1212
{
1313
key: 'sdk',
14-
label: 'SDK',
14+
label: 'SDKs',
1515
path: '/embedded-wallets/sdk/',
1616
},
1717
{

src/pages/tutorials/android-wallet.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Empower your Android app with a Ethereum Web3 wallet using the Web3
55
type: guide
66
tags: [embedded wallets, android, evm, kotlin, secp256k1, web3auth]
77
date: May 27, 2024
8-
author: Web3Auth Team
8+
author: MetaMask Developer Relations
99
---
1010

1111
import SEO from '@site/src/components/SEO'

sdk/tutorials/create-wallet-ai-agent.md renamed to src/pages/tutorials/create-wallet-ai-agent.md

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
2+
title: Create an AI agent using MetaMask SDK
3+
image: 'img/guides/guides-banners/mm-sdk-ai-agent.png'
24
description: Create a wallet AI agent using MetaMask SDK and Vercel's AI SDK.
3-
keywords: [SDK, wallet, AI, agent, Vercel, Wagmi, Next.js, OpenAI, dapp]
5+
type: guide
6+
tags: [metamask sdk, wallet, AI, agent, Vercel, Wagmi, Next.js, OpenAI]
7+
date: May 2, 2025
48
---
59

610
import Tabs from "@theme/Tabs";
711
import TabItem from "@theme/TabItem";
812

9-
# Create a wallet AI agent
10-
1113
This tutorial walks you through creating an AI agent dapp that can display your wallet balance and initiate transactions from your wallet, on the Linea Sepolia network.
1214
You will use a provided template, which sets up MetaMask SDK and [Vercel's AI SDK](https://sdk.vercel.ai/) with a [Next.js](https://nextjs.org/docs) and [Wagmi](https://wagmi.sh/) dapp.
1315

@@ -24,36 +26,36 @@ You will use a provided template, which sets up MetaMask SDK and [Vercel's AI SD
2426

2527
### 1. Set up the project
2628

27-
1. Clone the [`Consensys/wallet-agent`](https://github.com/Consensys/wallet-agent/tree/main) repository:
29+
1. Clone the [`Consensys/wallet-agent`](https://github.com/Consensys/wallet-agent/tree/main) repository:
2830

2931
```bash
3032
git clone [email protected]:Consensys/wallet-agent.git
3133
```
3234

33-
2. Switch to the `initial-setup` branch:
35+
2. Switch to the `initial-setup` branch:
3436

3537
```bash
3638
cd wallet-agent && git switch initial-setup
3739
```
3840

39-
3. Install dependencies:
41+
3. Install dependencies:
4042

4143
```bash
4244
npm install
4345
```
4446

45-
4. Create a `.env.local` file:
47+
4. Create a `.env.local` file:
4648

4749
```bash
4850
touch .env.local
4951
```
5052

51-
5. In `.env.local`, add an `OPENAI_API_KEY` environment variable, replacing `<YOUR-API-KEY>` with your [OpenAI](https://platform.openai.com/docs/overview) API key.
52-
Vercel's AI SDK will use this environment variable to authenticate your dapp with the OpenAI service.
53+
5. In `.env.local`, add an `OPENAI_API_KEY` environment variable, replacing `<YOUR-API-KEY>` with your [OpenAI](https://platform.openai.com/docs/overview) API key.
54+
Vercel's AI SDK will use this environment variable to authenticate your dapp with the OpenAI service.
5355
54-
```text title=".env.local"
55-
OPENAI_API_KEY=<YOUR-API-KEY>
56-
```
56+
```text title=".env.local"
57+
OPENAI_API_KEY=<YOUR-API-KEY>
58+
```
5759
5860
### 2. Create the dapp interface
5961
@@ -78,7 +80,7 @@ import Image from "next/image";
7880
+ const { connect } = useConnect();
7981
+ const { address, isConnected } = useAccount();
8082
+ const { disconnect } = useDisconnect();
81-
+
83+
+
8284
+ return (
8385
+ <div className="mx-auto">
8486
+ {isConnected ? (
@@ -117,7 +119,7 @@ When connected, the AI agent chat interface displays with your connected wallet
117119
You can test the AI functionality by sending messages in the chat:
118120
119121
<p align="center">
120-
<img src={require("../_assets/sdk-ai-agent.png").default} alt="SDK AI agent initial setup" class="appScreen" />
122+
<img src={require("@site/static/img/guides/sdk-ai-agent.png").default} alt="SDK AI agent initial setup" class="appScreen" />
121123
</p>
122124
123125
### 3. Create a Public Client
@@ -153,7 +155,7 @@ Use the [`getBalance`](https://viem.sh/docs/actions/public/getBalance) method of
153155
154156
```ts title="tools.ts"
155157
// add-start
156-
+ import { publicClient } from "@/wagmi.config";
158+
+ import { publicClient } from "@/wagmi.config";
157159
+ import { formatEther } from "viem";
158160
// add-end
159161
import { tool as createTool } from "ai";
@@ -196,7 +198,7 @@ export const tools = {
196198
In the development server, test that this tool works to get your current Linea Sepolia ETH balance:
197199
198200
<p align="center">
199-
<img src={require("../_assets/sdk-ai-agent-get-balance.png").default} alt="SDK AI agent get balance" class="appScreen" />
201+
<img src={require("@site/static/img/guides/sdk-ai-agent-get-balance.png").default} alt="SDK AI agent get balance" class="appScreen" />
200202
</p>
201203
202204
### 5. Create a tool to send transactions
@@ -243,18 +245,15 @@ export const tools = {
243245
244246
```tsx
245247
// ...
246-
if (toolName === "sendTransaction") {
247-
const {
248-
result,
249-
}: { result: { to: string; amount: string } } =
250-
toolInvocation;
248+
if (toolName === 'sendTransaction') {
249+
const { result }: { result: { to: string; amount: string } } = toolInvocation
251250
252251
if (isLoading) {
253252
return (
254253
<div key={toolCallId}>
255254
<p>Loading...</p>
256255
</div>
257-
);
256+
)
258257
}
259258
260259
return (
@@ -266,17 +265,12 @@ if (toolName === "sendTransaction") {
266265
to: result.to as `0x${string}`,
267266
value: parseEther(result.amount),
268267
})
269-
}
270-
>
268+
}>
271269
Send Transaction
272270
</Button>
273-
<p>
274-
{hash
275-
? `Transaction sent: ${hash}`
276-
: "Transaction not sent"}
277-
</p>
271+
<p>{hash ? `Transaction sent: ${hash}` : 'Transaction not sent'}</p>
278272
</div>
279-
);
273+
)
280274
}
281275
// ...
282276
```
@@ -289,13 +283,13 @@ In the development server, test that this tool works to send Linea Sepolia ETH f
289283
When you request the agent to send a transaction, it will provide a button for you to send the transaction, but it will not send it for you:
290284
291285
<p align="center">
292-
<img src={require("../_assets/sdk-ai-agent-txn-not-sent.png").default} alt="NFT confirmation" class="appScreen" />
286+
<img src={require("@site/static/img/guides/sdk-ai-agent-txn-not-sent.png").default} alt="NFT confirmation" class="appScreen" />
293287
</p>
294288
295289
When you select the button and confirm the transaction in MetaMask, the transaction will be sent:
296290
297291
<p align="center">
298-
<img src={require("../_assets/sdk-ai-agent-txn-sent.png").default} alt="Multiple NFTs confirmation" class="appScreen" />
292+
<img src={require("@site/static/img/guides/sdk-ai-agent-txn-sent.png").default} alt="Multiple NFTs confirmation" class="appScreen" />
299293
</p>
300294
301295
You can check the status of the transaction in the [Linea Sepolia block explorer](https://sepolia.lineascan.build/).
@@ -307,4 +301,4 @@ You can configure the AI agent to directly send the transaction using a [Viem Wa
307301
## Resources
308302
309303
- View the main branch of the [`Consensys/wallet-agent`](https://github.com/Consensys/wallet-agent) template for the completed implementation of this tutorial.
310-
- Watch the [live coding session](https://www.youtube.com/watch?v=ZVuOaKuAhBQ) on YouTube, in which the MetaMask DevRel team walks through creating a wallet AI agent from the initial template.
304+
- Watch the [live coding session](https://www.youtube.com/watch?v=ZVuOaKuAhBQ) on YouTube, in which the MetaMask DevRel team walks through creating a wallet AI agent from the initial template.

src/pages/tutorials/erc20-paymaster.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to use ERC-20 paymaster with Web3Auth Native Account Abst
55
type: guide
66
tags: [embedded wallets, account abstraction, web, paymaster, erc4337, web3auth]
77
date: October 29, 2024
8-
author: Web3Auth Team
8+
author: MetaMask Developer Relations
99
---
1010

1111
import SEO from '@site/src/components/SEO'

src/pages/tutorials/flutter-wallet.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Empower your Flutter app with a Chain Agnostic Web3 wallet using th
55
type: guide
66
tags: [embedded wallets, flutter, andriod, ios, evm, solana, web3auth]
77
date: April 22, 2024
8-
author: Web3Auth Team
8+
author: MetaMask Developer Relations
99
---
1010

1111
import SEO from '@site/src/components/SEO'

0 commit comments

Comments
 (0)