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: introduce frontend #203

Merged
merged 38 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
edb836a
Init
nikitayutanov Aug 23, 2024
dad4cae
Bump deps
nikitayutanov Aug 23, 2024
9f20215
Fix selective wallet connect
nikitayutanov Aug 23, 2024
d0c89d7
Fix ts/eslint dev errors
nikitayutanov Aug 23, 2024
6a46a7a
Pull sails migration
nikitayutanov Aug 26, 2024
3ff9b53
Update balance and config hooks
nikitayutanov Aug 26, 2024
0fc25e5
Add tokens fetch
nikitayutanov Aug 27, 2024
6851d2e
Remove unused swap constants
nikitayutanov Aug 27, 2024
4919534
Add bridging payment address env
nikitayutanov Aug 27, 2024
7c03515
Fix fee loading on eth network
nikitayutanov Aug 27, 2024
9745820
Remove min value
nikitayutanov Aug 27, 2024
06efd09
Add bridge loading state
nikitayutanov Aug 27, 2024
8427eb5
Add vara submit approve
nikitayutanov Aug 28, 2024
2c6b20b
Optimize state reading
nikitayutanov Sep 2, 2024
fa9a526
Replace function names with constants
nikitayutanov Sep 2, 2024
5bbdf0e
Add fee balance check
nikitayutanov Sep 3, 2024
e5473f9
Create Dockerfile
sergeyfilyanin Sep 4, 2024
7e96f2d
Update Dockerfile
sergeyfilyanin Sep 4, 2024
9c8eca1
Update k8s-deploy.yml
sergeyfilyanin Sep 4, 2024
7c92979
Update Dockerfile
sergeyfilyanin Sep 4, 2024
9fbbf9a
Update Dockerfile
sergeyfilyanin Sep 4, 2024
75d2c93
Update Dockerfile
sergeyfilyanin Sep 4, 2024
53a987c
Update Dockerfile
sergeyfilyanin Sep 4, 2024
2e0c020
Update Dockerfile
sergeyfilyanin Sep 4, 2024
8cb4b86
support indexer
nikitayutanov Nov 13, 2024
cd616cb
integrate eth bridging payment
nikitayutanov Nov 14, 2024
4d5057e
add approve ux
nikitayutanov Nov 18, 2024
a140385
add swap networks animation
nikitayutanov Nov 19, 2024
7588866
add detailed transaction card skeletons
nikitayutanov Nov 19, 2024
cd7b6be
add transaction card block explorer link
nikitayutanov Nov 19, 2024
5a3ca3f
await eth bridging request result
nikitayutanov Nov 20, 2024
bc7aba0
fix allowance refetch on successful bridge request
nikitayutanov Nov 20, 2024
fb0b786
remove redudant decimals query
nikitayutanov Nov 20, 2024
2d9a048
fix no account form loading state
nikitayutanov Nov 20, 2024
5b61c5b
update docker env
nikitayutanov Nov 20, 2024
875e740
remove allowance refetch
nikitayutanov Nov 20, 2024
00b0ca2
remove refetch intervals
nikitayutanov Nov 21, 2024
681fc65
migrate to vft manager
nikitayutanov Nov 25, 2024
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: 1 addition & 2 deletions .github/workflows/k8s-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ jobs:
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: frontend
file: frontend/Dockerfile
push: true
tags: ${{ needs.prepair.outputs.image_name }}
Expand All @@ -80,7 +79,7 @@ jobs:
VITE_WALLET_CONNECT_PROJECT_ID=${{ secrets.VITE_WALLET_CONNECT_PROJECT_ID }}
VITE_INDEXER_ADDRESS=${{ secrets.VITE_INDEXER_ADDRESS }}
VITE_BRIDGING_PAYMENT_CONTRACT_ADDRESS=${{ secrets.VITE_BRIDGING_PAYMENT_CONTRACT_ADDRESS }}
VITE_ERC20_TREASURY_CONTRACT_ADDRESS=${{ secrets.VITE_ERC20_TREASURY_CONTRACT_ADDRESS }}
VITE_ETH_BRIDGING_PAYMENT_CONTRACT_ADDRESS=${{ secrets.VITE_ETH_BRIDGING_PAYMENT_CONTRACT_ADDRESS }}

deploy-to-k8s:
needs: [prepair, build-and-push-image]
Expand Down
7 changes: 7 additions & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
VITE_VARA_NODE_ADDRESS=
VITE_ETH_NODE_ADDRESS=
VITE_ETH_CHAIN_ID=
VITE_WALLET_CONNECT_PROJECT_ID=
VITE_INDEXER_ADDRESS=
VITE_BRIDGING_PAYMENT_CONTRACT_ADDRESS=
VITE_ETH_BRIDGING_PAYMENT_CONTRACT_ADDRESS=
69 changes: 69 additions & 0 deletions frontend/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"root": true,
"env": { "browser": true, "es2020": true },

"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:react/jsx-runtime",
"plugin:import/recommended",
"plugin:jsx-a11y/recommended",
"prettier"
],

"settings": {
"ecmaVersion": "latest",
"react": {
"version": "detect"
},
"import/resolver": {
"typescript": true
}
},

"plugins": ["react", "react-hooks", "import", "jsx-a11y", "react-refresh"],

