Skip to content

Commit dedb35d

Browse files
committed
fix(wallet-ui): walletconnect connection
1 parent 5585def commit dedb35d

File tree

27 files changed

+301
-199
lines changed

27 files changed

+301
-199
lines changed

apps/wallet-ui/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Root domain for the app
2-
NEXT_PUBLIC_ROOT_DOMAIN=ecosystem.localhost:3000
2+
NEXT_PUBLIC_ROOT_DOMAIN=localhost:3000
33
# Thirdweb client ID
44
NEXT_PUBLIC_THIRDWEB_CLIENT_ID=
55
# Thirdweb API key

apps/wallet-ui/.eslintrc.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
module.exports = {
2+
extends: [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended",
5+
"plugin:@next/next/recommended",
6+
],
7+
rules: {
8+
"react-compiler/react-compiler": "error",
9+
"no-restricted-syntax": [
10+
"error",
11+
{
12+
selector: "CallExpression[callee.name='useEffect']",
13+
message:
14+
'Are you *sure* you need to use "useEffect" here? If you loading any async function prefer using "useQuery".',
15+
},
16+
{
17+
selector: "CallExpression[callee.name='createContext']",
18+
message:
19+
'Are you *sure* you need to use a "Context"? In almost all cases you should prefer passing props directly.',
20+
},
21+
],
22+
"no-restricted-imports": [
23+
"error",
24+
{
25+
paths: [
26+
{
27+
name: "next/navigation",
28+
importNames: ["useRouter"],
29+
message:
30+
'Use `import { useRouter } from "@/lib/useRouter";` instead',
31+
},
32+
],
33+
},
34+
],
35+
},
36+
parser: "@typescript-eslint/parser",
37+
plugins: ["@typescript-eslint", "react-compiler"],
38+
parserOptions: {
39+
ecmaVersion: 2019,
40+
ecmaFeatures: {
41+
impliedStrict: true,
42+
jsx: true,
43+
},
44+
warnOnUnsupportedTypeScriptVersion: true,
45+
},
46+
settings: {
47+
react: {
48+
createClass: "createReactClass",
49+
pragma: "React",
50+
version: "detect",
51+
},
52+
},
53+
overrides: [
54+
// enable rule specifically for TypeScript files
55+
{
56+
files: ["*.ts", "*.tsx"],
57+
rules: {
58+
"@typescript-eslint/explicit-module-boundary-types": ["off"],
59+
},
60+
},
61+
// THIS NEEDS TO GO LAST!
62+
{
63+
files: ["*.ts", "*.js", "*.tsx", "*.jsx"],
64+
extends: ["biome"],
65+
},
66+
],
67+
env: {
68+
browser: true,
69+
node: true,
70+
},
71+
};

apps/wallet-ui/biome.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
3+
"extends": ["../../biome.json"],
4+
"overrides": [
5+
{
6+
"include": ["src/css/swagger-ui.css"],
7+
"linter": {
8+
"rules": {
9+
"suspicious": {
10+
"noImportantInKeyframe": "off"
11+
}
12+
}
13+
}
14+
}
15+
]
16+
}

apps/wallet-ui/knip.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "https://unpkg.com/knip@latest/schema.json",
3+
"next": true,
4+
"ignore": ["src/components/ui/**"],
5+
"ignoreBinaries": ["biome"],
6+
"ignoreDependencies": ["thirdweb"],
7+
"project": ["src/**"]
8+
}

