Skip to content

Commit

Permalink
v1.0.0 release
Browse files Browse the repository at this point in the history
init
first public release
publish to npmjs
add example
  • Loading branch information
joshuamind committed Jun 1, 2023
0 parents commit 9cf86b4
Show file tree
Hide file tree
Showing 36 changed files with 17,477 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .fatherrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'father';

export default defineConfig({
esm: {output: 'dist'},
cjs: {output: 'dist'},
prebundle: {},
});
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/node_modules
/dist
.DS_Store
.idea
.editorconfig
example/src/myconfig.ts
.npmrc
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
**/*.md
**/*.svg
**/*.ejs
**/*.html
package.json
.umi
.umi-production
.umi-test
.dist
.node_modules
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 80,
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
}
]
}
15 changes: 15 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
MIT License

Copyright (c) 2021 The Typescript Packaging Authority

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Mind Lake Typescript SDK

An Typescript implementation for Mind Lake

## Description

The Mind Lake SDK utilizes Mind Lake's encryption storage and privacy computing capabilities to provide secure data management.
* Mind Lake is the backbone of Mind Network.
* All data is end-to-end encrypted at the client-side SDK side, ensuring that plaintext data never leaves the user's client.
* Cryptographic principles ensure that only the data owner can access their own plaintext data.
* Additionally, Mind Lake's powerful privacy computing capabilities enable the performance of calculations and querying of encrypted data.

## Getting Started

### Dependencies

* node [16, 18)
* web3js

### Installing

```
$ npm install --save mind-lake-sdk
# or
$ yarn add mind-lake-sdk
```

### Executing program

* [quick starts](https://mind-network.gitbook.io/mind-lake-sdk/get-started)
* [more examples](https://mind-network.gitbook.io/mind-lake-sdk/use-cases)
* Step-by-step bullets
```
import { MindLake } from "mind-lake-sdk";
const mindLake = await MindLake.getInstance("YOUR OWN APP KEY")
...
```

## code
```
mind-lake-sdk-typescript
|-- src # source code
| |-- MindLake.ts
| |-- DataLake.ts
| |-- Permission.ts
| |-- Cryptor.ts
|-- tests # unit test code
|-- example # use case examples
|-- README.md
└--- LICENSE
```

## Help

Full doc: [https://mind-network.gitbook.io/mind-lake-sdk](https://mind-network.gitbook.io/mind-lake-sdk)

## Authors
* Joshua [@JoshuaW55818202](https://twitter.com/JoshuaW55818202)
* Lee [@LeeTan853917](https://twitter.com/LeeTan853917)

## Version History

* v1.0.0
* Initial Release

## License

This project is licensed under the [MIT] License - see the LICENSE.md file for details
21 changes: 21 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/npm-debug.log*
/yarn-error.log
/yarn.lock
/package-lock.json
.editorconfig

# production
/dist

# misc
.DS_Store

# umi
/src/.umi
/src/.umi-production
/src/.umi-test
/.env.local
8 changes: 8 additions & 0 deletions example/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**/*.md
**/*.svg
**/*.ejs
**/*.html
package.json
.umi
.umi-production
.umi-test
11 changes: 11 additions & 0 deletions example/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 80,
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
}
]
}
11 changes: 11 additions & 0 deletions example/.umirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from 'umi';

export default defineConfig({
nodeModulesTransform: {
type: 'none',
},
routes: [
{ path: '/', component: '@/pages/index' },
],
fastRefresh: {},
});
42 changes: 42 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Overview
A quick example on how to use mind-lake-sdk TypeScript library

## Getting Started

### Install dependencies

install mind-lake-sdk manual
```bash
$ npm install --save mind-lake-sdk
```

install other all packages required for this quick demo. mind-lake-sdk (TypeScript) is defined in package.json

use npm
```bash
$ npm install
```

or use yarn
```bash
$ yarn
```

### request and change to your own app_key
```
cp myconfig_template.ts myconfig.ts
```

### Start the dev server

use npm
```bash
$ npm start
```

or use npm
```bash
$ yarn start
```

### checkout in browser: http://localhost:8000
39 changes: 39 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"private": true,
"scripts": {
"start": "umi dev",
"build": "umi build",
"postinstall": "umi generate tmp",
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
"test": "umi-test",
"test:coverage": "umi-test --coverage"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,less,md,json}": [
"prettier --write"
],
"*.ts?(x)": [
"prettier --parser=typescript --write"
]
},
"dependencies": {
"@ant-design/pro-layout": "^6.5.0",
"mind-lake-sdk": "^1.0.0",
"react": "17.x",
"react-dom": "17.x",
"umi": "^3.5.23"
},
"devDependencies": {
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@umijs/preset-react": "1.x",
"@umijs/test": "^3.5.23",
"lint-staged": "^10.0.7",
"prettier": "^2.2.0",
"typescript": "^4.1.2",
"yorkie": "^2.0.0"
}
}
4 changes: 4 additions & 0 deletions example/src/myconfig_template.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const appKey = "YOUR_APP_KEY";
const nodeUrl = "http://sdk.mindnetwork.xyz"; // or change to other node url

export {appKey, nodeUrl}
3 changes: 3 additions & 0 deletions example/src/pages/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.title {
background: rgb(121, 242, 157);
}
29 changes: 29 additions & 0 deletions example/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { appKey, nodeUrl } from '@/myconfig';
import {MindLake} from 'mind-lake-sdk';
import { useState } from 'react';


export default function IndexPage() {

const [result, setResult] = useState({});

const onLogin = async () => {
const mindLake = await MindLake.getInstance(appKey, nodeUrl);
const result = await mindLake.connect();
if(result.code === 403) {
setResult({...result, message: `Thanks for your interest. The product is under active development and limit to invited users only until full release. Your wallets are currently not in the early trial and you can apply via: https://bit.ly/mindalphatest`})
}else {
setResult(result)
}
};


return (
<div>
<button onClick={onLogin}>Login with your MetaMask (for development only)</button>
<div style={{marginTop: 30, fontSize: 16}}>
Log: { JSON.stringify(result) }
</div>
</div>
);
}
37 changes: 37 additions & 0 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"importHelpers": true,
"jsx": "react-jsx",
"esModuleInterop": true,
"sourceMap": true,
"baseUrl": "./",
"strict": true,
"paths": {
"@/*": ["src/*"],
"@@/*": ["src/.umi/*"]
},
"allowSyntheticDefaultImports": true
},
"include": [
"mock/**/*",
"src/**/*",
"config/**/*",
".umirc.ts",
"typings.d.ts"
],
"exclude": [
"node_modules",
"lib",
"es",
"dist",
"typings",
"**/__test__",
"test",
"docs",
"tests"
]
}
10 changes: 10 additions & 0 deletions example/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
declare module '*.css';
declare module '*.less';
declare module '*.png';
declare module '*.svg' {
export function ReactComponent(
props: React.SVGProps<SVGSVGElement>,
): React.ReactElement;
const url: string;
export default url;
}
21 changes: 21 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
export default {
preset: 'ts-jest',
testEnvironment: 'node',
moduleFileExtensions: [
"ts",
"tsx",
"js",
"jsx"
],
"modulePaths": [
"<rootDir>"
],
moduleNameMapper: {
'^src/(.*)': '<rootDir>/src/$1',
},
setupFiles: [
],
testMatch: [
]
};
Loading

0 comments on commit 9cf86b4

Please sign in to comment.