-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init first public release publish to npmjs add example
- Loading branch information
0 parents
commit 9cf86b4
Showing
36 changed files
with
17,477 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" } | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" } | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: {}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.title { | ||
background: rgb(121, 242, 157); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: [ | ||
] | ||
}; |
Oops, something went wrong.