apps/wallet-ui/package.json

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,46 @@
66
"dev": "next dev --turbopack",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "biome check ./src",
10-
"fix": "biome check ./src --fix"
9+
"lint": "biome check ./src && knip && eslint ./src",
10+
"fix": "biome check ./src --fix && knip --fix --allow-remove-files && eslint ./src --fix"
1111
},
1212
"dependencies": {
13-
"@hookform/resolvers": "^3.9.1",
13+
"@hookform/resolvers": "3.9.1",
1414
"@noble/curves": "1.6.0",
1515
"@radix-ui/react-dialog": "1.1.2",
16-
"@radix-ui/react-label": "^2.1.0",
17-
"@radix-ui/react-popover": "^1.1.2",
18-
"@radix-ui/react-slot": "^1.1.0",
19-
"@radix-ui/react-toast": "^1.2.2",
16+
"@radix-ui/react-label": "2.1.0",
17+
"@radix-ui/react-popover": "1.1.2",
18+
"@radix-ui/react-slot": "1.1.0",
2019
"@tanstack/react-query": "5.59.20",
21-
"class-variance-authority": "^0.7.0",
22-
"clsx": "^2.1.1",
23-
"cmdk": "^1.0.4",
20+
"class-variance-authority": "0.7.0",
21+
"clsx": "2.1.1",
22+
"cmdk": "1.0.4",
2423
"lucide-react": "0.454.0",
2524
"next": "15.0.3",
26-
"next-themes": "^0.4.3",
25+
"next-themes": "0.4.3",
2726
"react": "19.0.0-rc-69d4b800-20241021",
2827
"react-dom": "19.0.0-rc-69d4b800-20241021",
2928
"react-hook-form": "7.52.0",
30-
"sonner": "^1.7.0",
31-
"tailwind-merge": "^2.5.4",
32-
"tailwindcss-animate": "^1.0.7",
33-
"thirdweb": "workspace:*",
34-
"tiny-invariant": "^1.3.3",
35-
"zod": "3.23.8"
29+
"server-only": "0.0.1",
30+
"sonner": "1.7.0",
31+
"tailwind-merge": "2.5.4",
32+
"tailwindcss-animate": "1.0.7",
33+
"tiny-invariant": "1.3.3",
34+
"zod": "3.23.8",
35+
"thirdweb": "workspace:*"
3636
},
3737
"devDependencies": {
38+
"@next/eslint-plugin-next": "15.0.3",
3839
"@types/node": "20.14.9",
3940
"@types/react": "npm:[email protected]",
4041
"@types/react-dom": "npm:[email protected]",
42+
"@typescript-eslint/eslint-plugin": "7.14.1",
43+
"@typescript-eslint/parser": "7.14.1",
44+
"autoprefixer": "10.4.19",
4145
"eslint": "8.57.0",
42-
"eslint-config-next": "15.0.3",
46+
"eslint-config-biome": "1.9.3",
47+
"eslint-plugin-react-compiler": "19.0.0-beta-8a03594-20241020",
48+
"knip": "5.36.3",
4349
"postcss": "8.4.47",
4450
"tailwindcss": "3.4.14",
4551
"typescript": "5.6.3"

apps/wallet-ui/postcss.config.mjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
/** @type {import('postcss-load-config').Config} */
2-
const config = {
1+
module.exports = {
32
plugins: {
43
tailwindcss: {},
4+
autoprefixer: {},
55
},
66
};
7-
8-
export default config;

apps/wallet-ui/src/app/[ecosystem]/(authed)/layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import ConnectButton from "@/components/ConnectButton";
2+
import { Image } from "@/components/ui/image";
23
import { authedOnly } from "@/lib/auth";
34
import { getEcosystemInfo } from "@/lib/ecosystems";
45
import { resolveScheme } from "thirdweb/storage";
@@ -12,14 +13,14 @@ export default async function Layout(props: {
1213

1314
const { children } = props;
1415

15-
await authedOnly();
16+
await authedOnly(params.ecosystem);
1617
const ecosystem = await getEcosystemInfo(params.ecosystem);
1718
return (
1819
<div className="flex w-full flex-col items-stretch">
1920
<header className="hidden w-full border-accent border-b bg-card py-4 sm:block">
2021
<div className="container mx-auto flex justify-between">
2122
<div className="flex items-center gap-2">
22-
<img
23+
<Image
2324
className="h-8 w-8"
2425
src={resolveScheme({ uri: ecosystem.imageUrl, client })}
2526
alt={ecosystem.name}

apps/wallet-ui/src/app/[ecosystem]/(authed)/wallet/[address]/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ export default async function Page(props: {
66
params: Promise<{ address: string }>;
77
searchParams: Promise<{ chainId?: string; uri?: string }>;
88
}) {
9-
const searchParams = await props.searchParams;
9+
const [searchParams, params] = await Promise.all([
10+
props.searchParams,
11+
props.params,
12+
]);
1013

1114
const { chainId, uri } = searchParams;
12-
13-
const params = await props.params;
14-
1515
const { address } = params;
1616

1717
return (

apps/wallet-ui/src/app/[ecosystem]/login/layout.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import { redirect } from "next/navigation";
2-
import { getCurrentUser } from "../../../lib/auth";
1+
import { getCurrentUser } from "@/lib/auth";
2+
import { redirect } from "@/lib/redirect";
33

44
export default async function Layout({
55
children,
6-
}: { children: React.ReactNode }) {
6+
params,
7+
}: { children: React.ReactNode; params: Promise<{ ecosystem: string }> }) {
8+
const { ecosystem } = await params;
9+
710
const userAddress = await getCurrentUser();
811
if (userAddress) {
9-
redirect(`/wallet/${userAddress}`);
12+
redirect(`/wallet/${userAddress}`, ecosystem);
1013
}
1114

1215
return (
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { getCurrentUser } from "@/lib/auth";
2-
import { redirect } from "next/navigation";
2+
import { redirect } from "@/lib/redirect";
33

4-
export default async function Page() {
4+
export default async function Page({
5+
params,
6+
}: { params: Promise<{ ecosystem: string }> }) {
7+
const { ecosystem } = await params;
58
const user = await getCurrentUser();
69
if (user) {
7-
redirect("/wallet/${user}");
10+
redirect(`/wallet/${user}`, ecosystem);
811
}
9-
redirect("/login");
12+
redirect("/login", ecosystem);
1013
}

0 commit comments

Comments
 (0)