21 | );
22 | };
23 |
24 | export default Login;
25 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |