### Gameflow
- Once a user logs into the MD game, the game will call the listing API to retrieve all NFTs belonging to the user. It will display the units in-game based on the NFT response list.
- At the end of the game, the game will invoke an API to record the number of MD tokens earned by the user.
- Users can open boxes in-game, where the game randomly selects a unit to give to the user. After that, the game will call an API to mint the NFT with the unit's information on-chain. The API will return a deployHash for the minting action, which the game can use to check the status of the minting progress.
- Level - TBD Hao
### Roblox MD APIs
#### 1. List NFT by Roblox userId - Kien
- **Description:** This API retrieves all NFTs belonging to a Roblox user.
- **Method:** GET
- **URL:** `https://{endpoint}/v1/nfts/{userId}`
**Request:**
- **Header:** `x-api-key: tbd`
**Response:**
```json
[
{
"tokenId": "number",
"unitId": "string",
"unitAttributes": {
// other attributes...
"level" : "number",
"xp" : "number",
"damageBoots": "number",
}
}
]
#### 2. Gacha - Open box - Kien
- **Description:** This API for minting new NFT
- **Method:** POST
- **URL:** `https://{endpoint}/v1/nfts/{userId}/mint`
**Request:**
- **Header:** `x-api-key: tbd`
- **Payload:**
```json
{
"unitId": "string",
}
```
**Response:**
```json
{
deployHash: "string"
}
#### 3. Deploy status - Kien
- **Description:** This API to check the deploy status
- **Method:** GET
- **URL:** `https://{endpoint}/v1/deploy/{deployHash}/status
**Request:**
- **Header:** `x-api-key: tbd`
**Response:**
```json
{
status: "string" //pending/failed/completed
}
#### 4. Store MD token - Kien
- **Description:** This API to store the MD token each time user finish a game match
- **Method:** POST
- **URL:** `https://{endpoint}/v1/token/{userId}/store
**Request:**
- **Header:** `x-api-key: tbd`
- **Payload:**
```json
{
token: "number", // number of token which user get in a match
mathId: "string",
}
#### 5. Merge Unit - Kien
- **Description:** This API to merge 2 units
- **Method:** POST
- **URL:** `https://{endpoint}/v1/nfts/{userId}/merge
**Request:**
- **Header:** `x-api-key: tbd`
- **Payload:**
```json
{
mainTokenId: "number",
tokenIds: array["number"],
}
```
**Response:**
```json
{
deployHash: "string"
}
```
#### 6. Get MD Token - Kien
- **Description:** This API to get the MD token balance
- **Method:** GET
- **URL:** `https://{endpoint}/v1/users/{userId}/md`
**Request:**
- **Header:** `x-api-key: tbd`
**Response:**
```json
{
total: "number"
}
### Ingame APIs
#### 1. GET Unit Details - Hao
- **Description:** This API to get the unit information to display on landing page
- **Method:** GET
- **URL:** `https://{robloxEndpoint}/v1/universes/{universeId}/standard-datastores/datastore/entries/entry`
**Request:**
- **Header:** `x-api-key: tbd`
**Response:**
```json
{
// all unit attibutes
...
}