create-polygon-kit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Sanket Saagar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # create-polygon-kit
2
+
3
+ CLI tool to quickly scaffold PolygonKit projects with your choice of framework.
4
+
5
+ ## Usage
6
+
7
+ Create a new PolygonKit project interactively:
8
+
9
+ ```bash
10
+ npx create-polygon-kit my-app
11
+ ```
12
+
13
+ Or specify the project name when prompted:
14
+
15
+ ```bash
16
+ npx create-polygon-kit
17
+ ```
18
+
19
+ ## Features
20
+
21
+ - **Interactive CLI** - Guided setup with prompts for framework and options
22
+ - **Multiple Frameworks** - Choose between Next.js and Vite
23
+ - **TypeScript Support** - Option for TypeScript or JavaScript
24
+ - **Pre-configured** - PolygonKit, Wagmi, Viem, and TailwindCSS already set up
25
+ - **Automatic Installation** - Optional automatic dependency installation
26
+
27
+ ## Frameworks Supported
28
+
29
+ - **Next.js** - React framework with App Router and SSR
30
+ - **Vite** - Fast build tool with Hot Module Replacement
31
+
32
+ ## What's Included
33
+
34
+ Each generated project includes:
35
+
36
+ - ✅ PolygonKit components and hooks
37
+ - ✅ Wallet connection with WalletConnect
38
+ - ✅ Pre-built dashboard with Identity component
39
+ - ✅ TailwindCSS v4 for styling
40
+ - ✅ TypeScript configuration
41
+ - ✅ ESLint and development tools
42
+
43
+ ## Example
44
+
45
+ ```bash
46
+ # Create a new project
47
+ npx create-polygon-kit my-polygon-app
48
+
49
+ # Answer the prompts:
50
+ # ? Which framework would you like to use? › Next.js
51
+ # ? Would you like to use TypeScript? › Yes
52
+ # ? Install dependencies now? › Yes
53
+
54
+ # Start developing
55
+ cd my-polygon-app
56
+ npm run dev
57
+ ```
58
+
59
+ ## Requirements
60
+
61
+ - Node.js 18.0.0 or higher
62
+ - npm, yarn, or pnpm
63
+
64
+ ## Documentation
65
+
66
+ - [PolygonKit Documentation](https://docs.polygonkit.com) - Complete guides and API reference
67
+ - [GitHub Repository](https://github.com/sanketsaagar/polygonKit) - PolygonKit source code
68
+
69
+ ## License
70
+
71
+ MIT
72
+
73
+ ## Contributing
74
+
75
+ Contributions are welcome! Please open an issue or submit a pull request.
76
+
77
+ ---
78
+
79
+ Built with ❤️ for the Polygon ecosystem
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'fs-extra';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ import prompts from 'prompts';
6
+ import chalk from 'chalk';
7
+ import ora from 'ora';
8
+ import { execSync } from 'child_process';
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = path.dirname(__filename);
11
+ async function main() {
12
+ // Display ASCII art banner
13
+ console.log(chalk.bold.magenta(`
14
+ ╔═══════════════════════════════════════════════════════════════════════════════════════╗
15
+ ║ ║
16
+ ║ ██████╗ ██████╗ ██╗ ██╗ ██╗ ██████╗ ██████╗ ███╗ ██╗ ██╗ ██╗██╗████████╗ ║
17
+ ║ ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔════╝ ██╔═══██╗████╗ ██║ ██║ ██╔╝██║╚══██╔══╝ ║
18
+ ║ ██████╔╝██║ ██║██║ ╚████╔╝ ██║ ███╗██║ ██║██╔██╗██║ █████╔╝ ██║ ██║ ║
19
+ ║ ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██║ ██║██║ ██║██║╚████║ ██╔═██╗ ██║ ██║ ║
20
+ ║ ██║ ╚██████╔╝███████╗██║ ╚██████╔╝╚██████╔╝██║ ╚███║ ██║ ██╗██║ ██║ ║
21
+ ║ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ║
22
+ ║ ║
23
+ ╚═══════════════════════════════════════════════════════════════════════════════════════╝
24
+ `));
25
+ console.log(chalk.bold.cyan(' 🚀 Create your next Polygon app in seconds!\n'));
26
+ // Get project name from command line args or prompt
27
+ let projectName = process.argv[2];
28
+ if (!projectName) {
29
+ const response = await prompts({
30
+ type: 'text',
31
+ name: 'projectName',
32
+ message: 'What is your project named?',
33
+ initial: 'my-polygon-app',
34
+ validate: (value) => value.length > 0 ? true : 'Project name is required',
35
+ });
36
+ if (!response.projectName) {
37
+ console.log(chalk.red('\n❌ Project creation cancelled'));
38
+ process.exit(1);
39
+ }
40
+ projectName = response.projectName;
41
+ }
42
+ // Check if directory already exists
43
+ const targetDir = path.resolve(process.cwd(), projectName);
44
+ if (fs.existsSync(targetDir)) {
45
+ console.log(chalk.red(`\n❌ Directory ${projectName} already exists!`));
46
+ process.exit(1);
47
+ }
48
+ // Prompt for framework and options
49
+ const options = await prompts([
50
+ {
51
+ type: 'select',
52
+ name: 'framework',
53
+ message: 'Which framework would you like to use?',
54
+ choices: [
55
+ { title: 'Next.js', value: 'nextjs', description: 'React framework with SSR' },
56
+ { title: 'Vite', value: 'vite', description: 'Fast build tool with HMR' },
57
+ ],
58
+ initial: 0,
59
+ },
60
+ {
61
+ type: 'confirm',
62
+ name: 'typescript',
63
+ message: 'Would you like to use TypeScript?',
64
+ initial: true,
65
+ },
66
+ {
67
+ type: 'confirm',
68
+ name: 'installDeps',
69
+ message: 'Install dependencies now?',
70
+ initial: true,
71
+ },
72
+ ]);
73
+ if (!options.framework) {
74
+ console.log(chalk.red('\n❌ Project creation cancelled'));
75
+ process.exit(1);
76
+ }
77
+ const projectOptions = {
78
+ projectName,
79
+ ...options,
80
+ };
81
+ // Create project
82
+ await createProject(projectOptions);
83
+ }
84
+ async function createProject(options) {
85
+ const { projectName, framework, typescript, installDeps } = options;
86
+ const spinner = ora('Creating project...').start();
87
+ try {
88
+ const targetDir = path.resolve(process.cwd(), projectName);
89
+ const templateDir = path.resolve(__dirname, '..', 'templates', framework, typescript ? 'typescript' : 'javascript');
90
+ // Check if template exists
91
+ if (!fs.existsSync(templateDir)) {
92
+ spinner.fail('Template not found');
93
+ console.log(chalk.red(`\n❌ Template for ${framework} not found`));
94
+ process.exit(1);
95
+ }
96
+ // Copy template
97
+ await fs.copy(templateDir, targetDir);
98
+ // Update package.json with project name
99
+ const packageJsonPath = path.join(targetDir, 'package.json');
100
+ const packageJson = await fs.readJSON(packageJsonPath);
101
+ packageJson.name = projectName;
102
+ await fs.writeJSON(packageJsonPath, packageJson, { spaces: 2 });
103
+ spinner.succeed(chalk.green('Project created successfully!'));
104
+ // Install dependencies
105
+ if (installDeps) {
106
+ const installSpinner = ora('Installing dependencies...').start();
107
+ try {
108
+ process.chdir(targetDir);
109
+ execSync('npm install', { stdio: 'ignore' });
110
+ installSpinner.succeed(chalk.green('Dependencies installed!'));
111
+ }
112
+ catch (error) {
113
+ installSpinner.fail('Failed to install dependencies');
114
+ console.log(chalk.yellow('\n⚠️ You can install them manually by running:'));
115
+ console.log(chalk.cyan(` cd ${projectName}`));
116
+ console.log(chalk.cyan(' npm install'));
117
+ }
118
+ }
119
+ // Show success message
120
+ console.log(chalk.bold.green('\n✨ Your PolygonKit project is ready!\n'));
121
+ console.log('Next steps:');
122
+ console.log(chalk.cyan(` cd ${projectName}`));
123
+ if (!installDeps) {
124
+ console.log(chalk.cyan(' npm install'));
125
+ }
126
+ console.log(chalk.cyan(' npm run dev'));
127
+ console.log(chalk.dim('\n📚 Documentation: https://docs.polygonkit.com'));
128
+ console.log(chalk.dim('🐛 Issues: https://github.com/sanketsaagar/polygonKit/issues\n'));
129
+ }
130
+ catch (error) {
131
+ spinner.fail('Failed to create project');
132
+ console.error(chalk.red('\n❌ Error:'), error);
133
+ process.exit(1);
134
+ }
135
+ }
136
+ main().catch((error) => {
137
+ console.error(chalk.red('An error occurred:'), error);
138
+ process.exit(1);
139
+ });
140
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,O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AAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,CAAC;IACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "create-polygon-kit",
3
+ "version": "0.1.0",
4
+ "description": "CLI tool to create PolygonKit projects",
5
+ "type": "module",
6
+ "bin": {
7
+ "create-polygon-kit": "./dist/index.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "templates"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsc",
15
+ "dev": "tsc --watch",
16
+ "prepublishOnly": "npm run build"
17
+ },
18
+ "keywords": [
19
+ "polygon",
20
+ "polygonkit",
21
+ "web3",
22
+ "blockchain",
23
+ "cli",
24
+ "create",
25
+ "scaffold"
26
+ ],
27
+ "author": "Sanket Saagar",
28
+ "license": "MIT",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/sanketsaagar/create-polygon-kit.git"
32
+ },
33
+ "dependencies": {
34
+ "prompts": "^2.4.2",
35
+ "chalk": "^5.3.0",
36
+ "ora": "^8.0.1",
37
+ "fs-extra": "^11.2.0"
38
+ },
39
+ "devDependencies": {
40
+ "@types/node": "^20.10.0",
41
+ "@types/prompts": "^2.4.9",
42
+ "@types/fs-extra": "^11.0.4",
43
+ "typescript": "^5.3.3"
44
+ },
45
+ "engines": {
46
+ "node": ">=18.0.0"
47
+ }
48
+ }
@@ -0,0 +1,36 @@
1
+ # PolygonKit Next.js App
2
+
3
+ This project was created with [create-polygon-kit](https://github.com/sanketsaagar/create-polygon-kit).
4
+
5
+ ## Getting Started
6
+
7
+ First, run the development server:
8
+
9
+ ```bash
10
+ npm run dev
11
+ ```
12
+
13
+ Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
14
+
15
+ You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
16
+
17
+ ## Learn More
18
+
19
+ To learn more about PolygonKit and Next.js, check out the following resources:
20
+
21
+ - [PolygonKit Documentation](https://docs.polygonkit.com) - learn about PolygonKit features and API
22
+ - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API
23
+ - [GitHub Repository](https://github.com/sanketsaagar/polygonKit) - source code and issues
24
+
25
+ ## Deploy on Vercel
26
+
27
+ The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new).
28
+
29
+ Check out the [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
30
+
31
+ ## Built With
32
+
33
+ - [Next.js](https://nextjs.org/) - The React Framework for the Web
34
+ - [React](https://react.dev/) - The library for web and native user interfaces
35
+ - [PolygonKit](https://docs.polygonkit.com) - React components for Polygon apps
36
+ - [TailwindCSS](https://tailwindcss.com/) - A utility-first CSS framework
@@ -0,0 +1 @@
1
+ @import "tailwindcss";
@@ -0,0 +1,22 @@
1
+ import type { Metadata } from 'next';
2
+ import { Providers } from './providers';
3
+ import './globals.css';
4
+
5
+ export const metadata: Metadata = {
6
+ title: 'PolygonKit App',
7
+ description: 'Built with PolygonKit',
8
+ };
9
+
10
+ export default function RootLayout({
11
+ children,
12
+ }: Readonly<{
13
+ children: React.ReactNode;
14
+ }>) {
15
+ return (
16
+ <html lang="en">
17
+ <body>
18
+ <Providers>{children}</Providers>
19
+ </body>
20
+ </html>
21
+ );
22
+ }
@@ -0,0 +1,78 @@
1
+ 'use client';
2
+
3
+ import {
4
+ Wallet,
5
+ ConnectWallet,
6
+ WalletDropdown,
7
+ Identity,
8
+ usePolygonKit,
9
+ } from '@sanketsaagar/polygon-kit';
10
+
11
+ export default function Home() {
12
+ const { address, isConnected } = usePolygonKit();
13
+
14
+ if (!isConnected) {
15
+ return (
16
+ <div className="flex items-center justify-center min-h-screen bg-gradient-to-br from-purple-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800">
17
+ <div className="text-center">
18
+ <h1 className="text-4xl font-bold mb-8 text-gray-900 dark:text-white">
19
+ Welcome to PolygonKit
20
+ </h1>
21
+ <ConnectWallet />
22
+ </div>
23
+ </div>
24
+ );
25
+ }
26
+
27
+ return (
28
+ <div className="min-h-screen bg-gradient-to-br from-purple-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800">
29
+ <div className="container mx-auto px-4 py-8">
30
+ <header className="flex justify-between items-center mb-12">
31
+ <h1 className="text-3xl font-bold text-gray-900 dark:text-white">
32
+ My Polygon App
33
+ </h1>
34
+ <Wallet>
35
+ <WalletDropdown />
36
+ </Wallet>
37
+ </header>
38
+
39
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
40
+ <div className="bg-white dark:bg-gray-800 p-8 rounded-xl shadow-lg">
41
+ <h2 className="text-xl font-semibold mb-4 text-gray-900 dark:text-white">
42
+ Your Profile
43
+ </h2>
44
+ <Identity
45
+ address={address!}
46
+ showAvatar
47
+ showAddress
48
+ showBalance
49
+ />
50
+ </div>
51
+
52
+ <div className="bg-white dark:bg-gray-800 p-8 rounded-xl shadow-lg">
53
+ <h2 className="text-xl font-semibold mb-4 text-gray-900 dark:text-white">
54
+ Quick Actions
55
+ </h2>
56
+ <p className="text-gray-600 dark:text-gray-300">
57
+ Add your custom components here!
58
+ </p>
59
+ </div>
60
+ </div>
61
+
62
+ <div className="mt-12 text-center text-gray-600 dark:text-gray-400">
63
+ <p>
64
+ Built with{' '}
65
+ <a
66
+ href="https://docs.polygonkit.com"
67
+ target="_blank"
68
+ rel="noopener noreferrer"
69
+ className="text-purple-600 dark:text-purple-400 hover:underline"
70
+ >
71
+ PolygonKit
72
+ </a>
73
+ </p>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ );
78
+ }
@@ -0,0 +1,7 @@
1
+ 'use client';
2
+
3
+ import { PolygonKitProvider } from '@sanketsaagar/polygon-kit';
4
+
5
+ export function Providers({ children }: { children: React.ReactNode }) {
6
+ return <PolygonKitProvider>{children}</PolygonKitProvider>;
7
+ }
@@ -0,0 +1,4 @@
1
+ /** @type {import('next').NextConfig} */
2
+ const nextConfig = {};
3
+
4
+ export default nextConfig;
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "my-polygon-app",
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
+ "react": "^18.3.1",
13
+ "react-dom": "^18.3.1",
14
+ "next": "^15.0.3",
15
+ "@sanketsaagar/polygon-kit": "^0.1.5",
16
+ "wagmi": "^2.12.29",
17
+ "viem": "^2.21.45",
18
+ "@tanstack/react-query": "^5.59.20"
19
+ },
20
+ "devDependencies": {
21
+ "typescript": "^5",
22
+ "@types/node": "^20",
23
+ "@types/react": "^18",
24
+ "@types/react-dom": "^18",
25
+ "tailwindcss": "^4.0.0",
26
+ "@tailwindcss/postcss": "^4.0.0",
27
+ "postcss": "^8",
28
+ "eslint": "^8",
29
+ "eslint-config-next": "15.0.3"
30
+ }
31
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ plugins: {
3
+ '@tailwindcss/postcss': {},
4
+ },
5
+ };
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["dom", "dom.iterable", "esnext"],
4
+ "allowJs": true,
5
+ "skipLibCheck": true,
6
+ "strict": true,
7
+ "noEmit": true,
8
+ "esModuleInterop": true,
9
+ "module": "esnext",
10
+ "moduleResolution": "bundler",
11
+ "resolveJsonModule": true,
12
+ "isolatedModules": true,
13
+ "jsx": "preserve",
14
+ "incremental": true,
15
+ "plugins": [
16
+ {
17
+ "name": "next"
18
+ }
19
+ ],
20
+ "paths": {
21
+ "@/*": ["./*"]
22
+ }
23
+ },
24
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25
+ "exclude": ["node_modules"]
26
+ }
@@ -0,0 +1,27 @@
1
+ # PolygonKit Vite App
2
+
3
+ This project was created with [create-polygon-kit](https://github.com/sanketsaagar/create-polygon-kit).
4
+
5
+ ## Getting Started
6
+
7
+ First, run the development server:
8
+
9
+ ```bash
10
+ npm run dev
11
+ ```
12
+
13
+ Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
14
+
15
+ ## Learn More
16
+
17
+ To learn more about PolygonKit, check out the following resources:
18
+
19
+ - [PolygonKit Documentation](https://docs.polygonkit.com) - learn about PolygonKit features and API
20
+ - [GitHub Repository](https://github.com/sanketsaagar/polygonKit) - source code and issues
21
+
22
+ ## Built With
23
+
24
+ - [Vite](https://vitejs.dev/) - Next Generation Frontend Tooling
25
+ - [React](https://react.dev/) - The library for web and native user interfaces
26
+ - [PolygonKit](https://docs.polygonkit.com) - React components for Polygon apps
27
+ - [TailwindCSS](https://tailwindcss.com/) - A utility-first CSS framework
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>PolygonKit App</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "my-polygon-app",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc && vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "react": "^18.3.1",
13
+ "react-dom": "^18.3.1",
14
+ "@sanketsaagar/polygon-kit": "^0.1.5",
15
+ "wagmi": "^2.12.29",
16
+ "viem": "^2.21.45",
17
+ "@tanstack/react-query": "^5.59.20"
18
+ },
19
+ "devDependencies": {
20
+ "@types/react": "^18.3.12",
21
+ "@types/react-dom": "^18.3.1",
22
+ "@vitejs/plugin-react": "^4.3.3",
23
+ "typescript": "~5.6.2",
24
+ "vite": "^5.4.10",
25
+ "tailwindcss": "^4.0.0",
26
+ "@tailwindcss/vite": "^4.0.0"
27
+ }
28
+ }
@@ -0,0 +1 @@
1
+ /* Add your custom styles here */
@@ -0,0 +1,88 @@
1
+ import {
2
+ PolygonKitProvider,
3
+ Wallet,
4
+ ConnectWallet,
5
+ WalletDropdown,
6
+ Identity,
7
+ usePolygonKit,
8
+ } from '@sanketsaagar/polygon-kit';
9
+ import './App.css';
10
+
11
+ function Dashboard() {
12
+ const { address, isConnected } = usePolygonKit();
13
+
14
+ if (!isConnected) {
15
+ return (
16
+ <div className="flex items-center justify-center min-h-screen bg-gradient-to-br from-purple-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800">
17
+ <div className="text-center">
18
+ <h1 className="text-4xl font-bold mb-8 text-gray-900 dark:text-white">
19
+ Welcome to PolygonKit
20
+ </h1>
21
+ <ConnectWallet />
22
+ </div>
23
+ </div>
24
+ );
25
+ }
26
+
27
+ return (
28
+ <div className="min-h-screen bg-gradient-to-br from-purple-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800">
29
+ <div className="container mx-auto px-4 py-8">
30
+ <header className="flex justify-between items-center mb-12">
31
+ <h1 className="text-3xl font-bold text-gray-900 dark:text-white">
32
+ My Polygon App
33
+ </h1>
34
+ <Wallet>
35
+ <WalletDropdown />
36
+ </Wallet>
37
+ </header>
38
+
39
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
40
+ <div className="bg-white dark:bg-gray-800 p-8 rounded-xl shadow-lg">
41
+ <h2 className="text-xl font-semibold mb-4 text-gray-900 dark:text-white">
42
+ Your Profile
43
+ </h2>
44
+ <Identity
45
+ address={address!}
46
+ showAvatar
47
+ showAddress
48
+ showBalance
49
+ />
50
+ </div>
51
+
52
+ <div className="bg-white dark:bg-gray-800 p-8 rounded-xl shadow-lg">
53
+ <h2 className="text-xl font-semibold mb-4 text-gray-900 dark:text-white">
54
+ Quick Actions
55
+ </h2>
56
+ <p className="text-gray-600 dark:text-gray-300">
57
+ Add your custom components here!
58
+ </p>
59
+ </div>
60
+ </div>
61
+
62
+ <div className="mt-12 text-center text-gray-600 dark:text-gray-400">
63
+ <p>
64
+ Built with{' '}
65
+ <a
66
+ href="https://docs.polygonkit.com"
67
+ target="_blank"
68
+ rel="noopener noreferrer"
69
+ className="text-purple-600 dark:text-purple-400 hover:underline"
70
+ >
71
+ PolygonKit
72
+ </a>
73
+ </p>
74
+ </div>
75
+ </div>
76
+ </div>
77
+ );
78
+ }
79
+
80
+ function App() {
81
+ return (
82
+ <PolygonKitProvider>
83
+ <Dashboard />
84
+ </PolygonKitProvider>
85
+ );
86
+ }
87
+
88
+ export default App;
@@ -0,0 +1 @@
1
+ @import "tailwindcss";
@@ -0,0 +1,10 @@
1
+ import { StrictMode } from 'react'
2
+ import { createRoot } from 'react-dom/client'
3
+ import App from './App.tsx'
4
+ import './index.css'
5
+
6
+ createRoot(document.getElementById('root')!).render(
7
+ <StrictMode>
8
+ <App />
9
+ </StrictMode>,
10
+ )
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+ "moduleResolution": "bundler",
9
+ "allowImportingTsExtensions": true,
10
+ "resolveJsonModule": true,
11
+ "isolatedModules": true,
12
+ "noEmit": true,
13
+ "jsx": "react-jsx",
14
+ "strict": true,
15
+ "noUnusedLocals": true,
16
+ "noUnusedParameters": true,
17
+ "noFallthroughCasesInSwitch": true
18
+ },
19
+ "include": ["src"],
20
+ "references": [{ "path": "./tsconfig.node.json" }]
21
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "skipLibCheck": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "allowSyntheticDefaultImports": true
8
+ },
9
+ "include": ["vite.config.ts"]
10
+ }
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+ import tailwindcss from '@tailwindcss/vite'
4
+
5
+ export default defineConfig({
6
+ plugins: [react(), tailwindcss()],
7
+ })