Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/dhedge v1 withdraw app #306

Merged
merged 13 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .firebaserc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"projects": {
"lts": "apps-lts",
"mstable": "frontend-7e17f"
"mstable": "frontend-7e17f",
"dhedge": "dhedge-v1-withdraw"
}
}
59 changes: 59 additions & 0 deletions .github/workflows/dhedge-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: dHEDGE Dev

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'apps/dhedge/**'
- 'libs/dhedge/**'
- 'libs/shared/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout [main]
with:
fetch-depth: 0

- uses: actions/setup-node@v3
name: Setup node
with:
node-version: 18
cache: 'yarn'

- name: Install jq
run: |
sudo apt-get update
sudo apt-get install jq

- run: yarn install --frozen-lockfile
name: Install dependencies

- name: Build
env:
alchemyMain: ${{ secrets.ALCHEMY_FALLBACK_API_KEY }}
alchemyFallback: ${{ secrets.ALCHEMY_FALLBACK_API_KEY }}
run: NX_ALCHEMY_MAIN_API_KEY=$alchemyMain NX_ALCHEMY_FALLBACK_API_KEY=$alchemyFallback yarn nx build dhedge

- name: Copy Firebase dHEDGE to Firebase
run: cp firebase.dhedge.json firebase.json

- name: Firebase deploy
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_DHEDGE }}'
expires: 30d
projectId: dhedge-v1-withdraw
channelId: dev
47 changes: 47 additions & 0 deletions .github/workflows/dhedge-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: dHEDGE Main

on:
workflow_dispatch:

env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout [main]
with:
fetch-depth: 0

- uses: actions/setup-node@v3
name: Setup node
with:
node-version: 18
cache: 'yarn'

- name: Install jq
run: |
sudo apt-get update
sudo apt-get install jq

- run: yarn install --frozen-lockfile
name: Install dependencies

- name: Build
env:
alchemyMain: ${{ secrets.ALCHEMY_MAIN_API_KEY }}
alchemyFallback: ${{ secrets.ALCHEMY_FALLBACK_API_KEY }}
run: NX_ALCHEMY_MAIN_API_KEY=$alchemyMain NX_ALCHEMY_FALLBACK_API_KEY=$alchemyFallback yarn nx build dhedge

- name: Copy Firebase dHEDGE to Firebase
run: cp firebase.dhedge.json firebase.json

- name: Firebase deploy
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_DHEDGE }}'
projectId: dhedge-v1-withdraw
channelId: live
59 changes: 59 additions & 0 deletions .github/workflows/dhedge-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: dHEDGE preview

on:
pull_request:
paths:
- 'apps/dhedge/**'
- 'libs/dhedge/**'
- 'libs/shared/**'
- 'package.json'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout

- uses: actions/setup-node@v3
name: Setup node
with:
node-version: 18
cache: 'yarn'

- name: webfactory/ssh-agent
uses: webfactory/[email protected]
with:
'ssh-private-key': '${{ secrets.SSH_PRIVATE_KEY }}'

- name: Install jq
run: |
sudo apt-get update
sudo apt-get install jq

- run: yarn install --frozen-lockfile
name: Install dependencies

- name: Build
env:
alchemyMain: ${{ secrets.ALCHEMY_FALLBACK_API_KEY }}
alchemyFallback: ${{ secrets.ALCHEMY_FALLBACK_API_KEY }}
run: NX_ALCHEMY_MAIN_API_KEY=$alchemyMain NX_ALCHEMY_FALLBACK_API_KEY=$alchemyFallback yarn nx build dhedge

- name: Copy Firebase dHEDGE to Firebase
run: cp firebase.dhedge.json firebase.json

