diff --git a/.env.production.example b/.env.production.example new file mode 100644 index 0000000..8814c08 --- /dev/null +++ b/.env.production.example @@ -0,0 +1,2 @@ +REACT_APP_API_BASE_URL=https://api-baobab.wallet.klaytn.com/faucet +REACT_APP_HCAPTCHA_SITE_KEY=7be2579c-e9e0-47c7-b5b1-4819e593ff1c \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f21726c --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local +.env + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/README.md b/README.md new file mode 100644 index 0000000..b87cb00 --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# Getting Started with Create React App + +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +## Available Scripts + +In the project directory, you can run: + +### `npm start` + +Runs the app in the development mode.\ +Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.\ +You will also see any lint errors in the console. + +### `npm test` + +Launches the test runner in the interactive watch mode.\ +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +### `npm run build` + +Builds the app for production to the `build` folder.\ +It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.\ +Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +### `npm run eject` + +**Note: this is a one-way operation. Once you `eject`, you can’t go back!** + +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. + +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. + +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. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). diff --git a/package.json b/package.json new file mode 100644 index 0000000..8d5ee09 --- /dev/null +++ b/package.json @@ -0,0 +1,57 @@ +{ + "name": "klaytn-faucet", + "version": "0.1.0", + "private": true, + "dependencies": { + "@ethersproject/hash": "^5.7.0", + "@ethersproject/providers": "^5.7.1", + "@hcaptcha/react-hcaptcha": "^1.4.4", + "@testing-library/jest-dom": "^5.16.5", + "@testing-library/react": "^13.4.0", + "@testing-library/user-event": "^13.5.0", + "@types/jest": "^27.5.2", + "@types/lodash": "^4.14.186", + "@types/node": "^16.11.62", + "@types/react": "^18.0.21", + "@types/react-copy-to-clipboard": "^5.0.4", + "@types/react-dom": "^18.0.6", + "@web3-react/core": "^6.1.9", + "axios": "^0.27.2", + "ethers": "^5.7.1", + "lodash": "^4.17.21", + "number-to-bn": "^1.7.0", + "react": "^18.2.0", + "react-copy-to-clipboard": "^5.1.0", + "react-dom": "^18.2.0", + "react-scripts": "5.0.1", + "sass": "^1.55.0", + "typescript": "^4.8.3", + "web-vitals": "^2.1.4", + "web3": "^1.8.0", + "web3-react": "^5.0.5" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/public/fonts/circular-bold.woff2 b/public/fonts/circular-bold.woff2 new file mode 100644 index 0000000..ba8ba0e Binary files /dev/null and b/public/fonts/circular-bold.woff2 differ diff --git a/public/fonts/circular-book.woff2 b/public/fonts/circular-book.woff2 new file mode 100644 index 0000000..5fdb44c Binary files /dev/null and b/public/fonts/circular-book.woff2 differ diff --git a/public/fonts/circular-medium.woff2 b/public/fonts/circular-medium.woff2 new file mode 100644 index 0000000..0924c8a Binary files /dev/null and b/public/fonts/circular-medium.woff2 differ diff --git a/public/icons/icon-faucet-on.svg b/public/icons/icon-faucet-on.svg new file mode 100644 index 0000000..1728eba --- /dev/null +++ b/public/icons/icon-faucet-on.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..c623eef --- /dev/null +++ b/public/index.html @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + Klaytn Faucet + + + + +
+ + + + \ No newline at end of file diff --git a/public/logo128.png b/public/logo128.png new file mode 100644 index 0000000..02447f7 Binary files /dev/null and b/public/logo128.png differ diff --git a/public/logo16.png b/public/logo16.png new file mode 100644 index 0000000..fe9e36a Binary files /dev/null and b/public/logo16.png differ diff --git a/public/logo192.png b/public/logo192.png new file mode 100644 index 0000000..d7b1cc4 Binary files /dev/null and b/public/logo192.png differ diff --git a/public/logo32.png b/public/logo32.png new file mode 100644 index 0000000..da488ff Binary files /dev/null and b/public/logo32.png differ diff --git a/public/logo512.png b/public/logo512.png new file mode 100644 index 0000000..1990636 Binary files /dev/null and b/public/logo512.png differ diff --git a/public/logo64.png b/public/logo64.png new file mode 100644 index 0000000..2fc34e0 Binary files /dev/null and b/public/logo64.png differ diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..080d6c7 --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/src/App.test.tsx b/src/App.test.tsx new file mode 100644 index 0000000..2a68616 --- /dev/null +++ b/src/App.test.tsx @@ -0,0 +1,9 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import App from './App'; + +test('renders learn react link', () => { + render(); + const linkElement = screen.getByText(/learn react/i); + expect(linkElement).toBeInTheDocument(); +}); diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..d744e3a --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,30 @@ +import React from 'react'; +import { Web3Provider } from '@ethersproject/providers'; +import { Web3ReactProvider } from '@web3-react/core'; +import { ethers } from 'ethers'; +import { AppProvider } from './AppContext'; +import Header from './components/Header'; +import Main from './components/Main'; +import Footer from './components/Footer'; +import Background from './components/Background'; + +export const getLibrary = (provider: any): Web3Provider => { + const library = new ethers.providers.Web3Provider(provider, 'any'); + library.pollingInterval = 10000; + return library; +} + +function App() { + return ( + + + +
+
+