MindLake

1. connect() Method

Connect to Mind Lake while ensuring that all encryption keys are prepared and available. Prior to making any function calls within the SDK, execute this function as it serves as the entry point.

const mindLake = await MindLake.getInstance(appKey);
const res = await mindLake.connect(chainId);

Parameters

  1. appKey - string: used for authorization, allowing users of your application to gain access to Mind Lake. As a developer, you can apply for APP Keys from Mind Scan.

  2. chainId- string|number: the ID of the supported chain.

Returns

An object of Promise<>. For more information.

Wallet Interaction

During the 'Connect' procedure, the wallet will prompt the user 2-3 times as follows:

  1. Sign a nonce for login authentication.

If the user's account keys are already on the chain:

  1. Decrypt the user's account keys using the wallet's private key.

If the user's account keys do not exist yet:

  1. Obtain the public key of the wallet, which is used to encrypt the randomly generated account keys.

  1. Sign the transaction to upload the encrypted key ciphers to the smart contract on the chain.

Example

const mindLake = await MindLake.getInstance("YOUR_OWN_APP_KEY");
//"5" is example of Goerli Testnet chainId
const chainId = "5"
const res = await mindLake.connect(chainId);

2. MindLake.ResultType

Every method call in the Mind Lake SDK returns an object of ResultType.

type ResultType = {
  code: number,
  message?: string,
  result?: any
}
  • code - number: The return code of the method call. A return value of 0 indicates success, while non-zero values represent a specific error code.

  • message - string: If the return code is non-zero, an error message will be provided to describe the specific error encountered during the method call.

  • result - any: If a method call returns a result, it will be stored in the result field.

3. MindLake.DataType

The DataType enum defines a comprehensive range of supported data types. This enum can be used in conjunction with the MindLake.DataLake.Column class, which represents a single column in a table, to specify the data type of the column. By utilizing the DataType enum, you can ensure that your data is stored in the appropriate format and can be processed correctly by the system.

Members

  1. int4

  2. int8

  3. float4

  4. float8

  5. decimal

  6. text

  7. timestamp

Last updated