- name: Firebase deploy
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_DHEDGE }}'
expires: 8d
projectId: dhedge-v1-withdraw
18 changes: 18 additions & 0 deletions apps/dhedge/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
15 changes: 15 additions & 0 deletions apps/dhedge/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>dHEDGE V1 Deprecation App</title>
<base href="/" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
99 changes: 99 additions & 0 deletions apps/dhedge/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"name": "dhedge",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/dhedge/src",
"projectType": "application",
"targets": {
"build": {
"executor": "@nrwl/vite:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/apps/dhedge",
"dependsOn": ["^build", "i18n-compile"]
},
"configurations": {
"development": {
"mode": "development"
},
"production": {
"mode": "production"
}
}
},
"serve": {
"executor": "@nrwl/vite:dev-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "dhedge:build"
},
"configurations": {
"development": {
"buildTarget": "dhedge:build:development",
"hmr": true
},
"production": {
"buildTarget": "dhedge:build:production",
"hmr": false
}
}
},
"preview": {
"executor": "@nrwl/vite:preview-server",
"defaultConfiguration": "development",
"options": {
"buildTarget": "dhedge:build"
},
"configurations": {
"development": {
"buildTarget": "dhedge:build:development"
},
"production": {
"buildTarget": "dhedge:build:production"
}
}
},
"test": {
"executor": "@nrwl/vite:test",
"outputs": ["coverage/apps/dhedge"],
"options": {
"passWithNoTests": true,
"reportsDirectory": "../../coverage/apps/dhedge"
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/dhedge/**/*.{ts,tsx,js,jsx}"]
}
},
"i18n-extract": {
"executor": "nx:run-commands",
"options": {
"commands": [
"yarn run formatjs extract 'apps/dhedge/src/**/*.{ts,tsx}' --out-file i18n-extractions/apps-dhedge.json --id-interpolation-pattern '[sha512:contenthash:base64:6]'"
]
}
},
"i18n-clear": {
"executor": "nx:run-commands",
"options": {
"commands": ["yarn rimraf i18n-extractions"]
}
},
"i18n-compile": {
"executor": "nx:run-commands",
"dependsOn": ["i18n-clear", "i18n-extract", "^i18n-extract"],
"options": {
"commands": [
"jq -rs 'reduce .[] as $item ({}; . * $item)' i18n-extractions/* > apps/dhedge/i18n/en.json",
"yarn run formatjs compile apps/dhedge/i18n/en.json --ast --out-file apps/dhedge/src/assets/lang/en.json",
"yarn run nx format:write --files apps/dhedge/src/assets/lang/*.json"
],
"parallel": false
}
}
},
"tags": []
}
Binary file added apps/dhedge/public/favicon.ico
Binary file not shown.
34 changes: 34 additions & 0 deletions apps/dhedge/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Withdraw } from '@frontend/dhedge-withdraw';
import { Stack } from '@mui/material';

import { Footer } from './components/Footer';
import { Topnav } from './components/Topnav';

export const App = () => {
return (
<Stack
direction="column"
sx={{
width: 1,
height: 1,
}}
>
<Topnav />
<Stack
direction="column"
sx={(theme) => ({
width: 1,
height: 1,
pb: { xs: 2, md: 4 },
px: theme.mixins.paddings.page.paddingX,
minHeight: '84vh',
})}
>
<Withdraw />
</Stack>
<Footer
sx={(theme) => ({ py: 4, px: theme.mixins.paddings.page.paddingX })}
/>
</Stack>
);
};
12 changes: 12 additions & 0 deletions apps/dhedge/src/clients/google-analytics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { initializeApp } from 'firebase/app';

const firebaseConfig = Object.freeze({
apiKey: 'AIzaSyBi3nU0ysQmIqPHumwSaaUzxq8i9xOuP_c',
authDomain: 'apps-lts.firebaseapp.com',
projectId: 'apps-lts',
storageBucket: 'apps-lts.appspot.com',
messagingSenderId: '558241704832',
appId: '1:558241704832:web:baad7ec7c6061efdd32f65',
measurementId: 'G-R1530ER4M9',
});
export const firebaseApp = initializeApp(firebaseConfig);
3 changes: 3 additions & 0 deletions apps/dhedge/src/clients/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './react-query';
export * from './wagmi';
export * from './google-analytics';
15 changes: 15 additions & 0 deletions apps/dhedge/src/clients/react-query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { QueryClient } from '@tanstack/react-query';

const DEFAULT_STALE_TIME = 0;
const DEFAULT_CACHE_TIME = 1000 * 60 * 60 * 24; // 24 hours

export const reactQueryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
staleTime: DEFAULT_STALE_TIME,
cacheTime: DEFAULT_CACHE_TIME,
retry: false,
},
},
});
Loading
Loading