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

Dev to Main #8

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# OnlyTokens API url
VITE_ONLY_TOKENS_API_URL='https://api.only-tokens.distributedlab.com'

# JSON RPC provider for receiver chain
VITE_ETHERS_PROVIDER='https://goerli.infura.io/v3/<your_api_key>'


# Receiver token address (display amount of this token on wallet)
# Use '0x0000000000000000000000000000000000000000' - when receive native token (ETH, MATIC, BNB)
# VITE_SELLER_TOKEN='0x1f9840a85d5af5bf1d1762f925bdaddc4201f984' # UNI
VITE_SELLER_TOKEN='0x0000000000000000000000000000000000000000' # Native

# Checkout page
# List of chain IDs available to the sender
VITE_SWAP_CHAINS='5,97'

# Default sender chain, should be in the `VITE_SWAP_CHAINS`
VITE_SWAP_DEFAULT_FROM_CHAIN='5' # Should be one of `VITE_SWAP_CHAINS`

# Default receiver chain, shoud be the same with provider `VITE_ETHERS_PROVIDER`, should be in the `VITE_SWAP_CHAINS`
VITE_SWAP_DEFAULT_TO_CHAIN='5'
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
53 changes: 53 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true,
"node": true
},
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser",
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier",
"simple-import-sort"
],
"extends": [
"eslint:recommended",
"plugin:vue/vue3-recommended",
"@vue/eslint-config-typescript/recommended",
"prettier"
],
"rules": {
"prettier/prettier": [
"error",
{
"printWidth": 120,
"trailingComma": "all",
"endOfLine": "auto",
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "avoid"
}
],
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"no-return-await": "error",
"object-curly-spacing": ["error", "always"],
"no-var": "error",
"linebreak-style": ["error", "unix"],
"generator-star-spacing": "off",
"no-console": ["error", { "allow": ["error"] }],
"padding-line-between-statements": ["error", { "blankLine": "always", "prev": "*", "next": "return" }],
"vue/multi-word-component-names": "off",
"vue/component-definition-name-casing": ["error", "kebab-case"],
"vue/component-name-in-template-casing": ["error", "kebab-case"]
}
}
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@fedokdl
47 changes: 47 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
on:
push:
branches:
- "**"

jobs:
converge:
name: Converge
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install werf
uses: werf/actions/[email protected]

- name: Log in to registry
# This is where you will update the personal access token to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Run echo
run: |
werf version
docker version
echo $GITHUB_REPOSITORY
echo $GITHUB_SHA

- name: Run Build
run: |
. $(werf ci-env github --as-file)
echo "${{ secrets.STAGE_ENV }}" > .env
werf export web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA --dev

deploy:
name: Deploy
needs: converge
runs-on: ubuntu-latest
steps:
- name: ConfigCreate
run: |
mkdir ~/.kube/
echo "${{ secrets.KUBECONFIG }}" > config
mv config ~/.kube/
ls ~/.kube/
kubectl set image deployment/onlytokens-webclient webclient=ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA -n only-tokens
26 changes: 26 additions & 0 deletions .github/workflows/github-actions-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run project linters

on:
push:
branches: ["dev", "main"]
pull_request:
branches: ["dev", "main"]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.13.x]

steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: yarn
- run: yarn lint
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Demo
https://only-tokens.distributedlab.com

### Run
1. Install packages: run `yarn` or `npm i`;
2. Copy `.env.example` to `.env` and setup it;
3. Start project: run `yarn dev` or `npm run dev`;
---
### Checkout guide
1. Go to page /checkout/{<i>address</i>} - where `address` this is token receiver address;
2. Connect your Metamask wallet;
3. Transfer a small number of tokens to the recipient, for example 0.00001 ETH;
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>OnlyTokens</title>

<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link as="style" rel="stylesheet preload" type="text/css" href="/fonts/index.css" crossorigin="anonymous">
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
107 changes: 107 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that
worker_processes auto; #some last versions calculate it automatically

# number of file descriptors used for nginx
# the limit for the maximum FDs on the server is usually set by the OS.
# if you don't set FD's then OS settings will be used which is by default 2000
worker_rlimit_nofile 100000;

