npm package: @mojito-inc/loyalty
Description: <p align="center">     <a href="https://getmojito.com/loyalty">         <img src="./Mojito_wordmark_black.png" alt="Mojito Logo" width="100" />     </a> </p>
Latest version: 1.0.0

<p align="center">
    <a href="https://getmojito.com/loyalty">
        <img src="./Mojito_wordmark_black.png" alt="Mojito Logo" width="100" />
    </a>
</p>

# Mojito Loyalty Platform SDK

## Overview
The **Mojito Loyalty Platform SDK** is a development toolkit designed to integrate a loyalty platform with the SUI blockchain using Move smart contracts. This SDK provides a modular framework that facilitates:
- **User authentication**
- **LeaderBoard Details**
- **Claim Process**
- **Mission and Reward Related Details**
- **Wallet Module**
- **Redemption and reward distribution**

### Accessing the SDK
To access this SDK, you need to create an API key by logging into the **Loyalty Admin Portal** at [Mojito Loyalty](https://getmojito.com/loyalty). Navigate to the API section to generate your API Key, which is required for authentication when using this SDK.

## Build Process
### 1. Setup Development Environment
Ensure you have Node.js and npm installed, then install dependencies:
```sh
npm install
```

### 2. SDK Folder Structure
The SDK follows a structured folder layout:
```
sui-sdk/
├── src/
│   ├── auth/
│   ├── modules/
│   ├── utils/
│   ├── index.ts
│   └── constants.ts 
├── package.json
├── tsconfig.json
└── README.md
```

### 3. Publishing the SDK
To build and publish the SDK, run:
```sh
npm run build
npm publish
```

## Usage
### Installing the SDK
```sh
npm install @mojito-inc/loyalty
```

### Authentication
#### Set API Key
```js
const sdk = new LoyaltyClient('environment');
sdk.auth.setApiKey('API Key');
```
#### Generate JWT Token
```js
const sdk = new LoyaltyClient('environment');
sdk.auth.generateJWT('wallet-address', 'signature', 'chain', 'message', sdk.auth);
```
#### Set JWT Token
```js
const sdk = new LoyaltyClient('environment');
sdk.auth.setJWT('JWT Token');
```

### Claims Management
#### Initiate a Claim
```js
const sdk = new LoyaltyClient('environment');
sdk.auth.setApiKey('API Key');
let response = await sdk.claim.initiateClaim('mission-id', 'user-unique-address', sdk.auth);
```
#### Fetch Claim Status
```js
const sdk = new LoyaltyClient('environment');
sdk.auth.setApiKey('API Key');
let response = await sdk.admin.getClaimStatus('tenant-slug', 'mission-id', 'user-unique-address', 'claim-id', sdk.auth);
```
### Redeem Process
#### Initiate a Redeem Reward
```js
const sdk = new LoyaltyClient('environment');
sdk.auth.setApiKey('API Key');
let response = await sdk.redeemption.initiateReward('reward-id', 'user-unique-address','wallet-address', sdk.auth);
```

### Missions and Rewards
#### Fetch Mission by Id
```js
const sdk = new LoyaltyClient('environment');
let response = await sdk.admin.getMissions('mission-id', sdk.auth);
```
#### Fetch Rewards by Id
```js
const sdk = new LoyaltyClient('environment');
let response = await sdk.admin.getRewards('reward-id', sdk.auth);
```

## References
- [SUI Blockchain Documentation](https://docs.sui.io/)
- [Move Programming Language](https://move-language.github.io/move/)
<p align="left">
 <a href="https://getmojito.com/loyalty">
    <img src="./Mojito_wordmark_black.png" alt="Mojito Logo" width="100" />
    </a>
</p>