"overrides": [
{
"files": ["*.ts", "*.tsx"],

"parser": "@typescript-eslint/parser",
"parserOptions": { "project": ["./tsconfig.json", "./tsconfig.node.json"] },

"extends": [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/typescript"
],

"plugins": ["@typescript-eslint/eslint-plugin"],

"rules": {
// airbnb cfg
"no-shadow": "error",
"no-shadow-restricted-names": "error",

// dx
"@typescript-eslint/no-unused-vars": "warn",

// react-hook-form onSubmit
"@typescript-eslint/no-misused-promises": [2, { "checksVoidReturn": { "attributes": false } }],

// import sort
"import/order": [
1,
{
"groups": ["external", "builtin", "internal", "parent", "sibling", "index"],
"newlines-between": "always",
"alphabetize": { "order": "asc" }
}
],

// we're using typescript
"react/prop-types": "off"
}
}
]
}
27 changes: 27 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

.env*
!.env.example

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions frontend/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
11 changes: 11 additions & 0 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"trailingComma": "all",
"endOfLine": "lf",
"printWidth": 120,
"semi": true,
"bracketSpacing": true,
"bracketSameLine": true,
"arrowParens": "always",
"tabWidth": 2
}
36 changes: 36 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM node:18-alpine
MAINTAINER gear

WORKDIR /app

COPY ./frontend .

RUN npm install -g pnpm

RUN apk update

RUN apk add xsel

ARG VITE_VARA_NODE_ADDRESS \
VITE_ETH_NODE_ADDRESS \
VITE_ETH_CHAIN_ID \
VITE_WALLET_CONNECT_PROJECT_ID \
VITE_INDEXER_ADDRESS \
VITE_BRIDGING_PAYMENT_CONTRACT_ADDRESS \
VITE_ETH_BRIDGING_PAYMENT_CONTRACT_ADDRESS

ENV VITE_VARA_NODE_ADDRESS=${VITE_VARA_NODE_ADDRESS} \
VITE_ETH_NODE_ADDRESS=${VITE_ETH_NODE_ADDRESS} \
VITE_ETH_CHAIN_ID=${VITE_ETH_CHAIN_ID} \
VITE_WALLET_CONNECT_PROJECT_ID=${VITE_WALLET_CONNECT_PROJECT_ID} \
VITE_INDEXER_ADDRESS=${VITE_INDEXER_ADDRESS} \
VITE_BRIDGING_PAYMENT_CONTRACT_ADDRESS=${VITE_BRIDGING_PAYMENT_CONTRACT_ADDRESS} \
VITE_ETH_BRIDGING_PAYMENT_CONTRACT_ADDRESS=${VITE_ETH_BRIDGING_PAYMENT_CONTRACT_ADDRESS}

RUN pnpm install

RUN pnpm build

RUN npm install --global serve

CMD ["serve", "-s", "/app/dist"]
1 change: 1 addition & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Vara Network Bridge
23 changes: 23 additions & 0 deletions frontend/codegen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { CodegenConfig } from '@graphql-codegen/cli';
import { loadEnv } from 'vite';

const config: CodegenConfig = {
schema: loadEnv('', process.cwd(), '').VITE_INDEXER_ADDRESS,
documents: ['src/**/*.{ts,tsx}'],
ignoreNoDocuments: true, // for better experience with the watcher
generates: {
'./src/features/history/graphql/': {
preset: 'client',
plugins: [],
config: {
scalars: {
DateTime: 'string', // custom subsquid scalars
BigInt: 'string',
},
avoidOptionals: true,
},
},
},
};

export default config;
12 changes: 12 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<title>Vara Network Bridge</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
59 changes: 59 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "frontend",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"start": "vite --open --port 3000",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"codegen": "graphql-codegen"
},
"dependencies": {
"@gear-js/api": "0.38.1",
"@gear-js/react-hooks": "0.12.2",
"@gear-js/vara-ui": "0.0.10",
"@hookform/resolvers": "3.9.0",
"@polkadot/api": "11.0.2",
"@polkadot/react-identicon": "3.9.1",
"@tanstack/react-query": "5.52.1",
"@web3modal/wagmi": "5.1.3",
"graphql": "16.9.0",
"graphql-request": "7.1.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-hook-form": "7.52.2",
"react-number-format": "5.4.0",
"react-router-dom": "6.26.1",
"sails-js": "0.1.8",
"viem": "2.19.6",
"wagmi": "2.12.7",
"zod": "3.23.8"
},
"devDependencies": {
"@graphql-codegen/cli": "5.0.2",
"@graphql-codegen/client-preset": "4.3.3",
"@graphql-typed-document-node/core": "3.2.0",
"@polkadot/types": "11.0.2",
"@types/react": "18.3.4",
"@types/react-dom": "18.3.0",
"@typescript-eslint/eslint-plugin": "8.2.0",
"@typescript-eslint/parser": "8.2.0",
"@vitejs/plugin-react": "4.3.1",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsx-a11y": "6.9.0",
"eslint-plugin-react": "7.35.0",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-react-refresh": "0.4.11",
"sass": "1.77.8",
"typescript": "5.5.4",
"vite": "5.4.2",
"vite-plugin-checker": "0.7.2",
"vite-plugin-node-polyfills": "0.22.0",
"vite-plugin-svgr": "4.2.0"
}
}
Loading
Loading