Skip to content

Commit aaa2cf6

Browse files
Adds MetaMask Smart Accounts template
* add metamask smart accounts starter * update READMEs * resolve review comments
1 parent 2fe9414 commit aaa2cf6

File tree

119 files changed

+1892
-524
lines changed

Some content is hidden

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

119 files changed

+1892
-524
lines changed

packages/create-gator-app/src/lib/choices/templates.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,25 @@ import { ITemplate } from "../types/template";
22

33
const NEXTJS_TEMPLATE_OPTIONS: ITemplate[] = [
44
{
5-
name: "Basic Delegator app with NextJS",
5+
name: "MetaMask Smart Accounts Starter",
66
value: "starter",
7-
description: "A basic Next.js template with App Router",
7+
description: "A basic Next.js MetaMask Smart Accounts starter",
88
framework: "nextjs",
99
isWeb3AuthSupported: true,
1010
areLLMRulesSupported: false,
1111
},
1212
{
13-
name: "Experimental: Basic Gator app to try out ERC7715 Permissions",
13+
name: "MetaMask Smart Accounts & Delegation Starter",
14+
value: "delegation-starter",
15+
description: "A basic Next.js MetaMask Smart Accounts & Delegation starter",
16+
framework: "nextjs",
17+
isWeb3AuthSupported: true,
18+
areLLMRulesSupported: false,
19+
},
20+
{
21+
name: "Experimental: ERC7715 Permissions starter",
1422
value: "erc7715-starter",
15-
description: "Experimental: A basic Gator app to try out ERC7715 Permissions",
23+
description: "A basic Next.js ERC7715 Permissions starter",
1624
framework: "nextjs",
1725
isWeb3AuthSupported: false,
1826
areLLMRulesSupported: true,
@@ -21,9 +29,17 @@ const NEXTJS_TEMPLATE_OPTIONS: ITemplate[] = [
2129

2230
const VITE_REACT_TEMPLATE_OPTIONS: ITemplate[] = [
2331
{
24-
name: "Basic Delegator app with Vite React",
32+
name: "MetaMask Smart Accounts Starter",
2533
value: "starter",
26-
description: "A basic Vite React template with App Router",
34+
description: "A basic Vite React MetaMask Smart Accounts starter",
35+
framework: "vite-react",
36+
isWeb3AuthSupported: true,
37+
areLLMRulesSupported: false,
38+
},
39+
{
40+
name: "MetaMask Smart Accounts & Delegation Starter",
41+
value: "delegation-starter",
42+
description: "A basic Vite React MetaMask Smart Accounts & Delegation starter",
2743
framework: "vite-react",
2844
isWeb3AuthSupported: true,
2945
areLLMRulesSupported: false,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_PIMLICO_API_KEY=pim_WDBELASDAFAo9guUAr7HNFaF
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts
42+
.npmrc
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# MetaMask Smart Accounts & Delegation starter template
2+
3+
This is a NextJS MetaMask Smart Accounts & Delegation starter template created with `@metamask/create-gator-app`.
4+
5+
This template is meant to help you bootstrap your own projects with Metamask Smart Acounts. It helps you build smart accounts with account abstraction, and powerful delegation features.
6+
7+
Learn more about [Metamask Smart Accounts](https://docs.metamask.io/delegation-toolkit/concepts/smart-accounts/).
8+
9+
## Prerequisites
10+
11+
1. **Pimlico API Key**: In this template, you’ll use Pimlico’s
12+
bundler and paymaster services to submit user operations and
13+
sponsor transactions. You can get your API key from [Pimlico’s dashboard](https://dashboard.pimlico.io/apikeys).
14+
15+
2. **Web3Auth Client ID**: During setup, if you used the
16+
`-add-web3auth` flag, you’ll need to create a new project on the
17+
Web3Auth Dashboard and get your Client ID. You can follow the [Web3Auth documentation](https://web3auth.io/docs/dashboard-setup#getting-started).
18+
19+
## Project structure
20+
21+
```bash
22+
template/
23+
├── public/ # Static assets
24+
├── src/
25+
│ ├── app/ # App router pages
26+
│ ├── components/ # UI Components
27+
│ ├── hooks/ # Custom React hooks
28+
│ ├── providers/ # Custom React Context Provider
29+
│ └── utils/ # Utils for the starter
30+
├── .env # Environment variables
31+
├── .gitignore # Git ignore rules
32+
├── next.config.ts # Next.js configuration
33+
└── tsconfig.json # TypeScript configuration
34+
```
35+
36+
## Setup environment variables
37+
38+
Update the following environment variables in the `.env` file at
39+
the root of your project.
40+
41+
```
42+
NEXT_PUBLIC_PIMLICO_API_KEY =
43+
44+
# Enter your Web3Auth Client ID if you
45+
# used the --add-web3auth flag.
46+
NEXT_PUBLIC_WEB3AUTH_CLIENT_ID =
47+
48+
# The Web3Auth network is configured based
49+
# on the network option you selected during setup.
50+
NEXT_PUBLIC_WEB3AUTH_NETWORK =
51+
```
52+
53+
## Getting started
54+
55+
First, start the development server using the package manager
56+
you chose during setup.
57+
58+
```bash
59+
npm run dev
60+
# or
61+
yarn dev
62+
# or
63+
pnpm dev
64+
```
65+
66+
Open [http://localhost:3000](http://localhost:3000) in your browser to view the app.
67+
68+
## Learn more
69+
70+
To learn more about MetaMask Smart Accounts, and delegations
71+
take a look at the following resources:
72+
73+
- [Quickstart](https://docs.metamask.io/delegation-toolkit/get-started/quickstart/) - Get started quickly with the MetaMask Smart Accounts
74+
- [Delegation quickstart](https://docs.metamask.io/delegation-toolkit/get-started/delegation-quickstart/) - Get started quickly with creating a MetaMask smart account and completing the delegation lifecycle (creating, signing, and redeeming a delegation).
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { dirname } from "path";
2+
import { fileURLToPath } from "url";
3+
import { FlatCompat } from "@eslint/eslintrc";
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
7+
8+
const compat = new FlatCompat({
9+
baseDirectory: __dirname,
10+
});
11+
12+
const eslintConfig = [
13+
...compat.extends("next/core-web-vitals", "next/typescript"),
14+
];
15+
16+
export default eslintConfig;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { NextConfig } from "next";
2+
3+
const nextConfig: NextConfig = {
4+
/* config options here */
5+
};
6+
7+
export default nextConfig;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "metamask-smart-accounts-delegation-starter",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "next dev",
7+
"build": "next build",
8+
"start": "next start",
9+
"lint": "next lint"
10+
},
11+
"dependencies": {
12+
"@metamask/delegation-toolkit": "^0.12.0",
13+
"@tanstack/react-query": "^5.76.1",
14+
"next": "15.2.1",
15+
"permissionless": "^0.2.46",
16+
"react": "^19.0.0",
17+
"react-dom": "^19.0.0",
18+
"viem": "^2.29.2",
19+
"wagmi": "^2.15.3"
20+
},
21+
"devDependencies": {
22+
"@eslint/eslintrc": "^3",
23+
"@tailwindcss/postcss": "^4.1.7",
24+
"@types/node": "^20",
25+
"@types/react": "^19",
26+
"@types/react-dom": "^19",
27+
"eslint": "^9",
28+
"eslint-config-next": "15.2.1",
29+
"postcss": "^8.5.3",
30+
"tailwindcss": "^4.1.7",
31+
"typescript": "^5"
32+
}
33+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
plugins: {
3+
'@tailwindcss/postcss': {},
4+
},
5+
};
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)