Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jhlee-young committed Oct 4, 2022
0 parents commit 7f0b448
Show file tree
Hide file tree
Showing 30 changed files with 4,563 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 13,
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint", "react-hooks"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"airbnb",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:react-hooks/recommended"
],
"env": {
"browser": true,
"es2021": true
},
"rules": {
"@typescript-eslint/no-explicit-any": "error",
"import/no-unresolved": "off",
"import/extensions": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/react-in-jsx-scope": "off",
"react/jsx-filename-extension": [
1,
{ "extensions": [".js", ".jsx", ".ts", ".tsx"] }
],
"react/require-default-props": "off",
"import/prefer-default-export": "off",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"react/jsx-props-no-spreading": "off",
"react/destructuring-assignment": "off",
"react/prop-types": "off"
}
}
118 changes: 118 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist
dist-ssr
*.local

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"singleQuote": false,
"trailingComma": "all",
"semi": true,
"useTabs": false,
"tabWidth": 2,
"printWidth": 80,
"arrowParens": "always"
}
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dezswap</title>
<script>
window.global = window;
</script>
<script type="module" src="/src/polyfills/polyfills.js"></script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
48 changes: 48 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "dezswap-web-app",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
"@rollup/plugin-inject": "^4.0.4",
"@xpla/wallet-provider": "^0.3.4",
"@xpla/xpla.js": "^0.2.1",
"buffer": "^6.0.3",
"emotion-reset": "^3.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-grid-system": "^8.1.6",
"react-router-dom": "^6.4.1",
"vite-plugin-svgr": "^2.2.1"
},
"devDependencies": {
"@emotion/babel-plugin": "^11.10.2",
"@types/node": "^18.8.1",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"@vitejs/plugin-basic-ssl": "^0.1.2",
"@vitejs/plugin-react": "^2.1.0",
"eslint": "^8.24.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^2.7.1",
"typescript": "^4.6.4",
"vite": "^3.1.0",
"vite-tsconfig-paths": "^3.5.1"
}
}
Empty file added public/.gitkeep
Empty file.
29 changes: 29 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Route, Routes } from "react-router-dom";
import routes, { RouteObject } from "routes";
import { useCallback } from "react";
import GlobalStyles from "styles/GlobalStyles";

function App() {
const renderRoute = useCallback(
({ children, ...props }: RouteObject) => {
return (
<Route
key={`${props.path} ${props.index}`}
{...props}
>
{children?.map(renderRoute)}
</Route>
);
},
[],
);

return (
<>
<GlobalStyles />
<Routes>{routes.map(renderRoute)}</Routes>
</>
);
}

export default App;
Empty file added src/assets/.gitkeep
Empty file.
Empty file added src/components/.gitkeep
Empty file.
17 changes: 17 additions & 0 deletions src/constants/network.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export type Network = {
lcd: string;
chainId: string;
};

const networks: Record<string, Network> = {
dimension: {
lcd: "https://dimension-lcd.xpla.dev",
chainId: "dimension_37-1",
},
cube: {
lcd: "https://cube-lcd.xpla.dev",
chainId: "cube_47-5",
},
};

export default networks;
11 changes: 11 additions & 0 deletions src/hooks/useLCDClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { LCDClient } from "@xpla/xpla.js";
import networks from "constants/network";

export const useLCDClient = (network: string) => {
const lcd = new LCDClient({
URL: networks[network].lcd,
chainID: networks[network].lcd
});

return { lcd };
};
13 changes: 13 additions & 0 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ThemeProvider } from "@emotion/react";
import App from "App";
import ReactDOM from "react-dom/client";
import { BrowserRouter } from "react-router-dom";
import theme from "styles/theme";

ReactDOM.createRoot(document.getElementById("root")!).render(
<ThemeProvider theme={theme}>
<BrowserRouter>
<App />
</BrowserRouter>
</ThemeProvider>
);
Empty file added src/pages/.gitkeep
Empty file.
17 changes: 17 additions & 0 deletions src/pages/Playground/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Container } from "react-grid-system";
import styled from "@emotion/styled";

const Wrapper = styled(Container)`
width: 100%;
height: auto;
position: relative;
display: flex;
`;

function PlaygroundPage() {
return (
<Wrapper>Hello Dezswap!</Wrapper>
);
}

export default PlaygroundPage;
3 changes: 3 additions & 0 deletions src/polyfills/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Node polyfills

copied node polyfills from <https://github.com/snowpackjs/rollup-plugin-polyfill-node/tree/main/polyfills>
5 changes: 5 additions & 0 deletions src/polyfills/polyfills.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as buffer from "buffer";
import process from "./process-es6.js";

window.Buffer = buffer.Buffer;
window.process = process;
32 changes: 32 additions & 0 deletions src/polyfills/process-es6-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Name: process-es6
Version: 0.11.6
License: MIT
Private: false
Description: process information for node.js and browsers, but in es6
Repository: git://github.com/calvinmetcalf/node-process-es6.git
Author: Roman Shtylman <[email protected]>
License Copyright:
===

(The MIT License)

Copyright (c) 2013 Roman Shtylman <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 7f0b448

Please sign in to comment.