Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: SIWE React client/server example #638

Merged
merged 8 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dapps/appkit-siwe/react/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_PROJECT_ID=<your-project-id-from-cloud.walletconnect.com>
18 changes: 18 additions & 0 deletions dapps/appkit-siwe/react/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
30 changes: 30 additions & 0 deletions dapps/appkit-siwe/react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*


node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Environment
.env.local
.env.development.local
.env
25 changes: 25 additions & 0 deletions dapps/appkit-siwe/react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SIWE Quickstart with WalletConnect

A Minimal demo using React so developers can work on their integration with WalletConnect and SIWE using this repository as a template.

1. Install dependencies in the frontend: `pnpm install`

2. Create and complete the .env.local file with your Project Id from http://cloud.walletconnect.com

```
VITE_PROJECT_ID=...
```

3. Run the frontend: `pnpm run dev`

4. Create a new console and install dependencies in the server

```
cd server
pnpm install
```

5. Run the server: `pnpm start`

6. Open in your browser http://localhost:5173/
(the frontend address must be the same that you have in the server cors config)
13 changes: 13 additions & 0 deletions dapps/appkit-siwe/react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SIWE + WalletConnect (React)</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
34 changes: 34 additions & 0 deletions dapps/appkit-siwe/react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "appkit-siwe-react",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite --port 5174",
"build": "tsc -b && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-query": "^5.51.1",
"@wagmi/core": "^2.11.7",
"@web3modal/siwe": "^5.0.6",
"@web3modal/wagmi": "5.0.6",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "^2.17.3",
"wagmi": "^2.10.10"
},
"devDependencies": {
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"typescript": "^5.2.2",
"vite": "^5.3.3"
}
}
Loading
Loading