Monorepository has been setup

Signed-off-by: T-Hax <>
This commit is contained in:
T-Hax 2023-05-02 22:19:28 +00:00
parent f88fc5c812
commit 9419f0673c
345 changed files with 988845 additions and 537 deletions

13
@tornado/sdk/.env.example Normal file
View file

@ -0,0 +1,13 @@
# RPC URLs
ETH_MAINNET_TEST_RPC=
# debug (debug events are logged to console)
DEBUG=
# use tor (torify tests)
TORIFY=
# tor port (regular = 9050, browser = 9150)
TOR_PORT=
# relayer DOMAIN (the example.xyz in https://example.xyz) for testing
TEST_RELAYER_DOMAIN=

View file

@ -0,0 +1,3 @@
build
node_modules
package-log.json

76
@tornado/sdk/.eslintrc Normal file
View file

@ -0,0 +1,76 @@
{
"env": {
"es6": true,
"node": true,
"mocha": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"prettier"
],
"parserOptions": {
"ecmaVersion": 2019,
"sourceType": "module",
"project": "./tsconfig.json"
},
"ignorePatterns": [
".eslintrc.js",
"prettier.config.js"
],
"rules": {
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/type-annotation-spacing": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"args": "none"
}
],
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/ban-types": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"no-array-constructor": "off",
"@typescript-eslint/no-array-constructor": "error",
"no-empty": "off",
"no-empty-function": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-this-alias": "error",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/no-floating-promises": [
"error"
],
"no-var": "error",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error"
},
"overrides": [
{
"files": [
"*.js"
],
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
}
]
}

5
@tornado/sdk/.gitattributes vendored Normal file
View file

@ -0,0 +1,5 @@
# Prevent eslintrc from appearing in GitHub language calculation
# (There seems to be no way to prevent language detection from
# falsely calling the CLI commands Javascript due to the shebang line)
.eslintrc.js linguist-documentation
prettier.config.js linguist-documentation

52
@tornado/sdk/.gitignore vendored Normal file
View file

@ -0,0 +1,52 @@
# Custom
## Bash export gitea auth token
.gitea.env
## Personal project folders I'm using
cache
vanilla_cache
scripts
## We are NOT using Zero-Installs
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# Defaults
.env
## Logs
logs
*.log
npm-debug.log*
## Runtime data
pids
*.pid
*.seed
## Optional npm cache directory
.npm
## Optional REPL history
.node_repl_history
## Other defaults
typings/
node_modules
build
sandbox
sand\ box
debug.log
yarn-error.log
*.map

63
@tornado/sdk/.mocharc.yml Normal file
View file

@ -0,0 +1,63 @@
# file handling
extension: [ "ts" ]
spec: ["test/*.test.ts"]
require: ["ts-node/register", "tsconfig-paths/register.js", "test/preload.ts"]
ignore: "test/utils.test.ts"
# # This is an example Mocha config containing every Mocha option plus others.
# allow-uncaught: false
# async-only: false
# bail: false
# check-leaks: false
# color: true
# delay: false
# diff: true
# exit: false # could be expressed as "no-exit: true"
# extension: ['js', 'cjs', 'mjs']
# fail-zero: true
# # fgrep and grep are mutually exclusive
# fgrep: 'something'
# file:
# - '/path/to/some/file'
# - '/path/to/some/other/file'
# forbid-only: false
# forbid-pending: false
# full-trace: false
# global:
# - 'jQuery'
# - '$'
# # fgrep and grep are mutually exclusive
# grep: '/something/i' # also 'something'
# growl: false
# ignore:
# - '/path/to/some/ignored/file'
# inline-diffs: false
# # needs to be used with grep or fgrep
# # invert: false
# jobs: 1
# node-option:
# - 'unhandled-rejections=strict' # without leading "--", also V8 flags
# package: './package.json'
# parallel: false
# recursive: false
# reporter: 'spec'
# reporter-option: # array, not object
# - 'foo=bar'
# - 'baz=quux'
# require: '@babel/register'
# retries: 1
# slow: '75'
# sort: false
# spec:
# - 'test/**/*.spec.js' # the positional arguments!
# timeout: '2000' # same as "timeout: '2s'"
# # timeout: false # same as "timeout: 0"
# trace-warnings: true # node flags ok
# ui: 'bdd'
# v8-stack-trace-limit: 100 # V8 flags are prepended with "v8-"
# watch: false
# watch-files:
# - 'lib/**/*.js'
# - 'test/**/*.js'
# watch-ignore:
# - 'lib/vendor'

View file

@ -0,0 +1,3 @@
build
node_modules
package-log.json

7
@tornado/sdk/.prettierrc Normal file
View file

@ -0,0 +1,7 @@
{
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"semi": false,
"printWidth": 110
}

19
@tornado/sdk/.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,19 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
"recommendations": [
// For ESLint
"dbaeumer.vscode-eslint",
// For bleeding edge Typescript features
"ms-vscode.vscode-typescript-next",
// For better editing of the README and other markdown files
"yzhang.markdown-all-in-one",
// For auto-completes when typing out paths
"christian-kohler.path-intellisense",
// For auto-formatting
"esbenp.prettier-vscode",
// For support editing any YAML config or other files
"redhat.vscode-yaml",
"arcanis.vscode-zipfs"
],
"unwantedRecommendations": []
}

26
@tornado/sdk/.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,26 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Tests",
"preLaunchTask": "npm: build",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"--require",
"source-map-support/register",
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/build/test/index.js"
],
"console": "internalConsole",
"internalConsoleOptions": "neverOpen",
"protocol": "inspector"
}
]
}

