├── .gitignore ├── .vscode └── settings.json ├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt ├── src ├── App.css ├── App.test.tsx ├── App.tsx ├── index.css ├── index.tsx ├── logo.svg ├── pages │ ├── Discord.tsx │ └── Login.tsx ├── react-app-env.d.ts ├── reportWebVitals.ts └── setupTests.ts ├── tailwind.config.js ├── tsconfig.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "addnewuser", 4 | "browserslist", 5 | "discordid", 6 | "discordname", 7 | "groupid", 8 | "Ogfj", 9 | "qcqz", 10 | "reactdiscordsolana", 11 | "semibold", 12 | "solana", 13 | "Solflare", 14 | "tailwindcss", 15 | "userid", 16 | "wadres" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 13 | 14 | The page will reload if you make edits.\ 15 | You will also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 35 | 36 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 39 | 40 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reactdiscordsolana", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@solana/wallet-adapter-base": "^0.9.5", 7 | "@solana/wallet-adapter-react": "^0.15.5", 8 | "@solana/wallet-adapter-react-ui": "^0.9.7", 9 | "@solana/wallet-adapter-wallets": "^0.16.1", 10 | "@solana/web3.js": "^1.43.4", 11 | "@testing-library/jest-dom": "^5.16.4", 12 | "@testing-library/react": "^13.3.0", 13 | "@testing-library/user-event": "^13.5.0", 14 | "@types/jest": "^27.5.1", 15 | "@types/node": "^16.11.38", 16 | "@types/react": "^18.0.10", 17 | "@types/react-dom": "^18.0.5", 18 | "axios": "^0.27.2", 19 | "react": "^18.1.0", 20 | "react-dom": "^18.1.0", 21 | "react-router-dom": "^6.3.0", 22 | "react-scripts": "5.0.1", 23 | "typescript": "^4.7.2", 24 | "web-vitals": "^2.1.4" 25 | }, 26 | "scripts": { 27 | "start": "react-scripts start", 28 | "build": "react-scripts build", 29 | "test": "react-scripts test", 30 | "eject": "react-scripts eject" 31 | }, 32 | "eslintConfig": { 33 | "extends": [ 34 | "react-app", 35 | "react-app/jest" 36 | ] 37 | }, 38 | "browserslist": { 39 | "production": [ 40 | ">0.2%", 41 | "not dead", 42 | "not op_mini all" 43 | ], 44 | "development": [ 45 | "last 1 chrome version", 46 | "last 1 firefox version", 47 | "last 1 safari version" 48 | ] 49 | }, 50 | "devDependencies": { 51 | "tailwindcss": "^3.0.24" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acehood0126/DiscordAuthSolanaWalletReactTypeScript/b39ec823fdba31bbd56e7f6c01414149721d5e59/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acehood0126/DiscordAuthSolanaWalletReactTypeScript/b39ec823fdba31bbd56e7f6c01414149721d5e59/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/acehood0126/DiscordAuthSolanaWalletReactTypeScript/b39ec823fdba31bbd56e7f6c01414149721d5e59/public/logo512.png -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab); 3 | background-size: 400% 400%; 4 | animation: gradient 15s ease infinite; 5 | height: 100vh; 6 | } 7 | 8 | @keyframes gradient { 9 | 0% { 10 | background-position: 0% 50%; 11 | } 12 | 50% { 13 | background-position: 100% 50%; 14 | } 15 | 100% { 16 | background-position: 0% 50%; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render, screen } from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | render(); 7 | const linkElement = screen.getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /src/App.tsx: -------------------------------------------------------------------------------- 1 | import { BrowserRouter, Routes, Route } from "react-router-dom"; 2 | 3 | import "./App.css"; 4 | 5 | import Discord from "./pages/Discord"; 6 | import Login from "./pages/Login"; 7 | function App() { 8 | return ( 9 | 10 | 11 | } /> 12 | } /> 13 | } /> 14 | 15 | 16 | ); 17 | } 18 | 19 | export default App; 20 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | body { 6 | margin: 0; 7 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 8 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 9 | sans-serif; 10 | -webkit-font-smoothing: antialiased; 11 | -moz-osx-font-smoothing: grayscale; 12 | } 13 | 14 | code { 15 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 16 | monospace; 17 | } 18 | -------------------------------------------------------------------------------- /src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot( 8 | document.getElementById('root') as HTMLElement 9 | ); 10 | root.render( 11 | 12 | 13 | 14 | ); 15 | 16 | // If you want to start measuring performance in your app, pass a function 17 | // to log results (for example: reportWebVitals(console.log)) 18 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 19 | reportWebVitals(); 20 | -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/pages/Discord.tsx: -------------------------------------------------------------------------------- 1 | import { FC, useMemo, useEffect, useState } from "react"; 2 | import axios from "axios"; 3 | import { Link, useParams } from "react-router-dom"; 4 | 5 | import { 6 | ConnectionProvider, 7 | WalletProvider, 8 | } from "@solana/wallet-adapter-react"; 9 | import { WalletAdapterNetwork } from "@solana/wallet-adapter-base"; 10 | import { 11 | GlowWalletAdapter, 12 | PhantomWalletAdapter, 13 | SlopeWalletAdapter, 14 | SolflareWalletAdapter, 15 | SolletExtensionWalletAdapter, 16 | SolletWalletAdapter, 17 | TorusWalletAdapter, 18 | } from "@solana/wallet-adapter-wallets"; 19 | import { 20 | WalletModalProvider, 21 | WalletDisconnectButton, 22 | WalletMultiButton, 23 | } from "@solana/wallet-adapter-react-ui"; 24 | import { clusterApiUrl } from "@solana/web3.js"; 25 | 26 | type userData = { 27 | username: string; 28 | userid: string; 29 | gid: string; 30 | }; 31 | 32 | const serverURL = "http://localhost:5000"; 33 | 34 | const Discord: FC = () => { 35 | // The network can be set to 'devnet', 'testnet', or 'mainnet-beta'. 36 | const network = WalletAdapterNetwork.Devnet; 37 | 38 | // You can also provide a custom RPC endpoint. 39 | const endpoint = useMemo(() => clusterApiUrl(network), [network]); 40 | 41 | // @solana/wallet-adapter-wallets includes all the adapters but supports tree shaking and lazy loading -- 42 | // Only the wallets you configure here will be compiled into your application, and only the dependencies 43 | // of wallets that your users connect to will be loaded. 44 | const wallets = useMemo( 45 | () => [ 46 | new PhantomWalletAdapter(), 47 | new GlowWalletAdapter(), 48 | new SlopeWalletAdapter(), 49 | new SolflareWalletAdapter({ network }), 50 | new TorusWalletAdapter(), 51 | ], 52 | [network] 53 | ); 54 | 55 | const [discordname, setDiscordName] = useState(""); 56 | const [discordid, setDiscordId] = useState(""); 57 | const [wadres, setWalletAddress] = useState(""); 58 | const [groupid, setGroupId] = useState(""); 59 | 60 | const { username, userid, gid } = useParams() as userData; 61 | 62 | useEffect(() => { 63 | setDiscordName(username); 64 | setDiscordId(userid); 65 | setGroupId(gid); 66 | }, [username, userid, gid]); 67 | 68 | return ( 69 |
70 |
71 |
72 | Discord Logo 78 |
79 |
80 | setDiscordName(e.target.value)} 85 | readOnly 86 | className="flex-shrink-0 flex justify-center items-center text-center border-b-2 p-3 m-1 border-indigo-500 focus:border-indigo-900 focus:outline-none" 87 | > 88 | setDiscordId(e.target.value)} 93 | readOnly 94 | className="flex-shrink-0 flex justify-center items-center text-center border-b-2 p-3 m-1 border-indigo-500 focus:border-indigo-900 focus:outline-none" 95 | > 96 | setWalletAddress(e.target.value)} 101 | readOnly 102 | className="flex-shrink-0 flex justify-center items-center text-center border-b-2 p-3 m-1 border-indigo-500 focus:border-indigo-900 focus:outline-none" 103 | > 104 | setGroupId(e.target.value)} 109 | readOnly 110 | className="flex-shrink-0 flex justify-center items-center text-center border-b-2 p-3 m-1 border-indigo-500 focus:border-indigo-900 focus:outline-none" 111 | > 112 | 113 | 117 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | {/* Your app's components go here, nested within the context providers. */} 148 | 149 | 150 | 151 |
152 |
153 |
154 | ); 155 | }; 156 | 157 | export default Discord; 158 | -------------------------------------------------------------------------------- /src/pages/Login.tsx: -------------------------------------------------------------------------------- 1 | const Login = () => { 2 | return ( 3 |
4 |
5 |
6 | Discord Logo 12 |
13 | {/* */} 14 | 15 | 18 | 19 |
20 |
21 | ); 22 | }; 23 | 24 | export default Login; 25 | -------------------------------------------------------------------------------- /src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /src/reportWebVitals.ts: -------------------------------------------------------------------------------- 1 | import { ReportHandler } from 'web-vitals'; 2 | 3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => { 4 | if (onPerfEntry && onPerfEntry instanceof Function) { 5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 6 | getCLS(onPerfEntry); 7 | getFID(onPerfEntry); 8 | getFCP(onPerfEntry); 9 | getLCP(onPerfEntry); 10 | getTTFB(onPerfEntry); 11 | }); 12 | } 13 | }; 14 | 15 | export default reportWebVitals; 16 | -------------------------------------------------------------------------------- /src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | content: ["./src/**/*.{html,js,ts,tsx}"], 3 | theme: { 4 | extend: {}, 5 | }, 6 | plugins: [], 7 | }; 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "noEmit": true, 21 | "jsx": "react-jsx" 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | --------------------------------------------------------------------------------