Skip to content

Commit

Permalink
chore: bring in library from old repo
Browse files Browse the repository at this point in the history
  • Loading branch information
beeman committed Mar 7, 2024
1 parent fc50ffd commit 926020f
Show file tree
Hide file tree
Showing 26 changed files with 7,019 additions and 784 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
42 changes: 42 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
}
]
}
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
28 changes: 28 additions & 0 deletions .verdaccio/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# path to a directory with all packages
storage: ../tmp/local-registry/storage

# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
maxage: 60m

packages:
'**':
# give all users (including non-authenticated users) full access
# because it is a local registry
access: $all
publish: $all
unpublish: $all

# if package is not available locally, proxy requests to npm registry
proxy: npmjs

# log settings
logs:
type: stdout
format: pretty
level: warn

publish:
allow_offline: true # set offline to true to allow publish offline
4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"recommendations": [

"nrwl.angular-console",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner"
]
}
5 changes: 5 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { getJestProjectsAsync } from '@nx/jest'

export default async () => ({
projects: await getJestProjectsAsync(),
})
3 changes: 3 additions & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const nxPreset = require('@nx/jest/preset').default

module.exports = { ...nxPreset }
51 changes: 45 additions & 6 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,53 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"sharedGlobals"
],
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"production": [
"default"
"default",
"!{projectRoot}/.eslintrc.json",
"!{projectRoot}/eslint.config.js",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/jest.config.[jt]s",
"!{projectRoot}/src/test-setup.[jt]s",
"!{projectRoot}/test-setup.[jt]s"
],
"sharedGlobals": []
},
"nxCloudAccessToken": "NzE5YjFkNTUtZTk1Ni00NjU2LWExOGMtODIxNmJkOWMxNDlifHJlYWQtd3JpdGU="
"nxCloudAccessToken": "NzE5YjFkNTUtZTk1Ni00NjU2LWExOGMtODIxNmJkOWMxNDlifHJlYWQtd3JpdGU=",
"useInferencePlugins": false,
"targetDefaults": {
"@nx/rollup:rollup": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
},
"@nx/eslint:lint": {
"cache": true,
"inputs": [
"default",
"{workspaceRoot}/.eslintrc.json",
"{workspaceRoot}/.eslintignore",
"{workspaceRoot}/eslint.config.js"
]
},
"@nx/jest:jest": {
"cache": true,
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
"options": {
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"release": {
"version": {
"preVersionCommand": "pnpm dlx nx run-many -t build"
}
}
}
34 changes: 32 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,40 @@
"license": "MIT",
"scripts": {},
"private": true,
"dependencies": {},
"dependencies": {
"@solana/web3.js": "^1.90.1",
"bs58": "^5.0.0",
"tslib": "^2.3.0",
"tweetnacl": "^1.0.3"
},
"devDependencies": {
"@nx/eslint": "18.1.0-beta.5",
"@nx/eslint-plugin": "18.1.0-beta.5",
"@nx/jest": "18.1.0-beta.5",
"@nx/js": "18.1.0-beta.5",
"@nx/rollup": "18.1.0-beta.5",
"@nx/workspace": "18.1.0-beta.5",
"nx": "18.1.0-beta.5"
"@swc-node/register": "~1.8.0",
"@swc/cli": "~0.1.62",
"@swc/core": "~1.3.85",
"@swc/helpers": "~0.5.2",
"@swc/jest": "0.2.20",
"@types/jest": "^29.4.0",
"@types/node": "18.16.9",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"eslint": "~8.48.0",
"eslint-config-prettier": "^9.0.0",
"jest": "^29.4.1",
"jest-environment-node": "^29.4.1",
"nx": "18.1.0-beta.5",
"prettier": "^2.6.2",
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",
"typescript": "~5.3.2",
"verdaccio": "^5.0.4"
},
"nx": {
"includedScripts": []
}
}
30 changes: 30 additions & 0 deletions packages/solana-verify-wallet/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": [
"error",
{
"ignoredFiles": ["{projectRoot}/rollup.config.{js,ts,mjs,mts}"]
}
]
}
}
]
}
29 changes: 29 additions & 0 deletions packages/solana-verify-wallet/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"jsc": {
"target": "es2017",
"parser": {
"syntax": "typescript",
"decorators": true,
"dynamicImport": true
},
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true
},
"keepClassNames": true,
"externalHelpers": true,
"loose": true
},
"module": {
"type": "es6"
},
"sourceMaps": true,
"exclude": [
"jest.config.ts",
".*\\.spec.tsx?$",
".*\\.test.tsx?$",
"./src/jest-setup.ts$",
"./**/jest-setup.ts$",
".*.js$"
]
}
11 changes: 11 additions & 0 deletions packages/solana-verify-wallet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# solana-verify-wallet

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build solana-verify-wallet` to build the library.

## Running unit tests

Run `nx test solana-verify-wallet` to execute the unit tests via [Jest](https://jestjs.io).
30 changes: 30 additions & 0 deletions packages/solana-verify-wallet/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable */
import { readFileSync } from 'fs';

// Reading the SWC compilation config and remove the "exclude"
// for the test files to be compiled by SWC
const { exclude: _, ...swcJestConfig } = JSON.parse(
readFileSync(`${__dirname}/.swcrc`, 'utf-8')
);

// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves.
// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude"
if (swcJestConfig.swcrc === undefined) {
swcJestConfig.swcrc = false;
}

// Uncomment if using global setup/teardown files being transformed via swc
// https://nx.dev/packages/jest/documents/overview#global-setup/teardown-with-nx-libraries
// jest needs EsModule Interop to find the default exported setup/teardown functions
// swcJestConfig.module.noInterop = false;

export default {
displayName: 'solana-verify-wallet',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]s$': ['@swc/jest', swcJestConfig],
},
moduleFileExtensions: ['ts', 'js', 'html'],
testEnvironment: 'node',
coverageDirectory: '../../coverage/packages/solana-verify-wallet',
};
12 changes: 12 additions & 0 deletions packages/solana-verify-wallet/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@pubkeyapp/solana-verify-wallet",
"version": "0.0.1",
"dependencies": {
"@solana/web3.js": "^1.90.1",
"bs58": "^5.0.0",
"tweetnacl": "^1.0.3"
},
"type": "commonjs",
"main": "./index.cjs",
"module": "./index.js"
}
46 changes: 46 additions & 0 deletions packages/solana-verify-wallet/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "solana-verify-wallet",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/solana-verify-wallet/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx/rollup:rollup",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/solana-verify-wallet",
"main": "packages/solana-verify-wallet/src/index.ts",
"tsConfig": "packages/solana-verify-wallet/tsconfig.lib.json",
"assets": [],
"project": "packages/solana-verify-wallet/package.json",
"compiler": "swc",
"format": ["cjs", "esm"],
"external": "all"
}
},
"nx-release-publish": {
"options": {
"packageRoot": "dist/{projectRoot}"
}
},
"lint": {
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/solana-verify-wallet/jest.config.ts"
}
}
},
"tags": [],
"release": {
"version": {
"generatorOptions": {
"packageRoot": "dist/{projectRoot}",
"currentVersionResolver": "git-tag"
}
}
}
}
2 changes: 2 additions & 0 deletions packages/solana-verify-wallet/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './lib/create-signature'
export * from './lib/verify-signature'
3 changes: 3 additions & 0 deletions packages/solana-verify-wallet/src/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { PublicKey } from '@solana/web3.js'

export const MEMO_PROGRAM_ID = new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr')
Loading

0 comments on commit 926020f

Please sign in to comment.