# only log critical errors
error_log /var/log/nginx/error.log crit;

# provides the configuration file context in which the directives that affect connection processing are specified.
events {
# determines how much clients will be served per worker
# max clients = worker_connections * worker_processes
# max clients is also limited by the number of socket connections available on the system (~64k)
worker_connections 4000;

# optimized to serve many clients with each thread, essential for linux -- for testing environment
use epoll;

# accept as many connections as possible, may flood worker connections if set too low -- for testing environment
multi_accept on;
}

http {
# Temporary directories for kubernetes "readonlyfilesystem"
client_body_temp_path /tmp/nginx-client-body;
proxy_temp_path /tmp/nginx-proxy;
fastcgi_temp_path /tmp/nginx-fastcgi;
uwsgi_temp_path /tmp/nginx-uwsgi;
scgi_temp_path /tmp/nginx-scgi;
# cache informations about FDs, frequently accessed files
# can boost performance, but you need to test those values
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;

# to boost I/O on HDD we can disable access logs
access_log off;

# copies data between one FD and other from within the kernel
# faster than read() + write()
sendfile on;

# send headers in one piece, it is better than sending them one by one
tcp_nopush on;

# don't buffer data sent, good for small data bursts in real time
tcp_nodelay on;

# reduce the data that needs to be sent over network -- for testing environment
gzip on;
# gzip_static on;
gzip_min_length 10240;
gzip_comp_level 1;
gzip_vary on;
gzip_disable msie6;
gzip_proxied expired no-cache no-store private auth;
gzip_types
# text/html is always compressed by HttpGzipModule
text/css
text/javascript
text/xml
text/plain
text/x-component
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
application/atom+xml
font/truetype
font/opentype
application/vnd.ms-fontobject
image/svg+xml;

# allow the server to close connection on non responding client, this will free up memory
reset_timedout_connection on;

# request timed out -- default 60
client_body_timeout 10;

# if client stop responding, free up memory -- default 60
send_timeout 2;

# server will close connection after this time -- default 75
keepalive_timeout 30;

# number of requests client can make over keep-alive -- for testing environment
keepalive_requests 100000;

include /etc/nginx/mime.types;

server {
listen 80 default_server;
root /usr/share/nginx/html;
index index.html index.htm;
server_name _;
location / {
aio threads;
try_files $uri /index.html;
}
}

}
48 changes: 48 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "only-tokens",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"preview": "yarn build && vite preview",
"lint": "eslint '**/*.{ts,tsx,vue}'"
},
"dependencies": {
"@formkit/vue": "^0.17.4",
"@rarimo/nft-checkout": "^2.0.0-rc.11",
"@rarimo/provider": "^2.0.0-rc.11",
"@rarimo/providers-evm": "^2.0.0-rc.11",
"@vueuse/core": "^10.2.1",
"axios": "^1.4.0",
"bignumber.js": "^9.1.1",
"ethers": "5.7.2",
"lottie-web-vue": "^2.0.7",
"pinia": "^2.1.4",
"typescript": "^5.1.6",
"vue": "^3.3.4",
"vue-router": "4",
"vue-toastification": "^2.0.0-rc.5"
},
"devDependencies": {
"@types/node": "^20.4.2",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/tsconfig": "^0.4.0",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-vue": "^9.15.1",
"prettier": "^3.0.0",
"sass": "^1.68.0",
"vite": "^4.4.9",
"vite-svg-loader": "^4.0.0",
"vue-eslint-parser": "^9.3.1",
"vue-tsc": "^1.8.3"
}
}
9 changes: 9 additions & 0 deletions public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/fonts/Inter/Inter-Medium.ttf
Binary file not shown.
Binary file added public/fonts/Inter/Inter-Regular.ttf
Binary file not shown.
Binary file added public/fonts/Nunito/Nunito-Bold.ttf
Binary file not shown.
Binary file added public/fonts/Nunito/Nunito-Medium.ttf
Binary file not shown.
Binary file added public/fonts/Nunito/Nunito-Regular.ttf
Binary file not shown.
Binary file added public/fonts/Nunito/Nunito-SemiBold.ttf
Binary file not shown.
Loading
Loading