Skip to content

Commit

Permalink
Merge branch 'development' into feat/npm-package
Browse files Browse the repository at this point in the history
  • Loading branch information
gitcoindev authored Apr 8, 2024
2 parents 2be290c + 9901499 commit 48e6816
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 842 deletions.
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"libsodium",
"Libsodium",
"ciphertext",
"tweetnacl"
"tweetnacl",
"typeguards"
]
}
2 changes: 1 addition & 1 deletion .github/workflows/compute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
node-version: "20.10.0"

- name: Install dependencies
run: yarn i --immutable --immutable-cache --check-cache
run: yarn install --immutable --immutable-cache --check-cache

- name: Generate Permit
run: npx tsx ./src/index.ts
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/knip-reporter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Knip-reporter

on:
workflow_run:
workflows: ["Knip"]
types:
- completed

jobs:
knip-reporter:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install toolchain
run: yarn install

- uses: actions/download-artifact@v4
with:
name: knip-results
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Read pr number
id: pr-number
uses: juliangruber/read-file-action@v1
with:
path: ./pr-number.txt
trim: true

- name: Report knip results to pull request
if: ${{ github.event.workflow_run.conclusion != 'success' }}
uses: gitcoindev/knip-reporter@main
with:
verbose: true
comment_id: ${{ github.workflow }}-reporter
command_script_name: knip-ci
annotations: true
ignore_results: false
json_input: true
json_input_file_name: knip-results.json
pull_request_number: ${{ steps.pr-number.outputs.content }}
token: ${{ secrets.GITHUB_TOKEN }}
22 changes: 13 additions & 9 deletions .github/workflows/knip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Knip
on:
pull_request:

permissions: write-all

jobs:
run-knip:
runs-on: ubuntu-latest
Expand All @@ -20,11 +18,17 @@ jobs:
- name: Install toolchain
run: yarn install

- name: Report knip results to pull request
uses: Codex-/knip-reporter@v2
- name: Store PR number
run: echo ${{ github.event.number }} > pr-number.txt

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

- name: Upload knip result
if: failure()
uses: actions/upload-artifact@v4
with:
verbose: true
comment_id: ${{ github.workflow }}-reporter
command_script_name: knip-ci
annotations: true
ignore_results: false
name: knip-results
path: |
knip-results.json
pr-number.txt
8 changes: 6 additions & 2 deletions knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import type { KnipConfig } from "knip";
const config: KnipConfig = {
entry: ["build/index.ts"],
project: ["src/**/*.ts"],
ignore: ["src/types/config.ts"],
ignore: [],
ignoreExportsUsedInFile: true,
ignoreDependencies: [],
ignoreDependencies: ["ts-node"],
jest: {
config: ["jest.config.ts"],
entry: ["tests/*.ts"],
},
};

export default config;
15 changes: 3 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@ubiquibot/permit-generation",
"version": "1.0.0",
"description": "ECR20 / ECR721 permit generation for automated payments.",
"main": "src/index.ts",
"author": "Ubiquity DAO",
"license": "MIT",
"engines": {
Expand Down Expand Up @@ -30,20 +31,14 @@
"@actions/github": "^6.0.0",
"@octokit/rest": "^20.0.2",
"@octokit/webhooks": "^13.1.0",
"@octokit/webhooks-types": "^7.3.1",
"@sinclair/typebox": "^0.32.5",
"@supabase/supabase-js": "^2.39.7",
"@uniswap/permit2-sdk": "^1.2.0",
"blake2b": "^2.1.4",
"decimal.js": "^10.4.3",
"dotenv": "^16.4.4",
"ethers": "6.11.1",
"libsodium-wrappers": "^0.7.13",
"tweetnacl": "^1.0.3",
"tweetnacl-util": "^0.15.1"
"libsodium-wrappers": "^0.7.13"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240117.0",
"@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.2",
"@cspell/dict-node": "^4.0.3",
Expand All @@ -61,10 +56,7 @@
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"cspell": "^8.4.0",
"esbuild": "^0.20.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-sonarjs": "^0.24.0",
"husky": "^9.0.11",
"jest": "29.7.0",
Expand All @@ -79,8 +71,7 @@
"ts-jest": "29.1.2",
"ts-node": "10.9.2",
"tsx": "^4.7.1",
"typescript": "^5.3.3",
"wrangler": "^3.23.0"
"typescript": "^5.3.3"
},
"lint-staged": {
"*.ts": [
Expand Down
4 changes: 4 additions & 0 deletions src/adapters/supabase/types/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export type Database = {

type PublicSchema = Database[Extract<keyof Database, "public">];

/** @public */
export type Tables<
PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] & PublicSchema["Views"]) | { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
Expand All @@ -98,6 +99,7 @@ export type Tables<
: never
: never;

/** @public */
export type TablesInsert<
PublicTableNameOrOptions extends keyof PublicSchema["Tables"] | { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database } ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] : never = never,
Expand All @@ -115,6 +117,7 @@ export type TablesInsert<
: never
: never;

/** @public */
export type TablesUpdate<
PublicTableNameOrOptions extends keyof PublicSchema["Tables"] | { schema: keyof Database },
TableName extends PublicTableNameOrOptions extends { schema: keyof Database } ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] : never = never,
Expand All @@ -132,6 +135,7 @@ export type TablesUpdate<
: never
: never;

/** @public */
export type Enums<
PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] | { schema: keyof Database },
EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database } ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"] : never = never,
Expand Down
8 changes: 4 additions & 4 deletions src/handlers/generate-erc721-permit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ export async function generateErc721PermitSignature(
throw new Error("RPC is not defined");
}

if (!_nftContractAddress) {
const errorMesage = "NFT contract address is not defined";
_logger.error(errorMesage);
throw new Error(errorMesage);
if (!NFT_CONTRACT_ADDRESS) {
const errorMessage = "NFT contract address is not defined";
logger.error(errorMessage);
throw new Error(errorMessage);
}

let provider;
Expand Down
9 changes: 0 additions & 9 deletions src/types/github.ts

This file was deleted.

28 changes: 0 additions & 28 deletions src/types/webhook-events.ts

This file was deleted.

99 changes: 0 additions & 99 deletions src/utils/helpers.ts

This file was deleted.

1 change: 0 additions & 1 deletion tests/generate-payout-permit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { generatePayoutPermit } from "../src/handlers/generate-payout-permit";
import { Context } from "../src/types/context";
import { cypherText, mockContext, SPENDER } from "./constants";

jest.mock("../src/utils/helpers");
jest.mock("../src/handlers/generate-erc20-permit");
jest.mock("../src/handlers/generate-erc721-permit");

Expand Down
Loading

0 comments on commit 48e6816

Please sign in to comment.