32
@tornado/sdk/.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,32 @@
{
// Use the local version of Typescript
"typescript.tsdk": "../../.yarn/sdks/typescript/lib",
// ESM requires extensions on import paths to work,
// these options tell VSCode to prefer adding extensions
// on auto-import.
"typescript.preferences.importModuleSpecifierEnding": "js",
"javascript.preferences.importModuleSpecifierEnding": "js",
// Make sure ESLint runs on target files.
"eslint.validate": [
"javascript",
"typescript"
],
// Check JavaScript by default (using the Typescript engine)
"js/ts.implicitProjectConfig.checkJs": true,
// Auto-format an fix files
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
// Let VSCode auto-update import paths when you move files around
"typescript.updateImportsOnFileMove.enabled": "always",
"javascript.updateImportsOnFileMove.enabled": "always",
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"eslint.nodePath": "../../.yarn/sdks",
"prettier.prettierPath": "../../.yarn/sdks/prettier/index.js",
"typescript.enablePromptUseWorkspaceTsdk": true
}

33
@tornado/sdk/.yarnrc.yml Normal file
View file

@ -0,0 +1,33 @@
# So basically, we want to selectively download packages from the Gitea repository but still allow the
# main repositories, so we are going to have to scope OUR packages properly. This means, unless the tornadocash
# Gitea organization defines a default scope, that we'll have to add every user scope. Including my own below.
# Note that all scopes are after @ prefix. So my prefix is @thax
npmScopes:
thax:
npmPublishRegistry: "https://development.tornadocash.community/api/packages/T-Hax/npm/"
npmRegistryServer: "https://development.tornadocash.community/api/packages/T-Hax/npm/"
# The below can be EXPORTED via some env file which actually exports the variables though
# Check the env.example, you will notice it's not a regular env
# So split your env files up, since this is only for manual actions
# npmAuthToken: ${GITEA_AUTH_TOKEN}
# If the following isn't set you won't have a node_modules folder
# You might be used to a node_modules folder instead of a pnp or other folder type
# If you want to use the new linkers uncomment or change the following
# nodeLinker: "node-modules"
# So the tornadocash org, the person who maintains it, might setup something (in future) like,
# tornadocash:
# npmPublishRegistry: "https://development.tornadocash.community/api/packages/tornadocash/npm/"
# npmRegistryServer: "https://development.tornadocash.community/api/packages/tornadocash/npm/"
# We disable telemetry for obvious reasons.
enableTelemetry: false
packageExtensions:
"@resolver-engine/imports-fs@*":
dependencies:
"@resolver-engine/core": "*"
"@thax/circomlib@*":
dependencies:
"web3-utils": "*"

7
@tornado/sdk/LICENSE.md Normal file
View file

@ -0,0 +1,7 @@
ISC License
Copyright 2023 T-Hax
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

62
@tornado/sdk/package.json Normal file
View file

@ -0,0 +1,62 @@
{
"name": "@tornado/sdk",
"author": "T-Hax",
"license": "ISC",
"description": "The Tornado SDK.",
"repository": "https://development.tornadocash.community/T-Hax/sdk-data",
"homepage": "https://tornadocash.community",
"keywords": [
"ethereum",
"crypto",
"zk"
],
"version": "2023.04.28",
"engines": {
"node": "^18"
},
"dependencies": {
"@tornado/sdk-chain": "workspace:*",
"@tornado/sdk-core": "workspace:*",
"@tornado/sdk-crypto": "workspace:*",
"@tornado/sdk-data": "workspace:*",
"@tornado/sdk-utils": "workspace:*",
"@tornado/sdk-web": "workspace:*"
},
"devDependencies": {
"@types/node": "^18.15.0",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"dotenv": "^16.0.3",
"eslint": "^8.35.0",
"eslint-plugin-prettier": "^4.2.1",
"ethers": "^5",
"prettier": "^2.3.0",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.1.2",
"typescript": "^5.0.4"
},
"main": "./build/index.js",
"scripts": {
"build": "rimraf build && tsc && tsc-alias",
"preversion": "npm run lint && npm run build && npm test",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && npm run format && git add -A",
"postversion": "git push --follow-tags && npm publish",
"lint": "eslint --ext ts,js --fix src",
"build-live": "tsc -w && tsc-alias -w",
"clean": "rm -rf --interactive=never cache/*",
"format": "prettier src/*.ts -w"
},
"files": [
"build/lib/**/*",
"build/index.*",
"build/types/**/*"
],
"publishConfig": {
"access": "public"
},
"dependenciesMeta": {
"tsconfig-paths@4.2.0": {
"unplugged": true
}
}
}

View file

@ -0,0 +1,6 @@
export * as Crypto from '@tornado/sdk-crypto'
export * as Data from '@tornado/sdk-data'
export * as Network from '@tornado/sdk-chain'
export * as Web from '@tornado/sdk-web'
export * as Utils from '@tornado/sdk-utils'
export * from '@tornado/sdk-core'

View file

@ -0,0 +1,31 @@
{
"include": ["./src"],
"exclude": ["node_modules"],
"ts-node": {
// Do not forget to `npm i -D tsconfig-paths`
"require": ["tsconfig-paths/register"]
},
"compilerOptions": {
// ~~~~~~~~~~~~~~~~~~~~~~~~~NODE 18 STANDARD~~~~~~~~~~~~~~~~~~~~~~~
"target": "es2022",
"module": "commonjs",
"lib": ["es2022"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"moduleResolution": "node",
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"outDir": "./build",
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"allowSyntheticDefaultImports": true,
"checkJs": true,
"allowJs": true,
"baseUrl": ".",
"paths": {
"src/*": ["src/*"]
}
}
}