From 8a3703c6013e35d48c0ba479647cb7dadfdeb32a Mon Sep 17 00:00:00 2001 From: MantisClone Date: Thu, 27 Feb 2025 13:37:31 -0500 Subject: [PATCH 01/10] chore: bump minor version to 0.3.0 --- package-lock.json | 4 +- package.json | 112 +++++++++++++++++++++++----------------------- 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5a7cc53..bd45a96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "request-scan", - "version": "0.2.11", + "version": "0.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "request-scan", - "version": "0.2.11", + "version": "0.3.0", "dependencies": { "@next/third-parties": "^15.0.3", "@radix-ui/react-avatar": "^1.1.0", diff --git a/package.json b/package.json index 4ff3af8..ceed4b9 100644 --- a/package.json +++ b/package.json @@ -1,58 +1,58 @@ { - "name": "request-scan", - "version": "0.2.11", - "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "lint": "next lint", - "format": "biome check --write .", - "prepare": "husky install" - }, - "dependencies": { - "@next/third-parties": "^15.0.3", - "@radix-ui/react-avatar": "^1.1.0", - "@radix-ui/react-dialog": "^1.1.1", - "@radix-ui/react-dropdown-menu": "^2.1.1", - "@radix-ui/react-separator": "^1.1.0", - "@radix-ui/react-slot": "^1.1.0", - "@radix-ui/react-tabs": "^1.1.0", - "@react-pdf/renderer": "^3.4.4", - "@requestnetwork/currency": "^0.18.0", - "@requestnetwork/data-format": "^0.19.0", - "@requestnetwork/request-client.js": "^0.49.0", - "@requestnetwork/types": "^0.45.0", - "@tanstack/react-query": "^5.52.2", - "@tanstack/react-table": "^8.20.5", - "class-variance-authority": "^0.7.0", - "clsx": "^2.1.1", - "graphql-request": "^7.1.0", - "html2pdf.js": "^0.10.2", - "json-edit-react": "^1.15.12", - "lucide-react": "^0.428.0", - "next": "14.2.5", - "react": "^18", - "react-dom": "^18", - "react-social-icons": "^6.18.0", - "tailwind-merge": "^2.5.2", - "tailwindcss-animate": "^1.0.7", - "timeago-react": "^3.0.6", - "truncate-eth-address": "^1.0.2", - "viem": "^2.21.0" - }, - "devDependencies": { - "@biomejs/biome": "^1.9.4", - "@types/file-saver": "^2.0.7", - "@types/node": "^20", - "@types/react": "^18", - "@types/react-dom": "^18", - "eslint": "^8", - "eslint-config-next": "14.2.5", - "husky": "^9.1.7", - "lint-staged": "^15.2.10", - "postcss": "^8", - "tailwindcss": "^3.4.1", - "typescript": "^5" - } + "name": "request-scan", + "version": "0.3.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint", + "format": "biome check --write .", + "prepare": "husky install" + }, + "dependencies": { + "@next/third-parties": "^15.0.3", + "@radix-ui/react-avatar": "^1.1.0", + "@radix-ui/react-dialog": "^1.1.1", + "@radix-ui/react-dropdown-menu": "^2.1.1", + "@radix-ui/react-separator": "^1.1.0", + "@radix-ui/react-slot": "^1.1.0", + "@radix-ui/react-tabs": "^1.1.0", + "@react-pdf/renderer": "^3.4.4", + "@requestnetwork/currency": "^0.18.0", + "@requestnetwork/data-format": "^0.19.0", + "@requestnetwork/request-client.js": "^0.49.0", + "@requestnetwork/types": "^0.45.0", + "@tanstack/react-query": "^5.52.2", + "@tanstack/react-table": "^8.20.5", + "class-variance-authority": "^0.7.0", + "clsx": "^2.1.1", + "graphql-request": "^7.1.0", + "html2pdf.js": "^0.10.2", + "json-edit-react": "^1.15.12", + "lucide-react": "^0.428.0", + "next": "14.2.5", + "react": "^18", + "react-dom": "^18", + "react-social-icons": "^6.18.0", + "tailwind-merge": "^2.5.2", + "tailwindcss-animate": "^1.0.7", + "timeago-react": "^3.0.6", + "truncate-eth-address": "^1.0.2", + "viem": "^2.21.0" + }, + "devDependencies": { + "@biomejs/biome": "^1.9.4", + "@types/file-saver": "^2.0.7", + "@types/node": "^20", + "@types/react": "^18", + "@types/react-dom": "^18", + "eslint": "^8", + "eslint-config-next": "14.2.5", + "husky": "^9.1.7", + "lint-staged": "^15.2.10", + "postcss": "^8", + "tailwindcss": "^3.4.1", + "typescript": "^5" + } } From f7a301a5899f36e9df5899e5ebdfed35882d0512 Mon Sep 17 00:00:00 2001 From: MantisClone Date: Thu, 27 Feb 2025 14:24:25 -0500 Subject: [PATCH 02/10] chore: Adjust how biome is invoked --- .husky/pre-commit | 2 +- .lintstagedrc.js | 4 -- .lintstagedrc.json | 5 ++ package.json | 114 +++++++++++++++++++++++---------------------- 4 files changed, 64 insertions(+), 61 deletions(-) delete mode 100644 .lintstagedrc.js create mode 100644 .lintstagedrc.json diff --git a/.husky/pre-commit b/.husky/pre-commit index 2312dc5..0100eae 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1 @@ -npx lint-staged +npm run lint-staged diff --git a/.lintstagedrc.js b/.lintstagedrc.js deleted file mode 100644 index db7171a..0000000 --- a/.lintstagedrc.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - "**/*.{js,jsx,ts,tsx}": ["biome format --write", "biome lint"], - "*.json": ["biome format --write"], -}; diff --git a/.lintstagedrc.json b/.lintstagedrc.json new file mode 100644 index 0000000..6847973 --- /dev/null +++ b/.lintstagedrc.json @@ -0,0 +1,5 @@ +{ + "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [ + "biome check --write --no-errors-on-unmatched" + ] +} diff --git a/package.json b/package.json index ceed4b9..a506fcd 100644 --- a/package.json +++ b/package.json @@ -1,58 +1,60 @@ { - "name": "request-scan", - "version": "0.3.0", - "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "lint": "next lint", - "format": "biome check --write .", - "prepare": "husky install" - }, - "dependencies": { - "@next/third-parties": "^15.0.3", - "@radix-ui/react-avatar": "^1.1.0", - "@radix-ui/react-dialog": "^1.1.1", - "@radix-ui/react-dropdown-menu": "^2.1.1", - "@radix-ui/react-separator": "^1.1.0", - "@radix-ui/react-slot": "^1.1.0", - "@radix-ui/react-tabs": "^1.1.0", - "@react-pdf/renderer": "^3.4.4", - "@requestnetwork/currency": "^0.18.0", - "@requestnetwork/data-format": "^0.19.0", - "@requestnetwork/request-client.js": "^0.49.0", - "@requestnetwork/types": "^0.45.0", - "@tanstack/react-query": "^5.52.2", - "@tanstack/react-table": "^8.20.5", - "class-variance-authority": "^0.7.0", - "clsx": "^2.1.1", - "graphql-request": "^7.1.0", - "html2pdf.js": "^0.10.2", - "json-edit-react": "^1.15.12", - "lucide-react": "^0.428.0", - "next": "14.2.5", - "react": "^18", - "react-dom": "^18", - "react-social-icons": "^6.18.0", - "tailwind-merge": "^2.5.2", - "tailwindcss-animate": "^1.0.7", - "timeago-react": "^3.0.6", - "truncate-eth-address": "^1.0.2", - "viem": "^2.21.0" - }, - "devDependencies": { - "@biomejs/biome": "^1.9.4", - "@types/file-saver": "^2.0.7", - "@types/node": "^20", - "@types/react": "^18", - "@types/react-dom": "^18", - "eslint": "^8", - "eslint-config-next": "14.2.5", - "husky": "^9.1.7", - "lint-staged": "^15.2.10", - "postcss": "^8", - "tailwindcss": "^3.4.1", - "typescript": "^5" - } + "name": "request-scan", + "version": "0.3.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "biome lint --write", + "format": "biome format --write", + "check": "biome check --write", + "lint-staged": "lint-staged", + "prepare": "husky install" + }, + "dependencies": { + "@next/third-parties": "^15.0.3", + "@radix-ui/react-avatar": "^1.1.0", + "@radix-ui/react-dialog": "^1.1.1", + "@radix-ui/react-dropdown-menu": "^2.1.1", + "@radix-ui/react-separator": "^1.1.0", + "@radix-ui/react-slot": "^1.1.0", + "@radix-ui/react-tabs": "^1.1.0", + "@react-pdf/renderer": "^3.4.4", + "@requestnetwork/currency": "^0.18.0", + "@requestnetwork/data-format": "^0.19.0", + "@requestnetwork/request-client.js": "^0.49.0", + "@requestnetwork/types": "^0.45.0", + "@tanstack/react-query": "^5.52.2", + "@tanstack/react-table": "^8.20.5", + "class-variance-authority": "^0.7.0", + "clsx": "^2.1.1", + "graphql-request": "^7.1.0", + "html2pdf.js": "^0.10.2", + "json-edit-react": "^1.15.12", + "lucide-react": "^0.428.0", + "next": "14.2.5", + "react": "^18", + "react-dom": "^18", + "react-social-icons": "^6.18.0", + "tailwind-merge": "^2.5.2", + "tailwindcss-animate": "^1.0.7", + "timeago-react": "^3.0.6", + "truncate-eth-address": "^1.0.2", + "viem": "^2.21.0" + }, + "devDependencies": { + "@biomejs/biome": "^1.9.4", + "@types/file-saver": "^2.0.7", + "@types/node": "^20", + "@types/react": "^18", + "@types/react-dom": "^18", + "eslint": "^8", + "eslint-config-next": "14.2.5", + "husky": "^9.1.7", + "lint-staged": "^15.2.10", + "postcss": "^8", + "tailwindcss": "^3.4.1", + "typescript": "^5" + } } From b3fc776b80043b3956231d856734b04502862b62 Mon Sep 17 00:00:00 2001 From: MantisClone Date: Thu, 27 Feb 2025 14:25:04 -0500 Subject: [PATCH 03/10] chore: update biome settings to match EasyPanel --- biome.json | 88 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/biome.json b/biome.json index e502b77..c26b9c2 100644 --- a/biome.json +++ b/biome.json @@ -1,39 +1,53 @@ { - "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", - "vcs": { - "enabled": false, - "clientKind": "git", - "useIgnoreFile": false - }, - "files": { - "ignoreUnknown": false, - "ignore": [] - }, - "formatter": { - "enabled": true, - "indentStyle": "tab" - }, - "organizeImports": { - "enabled": true - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true, - "suspicious": { - "noExplicitAny": "off" - }, - "style": { - "noNonNullAssertion": "off" - }, - "complexity": { - "noForEach": "off" - } - } - }, - "javascript": { - "formatter": { - "quoteStyle": "double" - } - } + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "ignoreUnknown": false, + "ignore": ["dist/**/*", "node_modules/**/*", ".next/**/*"] + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 2 + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "suspicious": { + "noExplicitAny": "off", + "noConsole": { + "level": "error", + "options": { + "allow": ["error", "warn", "info", "debug"] + } + } + }, + "style": { + "noNonNullAssertion": "off" + }, + "complexity": { + "noForEach": "off" + }, + "correctness": { + "noUnusedImports": "error", + "noUnusedVariables": "error" + } + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + }, + "parser": { + "unsafeParameterDecoratorsEnabled": true + } + } } From 1e70a54e58cd883ee9443f805b5b34aeab04abff Mon Sep 17 00:00:00 2001 From: MantisClone Date: Thu, 27 Feb 2025 14:25:33 -0500 Subject: [PATCH 04/10] chore: add lint workflow --- .github/workflows/build-and-lint.yml | 94 ++++++++++++++++++++++++++++ .github/workflows/build.yml | 33 ---------- 2 files changed, 94 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/build-and-lint.yml delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build-and-lint.yml b/.github/workflows/build-and-lint.yml new file mode 100644 index 0000000..221a2c1 --- /dev/null +++ b/.github/workflows/build-and-lint.yml @@ -0,0 +1,94 @@ +name: Build and Lint + +on: + workflow_dispatch: + pull_request: + types: + - opened + - reopened + - synchronize + - ready_for_review + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + install: + name: Install Dependencies + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Cache node_modules + uses: actions/cache@v4 + id: node-modules-cache + with: + path: | + node_modules + ~/.npm + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-modules- + + - name: Install dependencies + if: steps.node-modules-cache.outputs.cache-hit != 'true' + run: npm ci + + lint: + name: Lint + needs: install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Restore node_modules from cache + uses: actions/cache@v4 + with: + path: | + node_modules + ~/.npm + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-modules- + + - name: Check formatting and lint + run: npm run check + + build: + name: Build + needs: install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Restore node_modules from cache + uses: actions/cache@v4 + with: + path: | + node_modules + ~/.npm + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-modules- + + - name: Build + run: npm run build diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index a0be917..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Build - -on: - workflow_dispatch: - pull_request: - types: [opened, reopened, synchronize, ready_for_review] - paths: - - "**/*.{js,jsx,ts,tsx}" - - "package*.json" - - ".github/workflows/build.yml" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "18" - cache: "npm" - - - name: Install dependencies - run: npm ci - - - name: Build - run: npm run build From d768fc24e83a6cd82d709984ea9f256471036b58 Mon Sep 17 00:00:00 2001 From: MantisClone Date: Thu, 27 Feb 2025 14:26:09 -0500 Subject: [PATCH 05/10] chore: add .env.example --- .env.example | 3 +++ README.md | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..6f3a616 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +NEXT_PUBLIC_HASURA_GRAPHQL_URL= +NEXT_PUBLIC_POLL_INTERVAL=30000 +NEXT_PUBLIC_HASURA_GRAPHQL_JWT_TOKEN= diff --git a/README.md b/README.md index 5d44b99..56fe801 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,10 @@ npm install ``` 3. Configure the Hasura GraphQL endpoint in your `.env` file. +```bash +cp .env.example .env +``` +Make sure to replace `` and `` in the `.env` file with your actual Hasura GraphQL URL and JWT token. 4. Start the development server: From 90e5f5b4749ddc162b1a55f1514c7c10f3a396e8 Mon Sep 17 00:00:00 2001 From: MantisClone Date: Thu, 27 Feb 2025 14:26:44 -0500 Subject: [PATCH 06/10] chore: update licence to 2025 --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index a403679..335cbb6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Request Network +Copyright (c) 2025 Request Network Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 5d79472fdd68fd27bf5a8823d96ef07cd9b88cbb Mon Sep 17 00:00:00 2001 From: MantisClone Date: Thu, 27 Feb 2025 14:34:28 -0500 Subject: [PATCH 07/10] fix: disable unsafeParameterDecoratorsEnabled. Not needed in Next.js app * Probably copied from the Request API Nest.js which uses decorators. --- biome.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/biome.json b/biome.json index c26b9c2..1133d1b 100644 --- a/biome.json +++ b/biome.json @@ -45,9 +45,6 @@ "javascript": { "formatter": { "quoteStyle": "double" - }, - "parser": { - "unsafeParameterDecoratorsEnabled": true } } } From e566df115ec61d624dedbdd042f3ca282f9fb209 Mon Sep 17 00:00:00 2001 From: MantisClone Date: Thu, 27 Feb 2025 14:36:02 -0500 Subject: [PATCH 08/10] chore: remove redundant quoteStyle. Default is already "double" --- biome.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/biome.json b/biome.json index 1133d1b..7c47854 100644 --- a/biome.json +++ b/biome.json @@ -41,10 +41,5 @@ "noUnusedVariables": "error" } } - }, - "javascript": { - "formatter": { - "quoteStyle": "double" - } } } From 765a7a2e7715cbe207475d84152a2932ae464827 Mon Sep 17 00:00:00 2001 From: MantisClone Date: Thu, 27 Feb 2025 14:49:50 -0500 Subject: [PATCH 09/10] chore: disable useExhaustiveDependencies. * We often omit useEffect dependencies, purposefully. --- biome.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/biome.json b/biome.json index 7c47854..9fe88fd 100644 --- a/biome.json +++ b/biome.json @@ -38,7 +38,8 @@ }, "correctness": { "noUnusedImports": "error", - "noUnusedVariables": "error" + "noUnusedVariables": "error", + "useExhaustiveDependencies": "off" } } } From fce5dc11595a7df29e448ffe4305b9554c6efd83 Mon Sep 17 00:00:00 2001 From: MantisClone Date: Thu, 27 Feb 2025 14:54:04 -0500 Subject: [PATCH 10/10] chore: lint and format using new biome settings --- components.json | 2 +- src/app/address/[id]/page.tsx | 22 +- src/app/globals.css | 2 +- src/app/layout.tsx | 10 +- src/app/not-found/page.tsx | 4 +- src/app/page.tsx | 6 +- src/app/payments/page.tsx | 10 +- src/app/providers.tsx | 6 +- src/app/request/[id]/page.tsx | 26 +- src/components/header.tsx | 14 +- src/components/logo.tsx | 12 +- src/components/main-nav.tsx | 10 +- src/components/payment-table.tsx | 107 +++-- src/components/recent-payment-table.tsx | 26 +- src/components/recent-request-table.tsx | 22 +- src/components/request-table.tsx | 72 ++-- src/components/search-area.tsx | 4 +- src/components/search.tsx | 22 +- src/components/socials.tsx | 4 +- src/components/srf-deployments-table.tsx | 10 +- src/components/srf-info-section.tsx | 6 +- src/components/stats-area.tsx | 4 +- .../transactions-and-payments-table.tsx | 42 +- src/components/ui/avatar.tsx | 26 +- src/components/ui/badge.tsx | 14 +- src/components/ui/button.tsx | 26 +- src/components/ui/card.tsx | 41 +- src/components/ui/dialog.tsx | 54 +-- src/components/ui/dropdown-menu.tsx | 82 ++-- src/components/ui/input.tsx | 16 +- src/components/ui/separator.tsx | 20 +- src/components/ui/sheet.tsx | 56 +-- src/components/ui/skeleton.tsx | 6 +- src/components/ui/table.tsx | 44 +- src/components/ui/tabs.tsx | 30 +- src/components/ui/version-badge.tsx | 2 +- src/lib/consts.ts | 88 ++-- src/lib/currency-manager.ts | 2 +- src/lib/graphQlClient.ts | 4 +- src/lib/hooks/use-address-payments.tsx | 10 +- src/lib/hooks/use-address-requests.tsx | 10 +- src/lib/hooks/use-export-pdf.tsx | 378 +++++++++--------- src/lib/hooks/use-latest-payments.tsx | 18 +- src/lib/hooks/use-latest-requests.tsx | 18 +- src/lib/hooks/use-latest-srf-deployments.tsx | 8 +- src/lib/queries/address-payments.ts | 12 +- src/lib/queries/address-transactions.ts | 8 +- src/lib/queries/channel.ts | 6 +- src/lib/queries/payments.ts | 10 +- src/lib/queries/request-payments.ts | 12 +- src/lib/queries/srf-deployments.ts | 2 +- src/lib/queries/transactions.ts | 4 +- src/lib/queries/utils.ts | 4 +- src/lib/utils.ts | 24 +- tailwind.config.ts | 84 ++-- 55 files changed, 784 insertions(+), 778 deletions(-) diff --git a/components.json b/components.json index 8c574b7..7559f63 100644 --- a/components.json +++ b/components.json @@ -14,4 +14,4 @@ "components": "@/components", "utils": "@/lib/utils" } -} \ No newline at end of file +} diff --git a/src/app/address/[id]/page.tsx b/src/app/address/[id]/page.tsx index 69c07cf..4239ee8 100644 --- a/src/app/address/[id]/page.tsx +++ b/src/app/address/[id]/page.tsx @@ -1,20 +1,20 @@ /** @format */ -'use client'; -import { PaymentTable } from '@/components/payment-table'; -import { RequestTable } from '@/components/request-table'; -import { Button } from '@/components/ui/button'; +"use client"; +import { PaymentTable } from "@/components/payment-table"; +import { RequestTable } from "@/components/request-table"; +import { Button } from "@/components/ui/button"; import { Card, CardDescription, CardHeader, CardTitle, -} from '@/components/ui/card'; -import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; -import { useAddressPayments } from '@/lib/hooks/use-address-payments'; -import { useAddressRequests } from '@/lib/hooks/use-address-requests'; -import { PaginationState } from '@tanstack/react-table'; -import { Copy } from 'lucide-react'; -import { useState } from 'react'; +} from "@/components/ui/card"; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { useAddressPayments } from "@/lib/hooks/use-address-payments"; +import { useAddressRequests } from "@/lib/hooks/use-address-requests"; +import type { PaginationState } from "@tanstack/react-table"; +import { Copy } from "lucide-react"; +import { useState } from "react"; interface AddressPageProps { params: { diff --git a/src/app/globals.css b/src/app/globals.css index dff9dc3..a5853da 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -66,4 +66,4 @@ body { @apply bg-background text-foreground; } -} \ No newline at end of file +} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 61ac2d0..27fe66a 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -3,12 +3,12 @@ import type { Metadata } from "next"; import { Montserrat } from "next/font/google"; import "./globals.css"; -import { cn } from "@/lib/utils"; -import Header from "@/components/header"; import { Footer } from "@/components/footer"; -import Providers from "./providers"; -import { Suspense } from "react"; +import Header from "@/components/header"; +import { cn } from "@/lib/utils"; import { GoogleTagManager } from "@next/third-parties/google"; +import { Suspense } from "react"; +import Providers from "./providers"; const montserrat = Montserrat({ subsets: ["latin"], variable: "--font-sans" }); @@ -28,7 +28,7 @@ export default function RootLayout({ diff --git a/src/app/not-found/page.tsx b/src/app/not-found/page.tsx index 2ee6248..5d054f4 100644 --- a/src/app/not-found/page.tsx +++ b/src/app/not-found/page.tsx @@ -7,8 +7,8 @@ import { CardFooter, CardHeader, CardTitle, -} from '@/components/ui/card'; -import Link from 'next/link'; +} from "@/components/ui/card"; +import Link from "next/link"; export default function NotFoundPage() { return ( diff --git a/src/app/page.tsx b/src/app/page.tsx index caee41a..2249fcc 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,7 +1,7 @@ +import { RecentArea } from "@/components/recent-area"; /** @format */ -import { SearchArea } from '@/components/search-area'; -import { StatsArea } from '@/components/stats-area'; -import { RecentArea } from '@/components/recent-area'; +import { SearchArea } from "@/components/search-area"; +import { StatsArea } from "@/components/stats-area"; export default function Home() { return ( diff --git a/src/app/payments/page.tsx b/src/app/payments/page.tsx index 1540016..e1bcfc0 100644 --- a/src/app/payments/page.tsx +++ b/src/app/payments/page.tsx @@ -1,10 +1,10 @@ /** @format */ -'use client'; +"use client"; -import { PaymentTable } from '@/components/payment-table'; -import { useLatestPayments } from '@/lib/hooks/use-latest-payments'; -import { PaginationState } from '@tanstack/react-table'; -import { useState } from 'react'; +import { PaymentTable } from "@/components/payment-table"; +import { useLatestPayments } from "@/lib/hooks/use-latest-payments"; +import type { PaginationState } from "@tanstack/react-table"; +import { useState } from "react"; export default function PaymentsPage() { const [pagination, setPagination] = useState({ diff --git a/src/app/providers.tsx b/src/app/providers.tsx index a95e3d3..265a6b1 100644 --- a/src/app/providers.tsx +++ b/src/app/providers.tsx @@ -1,8 +1,8 @@ /** @format */ -'use client'; -import React from 'react'; -import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; +"use client"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import React from "react"; export default function Providers({ children, diff --git a/src/app/request/[id]/page.tsx b/src/app/request/[id]/page.tsx index c765608..13b6cd8 100644 --- a/src/app/request/[id]/page.tsx +++ b/src/app/request/[id]/page.tsx @@ -1,18 +1,22 @@ /** @format */ "use client"; +import { SRFInfoSection } from "@/components/srf-info-section"; import { TransactionsAndPaymentsTable } from "@/components/transactions-and-payments-table"; import { Button } from "@/components/ui/button"; import { Card, - CardHeader, - CardTitle, CardContent, CardFooter, + CardHeader, + CardTitle, } from "@/components/ui/card"; import { Skeleton } from "@/components/ui/skeleton"; +import useExportPDF from "@/lib/hooks/use-export-pdf"; import { fetchRequest } from "@/lib/queries/channel"; import { fetchRequestPayments } from "@/lib/queries/request-payments"; +import { fetchProxyDeploymentsByReference } from "@/lib/queries/srf-deployments"; +import type { Channel } from "@/lib/types"; import { calculateLongPaymentReference, calculateShortPaymentReference, @@ -26,18 +30,14 @@ import { getTransactionCreateParameters, renderAddress, } from "@/lib/utils"; -import { ActorInfo } from "@requestnetwork/data-format"; +import type { ActorInfo } from "@requestnetwork/data-format"; import { useQuery } from "@tanstack/react-query"; +import { JsonEditor } from "json-edit-react"; import { Copy, File, Loader2 } from "lucide-react"; import Link from "next/link"; import { redirect } from "next/navigation"; -import TimeAgo from "timeago-react"; -import { JsonEditor } from "json-edit-react"; -import useExportPDF from "@/lib/hooks/use-export-pdf"; import { useState } from "react"; -import { Channel } from "@/lib/types"; -import { fetchProxyDeploymentsByReference } from "@/lib/queries/srf-deployments"; -import { SRFInfoSection } from "@/components/srf-info-section"; +import TimeAgo from "timeago-react"; interface RequestPageProps { params: { @@ -56,7 +56,7 @@ const ActorInfoSection = ({ actorInfo }: { actorInfo?: ActorInfo }) => { if ( !actorInfo || Object.keys(actorInfo).every( - (k) => !Object.keys((actorInfo as any)[k]).length + (k) => !Object.keys((actorInfo as any)[k]).length, ) ) { return "N/A"; @@ -134,7 +134,7 @@ export default function RequestPage({ params: { id } }: RequestPageProps) { request?.transactions[0].dataObject.data.parameters.extensionsData[0] .parameters.salt || "", request?.transactions[0].dataObject.data.parameters.extensionsData[0] - .parameters.paymentAddress || "" + .parameters.paymentAddress || "", ) : ""; @@ -299,7 +299,7 @@ export default function RequestPage({ params: { id } }: RequestPageProps) { {getAmountWithCurrencySymbol( BigInt(createParameters.expectedAmount), - createParameters.currency.value + createParameters.currency.value, )} @@ -308,7 +308,7 @@ export default function RequestPage({ params: { id } }: RequestPageProps) { {getAmountWithCurrencySymbol( BigInt(balance), - balanceCurrency || "" + balanceCurrency || "", )} diff --git a/src/components/header.tsx b/src/components/header.tsx index 2e6b3f4..1a6027b 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -1,11 +1,11 @@ /** @format */ -'use client'; +"use client"; -import { usePathname } from 'next/navigation'; -import { Logo } from './logo'; -import { MainNav } from './main-nav'; -import { Search } from './search'; -import { Socials } from './socials'; +import { usePathname } from "next/navigation"; +import { Logo } from "./logo"; +import { MainNav } from "./main-nav"; +import { Search } from "./search"; +import { Socials } from "./socials"; export default function Header() { const pathname = usePathname(); @@ -15,7 +15,7 @@ export default function Header() {
- {pathname !== '/' && } + {pathname !== "/" && }
) { return ( - {color === 'black' ? ( + {color === "black" ? ( Logo & { hoverClass: string }) { return (
) : ( - 'N/A' + "N/A" ); }, }, { - accessorKey: 'payer', - header: 'Payer', + accessorKey: "payer", + header: "Payer", cell: ({ row }: { row: any }) => { const address = row.original?.dataObject?.data?.parameters?.payer?.value; return address ? ( @@ -100,13 +100,13 @@ export const columns: ColumnDef[] = [ ) : ( - 'N/A' + "N/A" ); }, }, { - accessorKey: 'expectedAmount', - header: 'Expected Amount', + accessorKey: "expectedAmount", + header: "Expected Amount", cell: ({ row }: { row: any }) => getAmountWithCurrencySymbol( row.original?.dataObject?.data?.parameters?.expectedAmount, @@ -145,11 +145,11 @@ export function RequestTable({ }, }); - if (status === 'pending') { + if (status === "pending") { return ; } - if (status === 'error') { + if (status === "error") { return
Error occurred while fetching data.
; } @@ -187,7 +187,7 @@ export function RequestTable({ table.getRowModel().rows.map((row) => ( {row.getVisibleCells().map((cell) => ( diff --git a/src/components/search-area.tsx b/src/components/search-area.tsx index afe2779..6eff1de 100644 --- a/src/components/search-area.tsx +++ b/src/components/search-area.tsx @@ -1,7 +1,7 @@ /** @format */ -import Image from 'next/image'; -import { Search } from './search'; +import Image from "next/image"; +import { Search } from "./search"; export function SearchArea() { return ( diff --git a/src/components/search.tsx b/src/components/search.tsx index 2cbd723..07e8599 100644 --- a/src/components/search.tsx +++ b/src/components/search.tsx @@ -1,19 +1,19 @@ /** @format */ -'use client'; +"use client"; -import { Search as SearchIcon } from 'lucide-react'; -import { Input } from './ui/input'; -import { Button } from './ui/button'; -import { useState } from 'react'; -import { useRouter } from 'next/navigation'; -import { isAddress } from 'viem'; +import { Search as SearchIcon } from "lucide-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { isAddress } from "viem"; +import { Button } from "./ui/button"; +import { Input } from "./ui/input"; export function Search() { const router = useRouter(); - const [searchQuery, setSearchQuery] = useState(''); + const [searchQuery, setSearchQuery] = useState(""); const handleSearch = () => { - if (searchQuery === '' || searchQuery.length < 3) return; + if (searchQuery === "" || searchQuery.length < 3) return; if (isAddress(searchQuery)) { router.push(`/address/${searchQuery}`); } else { @@ -21,13 +21,13 @@ export function Search() { if (re.test(searchQuery)) { router.push(`/request/${searchQuery}`); } else { - router.push(`/not-found`); + router.push("/not-found"); } } }; const handleKeyPress = (event: { key: string }) => { - if (event.key === 'Enter') { + if (event.key === "Enter") { handleSearch(); } }; diff --git a/src/components/socials.tsx b/src/components/socials.tsx index faa3bf6..cf59171 100644 --- a/src/components/socials.tsx +++ b/src/components/socials.tsx @@ -1,8 +1,8 @@ /** @format */ -import { SocialIcon } from 'react-social-icons'; +import { SocialIcon } from "react-social-icons"; -export function Socials({ color = 'black' }: { color?: string }) { +export function Socials({ color = "black" }: { color?: string }) { return (
[] = [ { @@ -183,7 +183,7 @@ export function SRFDeploymentsTable({ ? null : flexRender( header.column.columnDef.header, - header.getContext() + header.getContext(), )} ); @@ -202,7 +202,7 @@ export function SRFDeploymentsTable({ {flexRender( cell.column.columnDef.cell, - cell.getContext() + cell.getContext(), )} ))} diff --git a/src/components/srf-info-section.tsx b/src/components/srf-info-section.tsx index 234c310..d73040e 100644 --- a/src/components/srf-info-section.tsx +++ b/src/components/srf-info-section.tsx @@ -1,9 +1,9 @@ -import { SingleRequestProxyDeployment } from "@/lib/types"; -import Link from "next/link"; import { CHAIN_SCAN_URLS } from "@/lib/consts"; -import { formatUnits } from "viem"; +import type { SingleRequestProxyDeployment } from "@/lib/types"; import { formatTimestamp } from "@/lib/utils"; +import Link from "next/link"; import TimeAgo from "timeago-react"; +import { formatUnits } from "viem"; interface SRFInfoSectionProps { deployments: SingleRequestProxyDeployment[]; diff --git a/src/components/stats-area.tsx b/src/components/stats-area.tsx index 3cee67f..aaf419c 100644 --- a/src/components/stats-area.tsx +++ b/src/components/stats-area.tsx @@ -1,7 +1,7 @@ /** @format */ -import { DollarSign, Activity, ArrowRightLeft, Building } from 'lucide-react'; -import { Card, CardContent, CardHeader, CardTitle } from './ui/card'; +import { Activity, ArrowRightLeft, Building, DollarSign } from "lucide-react"; +import { Card, CardContent, CardHeader, CardTitle } from "./ui/card"; export function StatsArea() { return ( diff --git a/src/components/transactions-and-payments-table.tsx b/src/components/transactions-and-payments-table.tsx index c60ae1d..d270143 100644 --- a/src/components/transactions-and-payments-table.tsx +++ b/src/components/transactions-and-payments-table.tsx @@ -7,17 +7,17 @@ import { TableHead, TableHeader, TableRow, -} from '@/components/ui/table'; -import { CHAIN_SCAN_URLS } from '@/lib/consts'; -import { Payment, Transaction } from '@/lib/types'; +} from "@/components/ui/table"; +import { CHAIN_SCAN_URLS } from "@/lib/consts"; +import type { Payment, Transaction } from "@/lib/types"; import { formatTimestamp, getAmountWithCurrencySymbol, safeTruncateEthAddress, -} from '@/lib/utils'; -import Link from 'next/link'; -import TimeAgo from 'timeago-react'; -import { formatUnits } from 'viem'; +} from "@/lib/utils"; +import Link from "next/link"; +import TimeAgo from "timeago-react"; +import { formatUnits } from "viem"; interface Props { transactions: Transaction[]; @@ -58,13 +58,13 @@ export function TransactionsAndPaymentsTable({ {allData.map((item) => ( - {'dataObject' in item ? 'action' : 'payment'} + {"dataObject" in item ? "action" : "payment"} - {'dataObject' in item ? item?.dataObject?.data?.name : ''} + {"dataObject" in item ? item?.dataObject?.data?.name : ""} - {'chain' in item ? ( + {"chain" in item ? (
- {'from' in item ? ( + {"from" in item ? (
- {safeTruncateEthAddress(item.from)}{' '} + {safeTruncateEthAddress(item.from)}{" "}
) : ( - '' + "" )}
- {'to' in item ? ( + {"to" in item ? (
- {safeTruncateEthAddress(item.to)}{' '} + {safeTruncateEthAddress(item.to)}{" "}
) : ( - '' + "" )}
- {'dataObject' in item + {"dataObject" in item ? getAmountWithCurrencySymbol( item?.dataObject?.data?.parameters?.expectedAmount || 0, item?.dataObject?.data?.parameters?.currency?.value, ) : getAmountWithCurrencySymbol( - BigInt(item?.amountInCrypto || item?.amount || '0'), + BigInt(item?.amountInCrypto || item?.amount || "0"), item?.tokenAddress, )} - {'gasUsed' in item + {"gasUsed" in item ? formatUnits( BigInt(Number(item?.gasUsed) * Number(item?.gasPrice)), 18, ) - : ''} + : ""} - {'feeAmount' in item ? item.feeAmount : ''} + {"feeAmount" in item ? item.feeAmount : ""} ))} diff --git a/src/components/ui/avatar.tsx b/src/components/ui/avatar.tsx index 51e507b..9b121d2 100644 --- a/src/components/ui/avatar.tsx +++ b/src/components/ui/avatar.tsx @@ -1,9 +1,9 @@ -"use client" +"use client"; -import * as React from "react" -import * as AvatarPrimitive from "@radix-ui/react-avatar" +import * as AvatarPrimitive from "@radix-ui/react-avatar"; +import * as React from "react"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; const Avatar = React.forwardRef< React.ElementRef, @@ -13,12 +13,12 @@ const Avatar = React.forwardRef< ref={ref} className={cn( "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", - className + className, )} {...props} /> -)) -Avatar.displayName = AvatarPrimitive.Root.displayName +)); +Avatar.displayName = AvatarPrimitive.Root.displayName; const AvatarImage = React.forwardRef< React.ElementRef, @@ -29,8 +29,8 @@ const AvatarImage = React.forwardRef< className={cn("aspect-square h-full w-full", className)} {...props} /> -)) -AvatarImage.displayName = AvatarPrimitive.Image.displayName +)); +AvatarImage.displayName = AvatarPrimitive.Image.displayName; const AvatarFallback = React.forwardRef< React.ElementRef, @@ -40,11 +40,11 @@ const AvatarFallback = React.forwardRef< ref={ref} className={cn( "flex h-full w-full items-center justify-center rounded-full bg-muted", - className + className, )} {...props} /> -)) -AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName +)); +AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName; -export { Avatar, AvatarImage, AvatarFallback } +export { Avatar, AvatarImage, AvatarFallback }; diff --git a/src/components/ui/badge.tsx b/src/components/ui/badge.tsx index f000e3e..6d5a5c0 100644 --- a/src/components/ui/badge.tsx +++ b/src/components/ui/badge.tsx @@ -1,7 +1,7 @@ -import * as React from "react" -import { cva, type VariantProps } from "class-variance-authority" +import { type VariantProps, cva } from "class-variance-authority"; +import type * as React from "react"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; const badgeVariants = cva( "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", @@ -20,8 +20,8 @@ const badgeVariants = cva( defaultVariants: { variant: "default", }, - } -) + }, +); export interface BadgeProps extends React.HTMLAttributes, @@ -30,7 +30,7 @@ export interface BadgeProps function Badge({ className, variant, ...props }: BadgeProps) { return (
- ) + ); } -export { Badge, badgeVariants } +export { Badge, badgeVariants }; diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx index 0ba4277..165aa58 100644 --- a/src/components/ui/button.tsx +++ b/src/components/ui/button.tsx @@ -1,8 +1,8 @@ -import * as React from "react" -import { Slot } from "@radix-ui/react-slot" -import { cva, type VariantProps } from "class-variance-authority" +import { Slot } from "@radix-ui/react-slot"; +import { type VariantProps, cva } from "class-variance-authority"; +import * as React from "react"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; const buttonVariants = cva( "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", @@ -30,27 +30,27 @@ const buttonVariants = cva( variant: "default", size: "default", }, - } -) + }, +); export interface ButtonProps extends React.ButtonHTMLAttributes, VariantProps { - asChild?: boolean + asChild?: boolean; } const Button = React.forwardRef( ({ className, variant, size, asChild = false, ...props }, ref) => { - const Comp = asChild ? Slot : "button" + const Comp = asChild ? Slot : "button"; return ( - ) - } -) -Button.displayName = "Button" + ); + }, +); +Button.displayName = "Button"; -export { Button, buttonVariants } +export { Button, buttonVariants }; diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx index afa13ec..dc3b01d 100644 --- a/src/components/ui/card.tsx +++ b/src/components/ui/card.tsx @@ -1,6 +1,6 @@ -import * as React from "react" +import * as React from "react"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; const Card = React.forwardRef< HTMLDivElement, @@ -10,12 +10,12 @@ const Card = React.forwardRef< ref={ref} className={cn( "rounded-lg border bg-card text-card-foreground shadow-sm", - className + className, )} {...props} /> -)) -Card.displayName = "Card" +)); +Card.displayName = "Card"; const CardHeader = React.forwardRef< HTMLDivElement, @@ -26,8 +26,8 @@ const CardHeader = React.forwardRef< className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} /> -)) -CardHeader.displayName = "CardHeader" +)); +CardHeader.displayName = "CardHeader"; const CardTitle = React.forwardRef< HTMLParagraphElement, @@ -37,12 +37,12 @@ const CardTitle = React.forwardRef< ref={ref} className={cn( "text-2xl font-semibold leading-none tracking-tight", - className + className, )} {...props} /> -)) -CardTitle.displayName = "CardTitle" +)); +CardTitle.displayName = "CardTitle"; const CardDescription = React.forwardRef< HTMLParagraphElement, @@ -53,16 +53,16 @@ const CardDescription = React.forwardRef< className={cn("text-sm text-muted-foreground", className)} {...props} /> -)) -CardDescription.displayName = "CardDescription" +)); +CardDescription.displayName = "CardDescription"; const CardContent = React.forwardRef< HTMLDivElement, React.HTMLAttributes >(({ className, ...props }, ref) => (
-)) -CardContent.displayName = "CardContent" +)); +CardContent.displayName = "CardContent"; const CardFooter = React.forwardRef< HTMLDivElement, @@ -73,7 +73,14 @@ const CardFooter = React.forwardRef< className={cn("flex items-center p-6 pt-0", className)} {...props} /> -)) -CardFooter.displayName = "CardFooter" +)); +CardFooter.displayName = "CardFooter"; -export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } +export { + Card, + CardHeader, + CardFooter, + CardTitle, + CardDescription, + CardContent, +}; diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx index 01ff19c..b8661a6 100644 --- a/src/components/ui/dialog.tsx +++ b/src/components/ui/dialog.tsx @@ -1,18 +1,18 @@ -"use client" +"use client"; -import * as React from "react" -import * as DialogPrimitive from "@radix-ui/react-dialog" -import { X } from "lucide-react" +import * as DialogPrimitive from "@radix-ui/react-dialog"; +import { X } from "lucide-react"; +import * as React from "react"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; -const Dialog = DialogPrimitive.Root +const Dialog = DialogPrimitive.Root; -const DialogTrigger = DialogPrimitive.Trigger +const DialogTrigger = DialogPrimitive.Trigger; -const DialogPortal = DialogPrimitive.Portal +const DialogPortal = DialogPrimitive.Portal; -const DialogClose = DialogPrimitive.Close +const DialogClose = DialogPrimitive.Close; const DialogOverlay = React.forwardRef< React.ElementRef, @@ -22,12 +22,12 @@ const DialogOverlay = React.forwardRef< ref={ref} className={cn( "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", - className + className, )} {...props} /> -)) -DialogOverlay.displayName = DialogPrimitive.Overlay.displayName +)); +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; const DialogContent = React.forwardRef< React.ElementRef, @@ -39,7 +39,7 @@ const DialogContent = React.forwardRef< ref={ref} className={cn( "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", - className + className, )} {...props} > @@ -50,8 +50,8 @@ const DialogContent = React.forwardRef< -)) -DialogContent.displayName = DialogPrimitive.Content.displayName +)); +DialogContent.displayName = DialogPrimitive.Content.displayName; const DialogHeader = ({ className, @@ -60,12 +60,12 @@ const DialogHeader = ({
-) -DialogHeader.displayName = "DialogHeader" +); +DialogHeader.displayName = "DialogHeader"; const DialogFooter = ({ className, @@ -74,12 +74,12 @@ const DialogFooter = ({
-) -DialogFooter.displayName = "DialogFooter" +); +DialogFooter.displayName = "DialogFooter"; const DialogTitle = React.forwardRef< React.ElementRef, @@ -89,12 +89,12 @@ const DialogTitle = React.forwardRef< ref={ref} className={cn( "text-lg font-semibold leading-none tracking-tight", - className + className, )} {...props} /> -)) -DialogTitle.displayName = DialogPrimitive.Title.displayName +)); +DialogTitle.displayName = DialogPrimitive.Title.displayName; const DialogDescription = React.forwardRef< React.ElementRef, @@ -105,8 +105,8 @@ const DialogDescription = React.forwardRef< className={cn("text-sm text-muted-foreground", className)} {...props} /> -)) -DialogDescription.displayName = DialogPrimitive.Description.displayName +)); +DialogDescription.displayName = DialogPrimitive.Description.displayName; export { Dialog, @@ -119,4 +119,4 @@ export { DialogFooter, DialogTitle, DialogDescription, -} +}; diff --git a/src/components/ui/dropdown-menu.tsx b/src/components/ui/dropdown-menu.tsx index f69a0d6..f0aaafa 100644 --- a/src/components/ui/dropdown-menu.tsx +++ b/src/components/ui/dropdown-menu.tsx @@ -1,27 +1,27 @@ -"use client" +"use client"; -import * as React from "react" -import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" -import { Check, ChevronRight, Circle } from "lucide-react" +import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"; +import { Check, ChevronRight, Circle } from "lucide-react"; +import * as React from "react"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; -const DropdownMenu = DropdownMenuPrimitive.Root +const DropdownMenu = DropdownMenuPrimitive.Root; -const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger +const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; -const DropdownMenuGroup = DropdownMenuPrimitive.Group +const DropdownMenuGroup = DropdownMenuPrimitive.Group; -const DropdownMenuPortal = DropdownMenuPrimitive.Portal +const DropdownMenuPortal = DropdownMenuPrimitive.Portal; -const DropdownMenuSub = DropdownMenuPrimitive.Sub +const DropdownMenuSub = DropdownMenuPrimitive.Sub; -const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup +const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup; const DropdownMenuSubTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { - inset?: boolean + inset?: boolean; } >(({ className, inset, children, ...props }, ref) => ( {children} -)) +)); DropdownMenuSubTrigger.displayName = - DropdownMenuPrimitive.SubTrigger.displayName + DropdownMenuPrimitive.SubTrigger.displayName; const DropdownMenuSubContent = React.forwardRef< React.ElementRef, @@ -48,13 +48,13 @@ const DropdownMenuSubContent = React.forwardRef< ref={ref} className={cn( "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", - className + className, )} {...props} /> -)) +)); DropdownMenuSubContent.displayName = - DropdownMenuPrimitive.SubContent.displayName + DropdownMenuPrimitive.SubContent.displayName; const DropdownMenuContent = React.forwardRef< React.ElementRef, @@ -66,18 +66,18 @@ const DropdownMenuContent = React.forwardRef< sideOffset={sideOffset} className={cn( "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", - className + className, )} {...props} /> -)) -DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName +)); +DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName; const DropdownMenuItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { - inset?: boolean + inset?: boolean; } >(({ className, inset, ...props }, ref) => ( -)) -DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName +)); +DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; const DropdownMenuCheckboxItem = React.forwardRef< React.ElementRef, @@ -100,7 +100,7 @@ const DropdownMenuCheckboxItem = React.forwardRef< ref={ref} className={cn( "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", - className + className, )} checked={checked} {...props} @@ -112,9 +112,9 @@ const DropdownMenuCheckboxItem = React.forwardRef< {children} -)) +)); DropdownMenuCheckboxItem.displayName = - DropdownMenuPrimitive.CheckboxItem.displayName + DropdownMenuPrimitive.CheckboxItem.displayName; const DropdownMenuRadioItem = React.forwardRef< React.ElementRef, @@ -124,7 +124,7 @@ const DropdownMenuRadioItem = React.forwardRef< ref={ref} className={cn( "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", - className + className, )} {...props} > @@ -135,13 +135,13 @@ const DropdownMenuRadioItem = React.forwardRef< {children} -)) -DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName +)); +DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName; const DropdownMenuLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { - inset?: boolean + inset?: boolean; } >(({ className, inset, ...props }, ref) => ( -)) -DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName +)); +DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName; const DropdownMenuSeparator = React.forwardRef< React.ElementRef, @@ -165,8 +165,8 @@ const DropdownMenuSeparator = React.forwardRef< className={cn("-mx-1 my-1 h-px bg-muted", className)} {...props} /> -)) -DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName +)); +DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName; const DropdownMenuShortcut = ({ className, @@ -177,9 +177,9 @@ const DropdownMenuShortcut = ({ className={cn("ml-auto text-xs tracking-widest opacity-60", className)} {...props} /> - ) -} -DropdownMenuShortcut.displayName = "DropdownMenuShortcut" + ); +}; +DropdownMenuShortcut.displayName = "DropdownMenuShortcut"; export { DropdownMenu, @@ -197,4 +197,4 @@ export { DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, -} +}; diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx index 677d05f..9d631e7 100644 --- a/src/components/ui/input.tsx +++ b/src/components/ui/input.tsx @@ -1,6 +1,6 @@ -import * as React from "react" +import * as React from "react"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; export interface InputProps extends React.InputHTMLAttributes {} @@ -12,14 +12,14 @@ const Input = React.forwardRef( type={type} className={cn( "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", - className + className, )} ref={ref} {...props} /> - ) - } -) -Input.displayName = "Input" + ); + }, +); +Input.displayName = "Input"; -export { Input } +export { Input }; diff --git a/src/components/ui/separator.tsx b/src/components/ui/separator.tsx index 12d81c4..3cc446d 100644 --- a/src/components/ui/separator.tsx +++ b/src/components/ui/separator.tsx @@ -1,9 +1,9 @@ -"use client" +"use client"; -import * as React from "react" -import * as SeparatorPrimitive from "@radix-ui/react-separator" +import * as SeparatorPrimitive from "@radix-ui/react-separator"; +import * as React from "react"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; const Separator = React.forwardRef< React.ElementRef, @@ -11,7 +11,7 @@ const Separator = React.forwardRef< >( ( { className, orientation = "horizontal", decorative = true, ...props }, - ref + ref, ) => ( - ) -) -Separator.displayName = SeparatorPrimitive.Root.displayName + ), +); +Separator.displayName = SeparatorPrimitive.Root.displayName; -export { Separator } +export { Separator }; diff --git a/src/components/ui/sheet.tsx b/src/components/ui/sheet.tsx index a37f17b..9c845f2 100644 --- a/src/components/ui/sheet.tsx +++ b/src/components/ui/sheet.tsx @@ -1,19 +1,19 @@ -"use client" +"use client"; -import * as React from "react" -import * as SheetPrimitive from "@radix-ui/react-dialog" -import { cva, type VariantProps } from "class-variance-authority" -import { X } from "lucide-react" +import * as SheetPrimitive from "@radix-ui/react-dialog"; +import { type VariantProps, cva } from "class-variance-authority"; +import { X } from "lucide-react"; +import * as React from "react"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; -const Sheet = SheetPrimitive.Root +const Sheet = SheetPrimitive.Root; -const SheetTrigger = SheetPrimitive.Trigger +const SheetTrigger = SheetPrimitive.Trigger; -const SheetClose = SheetPrimitive.Close +const SheetClose = SheetPrimitive.Close; -const SheetPortal = SheetPrimitive.Portal +const SheetPortal = SheetPrimitive.Portal; const SheetOverlay = React.forwardRef< React.ElementRef, @@ -22,13 +22,13 @@ const SheetOverlay = React.forwardRef< -)) -SheetOverlay.displayName = SheetPrimitive.Overlay.displayName +)); +SheetOverlay.displayName = SheetPrimitive.Overlay.displayName; const sheetVariants = cva( "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500", @@ -46,8 +46,8 @@ const sheetVariants = cva( defaultVariants: { side: "right", }, - } -) + }, +); interface SheetContentProps extends React.ComponentPropsWithoutRef, @@ -71,8 +71,8 @@ const SheetContent = React.forwardRef< -)) -SheetContent.displayName = SheetPrimitive.Content.displayName +)); +SheetContent.displayName = SheetPrimitive.Content.displayName; const SheetHeader = ({ className, @@ -81,12 +81,12 @@ const SheetHeader = ({
-) -SheetHeader.displayName = "SheetHeader" +); +SheetHeader.displayName = "SheetHeader"; const SheetFooter = ({ className, @@ -95,12 +95,12 @@ const SheetFooter = ({
-) -SheetFooter.displayName = "SheetFooter" +); +SheetFooter.displayName = "SheetFooter"; const SheetTitle = React.forwardRef< React.ElementRef, @@ -111,8 +111,8 @@ const SheetTitle = React.forwardRef< className={cn("text-lg font-semibold text-foreground", className)} {...props} /> -)) -SheetTitle.displayName = SheetPrimitive.Title.displayName +)); +SheetTitle.displayName = SheetPrimitive.Title.displayName; const SheetDescription = React.forwardRef< React.ElementRef, @@ -123,8 +123,8 @@ const SheetDescription = React.forwardRef< className={cn("text-sm text-muted-foreground", className)} {...props} /> -)) -SheetDescription.displayName = SheetPrimitive.Description.displayName +)); +SheetDescription.displayName = SheetPrimitive.Description.displayName; export { Sheet, @@ -137,4 +137,4 @@ export { SheetFooter, SheetTitle, SheetDescription, -} +}; diff --git a/src/components/ui/skeleton.tsx b/src/components/ui/skeleton.tsx index 01b8b6d..2cdf440 100644 --- a/src/components/ui/skeleton.tsx +++ b/src/components/ui/skeleton.tsx @@ -1,4 +1,4 @@ -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; function Skeleton({ className, @@ -9,7 +9,7 @@ function Skeleton({ className={cn("animate-pulse rounded-md bg-muted", className)} {...props} /> - ) + ); } -export { Skeleton } +export { Skeleton }; diff --git a/src/components/ui/table.tsx b/src/components/ui/table.tsx index 7f3502f..73cf6b4 100644 --- a/src/components/ui/table.tsx +++ b/src/components/ui/table.tsx @@ -1,6 +1,6 @@ -import * as React from "react" +import * as React from "react"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; const Table = React.forwardRef< HTMLTableElement, @@ -13,16 +13,16 @@ const Table = React.forwardRef< {...props} />
-)) -Table.displayName = "Table" +)); +Table.displayName = "Table"; const TableHeader = React.forwardRef< HTMLTableSectionElement, React.HTMLAttributes >(({ className, ...props }, ref) => ( -)) -TableHeader.displayName = "TableHeader" +)); +TableHeader.displayName = "TableHeader"; const TableBody = React.forwardRef< HTMLTableSectionElement, @@ -33,8 +33,8 @@ const TableBody = React.forwardRef< className={cn("[&_tr:last-child]:border-0", className)} {...props} /> -)) -TableBody.displayName = "TableBody" +)); +TableBody.displayName = "TableBody"; const TableFooter = React.forwardRef< HTMLTableSectionElement, @@ -44,12 +44,12 @@ const TableFooter = React.forwardRef< ref={ref} className={cn( "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", - className + className, )} {...props} /> -)) -TableFooter.displayName = "TableFooter" +)); +TableFooter.displayName = "TableFooter"; const TableRow = React.forwardRef< HTMLTableRowElement, @@ -59,12 +59,12 @@ const TableRow = React.forwardRef< ref={ref} className={cn( "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", - className + className, )} {...props} /> -)) -TableRow.displayName = "TableRow" +)); +TableRow.displayName = "TableRow"; const TableHead = React.forwardRef< HTMLTableCellElement, @@ -74,12 +74,12 @@ const TableHead = React.forwardRef< ref={ref} className={cn( "h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0", - className + className, )} {...props} /> -)) -TableHead.displayName = "TableHead" +)); +TableHead.displayName = "TableHead"; const TableCell = React.forwardRef< HTMLTableCellElement, @@ -90,8 +90,8 @@ const TableCell = React.forwardRef< className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)} {...props} /> -)) -TableCell.displayName = "TableCell" +)); +TableCell.displayName = "TableCell"; const TableCaption = React.forwardRef< HTMLTableCaptionElement, @@ -102,8 +102,8 @@ const TableCaption = React.forwardRef< className={cn("mt-4 text-sm text-muted-foreground", className)} {...props} /> -)) -TableCaption.displayName = "TableCaption" +)); +TableCaption.displayName = "TableCaption"; export { Table, @@ -114,4 +114,4 @@ export { TableRow, TableCell, TableCaption, -} +}; diff --git a/src/components/ui/tabs.tsx b/src/components/ui/tabs.tsx index 26eb109..37a28d3 100644 --- a/src/components/ui/tabs.tsx +++ b/src/components/ui/tabs.tsx @@ -1,11 +1,11 @@ -"use client" +"use client"; -import * as React from "react" -import * as TabsPrimitive from "@radix-ui/react-tabs" +import * as TabsPrimitive from "@radix-ui/react-tabs"; +import * as React from "react"; -import { cn } from "@/lib/utils" +import { cn } from "@/lib/utils"; -const Tabs = TabsPrimitive.Root +const Tabs = TabsPrimitive.Root; const TabsList = React.forwardRef< React.ElementRef, @@ -15,12 +15,12 @@ const TabsList = React.forwardRef< ref={ref} className={cn( "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground", - className + className, )} {...props} /> -)) -TabsList.displayName = TabsPrimitive.List.displayName +)); +TabsList.displayName = TabsPrimitive.List.displayName; const TabsTrigger = React.forwardRef< React.ElementRef, @@ -30,12 +30,12 @@ const TabsTrigger = React.forwardRef< ref={ref} className={cn( "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm", - className + className, )} {...props} /> -)) -TabsTrigger.displayName = TabsPrimitive.Trigger.displayName +)); +TabsTrigger.displayName = TabsPrimitive.Trigger.displayName; const TabsContent = React.forwardRef< React.ElementRef, @@ -45,11 +45,11 @@ const TabsContent = React.forwardRef< ref={ref} className={cn( "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", - className + className, )} {...props} /> -)) -TabsContent.displayName = TabsPrimitive.Content.displayName +)); +TabsContent.displayName = TabsPrimitive.Content.displayName; -export { Tabs, TabsList, TabsTrigger, TabsContent } +export { Tabs, TabsList, TabsTrigger, TabsContent }; diff --git a/src/components/ui/version-badge.tsx b/src/components/ui/version-badge.tsx index 73c4171..d95f9cf 100644 --- a/src/components/ui/version-badge.tsx +++ b/src/components/ui/version-badge.tsx @@ -1,6 +1,6 @@ import { Badge } from "@/components/ui/badge"; -import packageInfo from "../../../package.json"; import Link from "next/link"; +import packageInfo from "../../../package.json"; interface VersionDisplayProps { githubRelease: string; diff --git a/src/lib/consts.ts b/src/lib/consts.ts index d0fc38f..9d54e84 100644 --- a/src/lib/consts.ts +++ b/src/lib/consts.ts @@ -1,6 +1,6 @@ /** @format */ -import { createPublicClient, http } from 'viem'; +import { http, createPublicClient } from "viem"; import { arbitrum, avalanche, @@ -16,57 +16,57 @@ import { polygon, sepolia, zksync, -} from 'viem/chains'; +} from "viem/chains"; export const CHAINS = { - MAINNET: 'mainnet', - ARBITRUM_ONE: 'arbitrum_one', - AVALANCHE: 'avalanche', - BASE: 'base', - BSC: 'bsc', - CELO: 'celo', - FANTOM: 'fantom', - FUSE: 'fuse', - MATIC: 'matic', - MOONBEAM: 'moonbeam', - OPTIMISM: 'optimism', - SEPOLIA: 'sepolia', - XDAI: 'xdai', - ZKSYNCERA: 'zksyncera', + MAINNET: "mainnet", + ARBITRUM_ONE: "arbitrum_one", + AVALANCHE: "avalanche", + BASE: "base", + BSC: "bsc", + CELO: "celo", + FANTOM: "fantom", + FUSE: "fuse", + MATIC: "matic", + MOONBEAM: "moonbeam", + OPTIMISM: "optimism", + SEPOLIA: "sepolia", + XDAI: "xdai", + ZKSYNCERA: "zksyncera", }; export const CHAIN_SCAN_URLS = { - [CHAINS.MAINNET]: 'https://etherscan.io', - [CHAINS.ARBITRUM_ONE]: 'https://arbiscan.io', - [CHAINS.AVALANCHE]: 'https://cchain.explorer.avax.network', - [CHAINS.BASE]: 'https://basescan.org', - [CHAINS.BSC]: 'https://bscscan.com', - [CHAINS.CELO]: 'https://explorer.celo.org', - [CHAINS.FANTOM]: 'https://ftmscan.com', - [CHAINS.FUSE]: 'https://explorer.fuse.io', - [CHAINS.MATIC]: 'https://explorer-mainnet.maticvigil.com', - [CHAINS.MOONBEAM]: 'https://moonbeam-explorer.netlify.app', - [CHAINS.OPTIMISM]: 'https://optimistic.etherscan.io', - [CHAINS.SEPOLIA]: 'https://sepolia.etherscan.io', - [CHAINS.XDAI]: 'https://gnosisscan.io', - [CHAINS.ZKSYNCERA]: 'https://explorer.zksync.io', + [CHAINS.MAINNET]: "https://etherscan.io", + [CHAINS.ARBITRUM_ONE]: "https://arbiscan.io", + [CHAINS.AVALANCHE]: "https://cchain.explorer.avax.network", + [CHAINS.BASE]: "https://basescan.org", + [CHAINS.BSC]: "https://bscscan.com", + [CHAINS.CELO]: "https://explorer.celo.org", + [CHAINS.FANTOM]: "https://ftmscan.com", + [CHAINS.FUSE]: "https://explorer.fuse.io", + [CHAINS.MATIC]: "https://explorer-mainnet.maticvigil.com", + [CHAINS.MOONBEAM]: "https://moonbeam-explorer.netlify.app", + [CHAINS.OPTIMISM]: "https://optimistic.etherscan.io", + [CHAINS.SEPOLIA]: "https://sepolia.etherscan.io", + [CHAINS.XDAI]: "https://gnosisscan.io", + [CHAINS.ZKSYNCERA]: "https://explorer.zksync.io", }; export enum PAYMENT_CHAINS { - MAINNET = 'payment_mainnet', - ARBITRUM_ONE = 'payment_arbitrum_one', - AVALANCHE = 'payment_avalanche', - BASE = 'payment_base', - BSC = 'payment_bsc', - CELO = 'payment_celo', - FANTOM = 'payment_fantom', - FUSE = 'payment_fuse', - MATIC = 'payment_matic', - MOONBEAM = 'payment_moonbeam', - OPTIMISM = 'payment_optimism', - SEPOLIA = 'payment_sepolia', - XDAI = 'payment_xdai', - ZKSYNCERA = 'payment_zksyncera', + MAINNET = "payment_mainnet", + ARBITRUM_ONE = "payment_arbitrum_one", + AVALANCHE = "payment_avalanche", + BASE = "payment_base", + BSC = "payment_bsc", + CELO = "payment_celo", + FANTOM = "payment_fantom", + FUSE = "payment_fuse", + MATIC = "payment_matic", + MOONBEAM = "payment_moonbeam", + OPTIMISM = "payment_optimism", + SEPOLIA = "payment_sepolia", + XDAI = "payment_xdai", + ZKSYNCERA = "payment_zksyncera", } export const PUBLIC_CLIENTS = { diff --git a/src/lib/currency-manager.ts b/src/lib/currency-manager.ts index 169ef80..f64fe5c 100644 --- a/src/lib/currency-manager.ts +++ b/src/lib/currency-manager.ts @@ -1,6 +1,6 @@ /** @format */ -import { CurrencyManager } from '@requestnetwork/currency'; +import { CurrencyManager } from "@requestnetwork/currency"; export const currencyManager = new CurrencyManager( CurrencyManager.getDefaultList(), diff --git a/src/lib/graphQlClient.ts b/src/lib/graphQlClient.ts index b45a8e5..97c0421 100644 --- a/src/lib/graphQlClient.ts +++ b/src/lib/graphQlClient.ts @@ -8,11 +8,11 @@ export const graphQLClient = new GraphQLClient( { fetch: cache( async (url: string | Request | URL, params: RequestInit | undefined) => - fetch(url, { ...params, next: { revalidate: 60 } }) + fetch(url, { ...params, next: { revalidate: 60 } }), ), headers: { Authorization: `Bearer ${process.env.NEXT_PUBLIC_HASURA_GRAPHQL_JWT_TOKEN || ""}`, "x-hasura-role": "request-scan", }, - } + }, ); diff --git a/src/lib/hooks/use-address-payments.tsx b/src/lib/hooks/use-address-payments.tsx index 42fb90d..0c46502 100644 --- a/src/lib/hooks/use-address-payments.tsx +++ b/src/lib/hooks/use-address-payments.tsx @@ -1,9 +1,9 @@ /** @format */ -import { useQuery } from '@tanstack/react-query'; -import { PaginationState } from '@tanstack/react-table'; -import { fetchAddressPayments } from '../queries/address-payments'; -import { commonQueryOptions } from '../utils'; +import { useQuery } from "@tanstack/react-query"; +import type { PaginationState } from "@tanstack/react-table"; +import { fetchAddressPayments } from "../queries/address-payments"; +import { commonQueryOptions } from "../utils"; export function useAddressPayments( address: string, @@ -11,7 +11,7 @@ export function useAddressPayments( ) { return useQuery({ queryKey: [ - 'address-payments', + "address-payments", address, pagination.pageSize, pagination.pageIndex * pagination.pageSize, diff --git a/src/lib/hooks/use-address-requests.tsx b/src/lib/hooks/use-address-requests.tsx index 145d3e1..cdbf170 100644 --- a/src/lib/hooks/use-address-requests.tsx +++ b/src/lib/hooks/use-address-requests.tsx @@ -1,9 +1,9 @@ /** @format */ -import { useQuery } from '@tanstack/react-query'; -import { PaginationState } from '@tanstack/react-table'; -import { fetchAddressRequests } from '../queries/address-transactions'; -import { commonQueryOptions } from '../utils'; +import { useQuery } from "@tanstack/react-query"; +import type { PaginationState } from "@tanstack/react-table"; +import { fetchAddressRequests } from "../queries/address-transactions"; +import { commonQueryOptions } from "../utils"; export function useAddressRequests( address: string, @@ -11,7 +11,7 @@ export function useAddressRequests( ) { return useQuery({ queryKey: [ - 'address-request', + "address-request", address, pagination.pageSize, pagination.pageIndex * pagination.pageSize, diff --git a/src/lib/hooks/use-export-pdf.tsx b/src/lib/hooks/use-export-pdf.tsx index c05da98..ea71c8c 100644 --- a/src/lib/hooks/use-export-pdf.tsx +++ b/src/lib/hooks/use-export-pdf.tsx @@ -1,97 +1,97 @@ /** @format */ "use client"; -import { Invoice, InvoiceItem } from "@requestnetwork/data-format"; +import type { Invoice, InvoiceItem } from "@requestnetwork/data-format"; +// @ts-expect-error: No html2pdf does not have the @types to install +import html2pdf from "html2pdf.js"; import { formatUnits, isAddress } from "viem"; import { currencyManager } from "../currency-manager"; +import type { PaymentData } from "../types"; import { capitalize, renderAddress } from "../utils"; -import { PaymentData } from "../types"; -// @ts-expect-error: No html2pdf does not have the @types to install -import html2pdf from "html2pdf.js"; const RENDER_DELAY_MS = 3000; // Define this at the top of the file or in a config const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); export default function useExportPDF() { - // Add timeout handling - const TIMEOUT_MS = 10000; - const MAX_RETRIES = 3; + // Add timeout handling + const TIMEOUT_MS = 10000; + const MAX_RETRIES = 3; - const formatDate = (date: string | undefined) => { - return date ? new Date(date).toLocaleDateString() : "-"; - }; + const formatDate = (date: string | undefined) => { + return date ? new Date(date).toLocaleDateString() : "-"; + }; - const getCurrencyDetails = (currency: any) => { - const currencyDetails: { symbol: string; decimals: number } | undefined = - isAddress(currency) - ? currencyManager.fromAddress(currency) - : currencyManager.fromSymbol(currency); + const getCurrencyDetails = (currency: any) => { + const currencyDetails: { symbol: string; decimals: number } | undefined = + isAddress(currency) + ? currencyManager.fromAddress(currency) + : currencyManager.fromSymbol(currency); - return currencyDetails; - }; + return currencyDetails; + }; - const calculateItemTotal = (item: InvoiceItem): bigint => { - try { - const unitPrice = BigInt(Math.floor(Number(item.unitPrice || 0))); - const discount = BigInt(Math.floor(Number(item.discount || 0))); - const taxPercentage = Number(item.tax?.amount || 0); - const quantity = BigInt(Math.floor(Number(item.quantity || 1))); + const calculateItemTotal = (item: InvoiceItem): bigint => { + try { + const unitPrice = BigInt(Math.floor(Number(item.unitPrice || 0))); + const discount = BigInt(Math.floor(Number(item.discount || 0))); + const taxPercentage = Number(item.tax?.amount || 0); + const quantity = BigInt(Math.floor(Number(item.quantity || 1))); - const priceAfterDiscount = unitPrice - discount; - const taxAmount = - (priceAfterDiscount * BigInt(Math.floor(taxPercentage * 100))) / - BigInt(10000); - const itemTotal = (priceAfterDiscount + taxAmount) * quantity; + const priceAfterDiscount = unitPrice - discount; + const taxAmount = + (priceAfterDiscount * BigInt(Math.floor(taxPercentage * 100))) / + BigInt(10000); + const itemTotal = (priceAfterDiscount + taxAmount) * quantity; - return itemTotal; - } catch (error) { - console.error("Error calculating item total:", error); - return BigInt(0); - } - }; + return itemTotal; + } catch (error) { + console.error("Error calculating item total:", error); + return BigInt(0); + } + }; - const formatBigIntAmount = ( - amount: string | number | undefined, - decimals: number, - ): string => { - try { - if (!amount) return "0"; - const value = Math.floor(Number(amount)); - return formatUnits(BigInt(value), decimals || 0); - } catch (error) { - console.error("Error formatting amount:", error); - return "0"; - } - }; + const formatBigIntAmount = ( + amount: string | number | undefined, + decimals: number, + ): string => { + try { + if (!amount) return "0"; + const value = Math.floor(Number(amount)); + return formatUnits(BigInt(value), decimals || 0); + } catch (error) { + console.error("Error formatting amount:", error); + return "0"; + } + }; - const exportPDF = async ( - invoice: Invoice & { - currency: any; - currencyInfo: any; - payer: any; - payee: any; - expectedAmount: any; - paymentData: PaymentData; - }, - ) => { - let retries = 0; + const exportPDF = async ( + invoice: Invoice & { + currency: any; + currencyInfo: any; + payer: any; + payee: any; + expectedAmount: any; + paymentData: PaymentData; + }, + ) => { + let retries = 0; - const generatePDF = async () => { - try { - const currencyDetails = getCurrencyDetails(invoice.currencyInfo?.value); - const paymentCurrencyDetails = getCurrencyDetails( - invoice.paymentData?.acceptedTokens?.length > 0 - ? invoice.paymentData.acceptedTokens[0] - : undefined, - ); + const generatePDF = async () => { + try { + const currencyDetails = getCurrencyDetails(invoice.currencyInfo?.value); + const paymentCurrencyDetails = getCurrencyDetails( + invoice.paymentData?.acceptedTokens?.length > 0 + ? invoice.paymentData.acceptedTokens[0] + : undefined, + ); - // Sanitize invoice number for filename - const safeInvoiceNumber = (invoice?.invoiceNumber || "unknown") - .replace(/[^a-z0-9]/gi, "-") - .toLowerCase(); + // Sanitize invoice number for filename + const safeInvoiceNumber = (invoice?.invoiceNumber || "unknown") + .replace(/[^a-z0-9]/gi, "-") + .toLowerCase(); - const content = ` + const content = ` @@ -130,57 +130,57 @@ export default function useExportPDF() {

INVOICE #${ - invoice?.invoiceNumber || "-" - }

+ invoice?.invoiceNumber || "-" + }
From:

${ - invoice.payee?.value || "-" - }

+ invoice.payee?.value || "-" + }

${ - invoice?.sellerInfo?.firstName || "" - } ${invoice?.sellerInfo?.lastName || ""}

+ invoice?.sellerInfo?.firstName || "" + } ${invoice?.sellerInfo?.lastName || ""}

${renderAddress( - invoice?.sellerInfo, - )}

+ invoice?.sellerInfo, + )}

${ - invoice?.sellerInfo?.taxRegistration - ? `

VAT: ${invoice.sellerInfo.taxRegistration}

` - : "" - } + invoice?.sellerInfo?.taxRegistration + ? `

VAT: ${invoice.sellerInfo.taxRegistration}

` + : "" + }
To:

${ - invoice.payer?.value || "-" - }

+ invoice.payer?.value || "-" + }

${ - invoice?.buyerInfo?.firstName || "" - } ${invoice?.buyerInfo?.lastName || ""}

+ invoice?.buyerInfo?.firstName || "" + } ${invoice?.buyerInfo?.lastName || ""}

${renderAddress( - invoice?.buyerInfo, - )}

+ invoice?.buyerInfo, + )}

${ - invoice?.buyerInfo?.taxRegistration - ? `

VAT: ${invoice.buyerInfo.taxRegistration}

` - : "" - } + invoice?.buyerInfo?.taxRegistration + ? `

VAT: ${invoice.buyerInfo.taxRegistration}

` + : "" + }
Payment Chain: ${ - invoice?.paymentData?.network - ? capitalize(invoice?.paymentData?.network) - : "-" - }
+ invoice?.paymentData?.network + ? capitalize(invoice?.paymentData?.network) + : "-" + }
Invoice Currency: ${currencyDetails?.symbol || "-"}
Settlement Currency: ${ - paymentCurrencyDetails?.symbol || "-" - }
+ paymentCurrencyDetails?.symbol || "-" + }
@@ -196,126 +196,126 @@ export default function useExportPDF() { ${(invoice?.invoiceItems || []) - .map( - (item: any) => ` + .map( + (item: any) => ` + item.name || "-" + } + item.quantity || "-" + } + item.unitPrice, + currencyDetails?.decimals || 0, + )} + item.discount, + currencyDetails?.decimals || 0, + )} + item.tax?.amount ? `${item.tax.amount}%` : "-" + } + calculateItemTotal(item).toString(), + currencyDetails?.decimals || 0, + )} `, - ) - .join("")} + ) + .join("")} + invoice.expectedAmount + ? `${formatUnits( + BigInt(invoice.expectedAmount), + currencyDetails?.decimals || 0, + )} ${currencyDetails?.symbol || ""}` + : "-" + }
${ - item.name || "-" - } ${ - item.quantity || "-" - } ${formatBigIntAmount( - item.unitPrice, - currencyDetails?.decimals || 0, - )} ${formatBigIntAmount( - item.discount, - currencyDetails?.decimals || 0, - )} ${ - item.tax?.amount ? `${item.tax.amount}%` : "-" - } ${formatBigIntAmount( - calculateItemTotal(item).toString(), - currencyDetails?.decimals || 0, - )}
Due: ${ - invoice.expectedAmount - ? `${formatUnits( - BigInt(invoice.expectedAmount), - currencyDetails?.decimals || 0, - )} ${currencyDetails?.symbol || ""}` - : "-" - }
${ - invoice?.note - ? `
+ invoice?.note + ? `

Note:

${invoice.note}

` - : "" - } + : "" + }
`; - const opt = { - margin: 10, - filename: `invoice-${safeInvoiceNumber}.pdf`, - html2canvas: { - scale: 2, - useCORS: true, - letterRendering: true, - logging: false, // Disable logging - timeout: TIMEOUT_MS, - }, - jsPDF: { - unit: "mm", - format: "a4", - orientation: "portrait", - compress: true, - }, - }; + const opt = { + margin: 10, + filename: `invoice-${safeInvoiceNumber}.pdf`, + html2canvas: { + scale: 2, + useCORS: true, + letterRendering: true, + logging: false, // Disable logging + timeout: TIMEOUT_MS, + }, + jsPDF: { + unit: "mm", + format: "a4", + orientation: "portrait", + compress: true, + }, + }; - // Create container outside the viewport - const container = document.createElement("div"); - container.style.position = "absolute"; - container.style.left = "-9999px"; - container.style.top = "-9999px"; - document.body.appendChild(container); + // Create container outside the viewport + const container = document.createElement("div"); + container.style.position = "absolute"; + container.style.left = "-9999px"; + container.style.top = "-9999px"; + document.body.appendChild(container); - try { - const element = document.createElement("div"); - element.innerHTML = content; - container.appendChild(element); + try { + const element = document.createElement("div"); + element.innerHTML = content; + container.appendChild(element); - await sleep(RENDER_DELAY_MS); - await Promise.race([ - html2pdf().from(element).set(opt).save(), - new Promise((_, reject) => - setTimeout( - () => reject(new Error("PDF generation timeout")), - TIMEOUT_MS, - ), - ), - ]); - } finally { - // Ensure cleanup happens even if there's an error - if (document.body.contains(container)) { - document.body.removeChild(container); - } - } - } catch (error) { - if (retries < MAX_RETRIES) { - retries++; - console.warn( - `PDF generation failed, attempt ${retries} of ${MAX_RETRIES}`, - ); - await sleep(1000); // Wait before retrying - return generatePDF(); - } - throw error; - } - }; + await sleep(RENDER_DELAY_MS); + await Promise.race([ + html2pdf().from(element).set(opt).save(), + new Promise((_, reject) => + setTimeout( + () => reject(new Error("PDF generation timeout")), + TIMEOUT_MS, + ), + ), + ]); + } finally { + // Ensure cleanup happens even if there's an error + if (document.body.contains(container)) { + document.body.removeChild(container); + } + } + } catch (error) { + if (retries < MAX_RETRIES) { + retries++; + console.warn( + `PDF generation failed, attempt ${retries} of ${MAX_RETRIES}`, + ); + await sleep(1000); // Wait before retrying + return generatePDF(); + } + throw error; + } + }; - await generatePDF(); - }; + await generatePDF(); + }; - return { - exportPDF, - }; + return { + exportPDF, + }; } diff --git a/src/lib/hooks/use-latest-payments.tsx b/src/lib/hooks/use-latest-payments.tsx index d8d9bb2..806155d 100644 --- a/src/lib/hooks/use-latest-payments.tsx +++ b/src/lib/hooks/use-latest-payments.tsx @@ -1,12 +1,12 @@ /** @format */ -'use client'; +"use client"; -import { useEffect, useMemo, useState } from 'react'; -import { Payment } from '../types'; -import { fetchPayments } from '../queries/payments'; -import { useQuery } from '@tanstack/react-query'; -import { usePathname, useSearchParams, useRouter } from 'next/navigation'; -import { commonQueryOptions } from '../utils'; +import { useQuery } from "@tanstack/react-query"; +import { usePathname, useRouter, useSearchParams } from "next/navigation"; +import { useEffect, useMemo, useState } from "react"; +import { fetchPayments } from "../queries/payments"; +import type { Payment } from "../types"; +import { commonQueryOptions } from "../utils"; interface ILatestPayments { payments: Payment[]; @@ -38,7 +38,7 @@ export const useLatestPayments = ({ const [prefetchedData, setPrefetchedData] = useState(); const { status, isLoading, data, isFetching } = useQuery({ - queryKey: ['payments', first, skip], + queryKey: ["payments", first, skip], queryFn: () => fetchPayments({ first, skip }), refetchInterval: pollInterval === 0 ? false : pollInterval, placeholderData: commonQueryOptions.placeholderData, @@ -52,7 +52,7 @@ export const useLatestPayments = ({ } const params = new URLSearchParams(searchParams); - params.set('page', page.toString()); + params.set("page", page.toString()); replace(`${pathname}?${params.toString()}`); (async () => { diff --git a/src/lib/hooks/use-latest-requests.tsx b/src/lib/hooks/use-latest-requests.tsx index d5c89b1..33f3503 100644 --- a/src/lib/hooks/use-latest-requests.tsx +++ b/src/lib/hooks/use-latest-requests.tsx @@ -1,12 +1,12 @@ /** @format */ -'use client'; +"use client"; -import { useEffect, useMemo, useState } from 'react'; -import { Transaction } from '../types'; -import { useQuery } from '@tanstack/react-query'; -import { fetchRequests } from '../queries/transactions'; -import { usePathname, useSearchParams, useRouter } from 'next/navigation'; -import { commonQueryOptions } from '../utils'; +import { useQuery } from "@tanstack/react-query"; +import { usePathname, useRouter, useSearchParams } from "next/navigation"; +import { useEffect, useMemo, useState } from "react"; +import { fetchRequests } from "../queries/transactions"; +import type { Transaction } from "../types"; +import { commonQueryOptions } from "../utils"; interface ILatestRequests { requests: { @@ -43,7 +43,7 @@ export const useLatestRequests = ({ }>(); const { status, isLoading, data, isFetching } = useQuery({ - queryKey: ['requests', first, skip], + queryKey: ["requests", first, skip], queryFn: () => fetchRequests({ first, skip }), refetchInterval: pollInterval === 0 ? false : pollInterval, placeholderData: commonQueryOptions.placeholderData, @@ -57,7 +57,7 @@ export const useLatestRequests = ({ } const params = new URLSearchParams(searchParams); - params.set('page', page.toString()); + params.set("page", page.toString()); replace(`${pathname}?${params.toString()}`); (async () => { diff --git a/src/lib/hooks/use-latest-srf-deployments.tsx b/src/lib/hooks/use-latest-srf-deployments.tsx index 22c430b..55c38cf 100644 --- a/src/lib/hooks/use-latest-srf-deployments.tsx +++ b/src/lib/hooks/use-latest-srf-deployments.tsx @@ -1,10 +1,10 @@ "use client"; -import { useEffect, useMemo, useState } from "react"; -import type { SingleRequestProxyDeployment } from "../types"; import { useQuery } from "@tanstack/react-query"; +import { usePathname, useRouter, useSearchParams } from "next/navigation"; +import { useEffect, useMemo, useState } from "react"; import { fetchProxyDeployments } from "../queries/srf-deployments"; -import { usePathname, useSearchParams, useRouter } from "next/navigation"; +import type { SingleRequestProxyDeployment } from "../types"; import { commonQueryOptions } from "../utils"; interface LatestSRFDeployments { @@ -70,7 +70,7 @@ export const useLatestSRFDeployments = ({ isFetching, error, }), - [data, isLoading, status, isFetching, error] + [data, isLoading, status, isFetching, error], ); return value as LatestSRFDeployments; diff --git a/src/lib/queries/address-payments.ts b/src/lib/queries/address-payments.ts index 799638a..c21894c 100644 --- a/src/lib/queries/address-payments.ts +++ b/src/lib/queries/address-payments.ts @@ -1,10 +1,10 @@ /** @format */ -import { gql } from 'graphql-request'; -import { Payment } from '../types'; -import { graphQLClient } from '../graphQlClient'; -import { formatPaymentData } from '../utils'; -import { CORE_PAYMENT_FIELDS } from './utils'; +import { gql } from "graphql-request"; +import { graphQLClient } from "../graphQlClient"; +import type { Payment } from "../types"; +import { formatPaymentData } from "../utils"; +import { CORE_PAYMENT_FIELDS } from "./utils"; export const ADDRESS_PAYMENTS_QUERY = gql` ${CORE_PAYMENT_FIELDS} @@ -177,7 +177,7 @@ export const fetchAddressPayments = async (variables: { return formatPaymentData(data); } catch (error: any) { - console.error('Error fetching address payments:', error); + console.error("Error fetching address payments:", error); throw error; } }; diff --git a/src/lib/queries/address-transactions.ts b/src/lib/queries/address-transactions.ts index 70b9518..8b50c5e 100644 --- a/src/lib/queries/address-transactions.ts +++ b/src/lib/queries/address-transactions.ts @@ -1,10 +1,10 @@ /** @format */ import { gql } from "graphql-request"; +import { getAddress } from "viem"; import { graphQLClient } from "../graphQlClient"; -import { Transaction } from "../types"; +import type { Transaction } from "../types"; import { groupBy } from "../utils"; -import { getAddress } from "viem"; export const ADDRESS_TRANSACTIONS_QUERY = gql` query AddressTransactionsQuery( @@ -83,7 +83,7 @@ export const fetchAddressRequests = async (variables: { storage_sepolia: { transactions: Transaction[] }; } = await graphQLClient.request( ADDRESS_TRANSACTIONS_QUERY, - formatedVariables + formatedVariables, ); // Combine transactions from both networks @@ -100,7 +100,7 @@ export const fetchAddressRequests = async (variables: { dataObject: JSON.parse(transaction.data), }; }), - "channelId" + "channelId", ) : []; }; diff --git a/src/lib/queries/channel.ts b/src/lib/queries/channel.ts index 3452126..55fec30 100644 --- a/src/lib/queries/channel.ts +++ b/src/lib/queries/channel.ts @@ -2,7 +2,7 @@ import { gql } from "graphql-request"; import { graphQLClient } from "../graphQlClient"; -import { Channel, Transaction } from "../types"; +import type { Channel, Transaction } from "../types"; export const CHANNEL_QUERY = gql` query ChannelQuery($id: ID!) @cached { @@ -79,7 +79,7 @@ export const fetchRequest = async (variables: { console.error(`Error parsing transaction data: ${error.message}`); return transaction; } - } + }, ), }; } @@ -99,7 +99,7 @@ export const fetchRequest = async (variables: { console.error(`Error parsing transaction data: ${error.message}`); return transaction; } - } + }, ), }; } diff --git a/src/lib/queries/payments.ts b/src/lib/queries/payments.ts index a0f8797..1ac548b 100644 --- a/src/lib/queries/payments.ts +++ b/src/lib/queries/payments.ts @@ -1,10 +1,10 @@ /** @format */ -import { gql } from 'graphql-request'; -import { Payment } from '../types'; -import { graphQLClient } from '../graphQlClient'; -import { formatPaymentData } from '../utils'; -import { CORE_PAYMENT_FIELDS } from './utils'; +import { gql } from "graphql-request"; +import { graphQLClient } from "../graphQlClient"; +import type { Payment } from "../types"; +import { formatPaymentData } from "../utils"; +import { CORE_PAYMENT_FIELDS } from "./utils"; export const PAYMENTS_QUERY = gql` ${CORE_PAYMENT_FIELDS} diff --git a/src/lib/queries/request-payments.ts b/src/lib/queries/request-payments.ts index 9f0348e..c488570 100644 --- a/src/lib/queries/request-payments.ts +++ b/src/lib/queries/request-payments.ts @@ -1,10 +1,10 @@ /** @format */ -import { gql } from 'graphql-request'; -import { Payment } from '../types'; -import { graphQLClient } from '../graphQlClient'; -import { formatPaymentData } from '../utils'; -import { CORE_PAYMENT_FIELDS } from './utils'; +import { gql } from "graphql-request"; +import { graphQLClient } from "../graphQlClient"; +import type { Payment } from "../types"; +import { formatPaymentData } from "../utils"; +import { CORE_PAYMENT_FIELDS } from "./utils"; export const REQUEST_PAYMENTS_QUERY = gql` ${CORE_PAYMENT_FIELDS} @@ -151,7 +151,7 @@ export const fetchRequestPayments = async (variables: { return formatPaymentData(data); } catch (error) { - console.error('fetchRequestPayments', error); + console.error("fetchRequestPayments", error); throw error; } }; diff --git a/src/lib/queries/srf-deployments.ts b/src/lib/queries/srf-deployments.ts index e0e025b..77570bc 100644 --- a/src/lib/queries/srf-deployments.ts +++ b/src/lib/queries/srf-deployments.ts @@ -209,7 +209,7 @@ export const fetchProxyDeploymentsByReference = async (variables: { }; } = await graphQLClient.request( PROXY_DEPLOYMENTS_BY_REFERENCE_QUERY, - variables + variables, ); return formatProxyDeploymentData(data); diff --git a/src/lib/queries/transactions.ts b/src/lib/queries/transactions.ts index c17b3da..341d108 100644 --- a/src/lib/queries/transactions.ts +++ b/src/lib/queries/transactions.ts @@ -2,7 +2,7 @@ import { gql } from "graphql-request"; import { graphQLClient } from "../graphQlClient"; -import { Transaction } from "../types"; +import type { Transaction } from "../types"; import { groupBy } from "../utils"; export const TRANSACTIONS_QUERY = gql` @@ -74,7 +74,7 @@ export const fetchRequests = async (variables: { dataObject: JSON.parse(transaction.data), }; }), - "channelId" + "channelId", ) : []; }; diff --git a/src/lib/queries/utils.ts b/src/lib/queries/utils.ts index 9f01fc0..2f07b1d 100644 --- a/src/lib/queries/utils.ts +++ b/src/lib/queries/utils.ts @@ -47,7 +47,7 @@ export const formatProxyDeploymentData = ( [x: string]: { singleRequestProxyDeployments: SingleRequestProxyDeployment[]; }; - } | null + } | null, ) => { if (!data) return []; @@ -58,7 +58,7 @@ export const formatProxyDeploymentData = ( (deployment) => ({ ...deployment, chain: networkName, - }) + }), ); deployments.push(...networkDeployments); }); diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 78ecb87..91f6941 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -45,7 +45,7 @@ export const formatTimestamp = (timestamp: number) => export const getAmountWithCurrencySymbol = ( amount: bigint, - currency: string + currency: string, ) => { const currencyDetails: { symbol: string; decimals: number } | undefined = currency && isAddress(currency) @@ -68,7 +68,7 @@ export const getAmountWithCurrencySymbol = ( export function calculateShortPaymentReference( requestId: string, salt: string, - address: string + address: string, ): `0x${string}` | undefined { try { return `0x${PaymentReferenceCalculator.calculate(requestId, salt, address)}`; @@ -79,7 +79,7 @@ export function calculateShortPaymentReference( } export const calculateLongPaymentReference = ( - shortPaymentReference: `0x${string}` + shortPaymentReference: `0x${string}`, ) => { return keccak256(shortPaymentReference); }; @@ -104,7 +104,7 @@ export const formatPaymentData = (data: PaymentDataStructure | null) => { if (!data) return []; const chainEntries = Object.entries(data).filter(([key]) => - key.startsWith("payment_") + key.startsWith("payment_"), ); return chainEntries @@ -114,7 +114,7 @@ export const formatPaymentData = (data: PaymentDataStructure | null) => { .toUpperCase() as keyof typeof CHAINS; return ( value?.payments.map((payment) => - mapPaymentToChain(payment, CHAINS[chainName]) + mapPaymentToChain(payment, CHAINS[chainName]), ) || [] ); }) @@ -122,12 +122,12 @@ export const formatPaymentData = (data: PaymentDataStructure | null) => { }; export const formatProxyDeploymentData = ( - data: ProxyDeploymentDataStructure | null + data: ProxyDeploymentDataStructure | null, ) => { if (!data) return []; const chainEntries = Object.entries(data).filter(([key]) => - key.startsWith("payment_") + key.startsWith("payment_"), ); return chainEntries @@ -152,25 +152,25 @@ export const commonQueryOptions = { }; export const getTransactionCreateParameters = ( - transaction: Transaction + transaction: Transaction, ): RequestLogicTypes.ICreateParameters => { return transaction?.dataObject?.data ?.parameters as RequestLogicTypes.ICreateParameters; }; export const getContentDataFromCreateTransaction = ( - createParameters: RequestLogicTypes.ICreateParameters + createParameters: RequestLogicTypes.ICreateParameters, ) => { const extensionData = createParameters.extensionsData; const contentData: Invoice = extensionData?.find( - (extension) => extension.id === "content-data" + (extension) => extension.id === "content-data", )?.parameters?.content; return contentData; }; export const getPaymentDataFromCreateTransaction = ( - createParameters: RequestLogicTypes.ICreateParameters + createParameters: RequestLogicTypes.ICreateParameters, ) => { const extensionData = createParameters?.extensionsData!; return extensionData[0]?.parameters; @@ -180,7 +180,7 @@ export const getBalance = (payments: Payment[] | undefined) => { return payments ? payments .map((payment) => - BigInt(payment?.amount || payment?.amountInCrypto || "0") + BigInt(payment?.amount || payment?.amountInCrypto || "0"), ) .reduce((a, b) => a + b, BigInt(0)) : BigInt(0); diff --git a/tailwind.config.ts b/tailwind.config.ts index e618f96..40510c3 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,86 +1,86 @@ /** @format */ -import type { Config } from 'tailwindcss'; -const { fontFamily } = require('tailwindcss/defaultTheme'); +import type { Config } from "tailwindcss"; +const { fontFamily } = require("tailwindcss/defaultTheme"); const config = { - darkMode: ['class'], + darkMode: ["class"], content: [ - './pages/**/*.{ts,tsx}', - './components/**/*.{ts,tsx}', - './app/**/*.{ts,tsx}', - './src/**/*.{ts,tsx}', + "./pages/**/*.{ts,tsx}", + "./components/**/*.{ts,tsx}", + "./app/**/*.{ts,tsx}", + "./src/**/*.{ts,tsx}", ], - prefix: '', + prefix: "", theme: { container: { center: true, - padding: '2rem', + padding: "2rem", screens: { - '2xl': '1400px', + "2xl": "1400px", }, }, extend: { colors: { - border: 'hsl(var(--border))', - input: 'hsl(var(--input))', - ring: 'hsl(var(--ring))', - background: 'hsl(var(--background))', - foreground: 'hsl(var(--foreground))', + border: "hsl(var(--border))", + input: "hsl(var(--input))", + ring: "hsl(var(--ring))", + background: "hsl(var(--background))", + foreground: "hsl(var(--foreground))", primary: { - DEFAULT: 'hsl(var(--primary))', - foreground: 'hsl(var(--primary-foreground))', + DEFAULT: "hsl(var(--primary))", + foreground: "hsl(var(--primary-foreground))", }, secondary: { - DEFAULT: 'hsl(var(--secondary))', - foreground: 'hsl(var(--secondary-foreground))', + DEFAULT: "hsl(var(--secondary))", + foreground: "hsl(var(--secondary-foreground))", }, destructive: { - DEFAULT: 'hsl(var(--destructive))', - foreground: 'hsl(var(--destructive-foreground))', + DEFAULT: "hsl(var(--destructive))", + foreground: "hsl(var(--destructive-foreground))", }, muted: { - DEFAULT: 'hsl(var(--muted))', - foreground: 'hsl(var(--muted-foreground))', + DEFAULT: "hsl(var(--muted))", + foreground: "hsl(var(--muted-foreground))", }, accent: { - DEFAULT: 'hsl(var(--accent))', - foreground: 'hsl(var(--accent-foreground))', + DEFAULT: "hsl(var(--accent))", + foreground: "hsl(var(--accent-foreground))", }, popover: { - DEFAULT: 'hsl(var(--popover))', - foreground: 'hsl(var(--popover-foreground))', + DEFAULT: "hsl(var(--popover))", + foreground: "hsl(var(--popover-foreground))", }, card: { - DEFAULT: 'hsl(var(--card))', - foreground: 'hsl(var(--card-foreground))', + DEFAULT: "hsl(var(--card))", + foreground: "hsl(var(--card-foreground))", }, }, borderRadius: { - lg: 'var(--radius)', - md: 'calc(var(--radius) - 2px)', - sm: 'calc(var(--radius) - 4px)', + lg: "var(--radius)", + md: "calc(var(--radius) - 2px)", + sm: "calc(var(--radius) - 4px)", }, keyframes: { - 'accordion-down': { - from: { height: '0' }, - to: { height: 'var(--radix-accordion-content-height)' }, + "accordion-down": { + from: { height: "0" }, + to: { height: "var(--radix-accordion-content-height)" }, }, - 'accordion-up': { - from: { height: 'var(--radix-accordion-content-height)' }, - to: { height: '0' }, + "accordion-up": { + from: { height: "var(--radix-accordion-content-height)" }, + to: { height: "0" }, }, }, animation: { - 'accordion-down': 'accordion-down 0.2s ease-out', - 'accordion-up': 'accordion-up 0.2s ease-out', + "accordion-down": "accordion-down 0.2s ease-out", + "accordion-up": "accordion-up 0.2s ease-out", }, fontFamily: { - sans: ['var(--font-sans)', ...fontFamily.sans], + sans: ["var(--font-sans)", ...fontFamily.sans], }, }, }, - plugins: [require('tailwindcss-animate')], + plugins: [require("tailwindcss-animate")], } satisfies Config; export default config;