Skip to content

Commit 149ad34

Browse files
committed
feat: sdk
0 parents  commit 149ad34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+10406
-0
lines changed

.editorconfig

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[**.{json,vue,css,html,yml,ts,js,xml,yaml,yml,toml,tf}]
15+
indent_style = space
16+
indent_size = 2
17+
18+
[Makefile]
19+
indent_style = tab

.eslintrc.json

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2020": true,
5+
"node": true
6+
},
7+
"extends": [
8+
"airbnb-base",
9+
"prettier",
10+
"plugin:@typescript-eslint/recommended",
11+
"plugin:@typescript-eslint/recommended-requiring-type-checking"
12+
],
13+
"globals": {
14+
"Optional": "readonly"
15+
},
16+
"parser": "@typescript-eslint/parser",
17+
"parserOptions": {
18+
"ecmaVersion": 12,
19+
"project": ["./tsconfig.json", "./tsconfig.test.json"]
20+
},
21+
"plugins": [
22+
"@typescript-eslint",
23+
"es",
24+
"no-only-tests"
25+
],
26+
"rules": {
27+
"import/prefer-default-export": 0,
28+
"import/extensions": [
29+
2,
30+
"ignorePackages",
31+
{
32+
"js": "never",
33+
"jsx": "never",
34+
"ts": "never",
35+
"tsx": "never"
36+
}
37+
],
38+
"no-plusplus": 0,
39+
"no-shadow": 0,
40+
"no-param-reassign": 0,
41+
"no-return-await": 0,
42+
"@typescript-eslint/no-shadow": 1,
43+
"no-useless-constructor": 0,
44+
"no-empty-function": 0,
45+
"no-unused-vars": 0,
46+
"no-bitwise": 0,
47+
"camelcase": 0,
48+
"@typescript-eslint/no-unused-vars": 1,
49+
"no-promise-executor-return": 0,
50+
"no-continue": 0,
51+
"no-use-before-define": 0,
52+
"arrow-body-style": 0,
53+
"@typescript-eslint/switch-exhaustiveness-check": 2,
54+
"@typescript-eslint/no-inferrable-types": 0,
55+
"@typescript-eslint/ban-ts-comment": 1,
56+
"@typescript-eslint/no-explicit-any": 0,
57+
"@typescript-eslint/no-empty-function": 0,
58+
"default-case": 0,
59+
"@typescript-eslint/require-await": 0,
60+
"@typescript-eslint/no-unsafe-call": 0,
61+
"@typescript-eslint/no-unsafe-member-access": 0,
62+
"@typescript-eslint/no-unsafe-return": 0,
63+
"@typescript-eslint/no-unsafe-argument": 0,
64+
"@typescript-eslint/no-unsafe-assignment": 0,
65+
"@typescript-eslint/no-non-null-assertion": 2,
66+
"@typescript-eslint/no-floating-promises": 2,
67+
"import/no-extraneous-dependencies": 0,
68+
"import/order": 1,
69+
"no-warning-comments": 0,
70+
"@typescript-eslint/no-duplicate-enum-values": 1,
71+
"no-only-tests/no-only-tests": 1,
72+
"@typescript-eslint/strict-boolean-expressions": 0
73+
},
74+
"ignorePatterns": [
75+
"dist/*"
76+
],
77+
"settings": {
78+
"import/extensions": [
79+
".js",
80+
".ts",
81+
".d.ts"
82+
],
83+
"import/parsers": {
84+
"@typescript-eslint/parser": [
85+
".ts",
86+
".d.ts"
87+
]
88+
},
89+
"import/resolver": {
90+
"node": {
91+
"extensions": [
92+
".js",
93+
".ts",
94+
".d.ts"
95+
]
96+
}
97+
}
98+
}
99+
}

.gitignore

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Node
2+
node_modules
3+
package-lock.json
4+
5+
# Log files
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
pnpm-debug.log*
10+
11+
# Editor directories and files
12+
.idea
13+
.vscode
14+
*.suo
15+
*.ntvs*
16+
*.njsproj
17+
*.sln
18+
*.sw?
19+
20+
# NYC
21+
.nyc_output
22+
coverage
23+
24+
# Project specific
25+
dist
26+
src/test/configOverrides.test.ts
27+
28+
# Outputs
29+
.tgz
30+
release/
31+
corpus
32+
crash-*
33+
*.tgz

.mocharc.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"file": ["./src/test/setup.test.ts"],
3+
"require": "ts-node/register",
4+
"exit": true
5+
}

.nycrc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"cache": false,
3+
"check-coverage": false,
4+
"extension": [".ts"],
5+
"include": ["**/*.ts"],
6+
"exclude": ["tests/**", "coverage/**", "dist/**", "node_modules/**", "**/*.d.ts"],
7+
"sourceMap": true,
8+
"reporter": ["html", "text", "text-summary"],
9+
"all": true,
10+
"instrument": true
11+
}

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tsconfig.json
2+
.eslintrc.json

.prettierrc.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"trailingComma": "all",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true,
6+
"printWidth": 100,
7+
"arrowParens": "always"
8+
}

