commit 0f11c093213c588f46fd82629184d3ab1796c9c3 Author: Nishad Date: Fri Aug 28 07:20:09 2020 +0800 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3a1bea6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# 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 + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +.idea diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6623dd0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright 2020 Serum Foundation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a79c736 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# Serum DEX UI + +An implementation of a UI for the Serum DEX. + +See [A technical introduction to the Serum DEX](https://projectserum.com/blog/serum-dex-introduction) to learn more about the Serum DEX. + +See [serum-js](https://github.com/project-serum/serum-js) for DEX client-side code. Serum DEX UI uses this library. + +See [sol-wallet-adapter](https://github.com/project-serum/sol-wallet-adapter) for an explanation of how the Serum DEX UI interacts with wallet services to sign and send requests to the Serum DEX. + +See [spl-token-wallet](https://github.com/project-serum/spl-token-wallet) for an implementation of such a wallet, live at [sollet.io](https://sollet.io). + +--- + +Run `yarn start` to start a development server or `yarn build` to create a production build that can be served by a static file server. + +See the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started) for other commands and options. diff --git a/craco.config.js b/craco.config.js new file mode 100644 index 0000000..cdcc35c --- /dev/null +++ b/craco.config.js @@ -0,0 +1,17 @@ +const CracoLessPlugin = require('craco-less'); + +module.exports = { + plugins: [ + { + plugin: CracoLessPlugin, + options: { + lessLoaderOptions: { + lessOptions: { + modifyVars: { '@primary-color': '#2abdd2' }, + javascriptEnabled: true, + }, + }, + }, + }, + ], +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..cbbaa4e --- /dev/null +++ b/package.json @@ -0,0 +1,74 @@ +{ + "name": "serum-dex-ui", + "version": "0.1.0", + "private": true, + "dependencies": { + "@ant-design/icons": "^4.2.1", + "@craco/craco": "^5.6.4", + "@project-serum/serum": "^0.6.9", + "@project-serum/sol-wallet-adapter": "^0.1.0", + "@solana/web3.js": "^0.71.9", + "@testing-library/jest-dom": "^4.2.4", + "@testing-library/react": "^9.3.2", + "@testing-library/user-event": "^7.1.2", + "@tsconfig/node12": "^1.0.7", + "antd": "^4.6.0", + "bn.js": "^5.1.3", + "craco-less": "^1.17.0", + "immutable-tuple": "^0.4.10", + "qrcode.react": "^1.0.0", + "react": "^16.13.1", + "react-app-polyfill": "^1.0.5", + "react-copy-to-clipboard": "^5.0.2", + "react-dom": "^16.13.1", + "react-router": "^5.2.0", + "react-router-dom": "^5.2.0", + "react-scripts": "3.4.3", + "styled-components": "^5.1.1" + }, + "scripts": { + "start": "craco start", + "build": "craco build", + "test": "craco test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": "react-app" + }, + "jest": { + "transformIgnorePatterns": [ + "^.+\\.cjs$" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, + "prettier": { + "singleQuote": true, + "trailingComma": "all" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "devDependencies": { + "git-format-staged": "^2.1.0", + "husky": "^4.2.5", + "lint-staged": ">=10", + "prettier": "^2.0.5", + "typescript": "^4.0.2" + }, + "lint-staged": { + "*.{js,css,md}": "prettier --write" + } +} diff --git a/public/CNAME b/public/CNAME new file mode 100644 index 0000000..5f54191 --- /dev/null +++ b/public/CNAME @@ -0,0 +1 @@ +demo.projectserum.com \ No newline at end of file diff --git a/public/android-chrome-192x192.png b/public/android-chrome-192x192.png new file mode 100644 index 0000000..1962ba9 Binary files /dev/null and b/public/android-chrome-192x192.png differ diff --git a/public/android-chrome-512x512.png b/public/android-chrome-512x512.png new file mode 100644 index 0000000..756e551 Binary files /dev/null and b/public/android-chrome-512x512.png differ diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 0000000..9386487 Binary files /dev/null and b/public/apple-touch-icon.png differ diff --git a/public/favicon-16x16.png b/public/favicon-16x16.png new file mode 100644 index 0000000..b0463c2 Binary files /dev/null and b/public/favicon-16x16.png differ diff --git a/public/favicon-32x32.png b/public/favicon-32x32.png new file mode 100644 index 0000000..83881ec Binary files /dev/null and b/public/favicon-32x32.png differ diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..ba7d107 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..a227d7f --- /dev/null +++ b/public/index.html @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + Serum + + + +
+ + + diff --git a/public/logo.ico b/public/logo.ico new file mode 100644 index 0000000..05b4b95 Binary files /dev/null and b/public/logo.ico differ diff --git a/public/logo192.png b/public/logo192.png new file mode 100644 index 0000000..fc44b0a Binary files /dev/null and b/public/logo192.png differ diff --git a/public/logo512.png b/public/logo512.png new file mode 100644 index 0000000..a4e47a6 Binary files /dev/null and b/public/logo512.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.js b/src/App.js new file mode 100644 index 0000000..6e8c40e --- /dev/null +++ b/src/App.js @@ -0,0 +1,31 @@ +import React, { Suspense } from 'react'; +import './App.less'; +import { ConnectionProvider } from './utils/connection'; +import { MarketProvider } from './utils/markets'; +import { WalletProvider } from './utils/wallet'; +import TradePage from './pages/TradePage'; +import BasicLayout from './components/BasicLayout'; +import { GlobalStyle } from './global_style'; +import { Spin } from 'antd'; +import ErrorBoundary from './components/ErrorBoundary'; + +export default function App() { + return ( + }> + + + + + + + }> + + + + + + + + + ); +} diff --git a/src/App.less b/src/App.less new file mode 100644 index 0000000..9bf61aa --- /dev/null +++ b/src/App.less @@ -0,0 +1,40 @@ +@import '~antd/dist/antd.dark.less'; + +.App { + text-align: center; +} + +.App-logo { + height: 40vmin; + pointer-events: none; +} + +@media (prefers-reduced-motion: no-preference) { + .App-logo { + animation: App-logo-spin infinite 20s linear; + } +} + +.App-header { + background-color: #282c34; + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: calc(10px + 2vmin); + color: white; +} + +.App-link { + color: #61dafb; +} + +@keyframes App-logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} diff --git a/src/App.test.js b/src/App.test.js new file mode 100644 index 0000000..4db7ebc --- /dev/null +++ b/src/App.test.js @@ -0,0 +1,9 @@ +import React from 'react'; +import { render } from '@testing-library/react'; +import App from './App'; + +test('renders learn react link', () => { + const { getByText } = render(); + const linkElement = getByText(/learn react/i); + expect(linkElement).toBeInTheDocument(); +}); diff --git a/src/ant-custom.less b/src/ant-custom.less new file mode 100644 index 0000000..f4990b3 --- /dev/null +++ b/src/ant-custom.less @@ -0,0 +1,3 @@ +@import '~antd/dist/antd.css'; +@import '~antd/dist/antd.dark.less'; +@primary-color: #2abdd2; diff --git a/src/assets/logo.svg b/src/assets/logo.svg new file mode 100644 index 0000000..c3b488c --- /dev/null +++ b/src/assets/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/BasicLayout.js b/src/components/BasicLayout.js new file mode 100644 index 0000000..ce91aff --- /dev/null +++ b/src/components/BasicLayout.js @@ -0,0 +1,21 @@ +import { Layout } from 'antd'; +import React from 'react'; +import TopBar from './TopBar'; +import { CustomFooter as Footer } from './Footer'; +const { Header, Content } = Layout; + +export default function BasicLayout({ children }) { + return ( + + +
+ +
+ {children} +