Skip to content

Commit

Permalink
ci: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Jul 7, 2024
1 parent 4c97215 commit c91c88c
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 55 deletions.
5 changes: 3 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log", "supabase"],
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log", "supabase", "bun.lockb"],
"useGitignore": true,
"language": "en",
"words": ["dataurl", "devpool", "outdir", "servedir", "typebox"],
Expand Down Expand Up @@ -31,6 +31,7 @@
"ciphertext",
"tweetnacl",
"typeguards",
"Numberish"
"Numberish",
"Rpcs"
]
}
2 changes: 1 addition & 1 deletion .github/workflows/knip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
name: knip-results
path: |
knip-results.json
pr-number.txt
pr-number.txt
2 changes: 1 addition & 1 deletion .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.10.0'
node-version: "20.10.0"
registry-url: https://registry.npmjs.org/
- run: |
yarn install --immutable --immutable-cache --check-cache
Expand Down
26 changes: 12 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@

## 1.3.1 (2024-06-20)


### ⚠ BREAKING CHANGES

* bundle splitting ([#13](https://github.com/ubiquibot/permit-generation/issues/13))
- bundle splitting ([#13](https://github.com/ubiquibot/permit-generation/issues/13))

### Features

* add custom reward token to permit ([16b08bc](https://github.com/ubiquibot/permit-generation/commit/16b08bc2ea6cadaba5f1446c832ec85d609bedab))
* bundle splitting ([#13](https://github.com/ubiquibot/permit-generation/issues/13)) ([38eb308](https://github.com/ubiquibot/permit-generation/commit/38eb30843665724ca6521f19b72e572d0f59c1c2))
* encode decode permits ([#10](https://github.com/ubiquibot/permit-generation/issues/10)) ([5673641](https://github.com/ubiquibot/permit-generation/commit/567364137dd48bfa7adf1c5c8a9b55e48d470181))
* package generation and publish ([f743a24](https://github.com/ubiquibot/permit-generation/commit/f743a242bfe4487e4309647690228d98342bad74))
* permit module ([b3b95d1](https://github.com/ubiquibot/permit-generation/commit/b3b95d1a8e9081ee4d33b8408ddf194b961ae090))
* permits ([3b928a1](https://github.com/ubiquibot/permit-generation/commit/3b928a1c0544d8c117133cf80c4a3bcc58697345))
* return data to kernel ([de23301](https://github.com/ubiquibot/permit-generation/commit/de2330129fe709292e4598f81cb1461ac43c0df6))
* rollup for package bundling ([628cb59](https://github.com/ubiquibot/permit-generation/commit/628cb59da66c16f1ea8d76c95caaa25426486641))

- add custom reward token to permit ([16b08bc](https://github.com/ubiquibot/permit-generation/commit/16b08bc2ea6cadaba5f1446c832ec85d609bedab))
- bundle splitting ([#13](https://github.com/ubiquibot/permit-generation/issues/13)) ([38eb308](https://github.com/ubiquibot/permit-generation/commit/38eb30843665724ca6521f19b72e572d0f59c1c2))
- encode decode permits ([#10](https://github.com/ubiquibot/permit-generation/issues/10)) ([5673641](https://github.com/ubiquibot/permit-generation/commit/567364137dd48bfa7adf1c5c8a9b55e48d470181))
- package generation and publish ([f743a24](https://github.com/ubiquibot/permit-generation/commit/f743a242bfe4487e4309647690228d98342bad74))
- permit module ([b3b95d1](https://github.com/ubiquibot/permit-generation/commit/b3b95d1a8e9081ee4d33b8408ddf194b961ae090))
- permits ([3b928a1](https://github.com/ubiquibot/permit-generation/commit/3b928a1c0544d8c117133cf80c4a3bcc58697345))
- return data to kernel ([de23301](https://github.com/ubiquibot/permit-generation/commit/de2330129fe709292e4598f81cb1461ac43c0df6))
- rollup for package bundling ([628cb59](https://github.com/ubiquibot/permit-generation/commit/628cb59da66c16f1ea8d76c95caaa25426486641))

### Bug Fixes

* fixed compilation and erc20 tests ([63c3823](https://github.com/ubiquibot/permit-generation/commit/63c3823ae49cbda768dfd01d58d25e926101d7e9))
* fixed erc721 tests and errors ([414f29f](https://github.com/ubiquibot/permit-generation/commit/414f29fe852f7a5360eef1344d1e5d7b0da0dda5))
* this makes no sense ([881f006](https://github.com/ubiquibot/permit-generation/commit/881f006ca7f8dc64ba9fdeb7f02b3da8f0d68476))
- fixed compilation and erc20 tests ([63c3823](https://github.com/ubiquibot/permit-generation/commit/63c3823ae49cbda768dfd01d58d25e926101d7e9))
- fixed erc721 tests and errors ([414f29f](https://github.com/ubiquibot/permit-generation/commit/414f29fe852f7a5360eef1344d1e5d7b0da0dda5))
- this makes no sense ([881f006](https://github.com/ubiquibot/permit-generation/commit/881f006ca7f8dc64ba9fdeb7f02b3da8f0d68476))
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ General remarks:
Return value should just be an array of generated permits. A separate module can convert them into URLs for pay.ubq.fi.

[^1^]: I put a lot of thought into this and unless the plugins can hack X25519 encryption I think its fine for them to attempt brute forcing etc. In exchange its simpler infrastructure vs only accepting requests from the kernel (which seems more secure, but for V1 perhaps unnecessary.)

[^2^]: We pass in the username for enhanced developer experience for plugin development. I believe it will be much easier to use GitHub usernames and let the system do the lookup.

[^3^]: Mixed feelings on this lookup because it does not self encapsulate this module well. We already have an optional database write for the permit record, but this plugin WILL break if there is a database issue for reading the user's registered wallet, which can make testing and development more difficult here. The alternative is to pass in the user's wallet here, but then the kernel (or another plugin) needs to look up their wallet address (this seems like the better approach.)
31 changes: 3 additions & 28 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,23 @@ const config = [
dir: "dist/types",
format: "cjs",
},
plugins: [
del({ targets: ["dist/*"] }),
nodeResolve({ browser: true }),
commonjs(),
typescript(),
yaml(),
json(),
generateDtsBundle(),
terser(),
],
plugins: [del({ targets: ["dist/*"] }), nodeResolve({ browser: true }), commonjs(), typescript(), yaml(), json(), generateDtsBundle(), terser()],
},
{
input: "src/handlers/index.ts",
output: {
dir: "dist/handlers",
format: "cjs",
},
plugins: [
nodeResolve({ browser: true }),
commonjs(),
typescript(),
yaml(),
json(),
generateDtsBundle(),
terser(),
],
plugins: [nodeResolve({ browser: true }), commonjs(), typescript(), yaml(), json(), generateDtsBundle(), terser()],
},
{
input: "src/index.ts",
output: {
dir: "dist/core",
format: "cjs",
},
plugins: [
nodeResolve(),
commonjs(),
typescript(),
yaml(),
json(),
generateDtsBundle(),
terser(),
],
plugins: [nodeResolve(), commonjs(), typescript(), yaml(), json(), generateDtsBundle(), terser()],
},
];

Expand Down
1 change: 0 additions & 1 deletion src/adapters/supabase/helpers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ export class User extends Super {
console.log("Successfully deleted user", { userId });
}
}

7 changes: 6 additions & 1 deletion src/handlers/generate-erc20-permit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ export interface Payload {

export async function generateErc20PermitSignature(payload: Payload, username: string, amount: number, tokenAddress: string): Promise<PermitReward>;
export async function generateErc20PermitSignature(context: Context, username: string, amount: number, tokenAddress: string): Promise<PermitReward>;
export async function generateErc20PermitSignature(contextOrPayload: Context | Payload, username: string, amount: number, tokenAddress: string): Promise<PermitReward> {
export async function generateErc20PermitSignature(
contextOrPayload: Context | Payload,
username: string,
amount: number,
tokenAddress: string
): Promise<PermitReward> {
let _logger: Logger;
const _username = username;
let _walletAddress: string | null | undefined;
Expand Down
12 changes: 6 additions & 6 deletions src/utils/get-fastest-provider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-expect-error - no types
import { RPCHandler, HandlerConstructorConfig } from "@ubiquity-dao/rpc-handler"
import { RPCHandler, HandlerConstructorConfig } from "@ubiquity-dao/rpc-handler";
import { JsonRpcProvider } from "ethers";

function getHandler(networkId: number | string) {
Expand All @@ -13,14 +13,14 @@ function getHandler(networkId: number | string) {
networkRpcs: null,
};

return new RPCHandler(config as HandlerConstructorConfig)
return new RPCHandler(config as HandlerConstructorConfig);
}

export async function getFastestProvider(networkId: number | string): Promise<JsonRpcProvider> {
try {
const handler = getHandler(networkId)
return await handler.getFastestRpcProvider()
const handler = getHandler(networkId);
return await handler.getFastestRpcProvider();
} catch (e) {
throw new Error(`Failed to get fastest provider for networkId: ${networkId}`)
throw new Error(`Failed to get fastest provider for networkId: ${networkId}`);
}
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/* Modules */
"module": "ES2022" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */
"moduleResolution": "Node", /* Specify how TypeScript looks up a file from a given module specifier. */
"moduleResolution": "Node" /* Specify how TypeScript looks up a file from a given module specifier. */,
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
Expand Down

0 comments on commit c91c88c

Please sign in to comment.