@mojito-inc/loyalty
v1.0.0
Published
<p align="center"> <a href="https://getmojito.com/loyalty"> <img src="./Mojito_wordmark_black.png" alt="Mojito Logo" width="100" /> </a> </p>
Maintainers
Keywords
Readme
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. 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:
npm install2. 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.md3. Publishing the SDK
To build and publish the SDK, run:
npm run build
npm publishUsage
Installing the SDK
npm install @mojito-inc/loyaltyAuthentication
Set API Key
const sdk = new LoyaltyClient('environment');
sdk.auth.setApiKey('API Key');Generate JWT Token
const sdk = new LoyaltyClient('environment');
sdk.auth.generateJWT('wallet-address', 'signature', 'chain', 'message', sdk.auth);Set JWT Token
const sdk = new LoyaltyClient('environment');
sdk.auth.setJWT('JWT Token');Claims Management
Initiate a Claim
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
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
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
const sdk = new LoyaltyClient('environment');
let response = await sdk.admin.getMissions('mission-id', sdk.auth);Fetch Rewards by Id
const sdk = new LoyaltyClient('environment');
let response = await sdk.admin.getRewards('reward-id', sdk.auth);