Skip to content
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
18 changes: 18 additions & 0 deletions .env.mainnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
VITE_SIDECHAIN_ID=tDVV
VITE_NETWORK_TYPE=MAINNET
VITE_RPC_URL_AELF=https://explorer.aelf.io/chain
VITE_RPC_URL_TDVV=https://tdvv-explorer.aelf.io/chain
VITE_RPC_URL_TDVW=https://tdvv-explorer.aelf.io/chain
VITE_CONNECT_SERVER=https://auth-portkey.portkey.finance
VITE_CONNECT_URL=https://auth-aa-portkey.portkey.finance
VITE_GRAPHQL_SERVER=https://indexer-api.aefinder.io/api/app/graphql/portkey
VITE_PORTKEY_SERVER=https://aa-portkey.portkey.finance
VITE_SIDE_CHAIN_CA_CONTRACT_ADDRESS=2UthYi7AHRdfrqc1YCfeQnjdChDLaas65bW4WxESMGMojFiXj9
VITE_PROPAL_ADDRESS=2tCM3oV6dTCmwFxSiFGPEVhGngdMwBV741wi156vj8kmqfp6da
VITE_VOTE_ADDRESS=2A8h4hLynLt86RxqvpNY43x6Js8CYhgyuAzj7sDGQ2ecP77Zgp
VITE_HOST=https://tmrwdao.com
VITE_TELEGRAM_BOT_ID=7225715915
VITE_NFT_SYMBOL=TOMORROWPASS-1
VITE_TG_LINK=https://t.me/VotigramBot/votigram_web_app
VITE_BASE_URL=https://api.tmrwdao.com
VITE_ADSGRAM_ID=6793
18 changes: 18 additions & 0 deletions .env.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
VITE_SIDECHAIN_ID=tDVW
VITE_NETWORK_TYPE=TESTNET
VITE_RPC_URL_AELF=https://explorer-test.aelf.io/chain
VITE_RPC_URL_TDVV=https://tdvw-test-node.aelf.io
VITE_RPC_URL_TDVW=https://tdvw-test-node.aelf.io
VITE_CONNECT_SERVER=https://auth-portkey-test.portkey.finance
VITE_CONNECT_URL=https://auth-aa-portkey-test.portkey.finance
VITE_GRAPHQL_SERVER=https://test-indexer-api.aefinder.io/api/app/graphql/portkey
VITE_PORTKEY_SERVER=https://aa-portkey-test.portkey.finance
VITE_SIDE_CHAIN_CA_CONTRACT_ADDRESS=238X6iw1j8YKcHvkDYVtYVbuYk2gJnK8UoNpVCtssynSpVC8hb
VITE_PROPAL_ADDRESS=2sJ8MDufVDR3V8fDhBPUKMdP84CUf1oJroi9p8Er1yRvMp3fq7
VITE_VOTE_ADDRESS=2LpoLYNPAnjiBUozyYwcfaeekxRFehjt6hDR78VKgk47UwkvAv
VITE_HOST=https://test.tmrwdao.com
VITE_TELEGRAM_BOT_ID=7190916077
VITE_NFT_SYMBOL=TOMORROWPASSTEST-1
VITE_TG_LINK=https://t.me/monkeyTmrwDevBot/votigram
VITE_BASE_URL=https://test-api.tmrwdao.com
VITE_ADSGRAM_ID=6800
52 changes: 52 additions & 0 deletions .github/workflows/mainnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and Push Image
on:
push:
tags:
- "v*.*.*"
jobs:
build-and-push-image:
runs-on: tmrwdao-runner
permissions:
contents: read
outputs:
short_sha: ${{ steps.vars.outputs.short_sha }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "short_sha=$calculatedSha" >> "$GITHUB_OUTPUT"

- name: Create image tag
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.REPOSITORY_REGION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ secrets.REPOSITORY }}/votigram-web
tags: |
type=ref,event=tag

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v5
env:
VITE_ADSGRAM_ID: ${{ secrets.VITE_ADSGRAM_ID }}
VITE_HASH: ${{ secrets.VITE_HASH_MAINNET }}
with:
context: .
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
BUILD_SCRIPT=build:mainnet
VITE_ADSGRAM_ID=${{ secrets.VITE_ADSGRAM_ID }}
VITE_HASH=${{ secrets.VITE_HASH_MAINNET }}
VITE_BASE_URL=${{ secrets.VITE_BASE_URL }}
APP_ENV=mainnet
23 changes: 23 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Security Review

