diff --git a/apps/bridge/.gitignore b/apps/bridge/.gitignore new file mode 100644 index 0000000..d8017a0 --- /dev/null +++ b/apps/bridge/.gitignore @@ -0,0 +1,33 @@ +# 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? +.vercel + +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions \ No newline at end of file diff --git a/apps/bridge/.yarnrc.yml b/apps/bridge/.yarnrc.yml new file mode 100644 index 0000000..3186f3f --- /dev/null +++ b/apps/bridge/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/apps/bridge/README.md b/apps/bridge/README.md new file mode 100644 index 0000000..69eca22 --- /dev/null +++ b/apps/bridge/README.md @@ -0,0 +1,80 @@ +# Push Simulate Application + +A simulation and testing platform built with React, TypeScript, and Vite, integrated with the Push Protocol. This application provides a sandbox environment for testing and simulating various blockchain interactions and Push Protocol features. + +## 🚀 Features + +- Interactive simulation environment +- Integration with Push Protocol for testing +- Form validation with Formik and Yup +- Real-time blockchain interaction simulation +- TypeScript for type safety +- Vite for fast development and building +- Devnet integration for testing + +## 🛠️ Prerequisites + +- Node.js (v18 or higher) +- Yarn package manager +- Git + +## 📦 Installation + +1. First, build the shared components: + + ```bash + cd packages/shared-components + yarn install + yarn build + ``` + +2. Then, install and run the simulate application: + + ```bash + cd ../../examples/apps/simulate + yarn install + ``` + +## 🏃‍♂️ Running the Application + +### Development Mode + +```bash +yarn dev +``` + +This will start the development server at `http://localhost:5173` + +## 🛠️ Tech Stack + +- React 18 +- TypeScript +- Vite +- Push Protocol for testing +- Viem for Ethereum interactions +- Formik for form handling +- Yup for form validation +- React Router for navigation +- PushChain Devnet for testing + +## 📚 Project Structure + +``` +simulate/ +├── src/ # Source files +├── public/ # Static assets +├── vite.config.ts # Vite configuration +└── package.json # Project dependencies +``` + +## 🤝 Contributing + +1. Fork the repository +2. Create your feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes (`git commit -m 'Add some amazing feature'`) +4. Push to the branch (`git push origin feature/amazing-feature`) +5. Open a Pull Request + +## 📝 License + +This project is licensed under the MIT License - see the LICENSE file for details. diff --git a/apps/bridge/eslint.config.js b/apps/bridge/eslint.config.js new file mode 100644 index 0000000..092408a --- /dev/null +++ b/apps/bridge/eslint.config.js @@ -0,0 +1,28 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import tseslint from 'typescript-eslint' + +export default tseslint.config( + { ignores: ['dist'] }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ['**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...reactHooks.configs.recommended.rules, + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, + }, +) diff --git a/apps/bridge/index.html b/apps/bridge/index.html new file mode 100644 index 0000000..53458cf --- /dev/null +++ b/apps/bridge/index.html @@ -0,0 +1,53 @@ + + + + + + + Connect to Wallet + + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/apps/bridge/package.json b/apps/bridge/package.json new file mode 100644 index 0000000..0bc1142 --- /dev/null +++ b/apps/bridge/package.json @@ -0,0 +1,42 @@ +{ + "name": "core-connection", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "preinstall": "cd ../../packages/shared-components && yarn install && yarn build", + "dev": "vite", + "build": "vite build", + "lint": "eslint .", + "preview": "vite preview", + "deploy:vercel": "vercel build --prod && vercel deploy --prebuilt --prod", + "deploy": "VITE_DEPLOYMENT_MODE=production npm run build && echo 'simulate.push.org' > ./dist/CNAME && gh-pages -d dist -r https://github.com/push-protocol/simulate-dev-deployment", + "deploy:alpha": "VITE_DEPLOYMENT_MODE=alpha npm run build && echo 'simulate-alpha.push.org' > ./dist/CNAME && gh-pages -d dist -r https://github.com/push-protocol/simulate-alpha-deployment" + }, + "dependencies": { + "@pushchain/ui-kit": "2.1.3", + "@radix-ui/react-popover": "^1.1.2", + "gh-pages": "^6.2.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-icons": "^5.5.0", + "react-router-dom": "^7.0.2", + "shared-components": "file:../../packages/shared-components", + "viem": "^2.21.34" + }, + "devDependencies": { + "@eslint/js": "^9.9.0", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@vitejs/plugin-react-swc": "^3.10.2", + "eslint": "^9.9.0", + "eslint-plugin-react": "^7.37.2", + "eslint-plugin-react-hooks": "^5.1.0", + "eslint-plugin-react-refresh": "^0.4.9", + "globals": "^15.9.0", + "typescript": "^5.5.3", + "typescript-eslint": "^8.0.1", + "vite": "^5.4.1", + "vite-plugin-node-polyfills": "^0.23.0" + } +} diff --git a/apps/bridge/public/404.html b/apps/bridge/public/404.html new file mode 100644 index 0000000..7e88900 --- /dev/null +++ b/apps/bridge/public/404.html @@ -0,0 +1,52 @@ + + + + + Single Page Apps for GitHub Pages + + + + diff --git a/apps/bridge/public/BridgeLogo.png b/apps/bridge/public/BridgeLogo.png new file mode 100644 index 0000000..9b36bc4 Binary files /dev/null and b/apps/bridge/public/BridgeLogo.png differ diff --git a/apps/bridge/public/Discord.png b/apps/bridge/public/Discord.png new file mode 100644 index 0000000..ec72aeb Binary files /dev/null and b/apps/bridge/public/Discord.png differ diff --git a/apps/bridge/public/PushFooter.png b/apps/bridge/public/PushFooter.png new file mode 100644 index 0000000..591b1b6 Binary files /dev/null and b/apps/bridge/public/PushFooter.png differ diff --git a/apps/bridge/public/PushTitle.png b/apps/bridge/public/PushTitle.png new file mode 100644 index 0000000..64719ce Binary files /dev/null and b/apps/bridge/public/PushTitle.png differ diff --git a/apps/bridge/public/Success.png b/apps/bridge/public/Success.png new file mode 100644 index 0000000..215359a Binary files /dev/null and b/apps/bridge/public/Success.png differ diff --git a/apps/bridge/public/Twitter.png b/apps/bridge/public/Twitter.png new file mode 100644 index 0000000..26002a9 Binary files /dev/null and b/apps/bridge/public/Twitter.png differ diff --git a/apps/bridge/src/App.tsx b/apps/bridge/src/App.tsx new file mode 100644 index 0000000..4234c1b --- /dev/null +++ b/apps/bridge/src/App.tsx @@ -0,0 +1,35 @@ +import React, { useEffect } from 'react'; +import { Box } from 'shared-components'; +import Header from './components/Header'; +import Footer from './components/Footer'; +import Bridge from './components/bridge'; +import { usePushChainClient, PushUI, usePushWalletContext } from '@pushchain/ui-kit'; + +const App: React.FC = () => { + const { pushChainClient } = usePushChainClient(); + const { handleUserLogOutEvent } = usePushWalletContext(); + + useEffect(() => { + if (pushChainClient && pushChainClient.universal.origin.chain === PushUI.CONSTANTS.CHAIN_CONFIG.PUSH_TESTNET) { + handleUserLogOutEvent(); + } + }, [pushChainClient]) + + return ( + +
+ + + +