README.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
[Opact](https://www.opact.io)
2+
==========
3+
4+
## What is Opact Protocol
5+
OPACT is a privacy layer application on top of multiple different blockchains.
6+
7+
Developers in those blockchains can use OPACT to integrate privacy features in their application
8+
9+
## The SDK
10+
The SDK provides abstranctions to implement the opact privacy system.
11+
12+
## Guidelines
13+
* Use the present tense ("Add feature" not "Added feature") and the imperative mood ("Move class to..." not "Moves class to...") on commits and use the name issue on pull requests.
14+
* Pull requests must be reviewed before merged.
15+
* Done is better than perfect. Does it work as expected? Ship now, iterate later.
16+
* All contributions must have tests. Remember to verify the [Github Actions CI status](https://github.com/opact-protocol/sdk/actions/workflows/CI.yaml).
17+
* Every commit is checked using [Github Actions](https://github.com/opact-protocol/sdk/actions).
18+
* If the CI status are not passing, the deploy will not work.
19+
20+
## Coding Style
21+
- Typescript: https://github.com/airbnb/javascript
22+
23+
## Task Management
24+
* GitHub Issues is used to track all tasks that needed to be done.
25+
* Opact board is used to get a decent look on what's going on wright now.
26+
* Every two weeks all done tasks are put together in a Milestone and the current Sprint is closed.
27+
* Issues Board: https://github.com/orgs/hack-a-chain-software/projects/5
28+
29+
## Directory Structure
30+
Here's a brief overview of the SDK structure:
31+
32+
```bash
33+
├── .github
34+
│ └── CI # CI Workflow: validate TS and check all tests
35+
├── src
36+
│ └── util # Utils: -
37+
│ └── ticket # Ticket abstractions: -
38+
│ └── merkletree # Merkletree abstractions: -
39+
│ └── encryptation # Encryptation abstractions: -
40+
│ └── key-derivation # Key derivation abstractions: -
41+
├── package.json
42+
```
43+
44+
## Installation
45+
Opact Protocol is powered by [**Hack-a-chain**](https://hackachain.io/).
46+
47+
If you have any problems configuring your enviroment, remember to read the [Nuxt Documentation](https://nuxt.com/docs).
48+
49+
-----------------
50+
51+
#### Steps
52+
1) Clone the repository:
53+
```bash
54+
$ gh repo clone hack-a-chain-software/kadena-product
55+
$ cd kadena-product
56+
```
57+
58+
2) Check all packages and copy the .env.example file and edit it with your environment config:
59+
```bash
60+
$ cp ./front/.env.example ./front/.env
61+
```
62+
63+
3) Install frontend dependencies via PNPM
64+
```bash
65+
$ pnpm install
66+
```
67+
68+
When working on frontend, run `pnpm front dev`. Files will be compiled, concatenated and the browser will auto update.

package.json

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"name": "opact-sdk",
3+
"version": "1.0.57",
4+
"description": "Opact Protocol SDK to integrate with Opact Ecosystem",
5+
"author": "OPACT core Contributors",
6+
"license": "MIT",
7+
"main": "dist/index.js",
8+
"scripts": {
9+
"build": "pnpm clean && tsc",
10+
"prepack": "pnpm install && pnpm build",
11+
"build-test": "pnpm clean && tsc -p tsconfig.test.json",
12+
"release": "mkdir -p release && npm pack && mv *.tgz ./release",
13+
"clean": "rimraf dist && rimraf coverage && rimraf .nyc_outsput",
14+
"test": "pnpm build-test && env NODE_ENV=test mocha 'src/**/tests/*.test.ts'",
15+
"lint": "eslint src/**/*.ts src/*.ts; tsc --noEmit; tsc -p tsconfig.test.json --noEmit"
16+
},
17+
"files": [
18+
"/dist",
19+
"/*.md"
20+
],
21+
"exports": {
22+
".": "./dist/index.js"
23+
},
24+
"repository": {
25+
"type": "git",
26+
"url": "git+https://github.com/opact-protocol/sdk.git"
27+
},
28+
"homepage": "https://github.com/opact-protocol/sdk#readme",
29+
"bugs": {
30+
"url": "https://github.com/opact-protocol/sdk/issues"
31+
},
32+
"dependencies": {
33+
"@noble/hashes": "^1.3.2",
34+
"@peculiar/webcrypto": "^1.4.3",
35+
"axios": "^1.5.1",
36+
"big.js": "^6.2.1",
37+
"bigint-conversion": "^2.4.2",
38+
"blake-hash": "^2.0.0",
39+
"circomlibjs": "hsg88/circomlibjs#ffjavascrip.0.1.0",
40+
"crypto-browserify": "^3.12.0",
41+
"ethereum-cryptography": "^2.1.2",
42+
"ffjavascript": "^0.2.60",
43+
"fixed-merkle-tree": "^0.7.3",
44+
"js-base64": "^3.7.5",
45+
"localforage": "^1.10.0",
46+
"pact-lang-api": "^4.3.6"
47+
},
48+
"devDependencies": {
49+
"@types/big.js": "^6.1.6",
50+
"@types/chai": "^4.3.5",
51+
"@types/mocha": "^10.0.1",
52+
"@types/node": "^20.2.5",
53+
"@typescript-eslint/eslint-plugin": "^5.59.8",
54+
"@typescript-eslint/parser": "^5.59.8",
55+
"chai": "^4.3.7",
56+
"eslint": "^8.41.0",
57+
"eslint-config-airbnb-base": "^15.0.0",
58+
"eslint-config-prettier": "^8.8.0",
59+
"eslint-plugin-es": "^4.1.0",
60+
"eslint-plugin-import": "^2.27.5",
61+
"eslint-plugin-no-only-tests": "^3.1.0",
62+
"mocha": "^10.2.0",
63+
"nyc": "^15.1.0",
64+
"prettier": "^2.8.8",
65+
"rimraf": "^5.0.1",
66+
"snarkjs": "^0.7.0",
67+
"ts-node": "^10.9.1",
68+
"typechain": "^8.2.0",
69+
"typescript": "^5.0.4"
70+
}
71+
}

0 commit comments

Comments
 (0)