permissions:
pull-requests: write
contents: read

on:
pull_request:

jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 2

- uses: Portkey-Wallet/claude-code-security-review@main
with:
comment-pr: true
claude-api-key: ${{ secrets.CLAUDE_API_KEY }}
run-every-commit: true
69 changes: 69 additions & 0 deletions .github/workflows/testnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build and Push Image
on:
push:
branches: ["dev", "feat/v1.0.11"]
jobs:
build-and-push-image:
runs-on: tmrwdao-runner
permissions:
contents: read
outputs:
short_sha: ${{ steps.vars.outputs.short_sha }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "short_sha=$calculatedSha" >> "$GITHUB_OUTPUT"

- name: Create image tag
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.REPOSITORY_REGION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ secrets.REPOSITORY }}/votigram-web
tags: |
type=sha

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v5
env:
VITE_NETWORK_TYPE: TESTNET
VITE_HASH: ${{ secrets.VITE_HASH_TESTNET }}
with:
context: .
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
BUILD_SCRIPT=build:testnet
VITE_HASH=${{ secrets.VITE_HASH_TESTNET }}
APP_ENV=testnet

dispatch:
runs-on: tmrwdao-runner
needs: build-and-push-image
steps:
- name: Deploy
uses: actions/github-script@v6
with:
github-token: ${{ secrets.TOK }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'TomorrowDAOProject',
repo: 'devops',
workflow_id: 'deployment_testnet.yaml',
ref: 'main',
inputs: {
appName: 'votigram-web-server',
commit_sha: 'sha-${{ needs.build-and-push-image.outputs.short_sha }}',
}
})
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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?

coverage

.env
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

# Use the official Node.js image to build the app
FROM node:18 AS builder

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package.json ./
COPY pnpm-lock.yaml ./

# Install dependencies
RUN npm install -g pnpm
RUN pnpm install

# Copy the rest of the application code
COPY . .

# Pass environment variables during the build process
ARG BUILD_SCRIPT=build:testnet
ARG VITE_HASH

ENV VITE_HASH=${VITE_HASH}

# Build the application and handle non-root
RUN yarn ${BUILD_SCRIPT}

# Use the official nginx image for serving static files
FROM nginx:alpine

# Copy the build output to the nginx html directory
COPY --from=builder /app/dist /usr/share/nginx/html

# Copy the nginx configuration file
COPY nginx.conf /etc/nginx/conf.d/default.conf

# Expose port 80
EXPOSE 80

# Start nginx
CMD ["nginx", "-g", "daemon off;"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Portkey

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.
68 changes: 68 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
import importPlugin from "eslint-plugin-import"; // Add this

export default tseslint.config(
{ ignores: ["dist", "coverage", "node_modules"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
import: importPlugin, // Include the plugin
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
// Add the import/order rule
"import/order": [
"warn",
{
groups: [
["builtin", "external"], // Node.js and external libraries
["internal", "parent", "sibling", "index"], // Internal and relative imports
"type", // Type imports (from TypeScript)
],
pathGroups: [
{
pattern: "react",
group: "builtin",
position: "before",
},
{
pattern: "@/**", // Adjust if using aliases like `@/*` for absolute imports
group: "internal",
position: "before",
},
],
pathGroupsExcludedImportTypes: ["react"],
alphabetize: {
order: "asc", // Sort in ascending order
caseInsensitive: true, // Ignore case when sorting
},
"newlines-between": "always", // Add newline between groups
},
],
"no-unused-vars": "off", // Disable base ESLint rule
"@typescript-eslint/no-unused-vars": [
"warn", // You can set this to "error" if needed
{
vars: "all", // Check all variables
args: "after-used", // Ignore unused function arguments after the last used one
ignoreRestSiblings: true, // Ignore rest siblings in object destructuring
},
],
},
}
);
25 changes: 25 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&family=Press+Start+2P&family=Questrial&display=swap"
rel="stylesheet">
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Votigram Bot</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script async src="https://sad.adsgram.ai/js/sad.min.js"></script>
<script src="https://telegram.org/js/telegram-web-app.js?56"></script>
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.3/dist/confetti.browser.min.js"></script>
</body>

</html>
7 changes: 7 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
}
}
Loading
Loading