- 📔 Table of Contents
- 🌟 0. Other Programming Languages
- 🌟 1. Install Or Upgrade Node If Needed
- 🌟 2. Get Examples
- 🌟 3. Prepare myconfig.ts
- 🌟 4. Execute the examples
- Click to view step-by-step to configure Node if Node is not installed or upgraded
- Enter the following command in the terminal window to fetch the example code from github:
git clone https://github.com/mind-network/mind-lake-sdk-typescript.git
- Enter the path of example code:
cd mind-lake-sdk-typescript/examples
- Install depedency
npm install
- Check mind-lake-sdk depedency
npm info mind-lake-sdk version
An example of the output is:
1.0.2
myconfig.ts
contains the settings of parameters used in examples and use cases, you can copymyconfig_template.ts
to the namemyconfig.ts
and modify it as per your requirement.myconfig.ts
will need walletAddress and appKey.
-
2.1. Click 🎨 4.1. Prepare Wallet if test wallets (by MetaMask) are not created.
-
2.2 Click 🎯 4.1.3 Register wallets if not in whitelist during testing period if test wallets is not in whitelist during testing period.
-
2.3 Click 🎨 4.2. Prepare appKey if
appKey
is not set.
- If you want to run the examples of quickStart, Use Case 1 and Use Case 2, you only need to fill out
appKey
. - If you want to run Use Case 3, you need to fill out the wallets info for all of
Alice
,Bob
andCharlie
.
export const appKey = "YOUR_APP_KEY";
export const nodeUrl = "https://sdk.mindnetwork.xyz"; // or change to other node url
export const aliceWalletAddress = "Alice_Wallet_Address";
export const bobWalletAddress = "Bob_Wallet_Address";
export const charlieWalletAddress = "Charlie_Wallet_Address";
You can execute the following commands to run the quickstart and use cases.
cd examples
npm run start
An example of the output is:
App running at:
- Local: http://localhost:8002 (copied to clipboard)
- Network: http://192.168.137.1:8002
By default use 8000 as port number. But will auto increase port number if 8000 is used. You may see 8000 in your side. The example bellow 8002. Use the port number shown in your terminal.
Open a browser and visit http://localhost:8002
- First, you should create a test wallet for test.
- Click "Quick start with your MetaMask" and you will see the logs while login with your MetaMask wallet
- Open a browser and visit
http://localhost:8002/use_case_1
- Click "Test case one with your MetaMask" and you will see the logs while executing Use Case 1.
- Open a browser and visit
http://localhost:8002/use_case_2
- Click "Test case two with your MetaMask" and you will see the logs while executing Use Case 2
- You will need 3 wallets for Use Case 3: Alice, Bob, Charlie We show how to create a wallet for Alice for testing purpose.
Using the same way to create wallet for Bob and Charlie
Copy Alice,Bob,Charlie' wallet address into myconfig.ts to update aliceWalletAddress
bobWalletAddress
charlieWalletAddress
Note During testing period, please make you have all wallet address are registered in into whitelist: https://sites.google.com/mindnetwork.xyz/mindnetwork/alpha-test. Be more specific, please ensure your Alice, Bob and Charlie are registered and approved. Otherwise, you may experience the error on sharing.
- Open a browser and visit
http://localhost:8002/use_case_3
- Switch to Alice's wallet and perform actions as Alice
Click "Insert Alice Data And Share To Charlie"
Wait until "insert data done" appears which means data insertion is completely.
- Switch to BOb's wallet and performa actions as Bob
Click "Insert Bob Data And Share To Charlie"
Wait until "insert data done" appears which means data insertion is completely.
- Switch to Charlie's wallet and performa actions as Charlie
Click "Charlie Select Data And Decrypt Data"
- Final output quick view