Skip to content

Commit

Permalink
Merge branch 'development' into feat/rewrite-transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
pbkompasz committed Oct 9, 2024
2 parents 7beaaaf + dbe772f commit fe37d8d
Show file tree
Hide file tree
Showing 14 changed files with 2,147 additions and 684 deletions.
49 changes: 36 additions & 13 deletions .github/workflows/sync-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,44 @@ jobs:
- name: Sync branch to template
env:
GH_TOKEN: ${{ steps.get_installation_token.outputs.token }}
IGNORE_FILES: "README.md another-file.txt"
run: |
branch_name=$(git rev-parse --abbrev-ref HEAD)
original_remote=$(git remote get-url origin)
pr_branch="sync-template/${branch_name}"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git config --global user.email "ubiquity-os[bot]@users.noreply.github.com"
git config --global user.name "ubiquity-os[bot]"
git remote add template https://github.com/ubiquity/ts-template.git
git fetch template
git checkout -b "$pr_branch"
git clone https://github.com/ubiquity/ts-template
for file in $IGNORE_FILES; do
rm -rf "ts-template/$file"
done
cp -rf ts-template/* .
rm -rf ts-template/
git add .
git commit -m "chore: sync template"
git push "$original_remote" "$pr_branch"
gh pr create --title "Sync branch to template" --body "This pull request merges changes from the template repository." --head "$pr_branch" --base "$branch_name"
last_sync=$(git log --grep="Sync template" --format="%H" -n 1)
if [ -n "$last_sync" ]; then
# If there's a previous sync, try to cherry-pick new changes
if ! git cherry-pick $last_sync..template/main; then
# If cherry-pick fails, abort and try a merge instead
git cherry-pick --abort
git merge template/main --no-commit
fi
else
# If it's the first sync, merge the template
git merge template/main --allow-unrelated-histories --no-commit
fi
# Check if there are any changes
if git diff --staged --quiet && git diff --quiet; then
echo "No changes to sync from template."
exit 0
fi
# Commit changes, even if there are conflicts
git commit -am "chore: sync template (with potential conflicts)" || true
# Push changes and create PR
git push -f "$original_remote" "$pr_branch"
gh pr create --title "Sync branch to template (manual resolution required)" \
--body "This pull request merges changes from the template repository. There may be conflicts that require manual resolution." \
--head "$pr_branch" \
--base "$branch_name" || true
3 changes: 1 addition & 2 deletions build/esbuild-build.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { execSync } from "child_process";
import { config } from "dotenv";
import esbuild from "esbuild";
import { readFileSync, appendFileSync, writeFileSync } from "fs";
import { join } from "path";
import { appendFileSync, readFileSync, writeFileSync } from "fs";

// CSS files in order
const cssFiles: string[] = [
Expand Down
14 changes: 6 additions & 8 deletions build/esbuild-server.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import esbuild from "esbuild";
import { esBuildContext } from "./esbuild-build";

(async () => {
await server();
})().catch((error) => {
console.error("Unhandled error:", error);
startServer().catch((error) => {
console.error("Server startup error:", error);
process.exit(1);
});

export async function server() {
const _context = await esbuild.context(esBuildContext);
const { port } = await _context.serve({
async function startServer() {
const context = await esbuild.context(esBuildContext);
const { port } = await context.serve({
servedir: "static",
port: 8080,
});
console.log(`http://localhost:${port}`);
console.log(`Server running at http://localhost:${port}`);
}
7 changes: 3 additions & 4 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { defineConfig } from "cypress";
import { config } from "dotenv";

config();

export default defineConfig({
e2e: {
setupNodeEvents() {},
setupNodeEvents() {
// implement node event listeners here
},
baseUrl: "http://localhost:8080",
experimentalStudio: true,
},
Expand Down
5 changes: 2 additions & 3 deletions cypress/scripts/anvil.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { RPCHandler } from "@ubiquity-dao/rpc-handler";
import { spawnSync } from "child_process";
import { useHandler } from "../../static/scripts/rewards/web3/use-rpc-handler";
// @ts-expect-error - Missing types
import { RPCHandler } from "@ubiquity-dao/rpc-handler";

class Anvil {
rpcs: string[] = [];
rpcHandler: RPCHandler | null = null;

async init() {
this.rpcHandler = await useHandler(100);
this.rpcHandler = useHandler(100);
console.log(`[RPCHandler] Fetching RPCs...`);
await this.rpcHandler.testRpcPerformance();
const latencies: Record<string, number> = this.rpcHandler.getLatencies();
Expand Down
10 changes: 10 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"preset": "ts-jest",
"testEnvironment": "node",
"roots": ["./tests"],
"coveragePathIgnorePatterns": ["node_modules", "mocks"],
"collectCoverage": true,
"coverageReporters": ["json", "lcov", "text", "clover", "json-summary"],
"reporters": ["default", "jest-junit", "jest-md-dashboard"],
"coverageDirectory": "coverage"
}
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "pay.ubq.fi",
"version": "1.0.0",
"description": "Claim your DevPool rewards.",
"description": "Claim your UbiquityOS rewards.",
"main": "build/index.ts",
"author": "Ubiquity DAO",
"license": "MIT",
"engines": {
"node": ">=20.10.0"
"node": "20.10.0"
},
"scripts": {
"start": "run-s start:sign start:ui",
Expand All @@ -21,7 +21,6 @@
"format:lint": "eslint --fix .",
"format:prettier": "prettier --write .",
"format:cspell": "cspell **/*",
"prepare": "husky install",
"postinstall": "git submodule update --init --recursive",
"test:anvil": "tsx cypress/scripts/anvil.ts",
"test:start": "yarn start",
Expand All @@ -30,6 +29,8 @@
"test:fund": "tsx cypress/scripts/funding.ts",
"knip": "knip --config .github/knip.ts",
"knip-ci": "knip --no-exit-code --reporter json --config .github/knip.ts",
"prepare": "husky install",
"test": "jest --setupFiles dotenv/config --coverage",
"cy:open": "cypress open",
"cy:run": "cypress run"
},
Expand All @@ -46,41 +47,43 @@
"@ubiquibot/permit-generation": "1.4.1",
"@ubiquity-dao/rpc-handler": "^1.1.0",
"dotenv": "^16.4.4",
"ethers": "^5.7.2",
"npm-run-all": "^4.1.5"
"ethers": "^5.7.2"
},
"devDependencies": {
"@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.2",
"@cspell/dict-node": "^4.0.3",
"@cspell/dict-software-terms": "^3.3.18",
"@cspell/dict-typescript": "^3.1.2",
"@types/ethereum-protocol": "^1.0.5",
"@types/node": "^20.11.19",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"cspell": "^8.4.0",
"cypress": "13.7.0",
"cypress": "13.6.6",
"esbuild": "^0.20.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-filename-rules": "^1.3.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-sonarjs": "^0.24.0",
"ethereum-protocol": "^1.0.1",
"husky": "^9.0.11",
"jest": "29.7.0",
"jest-junit": "16.0.0",
"jest-md-dashboard": "0.8.0",
"knip": "^5.0.1",
"lint-staged": "^15.2.2",
"nodemon": "^3.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.5",
"ts-jest": "29.1.2",
"tsx": "^4.7.1",
"typescript": "^5.3.3"
},
"lint-staged": {
"*.ts": [
"yarn prettier --write",
"eslint --fix",
"bash .github/workflows/scripts/kebab-case.sh"
"eslint --fix"
],
"src/**.{ts,json}": [
"cspell"
Expand Down
14 changes: 11 additions & 3 deletions scripts/typescript/generate-erc20-permit-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,18 @@ export async function generateErc20Permit() {
const permitTransferFromData = await createPermitTransferFromData(process.env.AMOUNT_IN_ETH);
const signature = await signTypedData(myWallet, permitTransferFromData);

const permitTransferFromData2 = await createPermitTransferFromData("9");
const sig = await signTypedData(myWallet, permitTransferFromData);
// const permitTransferFromData2 = await createPermitTransferFromData("9");
// const sig = await signTypedData(myWallet, permitTransferFromData);

const txData = [createTxData(myWallet, permitTransferFromData, signature), createTxData(myWallet, permitTransferFromData2, sig)];
const txData = [
createTxData(myWallet, permitTransferFromData, signature),
// createTxData(myWallet, permitTransferFromData2, sig),
// createTxData(myWallet, permitTransferFromData2, sig),
// createTxData(myWallet, permitTransferFromData2, sig),
// createTxData(myWallet, permitTransferFromData2, sig),
// createTxData(myWallet, permitTransferFromData2, sig),
// createTxData(myWallet, permitTransferFromData2, sig),
];

const base64encodedTxData = Buffer.from(JSON.stringify(txData)).toString("base64");

Expand Down
4 changes: 2 additions & 2 deletions static/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<link rel="icon" href="favicon.svg" type="image/x-icon" />
<link href="bundles/bundles.css" rel="stylesheet" />
Expand Down Expand Up @@ -44,7 +44,7 @@
</svg>
</div>
<div id="logo-text">
<span>Ubiquity</span>
<span>Ubiquity DAO | </span>
<span>Rewards</span>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion static/styles/rewards/claim-table.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ main > div {
flex-grow: 1;
display: flex;
flex-direction: column;
justify-content: center;
justify-content: space-evenly;
align-items: center;
width: 100%;
gap: 64px;
Expand Down
30 changes: 5 additions & 25 deletions static/styles/rewards/media-queries.css
Original file line number Diff line number Diff line change
@@ -1,39 +1,19 @@
header span:first-child::after {
/* content: " | "; */
}

@media screen and (max-width: 640px) {
table {
border-left-width: 0px;
border-right-width: 0px;
border-left-width: 0;
border-right-width: 0;
}
}
@media screen and (max-width: 768px) {
header span:first-child {
display: none;
}

header span:first-child::after {
content: "";
}
}

/*
@media screen and (min-height: 512px) {
table[data-details-visible="false"] #additional-details-border ~ tr {
display: none;
}
table[data-details-visible="true"] #additional-details-border ~ tr {
display: table-row;
}
} */

/* Landscape */
@media screen and (orientation: landscape) {
body {
width: 100%; /* 100% of viewport width */
max-width: 100%; /* prevents any overflow issues */
overflow-x: hidden; /* prevents horizontal scrolling */
width: 100%;
max-width: 100%;
overflow-x: hidden;
padding-left: env(safe-area-inset-left);
padding-right: env(safe-area-inset-right);
}
Expand Down
Loading

0 comments on commit fe37d8d

Please sign in to comment.