Skip to content

Commit

Permalink
signing lib running (#97)
Browse files Browse the repository at this point in the history
* signing lib running

* removed unused packages

* really removed unused packages
  • Loading branch information
Ptroger authored Feb 8, 2024
1 parent 278adbf commit 6f40adb
Show file tree
Hide file tree
Showing 19 changed files with 708 additions and 0 deletions.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"clsx": "^1.2.1",
"date-fns": "^3.3.1",
"handlebars": "^4.7.8",
"jose": "^5.2.1",
"lodash": "^4.17.21",
"prism-react-renderer": "^2.3.1",
"react": "18.2.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/signature-verifier/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": [["@nrwl/js/babel", { "useBuiltIns": "usage" }]]
}
18 changes: 18 additions & 0 deletions packages/signature-verifier/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
29 changes: 29 additions & 0 deletions packages/signature-verifier/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
TRI_PROJECT_NAME := signature-verifier
TRI_PROJECT_DIR := ./packages/signature-verifier

# == Code format ==

signature-verifier/format:
npx nx format:write --projects ${TRI_PROJECT_NAME}

signature-verifier/lint:
npx nx lint ${TRI_PROJECT_NAME} -- --fix

signature-verifier/format/check:
npx nx format:check --projects ${TRI_PROJECT_NAME}

signature-verifier/lint/check:
npx nx lint ${TRI_PROJECT_NAME}

# == Testing ==

signature-verifier/test/type:
npx tsc \
--project ${TRI_PROJECT_DIR}/tsconfig.lib.json \
--noEmit

signature-verifier/test/unit:
npx nx test:unit ${TRI_PROJECT_NAME} -- ${ARGS}

signature-verifier/test/unit/watch:
make signature-verifier/test/unit ARGS=--watch
24 changes: 24 additions & 0 deletions packages/signature-verifier/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Transaction Request Intent

[![Transaction Request Intent CI](https://github.com/narval-xyz/narval/actions/workflows/transaction_request_intent_ci.yml/badge.svg?branch=main)](https://github.com/narval-xyz/narval/actions/workflows/transaction_request_intent_ci.yml)

Library to decode a
[TransactionRequest](https://viem.sh/docs/glossary/types#transactionrequest)
into an object with granular information.

## Testing

```bash
make signature-verifier/test/unit
make signature-verifier/test/unit/watch
```

## Formatting

```bash
make signature-verifier/format
make signature-verifier/lint

make signature-verifier/format/check
make signature-verifier/lint/check
```
18 changes: 18 additions & 0 deletions packages/signature-verifier/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Config } from 'jest'

const config: Config = {
displayName: 'signature-verifier',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]sx?$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.spec.json'
}
]
}
}

export default config
9 changes: 9 additions & 0 deletions packages/signature-verifier/jest.unit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { Config } from 'jest'
import sharedConfig from './jest.config'

const config: Config = {
...sharedConfig,
testMatch: ['<rootDir>/**/__test__/unit/**/*.spec.ts']
}

export default config
24 changes: 24 additions & 0 deletions packages/signature-verifier/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "signature-verifier",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/signature-verifier/src",
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/signature-verifier/**/*.ts"]
}
},
"test:unit": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/signature-verifier/jest.unit.ts",
"verbose": true
}
}
},
"tags": []
}
2 changes: 2 additions & 0 deletions packages/signature-verifier/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { sign } from './src/lib/signature/signRequest'
export { verify } from './src/lib/signature/verifySignature'
Loading

0 comments on commit 6f40adb

Please sign in to comment.