open-index/open-npm huggingface dataset:
npm package: @msafe/sui3-model
Description: Data model for msafe v3 backend on SUI
Author: Momentum Labs
Latest version: 1.0.59-pre-aea762a.0

# @msafe/sui3-model

Database and model for MSafe V3 SUI.

## Installation

```shell
yarn add @msafe/sui3-model
```

## Usage

There are 3 models, each can be accessed by different services.

* sync: Pull latest data from blockchain and write raw data to database.
* core: MSafe multi-sig business logic.
* stream: MPay service, which is stream payment.

```shell
import { CoreModel } from '@msafe/sui3-model/core';
import { StreamModel } from '@msafe/sui3-model/stream';
import { SyncModel } from '@msafe/sui3-model/sync';

const LOCAL_DB_CONFIG: ModelConfig = {
  host: '127.0.0.1',
  port: 3306,
  username: 'msafe',
  password: 'msafe',
  database: 'msafe_sui_local',
  logging: false,
};

const core = await CoreModel.New(LOCAL_DB_CONFIG);
// Handle core model queries

const sync = await SyncModel.New(LOCAL_DB_CONFIG);
// Handle core model queries

const stream = await StreamModel.New(LOCAL_DB_CONFIG);
// Handle core model queries
```

For each module, the `Repository` and `DataSource` from typeOrm is exported
in each instance. Please refer to
[TypeOrm documentation](https://typeorm.io/) for more database operations.

## Appendix

### Install and initialize mysql on local

**MacOS**

```shell
brew install mysql
mysql -u root

> create database msafe_sui_local;
```

Create a new user and grant permission to database

```shell
> CREATE USER 'msafe'@'localhost' IDENTIFIED BY 'msafe';
> use msafe_sui_local;
> GRANT ALL PRIVILEGES ON msafe_sui_local.* TO 'msafe'@'localhost'
> exit
```

Test our new user connection:

```shell
mysql -u msafe -p
// Input password `msafe`
use msafe_sui_local
```

Now you have user and database set.

### Scripts

**Database initialization**

After the database has been created, use `scripts/initialize.ts` to initialize the
database schema.

```shell
yarn initialize config/config.local.yaml
```

> To access database for other environments, please request the config file
> from admin.
npm package: @msafe/sui3-sdk
Description: SDK for MSafe SUI V3
Author: MSafe
Latest version: 0.0.90

# msafe-sui3-sdk

SDK for MSafe SUI V3 //chore

## Test

### Local test

Make sure you have MySQL database installed and setup.  

```shell
yarn test
```

The data will be written into the local database for further debug purpose.

### Unit test (CI)

```shell
yarn unit
```

Running this command will connect Sqlite DB only in memory.

### E2E test

1. make sure msafe_sui_local database exists in your mysql.
2. run api service:
   1. git clone msafe-sui3-api: <https://github.com/Momentum-Safe/msafe-sui-api>
   2. run yarn start:dev
3. run syncing service:
   1. git clone msafe-syncing: <https://github.com/Momentum-Safe/msafe-sui-chain-syncing>
   2. run yarn start:dev
4. run processor:
   1. git clone processor: <https://github.com/Momentum-Safe/msafe-sui-processors>
   2. run yarn start:dev
5. run tests in msafe-e2e.test.ts
npm package: @msafe/sui3-utils
Description: Common Utils for MSafe SUI V3
Author: MSafe
Latest version: 5.0.3-pre-f6292a1.0

# msafe-sui3-utils

[![codecov](https://codecov.io/gh/Momentum-Safe/msafe-sui3-utils/graph/badge.svg?token=FNQOLkh0SJ)](https://codecov.io/gh/Momentum-Safe/msafe-sui3-utils)

```bash
yarn add @msafe/sui3-utils
```