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: add an approval/funding UI #30

Open
wants to merge 40 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
bc37549
feat: rollback to template
zugdev Nov 20, 2024
6719d29
chore: install dependencies
zugdev Nov 21, 2024
dc3aaaa
feat: base UI
zugdev Nov 21, 2024
68e1715
feat: add network button
zugdev Nov 21, 2024
a220ca3
feat: add chains
zugdev Nov 21, 2024
f6a4e17
chore: format
zugdev Nov 21, 2024
4571b5e
feat: basic styiling and form
zugdev Nov 21, 2024
287505d
feat: add current allowance
zugdev Nov 21, 2024
a3caa79
feat: add neon border
zugdev Nov 26, 2024
9634f81
feat: add token-selector and change expected allowance
zugdev Nov 26, 2024
edd0772
feat: fix token selector
zugdev Nov 26, 2024
3befb07
feat: update dropdown tokens based on network
zugdev Nov 26, 2024
03b9dcf
feat: add erc20 abi
zugdev Nov 26, 2024
6fd952e
feat: rollback to current allowance
zugdev Nov 26, 2024
9d1ffb8
feat: add permit2 address table
zugdev Nov 26, 2024
19f3bbf
feat: add web3 integration
zugdev Nov 26, 2024
5b93446
feat: initially disabled
zugdev Nov 26, 2024
5f48675
feat: better error modal
zugdev Nov 26, 2024
18adb4e
feat: all providers
zugdev Dec 13, 2024
1337208
chore: pull alchemy key from secrets on build
zugdev Dec 13, 2024
3c77a03
chore: yarn
zugdev Dec 18, 2024
6478209
feat: make ALCHEMY_KEY optional
zugdev Dec 18, 2024
4605da3
feat: enable anvil in localhost
zugdev Dec 18, 2024
e2149ad
chore: prettier
zugdev Dec 18, 2024
89b0f04
feat: batch update
zugdev Dec 21, 2024
ba36a2c
feat: responsivity
zugdev Dec 21, 2024
6bec149
chore: fix eslint version
zugdev Dec 21, 2024
1f81afa
Merge branch 'development' of https://github.com/zugdev/onboard.ubq.f…
zugdev Dec 21, 2024
8ea7037
chore: unlog
zugdev Dec 21, 2024
7878d48
feat: fix signer
zugdev Dec 21, 2024
fa44c95
feat: loading while minting tx
zugdev Dec 21, 2024
f421786
feat: capitalize
zugdev Dec 21, 2024
c526d60
feat: get rid of chainId
zugdev Dec 21, 2024
b5c844a
feat: remove button setup
zugdev Dec 21, 2024
f801b95
feat: better naming
zugdev Dec 21, 2024
3ffcf15
feat: add reference for zksync permit2 address
zugdev Dec 21, 2024
bded1b3
feat: use actions/create-github-app-token
zugdev Dec 21, 2024
8f8fa38
feat: getAllowance on address only
zugdev Dec 21, 2024
c22af00
feat: add success modal
zugdev Dec 21, 2024
c0ca66d
feat: success pop up
zugdev Dec 21, 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
40 changes: 3 additions & 37 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,11 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log", "/lib"],
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log"],
"useGitignore": true,
"language": "en",
"words": [
"binkey",
"binsec",
"chainlist",
"cirip",
"dataurl",
"devpool",
"ethersproject",
"fract",
"gnosisscan",
"godb",
"greyscale",
"IERC",
"keccak",
"keypair",
"libsodium",
"Numberish",
"outdir",
"Rpcs",
"scalarmult",
"servedir",
"solmate",
"sonarjs",
"typebox",
"TYPEHASH",
"ubiquibot",
"UBIQUIBOT",
"URLSAFE",
"WXDAI",
"XDAI",
"xmark",
"wfzpewmlyiozupulbuur",
"SUPABASE",
"Knip"
],
"dictionaries": ["typescript", "node", "software-terms", "html"],
"words": ["dataurl", "devpool", "outdir", "servedir"],
"dictionaries": ["typescript", "node", "software-terms"],
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
"ignoreRegExpList": ["[0-9a-fA-F]{6}"]
}
4 changes: 0 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
# your Supabase url, e.g. https://wfzpewmlyiozupulbuur.supabase.co
SUPABASE_URL=""
# your Supabase Anon Key that you can find under settings/api, e.g eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6IndmenBld21seWlvenVwdWxidXVyIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTU2NzQzMzksImV4cCI6MjAxMTI1MDMzOX0.SKIL3Q0NOBaMehH0ekFspwgcu3afp3Dl9EDzPqs1nKs
SUPABASE_ANON_KEY=""
24 changes: 13 additions & 11 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@
"parserOptions": {
"project": ["./tsconfig.json"]
},
"plugins": ["@typescript-eslint", "sonarjs"],
"plugins": ["@typescript-eslint", "sonarjs", "filename-rules"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:sonarjs/recommended"],
"ignorePatterns": ["**/*.js"],
"rules": {
"filename-rules/match": [2, "/^(e2e\\.ts$|.*\\/e2e\\.ts$|[a-z0-9]+(?:[-._a-z0-9]+)*\\.ts|\\.[a-z0-9]+)$/"],
"prefer-arrow-callback": ["warn", { "allowNamedFunctions": true }],
"func-style": ["warn", "declaration", { "allowArrowFunctions": false }],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"constructor-super": "error",
"no-invalid-this": "off",
"@typescript-eslint/no-invalid-this": ["error"],
"@typescript-eslint/no-invalid-this": "error",
"no-restricted-syntax": ["error", "ForInStatement"],
"use-isnan": "error",
"no-unneeded-ternary": "error",
"no-nested-ternary": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
Expand All @@ -38,16 +41,15 @@
"sonarjs/no-identical-expressions": "error",
"@typescript-eslint/naming-convention": [
"error",
{ "selector": "interface", "format": ["PascalCase"], "custom": { "regex": "^I[A-Z]", "match": false } },
{ "selector": "memberLike", "modifiers": ["private"], "format": ["camelCase"], "leadingUnderscore": "require" },
{ "selector": "typeLike", "format": ["PascalCase"] },
{ "selector": "typeParameter", "format": ["PascalCase"], "prefix": ["T"] },
{ "selector": "variable", "format": ["camelCase", "UPPER_CASE"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
{ "selector": "variable", "format": ["camelCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
{ "selector": "interface", "format": ["StrictPascalCase"], "custom": { "regex": "^I[A-Z]", "match": false } },
{ "selector": "memberLike", "modifiers": ["private"], "format": ["strictCamelCase"], "leadingUnderscore": "require" },
{ "selector": "typeLike", "format": ["StrictPascalCase"] },
{ "selector": "typeParameter", "format": ["StrictPascalCase"], "prefix": ["T"] },
{ "selector": "variable", "format": ["strictCamelCase", "UPPER_CASE"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" },
{ "selector": "variable", "modifiers": ["destructured"], "format": null },
{ "selector": "variable", "types": ["boolean"], "format": ["PascalCase"], "prefix": ["is", "should", "has", "can", "did", "will", "does"] },
{ "selector": "variableLike", "format": ["camelCase"] },
{ "selector": ["function", "variable"], "format": ["camelCase"] }
{ "selector": "variable", "types": ["boolean"], "format": ["StrictPascalCase"], "prefix": ["is", "should", "has", "can", "did", "will", "does"] },
{ "selector": "variableLike", "format": ["strictCamelCase"] },
{ "selector": ["function", "variable"], "format": ["strictCamelCase"] }
]
}
}
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @rndquu
zugdev marked this conversation as resolved.
Show resolved Hide resolved

129 changes: 129 additions & 0 deletions .github/empty-string-checker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import * as core from "@actions/core";
import { Octokit } from "@octokit/rest";
import simpleGit from "simple-git";

const token = process.env.GITHUB_TOKEN;
const [owner, repo] = process.env.GITHUB_REPOSITORY?.split("/") || [];
const pullNumber = process.env.GITHUB_PR_NUMBER || process.env.PULL_REQUEST_NUMBER || "0";
const baseRef = process.env.GITHUB_BASE_REF;

if (!token || !owner || !repo || pullNumber === "0" || !baseRef) {
core.setFailed("Missing required environment variables.");
process.exit(1);
}

const octokit = new Octokit({ auth: token });
const git = simpleGit();

async function main() {
try {
const { data: pullRequest } = await octokit.pulls.get({
owner,
repo,
pull_number: parseInt(pullNumber, 10),
});

const baseSha = pullRequest.base.sha;
const headSha = pullRequest.head.sha;

await git.fetch(["origin", baseSha, headSha]);

const diff = await git.diff([`${baseSha}...${headSha}`]);

core.info("Checking for empty strings...");
const violations = parseDiffForEmptyStrings(diff);

if (violations.length > 0) {
violations.forEach(({ file, line, content }) => {
core.warning(
"Detected an empty string.\n\nIf this is during variable initialization, consider using a different approach.\nFor more information, visit: https://www.github.com/ubiquity/ts-template/issues/31",
{
file,
startLine: line,
}
);
});

// core.setFailed(`${violations.length} empty string${violations.length > 1 ? "s" : ""} detected in the code.`);

await octokit.rest.checks.create({
owner,
repo,
name: "Empty String Check",
head_sha: headSha,
status: "completed",
conclusion: violations.length > 0 ? "failure" : "success",
output: {
title: "Empty String Check Results",
summary: `Found ${violations.length} violation${violations.length !== 1 ? "s" : ""}`,
annotations: violations.map((v) => ({
path: v.file,
start_line: v.line,
end_line: v.line,
annotation_level: "warning",
message: "Empty string found",
raw_details: v.content,
})),
},
});
} else {
core.info("No empty strings found.");
}
} catch (error) {
core.setFailed(`An error occurred: ${error instanceof Error ? error.message : String(error)}`);
}
}

function parseDiffForEmptyStrings(diff: string) {
const violations: Array<{ file: string; line: number; content: string }> = [];
const diffLines = diff.split("\n");

let currentFile: string;
let headLine = 0;
let inHunk = false;

diffLines.forEach((line) => {
const hunkHeaderMatch = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(line);
if (hunkHeaderMatch) {
headLine = parseInt(hunkHeaderMatch[1], 10);
inHunk = true;
return;
}

if (line.startsWith("--- a/") || line.startsWith("+++ b/")) {
currentFile = line.slice(6);
inHunk = false;
return;
}

// Only process TypeScript files
if (!currentFile?.endsWith(".ts")) {
return;
}

if (inHunk && line.startsWith("+")) {
// Check for empty strings in TypeScript syntax
if (/^\+.*""/.test(line)) {
// Ignore empty strings in comments
if (!line.trim().startsWith("//") && !line.trim().startsWith("*")) {
// Ignore empty strings in template literals
if (!/`[^`]*\$\{[^}]*\}[^`]*`/.test(line)) {
violations.push({
file: currentFile,
line: headLine,
content: line.substring(1).trim(),
});
}
}
}
headLine++;
} else if (!line.startsWith("-")) {
headLine++;
}
});

return violations;
}
main().catch((error) => {
core.setFailed(`Error running empty string check: ${error instanceof Error ? error.message : String(error)}`);
});
13 changes: 13 additions & 0 deletions .github/knip.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { KnipConfig } from "knip";

const config: KnipConfig = {
entry: ["build/index.ts", ".github/empty-string-checker.ts"],
project: ["src/**/*.ts"],
ignore: ["src/types/config.ts", "**/__mocks__/**", "**/__fixtures__/**"],
ignoreExportsUsedInFile: true,
// eslint can also be safely ignored as per the docs: https://knip.dev/guides/handling-issues#eslint--jest
ignoreDependencies: ["eslint-config-prettier", "eslint-plugin-prettier", "@types/jest", "@mswjs/data"],
eslint: true,
};

export default config;
8 changes: 2 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
# with:
# submodules: "recursive" # Ensures submodules are checked out

- name: Set up Node.js
uses: actions/setup-node@v4
Expand All @@ -27,10 +25,8 @@ jobs:
run: |
yarn
yarn build
env: # Set environment variables for the build
FRONTEND_URL: "https://onboard.ubq.fi"
SUPABASE_URL: "https://wfzpewmlyiozupulbuur.supabase.co"
SUPABASE_ANON_KEY: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6IndmenBld21seWlvenVwdWxidXVyIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTU2NzQzMzksImV4cCI6MjAxMTI1MDMzOX0.SKIL3Q0NOBaMehH0ekFspwgcu3afp3Dl9EDzPqs1nKs"
env:
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }}

- name: Upload build artifact
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ jobs:
name: Conventional Commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ubiquity/action-conventional-commits@master
9 changes: 4 additions & 5 deletions .github/workflows/cypress-testing.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Run Cypress testing suite
on:
workflow_dispatch:
pull_request:
workflow_run:
workflows: ["Build"]
types:
- completed

jobs:
cypress-run:
Expand All @@ -17,13 +20,9 @@ jobs:
with:
build: yarn run build
start: yarn start
browser: chrome
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FRONTEND_URL: "http://localhost:8080"
SUPABASE_URL: "https://wfzpewmlyiozupulbuur.supabase.co"
SUPABASE_ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6IndmenBld21seWlvenVwdWxidXVyIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTU2NzQzMzksImV4cCI6MjAxMTI1MDMzOX0.SKIL3Q0NOBaMehH0ekFspwgcu3afp3Dl9EDzPqs1nKs
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ jobs:
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
commit_sha: ${{ github.event.workflow_run.head_sha }}
workflow_run_id: ${{ github.event.workflow_run.id }}
app_id: ${{ secrets.APP_ID }}
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
27 changes: 27 additions & 0 deletions .github/workflows/jest-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run Jest testing suite
on:
workflow_dispatch:
pull_request:

env:
NODE_ENV: "test"

jobs:
testing:
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: "20.10.0"

- uses: actions/checkout@master
with:
fetch-depth: 0

- name: Jest With Coverage
run: yarn install --immutable --immutable-cache --check-cache && yarn test

- name: Add Jest Report to Summary
if: always()
run: echo "$(cat test-dashboard.md)" >> $GITHUB_STEP_SUMMARY
11 changes: 0 additions & 11 deletions .github/workflows/knip-reporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,6 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion != 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.10.0

- name: Install toolchain
run: yarn install

- uses: actions/download-artifact@v4
with:
name: knip-results
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/knip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

# needed to use yarn v4
- name: Enable corepack
run: corepack enable

- name: Setup Node
uses: actions/setup-node@v4
with:
Expand All @@ -22,7 +26,7 @@ jobs:
run: echo ${{ github.event.number }} > pr-number.txt

- name: Run Knip
run: yarn knip || yarn -s knip --reporter json > knip-results.json
run: yarn knip || yarn knip --reporter json > knip-results.json

- name: Upload knip result
if: failure()
Expand Down
Loading
Loading