# @mojito-inc/core-service

> Mojito Core API service for auction, payment, token

Latest version **1.0.8-beta.49** (published 2025-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mojito-inc/core-service
pnpm add @mojito-inc/core-service
yarn add @mojito-inc/core-service
bun add @mojito-inc/core-service
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8-beta.49 |
| Published | 2025-01-08 |
| First published | 2023-05-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 521.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | mojito |
| Maintainers | alexinx, vivek_ionixx, vivek_mojito, santhosh_prabhakaran, madhimk, sakthi-mojito |
| Keywords | mojito-api, auction, signature, payment, core-service, token claim |

## Links

- npm: https://www.npmjs.com/package/@mojito-inc/core-service
- Repository: https://github.com/mojitoinc/mojito-core-service
- npm.io page: https://npm.io/package/@mojito-inc/core-service

## Recent versions

- 1.0.8-beta.49 (latest) — 2025-01-08
- 1.0.8-beta.25 (beta) — 2024-07-04
- 1.0.8-beta.48 — 2024-12-18
- 1.0.8-beta.47 — 2024-11-29
- 1.0.8-beta.46 — 2024-11-18
- 1.0.8-beta.45 — 2024-11-18
- 1.0.8-beta.44 — 2024-11-12
- 1.0.8-beta.43 — 2024-10-30
- 1.0.8-beta.42 — 2024-10-30
- 1.0.8-beta.41 — 2024-10-28
- 1.0.8-beta.40 — 2024-10-24
- 1.0.8-beta.39 — 2024-10-24
- 1.0.8-beta.38 — 2024-10-22
- 1.0.8-beta.37 — 2024-10-18
- 1.0.8-beta.36 — 2024-10-17
- … 40 more at https://npm.io/package/@mojito-inc/core-service/versions

## README

<br />

<h1 align="center">☁️ Mojito Modules -  Core Service</h1>

<br /><br />


<p align="center">
  👨‍💻 React components for the Mojito Platform, Reference App and third-party projects, including Mojito's core service 
<br />


<p align="center">
   Version: 1.0.0
</p>

<br />


## Using this library in your project Core Service

You can install this project with one of these commands:
    npm i @mojito-inc/core-service
    
    yarn add @mojito-inc/core-service

<br />

## In order to use this package you must install this dependency

You can install the package with one of these commands:

    npm i graphql
    
    yarn add graphql

<br />
    
Once the package is installed, you can import the library using import;

Two way of integration Core API provider uri or apollo client, if pass both param priority is client only. 

### For development URL

baseURL = https://api.mojito.xyz/query

### For production URL

baseURL = https://api-dev.mojito.xyz/query

```
    import { CoreServiceProvider } from "@mojito-inc/core-service";


    <CoreServiceProvider uri={ baseURL } token={ 'Bearer <Token>' }>
         { children }
    </CoreServiceProvider>

```
</br>

|Param    |type       | Description
|:--- | --- | :---:|
|uri| string|skip this param, if client param passed
|client| [Apollo Client](#https://www.apollographql.com/docs/react/get-started#step-3-initialize-apolloclient) | skip this param, if uri param passed
|token| string| Optional

</br>

## useAuth Hook to check whether session is Expired or Active

```
import { useAuth } from '@mojito-inc/core-service';
const { sessionStatus } = useAuth();
```


After setup with CoreServiceProvider, API can be access via hooks

following the api are
1. [GetSignature Message](#GetSignatureMessage)
2. [LoginWithSignature](#LoginWithSignature)
3. [RedeemClaimable Code](#RedeemClaimableCode)
4. [Redeem Earnable Item](#redeemEarnableItem)
5. [getInvoiceDetails](#getInvoiceDetails)
6. [Redeem Earnable Code](#redeemEarnableCode)
7. [SignUpWithSignature](#SignUpWithSignature)
8. [get Contract Details](#getContractDetails)
9. [complete Onchain Claim](#completeOnchainClaim)

### GetSignatureMessage
It will provide a message that should be used for in signing process

```
import { useClaims, Response, GetSignatureData } from "@mojito-inc/core-service";

  const { getSignatureMessage } = useClaims();

  const response: Response<GetSignatureData> = await getSignatureMessage({
          orgId: <ORG_ID>,
          networkID: <NETWORK_ID>,
          walletAddress: <WALLET_ADDRESS>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|networkID| UUID1 |✅|
|walletAddress| string |✅|

##### Response
```
 {
    "data:   {
        "getSignatureMessage": "This message is used for signature validation for organization caa and wallet address 0x6588ec22a85d611c8c3cd254d0c063d0be78a6c1 at 2023-02-22T04:39:23Z"
     }
 }
```

##### Error
 - error getting organization by id: <orgID> record not found

</br>

### LoginWithSignature
The request receiver retrieves the Signature security token 
```
import { useClaims, Response, LoginWithSignatureData } from "@mojito-inc/core-service";

  const { loginWithSignature } = useClaims();

  const response: Response<LoginWithSignatureData> = await loginWithSignature({
          challenge: <GET_SIGNATURE_MESSAGE>,
          signature: <CROSS_MINT_SIGNATURE>,
          signer: <SIGNER_ADDRESS>,
          chainId: <CHAIN_ID>,
          orgId: <ORG_ID>
        });
```
</br>

|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|challenge| String|✅|
|signature| String |✅|
|signer| String |✅|
|chainId| Int |✅| Int can represent values between -(2^31) and 2^31 - 1
|orgId| UUID1 |✅|

##### Response
```
 {
    "data": {
          "loginWithSignature": {
            "token": "344fbc51-b6d4-4428-9783-b09dd9df95fb"
          }
        }
 }
```

##### Error
 - Challenge is too old, please request a new one

</br>

### RedeemClaimableCode
Redeem a claimable code

```
import { useClaims, Response, RedeemClaimableCodeData } from "@mojito-inc/core-service";

  const { redeemClaimableCode } = useClaims();

  const response: Response<RedeemClaimableCodeData> = await redeemClaimableCode({
                            code: discountCode,
                            destAddr: address,
                         });

```

|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|code| string|✅|
|destAddr| string |✅|

##### Response
```
 {
     "data": {
          "redeemClaimableCode": {
            "success": true
          }
        }
 }
```

##### Error
 - Challenge is too old, please request a new one

</br>

 ### redeemEarnableItem

 Redeem Earnable Item.

 ```
 import { useClaims, RedeemEarnableItemData, Response } from '@mojito-inc/core-service';
 const { redeemEarnableItem } = useClaims();
 const response: Response<RedeemEarnableItemData> = await redeemEarnableItem({
    claimableItemId: claimableItemId,
    destAddr: destAddr,
    gating: gating
  });
 ```

|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|claimableItemId|string|✅|
|destAddr| string| |
|gating| object| |[gating](#gating)

#### gating

|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|ruleId| string|✅|
|contractAddress| string|✅|
|tokenId| string|✅|
|ownerWallet| string|✅|

##### Error
 - Invalid claimableItemId.

</br>

### getInvoiceDetails
  Get the Invoice detail of the Given invoice id.

```
import { useClaims, Response, GetClaimInvoiceDetailData } from '@mojito-inc/core-service';
const { getInvoiceDetails } = useClaims();
const response: Response<GetClaimInvoiceDetailData> = await getInvoiceDetails({
  invoiceID: invoiceID
});
```

|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|invoiceID|string|✅|

#### error
  - Invalid Invoice id


</br>

### redeemEarnableCode
Redeem a claimable code

```
import { useClaims, Response, RedeemEarnableCodeData } from "@mojito-inc/core-service";

  const { redeemEarnableCode } = useClaims();

  const response: Response<RedeemEarnableCodeData> = await redeemEarnableCode({
                            code: discountCode,
                            destAddr: address,
                         });

```

|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|code| string|✅|
|destAddr| string | |

##### Response
```
 {
     "data": {
          "redeemEarnableCode": {
            "redeemInitiated": true,
            "invoiceID": "278806fb-d82c-4d9c-bda0-ace148452c00"
          }
        }
 }
```

##### Error
 - Invalid code

</br>

### SignUpWithSignature
The request receiver retrieves the Signature security token 
```
import { useClaims, Response, SignUpWithSignatureData } from "@mojito-inc/core-service";

  const { signUpWithSignature } = useClaims();

  const response: Response<SignUpWithSignatureData> = await signUpWithSignature({
          challenge: <GET_SIGNATURE_MESSAGE>,
          signature: <CROSS_MINT_SIGNATURE>,
          signer: <SIGNER_ADDRESS>,
          chainId: <CHAIN_ID>,
          orgId: <ORG_ID>,
          firstName: <FIRST_NAME>,
          lastName: <LAST_NAME>,
          email: <EMAIL>
        });
```
</br>

|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|challenge| String|✅|
|signature| String |✅|
|signer| String |✅|
|chainId| Int |✅| Int can represent values between -(2^31) and 2^31 - 1
|orgId| UUID1 |✅|
|firstName| String |✅|
|lastName| String |✅|
|email| String |✅|

##### Response
```
 {
    "data": {
          "signUpWithSignature": {
            "token": "344fbc51-b6d4-4428-9783-b09dd9df95fb"
          }
        }
 }
```

##### Error
 - Challenge is too old, please request a new one

</br>

### getContractDetails
It will provide a contract details

```
import { useClaims, Response, GetContractDetailsData } from "@mojito-inc/core-service";

  const { getContractDetails } = useClaims();

  const response: Response<GetContractDetailsData> = await getContractDetails({
          orgId: <ORG_ID>,
          networkId: <NETWORK_ID>,
          contractType: <CONTRACT_TYPE>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|networkId| UUID1 |✅|
|contractType| string |✅|

##### Response
```
 {
    "data:   {
        "getContractDetails": {
          "id": "",
        }
     }
 }
```

##### Error
 - error getting organization by id: <orgID> record not found

</br>

### completeOnchainClaim
Complete onchain claim

```
import { useClaims, Response, CompleteOnchainClaimData } from "@mojito-inc/core-service";

  const { completeOnchainClaim } = useClaims();

  const response: Response<CompleteOnchainClaimData> = await completeOnchainClaim({
                            invoiceId: <invoiceId>,
                            txHash: <txHash>,
                         });

```

|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|invoiceId| string|✅|
|txHash| string |✅|

##### Response
```
 {
     "data": {
          "completeOnchainClaim": true
        }
 }
```

##### Error
 - error getting invoice by id: <invoiceID> record not found

</br>


### GetUsdConversion
 will receives 1 unit crypto equivalent USD price

```
import { useConversion, Response, USDConversionData } from '@mojito-inc/core-service';

const { getUSDConversion } = useConversion();

const response: Response<USDConversionData> = await getUSDConversion({ cryptoCurrencyCode: <cryptoCurrencyCode> });

```

|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|cryptoCurrencyCode| enum|✅| [CryptoCurrencyCode](#CryptoCurrencyCode)|

##### CryptoCurrencyCode
##### enum
|Enum Variable    |value    | 
|:--- | --- |
|ETH| ETH|
|MATIC | MATIC |
|WETH| WETH|
|WMATIC | WMATIC |

##### Response
```
{
  "data": {
    "getUSDPrice": {
      "amount": "1799.34",
      "currency": "USD",
      "base": "ETH",
    }
  }
}
```

##### Error
 - Expected type CryptoCurrenyCode!, found "".

 ### GetSupportedCurrency
 will receives list of supported currency by id

```
import { useConversion, Response, GetSupportedCurrenciesData } from '@mojito-inc/core-service';

const { getSupportedCurrency, GetSupportedCurrenciesData } = useConversion();

const response: Response<GetSupportedCurrenciesData> = await getSupportedCurrency({ nftTokenId: '514fedfe-165b-451b-b2f6-63667e66c096', orgId: 'f2f5c627-5421-4c40-9913-edfd09dd98b3' });

```

|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|nftTokenId| UUID|✅|
|orgId| UUID|✅|

##### Response
```
{
  "data": {
    "getSupportedCurrencies": [
      {
        "id": "8b2343d6-8a8b-11ed-9e0a-42010a940031",
        "name": "ETH",
        "networkId": "c41db347-0ee3-4212-943a-ca213b8e0ea8",
        "symbol": "ETH",
        "contractAddress": "0x0000000000000000000000000000000000000000",
        "secondaryMarketplaceContractAddress": "0xB658b650F0B2Dacd90aF58Ad78b3a6F8eb9BdF21",
        "network": {
          "id": "c41db347-0ee3-4212-943a-ca213b8e0ea8",
          "name": "Goerli Testnet",
          "chainID": 5,
          "wethAddress": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
          "paymentCurrency": "WETH"
        }
      },
    ]
  }
}
```

##### Error
 - error getting token by ID:<orgId> record not found.

 ### AuctionDetails
  Auction Details and Auction History

```
import { useAuction } from '@mojito-inc/core-service';

const { auctionDetails } = useAuction();

const response: Response<AuctionData> = await auctionDetails({ id: <ID> });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|id| UUID|✅| |

##### Response

 ```
{
  "data": {
    "collectionItemById": {
      "id": "8ed1783c-c4c4-47f1-9384-5ff64f2ebc97",
      "name": "POCA During Sale 2",
      "artist": null,
      "status": "Active",
      "description": null,
      "details": {
        "id": "68d2fee2-db56-48f4-9e10-e703e9054ae6",
        "startingBid": 0.0001,
        "startDate": "2023-03-22T05:00:00Z",
        "endDate": "2023-03-22T11:00:00Z",
        "currentBid": {
          "userId": "afca6cad-782c-4338-b71d-9193b14b736d",
          "currentBid": 0.0002,
          "isMine": false,
          "walletAddress": "0x669dbFF9c68CAC7b52C4B789f5Ebc3b5293D0a73",
          "marketplaceUser": {
            "id": "afca6cad-782c-4338-b71d-9193b14b736d",
            "username": null,
            "avatar": null,
          },
        },
        "myBid": null,
        "bids": [
          {
            "id": "9b407667-fc96-4022-a892-8c5d2fea4e52",
            "amount": 0.0002,
            "createdAt": "2023-03-22T09:32:15Z",
            "maximumBid": null,
            "marketplaceAuctionLotId": "68d2fee2-db56-48f4-9e10-e703e9054ae6",
            "walletAddress": "0x669dbFF9c68CAC7b52C4B789f5Ebc3b5293D0a73",
            "txHash": "0xa6d9d6474e759134bd85d9111376366a3e8360f93eafc723646967c63d675422",
            "marketplaceUser": {
              "id": "afca6cad-782c-4338-b71d-9193b14b736d",
              "username": null,
              "avatar": null,
            },
          }
        ],
      },
    }
  }
}
 ```

 ##### Error
 - uuid: incorrect UUID length.

  ### VerifyOnchainBid
  Receive tax and contract address

```
import { useAuction, OnChainBidResponse } from '@mojito-inc/core-service';

const { verifyOnChainBid } = useAuction();

const response: Response<OnChainBidResponse> = await verifyOnChainBid({ 
          lotID=<lotID>,
          orgID=<orgID>,
          walletAddress=<walletAddress>,
          amount: <amount>, });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|lotID| UUID|✅| |
|orgID| UUID|✅| |
|walletAddress| string|✅| |
|amount| Int|✅| |

##### Response

 ```
{
  "data": {
    "verifyOnchainBid": {
      "amount": 0.0003,
      "tax": 0.000055575933397801415,
      "onChainAuctionContractAddress": "0xeed7f3e16a6018d65dffd63bc30ac252c034edc1",
      "commissionFee": 0.000005999999999999999,
      "platformFee": 0.000005999999999999999,
      "__typename": "OnChainBidResponse"
    }
  }
}
 ```
 ##### Error
 - jwt token invalid or has been expired
 - uuid: incorrect UUID length
 - error fetching user wallet: wallet by address by  not found: record not found
 - amount is less then current bid + min increment

### confirmOnchainBid
  Auction submit

```
import { confirmOnChainBid, BidsItemData } from '@mojito-inc/core-service';

const { confirmOnChainBid } = useAuction();

const response: Promise<Response<BidsItemData>> = await confirmOnChainBid({     
    lotID=<lotID>
    orgID=<orgID>
    walletAddress=<walletAddress>
    amount=<amount>
    tax=<tax>
    txhash=<txhash>
    commissionFee=<commissionFee>
    platformFee<platformFee<> });

```
##### Response
 ```
 {
  "data": {
    "confirmOnchainBid": {
      "amount": 0.0005,
      "tax": 0.00007216969871926542,
      "__typename": "MarketplaceAuctionBid"
    }
  }
}
 ```

 ##### Error
 - jwt token invalid or has been expired
 - uuid: incorrect UUID length
 - error fetching user wallet: wallet by address by  not found: record not found
 - error creating marketplace auction bid: bid amount is below the current bid

### createMarketplaceAuctionBid
  Create Auction Bid

```
import { createMarketplaceAuctionBid, CreateMarketplaceAuctionBidData } from '@mojito-inc/core-service';

const { createMarketplaceAuctionBid } = useAuction();

const response: Promise<Response<CreateMarketplaceAuctionBidData> = await createMarketplaceAuctionBid({     
    marketplaceAuctionLotId=<marketplaceAuctionLotId>
    amount=<amount> });

```
##### Response
 ```
 {
  "data": {
    "createMarketplaceAuctionBid": {
      "id": "95962a20-2194-493e-ba2d-7abc5cea93bf",
      "marketplaceAuctionLotId": "95962a20-2194-493e-ba2d-7abc5cea93bf",
      "amount": 0.0005,
    }
  }
}
 ```

 ##### Error
 - jwt token invalid or has been expired
 - uuid: incorrect UUID length
 - error creating marketplace auction bid: bid amount is below the current bid 


User API can be access via hooks

following the api are 
1. [me](#me)
2. [updateUserOrgSettings](#updateUserOrgSettings)

### me
It will provide a active user data

```
import { useUser, GetUserData } from "@mojito-inc/core-service";

  const { currentUser } = useUser();

  const response: Response<GetUserData> = await currentUser({
          orgId: <ORG_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|

##### Response
```
 {
    "data: {
      "me": {
        "id": "d1a59f7e-8626-46f9-b0ca-b70477910c8c",
        "userOrgs": [
          {
            "id": "30ec5163-90bc-4b6a-a0a1-8696cc19c327",
            "role": "Admin",
            "organizationId": "d086ea16-d40d-454c-84a4-64b5e940670a",
            "organization": {
              "purchaseLimitWithoutKYC": 0
            },
            "kycStatus": "Clear",
            "w8Form": true,
            "isBlacklisted": false,
            "bidAllowed": true,
            "avatar": null,
            "username": "020704f2-cb16-4c26-bed0-4ac0dbdf67bb",
            "settings": null,
            "reason": ""
          }
        ]
      }
    }
 }
```

##### Error
 - access denied


### updateUserOrgSettings
It can able to update the user details

```
import { useUser, updateUserOrgSettingsData } from "@mojito-inc/core-service";

  const { updateUserOrgSettings } = useUser();

  const response: Response<updateUserOrgSettingsData> = await updateUserOrgSettings({
          userOrgId: <USER_ORG_ID>,
          username: <USER_NAME>,
          avatar: <AVATAR>,
          settingsJson: <SETTING_JSON>,
          profilePic: <PROFILE_PIC>
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|userOrgId| UUID1|✅|
|username| String|✅|
|avatar| String|✅|
|settingsJson| String|
|profilePic| String|

##### Response
```
 {
    "data: {
      "updateUserOrgSettings": {
        "id": "d1a59f7e-8626-46f9-b0ca-b70477910c8c",
        "username": "test",
        "avatar": "U0BpDFXLEKmMNPly",
      }
    }
 }
```

##### Error
 - user is not authorized to update record within userOrgID <userOrgId>

KYC API can be access via hooks

following the api are 
1. [createApplicant](#createApplicant)
2. [createCheck](#createCheck)
3. [getApplicant](#getApplicant)
4. [getSDKToken](#getSDKToken)
5. [updateApplicant](#updateApplicant)

### createApplicant
It can able to create form to complete KYC

```
import { useKYC } from "@mojito-inc/core-service";

  const { createApplicant } = useKYC();

  const response: Response<CreateApplicantData> = await createApplicant({
          orgID: <ORG_ID>,
          input: {
            firstName: <FIRST_NAME>,
            lastName: <LAST_NAME>,
            dob: <DATE_OF_BIRTH>,
            address: {
              country: <COUNTRY>,
              state: <STATE>,
              town: <TOWN>,
              postcode: <POSTAL_CODE>
            }
          },
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgID| UUID1|✅|
|input| ApplicantRequest|✅|

##### Response
```
 {
    "data: {
      "createApplicant": {
        "id": "7578afa6-cb7e-45cc-82ef-5c5821ebec42",
        "firstName": "test",
        "lastName": "test",
        "email": "",
        "dob": "1998-12-22",
        "href": "/v3.2/applicants/7578afa6-cb7e-45cc-82ef-5c5821ebec42",
        "idNumbers": null,
        "address": {
          "flatNumber": null,
          "buildingNumber": "12",
          "buildingName": null,
          "street": "test road",
          "subStreet": null,
          "town": "new york",
          "postcode": "12345",
          "country": "US",
          "line1": null,
          "line2": null,
          "line3": null,
          "state": "new york"
        }
      }
    }
 }
```

##### Error
 - error getting user organization KYC by applicant id: <OrgId> record not found

 ### createCheck
It can able to check the details

```
import { useKYC } from "@mojito-inc/core-service";

  const { createCheck } = useKYC();

  const response: Response<CreateCheckData> = await createCheck({
          applicantID: <APPLICANT_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|applicantID| UUID1|✅|

##### Response
```
 {
    "data: {
      "createCheck": {
        "id": "c2854107-93b6-4200-a1f7-ad28beaa9d1d",
        "success": true
      }
    }
 }
```

##### Error
 - error getting user organization KYC by applicant id:<applicantID> record not found


### getApplicant
It can able to get user kyc details

```
import { useKYC } from "@mojito-inc/core-service";

  const { getApplicant } = useKYC();

  const response: Response<GetApplicantData> = await getApplicant({
          organizationID: <ORGANIZATION_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|organizationID| UUID1|✅|

##### Response
```
 {
    "data: {
      "getApplicant": {
        "id": "262f085c-474b-44be-8568-e1b58a16c97f",
        "firstName": "test",
        "lastName": "test",
        "email": "",
        "dob": "1998-12-22",
        "href": "/v3.2/applicants/7578afa6-cb7e-45cc-82ef-5c5821ebec42",
        "idNumbers": null,
        "address": {
          "flatNumber": null,
          "buildingNumber": "12",
          "buildingName": null,
          "street": "test road",
          "subStreet": null,
          "town": "new york",
          "postcode": "12345",
          "country": "US",
          "line1": null,
          "line2": null,
          "line3": null,
          "state": "new york"
        }
      }
    }
 }
```

##### Error
 - error getting user organization KYC by applicant id: <OrgId> record not found


 ### getSDKToken
It can able to get sdk token

```
import { useKYC } from "@mojito-inc/core-service";

  const { getSDKToken } = useKYC();

  const response: Response<GetSDKTokenData> = await getSDKToken({
          applicantID: <APPLICANT_ID>,
          referrer: <REFERRER>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|applicantID| UUID1|✅|
|referrer| String|✅|

##### Response
```
 {
    "data: {
      "getSDKToken": {
        "token": "eyJhbGciOiJFUzUxMiJ9.eyJleHAiOjE2ODExMTgzNjEsInBheWxvYWQiOnsiYXBwIjoiNzU3OGFmYTYtY2I3ZS00NWNjLTgyZWYtNWM1ODIxZWJlYzQyIiwiY2xpZW50X3V1aWQiOiIyMmQyYzQ1NC0zNzMxLTQ4N2UtYmUzYS05N2I4NmQ4NWYzOWMiLCJpc19zYW5kYm94Ijp0cnVlLCJpc19zZWxmX3NlcnZpY2VfdHJpYWwiOmZhbHNlLCJpc190cmlhbCI6ZmFsc2UsInJlZiI6Imh0iHBzOi8vd2hpc2tleWV4Y2hhbmdlLWRldi5uZXRsaWZ5LmFwcC8iLCJzYXJkaW5lX3Nlc3Npb24iOiI1NzkxMGUyMC0yMTljLTQxZTItOTUzOS1lYjJhYjFmZDdiZTQifSwidXVpZCI6InBsYXRmb3JtX3N0YXRpY19hcGlfdG9rZW5fdXVpZCIsInVybHMiOnsiZGV0ZWN0X2RvY3VtZz50X3VybCI6Imh0dHBzOi8vc2RrLnVzLm9uZmlkby5jb20iLCJzeW5jX3VybCI6Imh0dHBzOi8vc3luYy5vbmZpZG8uY29tIiwiaG9zdGVkX3Nka191cmwiOiJodHRwczovL2lkLm9uZmlkby5jb20iLCJhdXRoX3VybCI6Imh0dHBzOi8vYXBpLnVzLm9uZmlkby5jb20iLCJvbmZpZG9fYXBpX3VybCI6Imh0dHBzOi8vYXBpLnVzLm9uZmlkby5jb20iLCJ0ZWxlcGhvbnlfdXJsIjoiaHR0cHM6Ly9hcGkudXMub25maWRvLmNvbSJ9fQ.MIGIAkIAtiM1UkIpaTKIGeTn6sYfX3GR4fTWPq_AeU1RxwQDQu5S7K3NM1z5hzh01sTo3KK_elpMh27XC0mhR9MkLt3kkroCQgG9gAW4w0vO1k1dXJKzbq3WDpklTqXtjT3plDbe5_bM8QujgjlbaW7nkASg68BYqa7P5UHOI5p-_QBayflaU3wXa"
      }
    }
 }
```

##### Error
 - error getting user organization KYC by applicant id:<applicantID> record not found


### updateApplicant
It can able to update the user kyc details

```
import { useKYC } from "@mojito-inc/core-service";

  const { updateApplicant } = useKYC();

  const response: Response<UpdateApplicantData> = await updateApplicant({
          orgID: <ORG_ID>,
          input: {
            firstName: <FIRST_NAME>,
            lastName: <LAST_NAME>,
            dob: <DATE_OF_BIRTH>,
            address: {
              country: <COUNTRY>,
              state: <STATE>,
              town: <TOWN>,
              postcode: <POSTAL_CODE>
            }
          },
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgID| UUID1|✅|
|input| ApplicantRequest|✅|

##### Response
```
 {
    "data: {
      "updateApplicant": {
        "id": "7578afa6-cb7e-45cc-82ef-5c5821ebec42",
        "firstName": "test",
        "lastName": "test",
        "email": "",
        "dob": "1998-12-22",
        "href": "/v3.2/applicants/7578afa6-cb7e-45cc-82ef-5c5821ebec42",
        "idNumbers": null,
        "address": {
          "flatNumber": null,
          "buildingNumber": "12",
          "buildingName": null,
          "street": "test road",
          "subStreet": null,
          "town": "new york",
          "postcode": "12345",
          "country": "US",
          "line1": null,
          "line2": null,
          "line3": null,
          "state": "new york"
        }
      }
    }
 }
```

##### Error
 - error getting user organization KYC by applicant id: <OrgId> record not found


Connect wallet API can be access via hooks

following the api are 
1. [connectExternalWallet](#connectExternalWallet)
2. [getActiveWalletsContent](#getActiveWalletsContent)
3. [getSupportedNetworks](#getSupportedNetworks)

### connectExternalWallet
It can able to connect wallet

```
import { useConnectWallet, ConnectExternalWalletData } from "@mojito-inc/core-service";

  const { connectExternalWallet } = useConnectWallet();

  const response: Response<ConnectExternalWalletData> = await connectExternalWallet({
          signature: <SIGNATURE>,
          message: <MESSAGE>,
          address: <ADDRESS>,
          orgID: <ORG_ID>,
          networkID: <NETWORK_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgID| UUID1|✅|
|networkID| UUID1|✅|
|message| String|✅|
|signature| String|✅|
|address| String|✅|

##### Response
```
 {
  "data": {
    "connectExternalWallet": true
  }
}
```

##### Error
 - challenge is too old, please request a new one


### getActiveWalletsContent
It can able to get wallet data

```
import { useConnectWallet, GetActiveWalletsContentData } from "@mojito-inc/core-service";

  const { getActiveWalletsContent } = useConnectWallet();

  const response: Response<GetActiveWalletsContentData> = await getActiveWalletsContent({
          orgID: <ORG_ID>,
          networkId: <NETWORK_ID>,
          walletAddress: <WALLET_ADDRESS>,
          filters: <FILTERS>,
          refreshCache: <REFRESH_CACHE>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgID| UUID1|✅|
|networkId| UUID1|✅|
|walletAddress| String|✅|
|filters| ActiveWalletFilterInput|
|refreshCache| Boolean|

##### Response
```
 {
  "data": {
    "getActiveWalletsContent": {
      "tokens": [
        {
          "contractAddress": "0xd0e2fd21764f643fa32b06a4c7d7924f43138d90",
          "id": "6",
          "network": "Goerli Testnet",
          "tokenType": "ERC1155",
          "title": "BasedHead #6",
          "tokenURI": "https://drops.api.topdogstudios.io/basedAf/token/6",
          "nftTokenId": "5bc739a6-f5d3-4417-b4af-91687e0af525",
          "mintedAt": "2023-01-25T14:18:02Z",
          "status": "SALE_PENDING",
          "metadata": {
            "name": "BasedHead #6",
            "description": "This PFP will be affiliated to the Fraz corporation.\n\nFraz is believed to have begun in the mid-1800s as the JP Fraz and Sons Tinctures and Cure-all Company. However, the lack of any supporting evidence that TrashLand existed before the 1980s suggests that this may not be factually correct. Fraz makes a variety of different food items, all alcoholic beverages, which are distilled from edible shore drift sourced on the island. In 2022, Fraz was announced as the official drink of the Metaverse.\n\n[Download V0 BasedHead](https://ipfs.io/ipfs/QmWiDG1zG7vncPYXMEVSkRYcn2gsujAACSyUsbXvD33ezC)",
            "image": "https://ipfs.io/ipfs/QmQJBFoLqcgxDogd5pLgbMKn6u4RPiu1djUfecuZxMhdzk",
            "animationURL": "",
            "openSeaImageURL": ""
          },
          "contractName": "test",
          "artistName": "Test",
        },
      ]
    }
  }
}
```

##### Error
 - wallet by address by id not found: record not found


### getSupportedNetworks
It can able to get the supported networks list

```
import { useConnectWallet, GetSupportedNetworksData } from "@mojito-inc/core-service";

  const { getSupportedNetworks } = useConnectWallet();

  const response: Response<GetSupportedNetworksData> = await getSupportedNetworks({
          orgId: <ORG_ID>,
          includeTestnets: <INCLUDE_TESTNETS>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|includeTestnets| Boolean|

##### Response
```
 {
  "data": {
    "getSupportedNetworks": [
      {
        "id": "f7babe75-2dfc-434a-9e3b-a28e101c4863",
        "name": "Ethereum Mainnet",
        "chainID": 1,
        "isTestnet": false
      },
      {
        "id": "c41db347-0ee3-4212-943a-ca213b8e0ea8",
        "name": "Goerli Testnet",
        "chainID": 5,
        "isTestnet": true
      },
    ]
  }
}
```

##### Error
 - encoding/hex: invalid byte: U+002D '-'


List item API can be access via hooks

following the api are 
1. [createSignatureToListNFTForSale](#createSignatureToListNFTForSale)
2. [removeListing](#removeListing)
3. [submitProofOfApproval](#submitProofOfApproval)

### createSignatureToListNFTForSale
It can able to create list item for sale

```
import { useListItem, CreateSignatureToListNFTForSaleData } from "@mojito-inc/core-service";

  const { createSignatureToListNFTForSale } = useListItem();

  const response: Response<CreateSignatureToListNFTForSaleData> = await createSignatureToListNFTForSale({
          orgId: <ORG_ID>,
          nftTokenId: <NFT_TOKEN_ID>,
          tokenType: <TOKEN_TYPE>,
          quantity: <QUANTITY>,
          nftOwnerAddress: <NFT_OWNER_ADDRESS>,
          fixedPrice: <FIXED_PRICE>,
          paymentToken: <PAYMENT_TOKEN>,
          currencyId: <CURRENCY_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|nftTokenId| UUID1|✅|
|tokenType| TokenType|✅|
|quantity| Int|✅|
|nftOwnerAddress| String|✅|
|fixedPrice| Float|✅|
|paymentToken| String|✅|
|currencyId| UUID1|✅|

##### Response
```
 {
  "data": {
    "createSignatureToListNFTForSale": {
      "messageToSign": "0xc061ed6367ab12e87d93ac081487f069e4c8ba3b6bc100fec2a1afffd937f632",
      "order": {
        "id":"32dc6e44-79f3-4d2f-8068-94639e543a6e"
        "nftTokenId":"6bd80dcd-9cc8-4078-a7e2-02c5164d7ab4"
        "tokenContract":"0xd0e2fd21764f643fa32b06a4c7d7924f43138d90"
        "tokenId":"15"
        "tokenType":"ERC1155"
        "quantity":1
        "nftOwnerAddress":"0xC7e893488A039A341d935959E52f86085976F865"
        "fixedPrice":0.04
        "paymentToken":"0x0000000000000000000000000000000000000000"
        "orderType":"LISTING"
      }
    }
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### removeListing
It can able to remove listing an item

```
import { useListItem, RemoveListingData } from "@mojito-inc/core-service";

  const { createSignatureToListNFTForSale } = useListItem();

  const response: Response<RemoveListingData> = await removeListing({
          orgID: <ORG_ID>,
          nftTokenId: <NFT_TOKEN_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgID| UUID1|✅|
|nftTokenId| UUID1|✅|

##### Response
```
 {
  "data": {
    "removeListing": "Listing removed."
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### submitProofOfApproval
It can able to submit approval for listing an item

```
import { useListItem, SubmitProofOfApprovalData } from "@mojito-inc/core-service";

  const { submitProofOfApproval } = useListItem();

  const response: Response<SubmitProofOfApprovalData> = await submitProofOfApproval({
          orgID: <ORG_ID>,
          nftTokenId: <NFT_TOKEN_ID>,
          signature: <SIGNATURE>,
          quantity: <QUANTITY>,
          fixedPrice: <FIXED_PRICE>,
          paymentToken: <PAYMENT_TOKEN>,
          currencyId: <CURRENCY_ID>,
          creatorFee: <CREATOR_FEE>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgID| UUID1|✅|
|nftTokenId| UUID1|✅|
|signature| String|✅|
|quantity| Int|
|fixedPrice| Float|
|paymentToken| String|
|currencyId| UUID1|
|creatorFee| TokenType|

##### Response
```
 {
  "data": {
    "submitProofOfApproval":"Signature updated."
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


Tax and fee API can be access via hooks

following the api are 
1. [estimateTaxAndRoyaltyFee](#estimateTaxAndRoyaltyFee)
2. [getTaxQuote](#getTaxQuote)

### estimateTaxAndRoyaltyFee
It can able to get tax and fee data

```
import { useFee, EstimateTaxAndRoyaltyFeeData } from "@mojito-inc/core-service";

  const { estimateTaxAndRoyaltyFee } = useFee();

  const response: Response<EstimateTaxAndRoyaltyFeeData> = await estimateTaxAndRoyaltyFee({
          orgId: <ORG_ID>,
          estimateType: <ESTIMATE_TYPE>,
          nftTokenId: <NFT_TOKEN_ID>,
          orderId: <ORDER_ID>,
          price: <PRICE>,
          country: <COUNTRY>,
          postalCode: <POSTAL_CODE>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|estimateType| TaxEstimateType|✅|
|nftTokenId| UUID1|
|orderId| UUID1|
|price| Float|
|country| String|
|postalCode| String|

##### Response
```
 {
  "data": {
    "estimateTaxAndRoyaltyFee": {
      "taxPercentage": 0,
      "royaltyFee": 0,
      "platformFee": 2.5,
      "taxResponse": {
        "cryptoTaxPrice": 0,
        "cryptoTotalPrice": 1,
        "USDUnitprice": 1920.88,
        "taxPercentage": 0
      }
    }
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### getTaxQuote
It can able to get tax and fee data

```
import { useFee, GetTaxQuoteData } from "@mojito-inc/core-service";

  const { getTaxQuote } = useFee();

  const response: Response<GetTaxQuoteData> = await getTaxQuote({
          orgID: <ORG_ID>,
          taxablePrice: <TAXABLE_PRICE>,
          street1: <STREET>,
          city: <CITY>,
          state: <STATE>,
          postalCode: <POSTAL_CODE>,
          country: <COUNTRY>,
          currencyCode: <CURRENCY_CODE>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgID| UUID1|✅|
|taxablePrice| Float|✅|
|street1| String|✅|
|city| String|✅|
|state| String|✅|
|postalCode| String|✅|
|country| String|✅|
|currencyCode| String|

##### Response
```
{
  "data": {
    "getTaxQuote": {
      "verifiedAddress": {
        "street1": "",
        "state": "Tamil Nadu",
        "postalCode": "",
        "country": "IN",
        "currencyCode": "USD"
      },
      "taxablePrice": 76.6724,
      "totalTaxedPrice": 76.6724,
      "totalTaxAmount": 0
    }
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


NFT API can be access via hooks

following the api are 
1. [getNFTFavoriteListByUser](#getNFTFavoriteListByUser)
2. [addNFTToFavorite](#addNFTToFavorite)
3. [removeNFTFromFavorite](#removeNFTFromFavorite)
4. [getAllRegistryTokens](#getAllRegistryTokens)
5. [getNFTDetails](#getNFTDetails)
6. [getNFTHistory](#getNFTHistory)
7. [getNFTAttributesRarity](#getNFTAttributesRarity)
8. [initiateBuyNFT](#initiateBuyNFT)
9. [updateTransactionHash](#updateTransactionHash)
10. [generateSecondaryInvoice](#generateSecondaryInvoice)
11. [userOrderActivity](#userOrderActivity)
12. [transferNFT](#transferNFT)
13. [getAllInvoices](#getAllInvoices)
14. [generatePrimaryInvoice](#generatePrimaryInvoice)
15. [getFileSignedURL](#getFileSignedURL)

### getNFTFavoriteListByUser
It can able to get favorite NFT list

```
import { useNFT, GetNFTFavoriteListByUserData } from "@mojito-inc/core-service";

  const { getNFTFavoriteListByUser } = useNFT();

  const response: Response<GetNFTFavoriteListByUserData> = await getNFTFavoriteListByUser({
          orgId: <ORG_ID>,
          searchKey: <SEARCH_KEY>,
          filter: <FILTER>,
          limit: <LIMIT>,
          offset: <OFFSET>,
          buyerAddress: <BUYER_ADDRESS>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|searchKey| Number|
|filter| enum| |[SavedNFTFilterInput](#SavedNFTFilterInput)|
|limit| Int|
|offset| Int|
|buyerAddress| String|

##### SavedNFTFilterInput
##### enum
|Enum Variable    |value    | 
|:--- | --- |
|recently_listed| recently_listed|
|recently_minted | recently_minted |
|initially_minted| initially_minted|
|price_low_to_high | price_low_to_high |
|most_saved| most_saved|
|purchased_from_org | purchased_from_org |

##### Response
```
{
  "data": {
    "getNFTFavouriteListByUser": {
      "totalCount": 1,
      "data": [
        {
          "id":"6"
          "title":"BasedHead #6"
          "status":"OPEN_FOR_SALE"
          "network":"Goerli Testnet"
          "networkID":"c41db347-0ee3-4212-943a-ca213b8e0ea8"
          "tokenURI":"https://drops.api.topdogstudios.io/basedAf/token/6"
        }
      ]
    }
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### addNFTToFavorite
It can able to add NFT to favorite

```
import { useNFT, AddNFTToFavoriteData } from "@mojito-inc/core-service";

  const { addNFTToFavorite } = useNFT();

  const response: Response<AddNFTToFavoriteData> = await addNFTToFavorite({
          orgID: <ORG_ID>,
          tokenId: <TOKEN_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|tokenId| UUID1|✅|

##### Response
```
{
  "data": {
    "addNFTToFavourite": true,
  }
}
```

##### Error
 - error getting token by ID: record not found


### removeNFTFromFavorite
It can able to remove NFT from favorite

```
import { useNFT, RemoveNFTFromFavoriteData } from "@mojito-inc/core-service";

  const { removeNFTFromFavorite } = useNFT();

  const response: Response<RemoveNFTFromFavoriteData> = await removeNFTFromFavorite({
          orgID: <ORG_ID>,
          tokenId: <TOKEN_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|tokenId| UUID1|✅|

##### Response
```
{
  "data": {
    "removeNFTFromFavourite": true,
  }
}
```

##### Error
 - error getting token by ID: record not found


### getAllRegistryTokens
It can able to get NFT list

```
import { useNFT, GetAllRegistryTokensData } from "@mojito-inc/core-service";

  const { getAllRegistryTokens } = useNFT();

  const response: Response<GetAllRegistryTokensData> = await getAllRegistryTokens({
          orgID: <ORG_ID>,
          searchKey: <SEARCH_KEY>,
          filter: <FILTER>,
          limit: <LIMIT>,
          offset: <OFFSET>,
          marketplaceID: <MARKETPLACE_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgID| UUID1|✅|
|searchKey| Number|
|filter| enum| |[RegistryTokenFilterInput](#RegistryTokenFilterInput)|
|limit| Int|
|offset| Int|
|buyerAddress| String|
|sort| RegistryTokenSortInput|
|artistID| UUID1|
|registryID| UUID1|
|categorySlug| String|
|artistSlug| String|

##### RegistryTokenFilterInput
##### enum
|Enum Variable    |value    | 
|:--- | --- |
|recently_listed| recently_listed|
|recently_minted | recently_minted |
|initially_minted| initially_minted|
|price_low_to_high | price_low_to_high |
|price_high_to_low| price_high_to_low|

##### Response
```
{
  "data": {
    "getAllRegistryTokens": {
      "totalCount": 1,
      "data": [
        {
          "ID":"7992bcb2-1d34-4158-b07b-e8725016b1d1"
          "TokenName":"BasedHead #15"
          "TokenID":"15"
          "Status":"OPEN_FOR_SALE"
          "TokenURI":"https://drops.api.topdogstudios.io/basedAf/token/15"
          "NFTTokenID":"6bd80dcd-9cc8-4078-a7e2-02c5164d7ab4"
        }
      ]
    }
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### getNFTDetails
It can able to get NFT list

```
import { useNFT, GetNFTDetailsData } from "@mojito-inc/core-service";

  const { getNFTDetails } = useNFT();

  const response: Response<GetNFTDetailsData> = await getNFTDetails({
          orgId: <ORG_ID>,
          contractAddress: <CONTRACT_ADDRESS>,
          onChainTokenID: <ONCHAIN_TOKEN_ID>,
          ownerAddress: <OWNER_ADDRESS>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|contractAddress| String|
|onChainTokenID| BigInt|
|ownerAddress| String|
|buyerAddress| String|
|editionNumber| Int|
|nftTokenId| UUID1|
|networkId| UUID1|

##### Response
```
{
  "data": {
    "getNFTDetails": {
      "contractAddress":"0xd0e2fd21764f643fa32b06a4c7d7924f43138d90"
      "tokenId":"7"
      "network":"Goerli Testnet"
      "networkID":"c41db347-0ee3-4212-943a-ca213b8e0ea8"
      "contractName":"test"
      "tokenType":"ERC1155"
      "mintedAt":"2023-01-25T06:40:22Z"
      "status":"SALE_PENDING"
    }
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### getNFTHistory
It can able to get NFT history

```
import { useNFT, GetNFTHistoryData } from "@mojito-inc/core-service";

  const { getNFTHistory } = useNFT();

  const response: Response<GetNFTHistoryData> = await getNFTHistory({
          orgId: <ORG_ID>,
          contractAddress: <CONTRACT_ADDRESS>,
          tokenId: <TOKEN_ID>,
          networkId: <NETWORK_ID>,
          ownerAddress: <OWNER_ADDRESS>,
          nftTokenId: <NFT_TOKEN_ID>,
          limit: <LIMIT>,
          offset: <OFFSET>
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|contractAddress| String|✅|
|networkId| UUID1|✅|
|tokenId| BigInt|✅|
|nftTokenId| UUID1|
|ownerAddress| String|
|limit| Int|
|offset| Int|

##### Response
```
{
  "data": {
    "getNFTHistoryV2": {
      "totalCount": 30,
      "data": [
        {
          "hash":"0xd3cc350c9020a32f699bea54824b90aa5adad6fbc5e09a0dbc2b78ce1415ae03",
          "from":"0xa77915a574e1f9b88db152525ceBfEAA8c71bAa4",
          "to":"test"
          "blockTimestamp":"2023-01-27T12:41:23Z"
          "eventType":"Sale"
          "fromUserAvatar":"qvx3wQZawwkDtws2"
        }
      ]
    }
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### getNFTAttributesRarity
It can able to get NFT Traits

```
import { useNFT, GetNFTAttributesRarityData } from "@mojito-inc/core-service";

  const { getNFTAttributesRarity } = useNFT();

  const response: Response<GetNFTAttributesRarityData> = await getNFTAttributesRarity({
          contractAddress: <CONTRACT_ADDRESS>,
          tokenID: <TOKEN_ID>,
          networkID: <NETWORK_ID>,
          refreshCatch: <REFRESH_CACHE>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|contractAddress| String|✅|
|networkID| UUID1|✅|
|tokenID| BigInt|✅|
|refreshCatch| Boolean|

##### Response
```
{
  "data": {
    "getNFTAttributesRarity": [
      {
        "traitType":"Brand",
        "displayType":"",
        "maxValue":0,
        "prevalance":0,
        "value": {
          "__typename":"AttributeValueString",
          "stringValue":"DGAF"
        }
      }
    ]
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### initiateBuyNFT
It can able to get order details

```
import { useNFT, InitiateBuyNFTData } from "@mojito-inc/core-service";

  const { initiateBuyNFT } = useNFT();

  const response: Response<InitiateBuyNFTData> = await initiateBuyNFT({
          nftTokenId: <NFT_TOKEN_ID>,
          buyerAddress: <BUYER_ADDRESS>,
          orgId: <ORG_ID>,
          country: <COUNTRY>,
          postalCode: <POSTAL_CODE>,
          currencyId: <CURRENCY_ID>,
          cryptoTax: <CRYPTO_TAX>,
          taxAddress: <TAX_ADDRESS>
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|nftTokenId| UUID1|✅|
|buyerAddress| String|✅|
|orgId| UUID1|✅|
|country| String|
|postalCode| String|
|currencyId| UUID1|
|cryptoTax| CryptoTax|
|taxAddress| TaxAddressInput|

##### Response
```
{
  "data": {
    "initiateBuyNFT": {
      "proofOfApproval":"0x28a9e439e3c091e737ff6209a1aa6f6022d8e7d16d738b2cbbc2fe8fad86630c341602d2653fcda2d02034278aee2a4fce9d6a48b7662ab67c5893c0fd857cf01c"
    }
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### updateTransactionHash
It can able to update the transaction hash

```
import { useNFT, UpdateTransactionHashData } from "@mojito-inc/core-service";

  const { updateTransactionHash } = useNFT();

  const response: Response<UpdateTransactionHashData> = await updateTransactionHash({
          nftTokenId: <NFT_TOKEN_ID>,
          orgId: <ORG_ID>,
          buyerAddress: <BUYER_ADDRESS>,
          transactionHash: <TRANSACTION_HASH>,
          orderId: <ORDER_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|nftTokenId| UUID1|✅|
|orgId| UUID1|✅|
|buyerAddress| String|✅|
|transactionHash| String|✅|
|orderId| UUID1|

##### Response
```
{
  "data": {
    "updateTransactionHash": {
      "success":false,
      "newNFTID":"2bb1fec0-94be-499c-989c-1a2a75ceb478"
    }
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found

### generateSecondaryInvoice
It will give a url to download invoice as a PDF format

```
import { useNFT, GenerateSecondaryInvoiceData } from "@mojito-inc/core-service";

  const { generateSecondaryInvoice } = useNFT();

  const response: Response<GenerateSecondaryInvoiceData> = 
  await generateSecondaryInvoice({
          invoiceID: <INVOICE_ID>,
          orderID: <ORDER_ID>,
          activityName: <ACTIVITY_NAME>,
          invoiceResType: <INVOICE_RES_TYPE>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|invoiceID| UUID1|✅|
|orderID| UUID1|✅|
|activityName| enum|✅| [ActivityName](#ActivityName)|
|invoiceResType| enum|✅| [InvoiceResType](#InvoiceResType)|

##### ActivityName
##### enum
|Enum Variable    |value    | 
|:--- | --- |
|Listed_Item| Listed_Item|
|Listed_Item_Removed | Listed_Item_Removed |
|Sold_Item| Sold_Item|
|Offered | Offered |
|Offer_Cancelled| Offer_Cancelled|
|Offer_Rejected | Offer_Rejected |
|Offer_Expired| Offer_Expired|
|Bought_Item | Bought_Item |

##### InvoiceResType
##### enum
|Enum Variable    |value    | 
|:--- | --- |
|pdf| pdf|
|base64 | base64 |

##### Response
```
 {
    "data: {
      "generateSecondaryInvoice": "https://storage.googleapis.com/mojito-dev-public/organizations/8fb128bd-f55d-4bcc-8b6c-0beb684e4d4e/invoices/208af15b-ae03-47c7-aa79-27ce453bcb2d_buyer.pdf"
    }
 }
```

##### Error
 - error getting invoice with id: <invoiceID> record not found

### generatePrimaryInvoice
It will give a url to download invoice as a PDF format

```
import { useNFT, GeneratePrimaryInvoiceData } from "@mojito-inc/core-service";

  const { generatePrimaryInvoice } = useNFT();

  const response: Response<GeneratePrimaryInvoiceData> = 
  await generatePrimaryInvoice({
          invoiceID: <INVOICE_ID>,
          invoiceResType: <INVOICE_RES_TYPE>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|invoiceID| UUID1|✅|
|invoiceResType| enum|✅| [InvoiceResType](#InvoiceResType)|

##### InvoiceResType
##### enum
|Enum Variable    |value    | 
|:--- | --- |
|pdf| pdf|
|base64 | base64 |

##### Response
```
 {
    "data: {
      "generatePrimaryInvoice": "https://storage.googleapis.com/mojito-dev-public/organizations/8fb128bd-f55d-4bcc-8b6c-0beb684e4d4e/invoices/208af15b-ae03-47c7-aa79-27ce453bcb2d_buyer.pdf"
    }
 }
```

##### Error
 - error getting invoice with id: <invoiceID> record not found 


### getUserOrderActivity
It will provide a user order activity data

```
import { useUser, UserOrderActivityData } from "@mojito-inc/core-service";
  const { userOrderActivity } = useUser();
  const response: Response<UserOrderActivityData> = await userOrderActivity({
          orgId: <ORG_ID>,
          filter: <FILTER>,
          limit: <LIMIT>,
          offset: <OFFSET> 
        });
```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|filter| enum|✅| [OrderActivityFilters](#OrderActivityFilters)|
|limit| Int|✅|
|offset| Int|✅|

##### OrderActivityFilters
##### enum
|Enum Variable    |value    | 
|:--- | --- |
|LATEST_TO_OLDEST| LATEST_TO_OLDEST|
|LATEST_TO_OLDEST | LATEST_TO_OLDEST |

##### Response
```
 {
    "data: {
      "getUserOrderActivity": {
        "totalCount": 529,
        "data": [
          {
            "CreatedAt": "2023-03-29T10:52:18Z",
            "nftImageUrl": "https://ipfs.io/ipfs/Qmf3YhCWVyansFPqunCfpCfKz9xNGzeMwYze7b359JR5xU",
            "ActivityName": "Offered",
            "TokenName": "BasedHead #8",
            "TokenID": "8",
            "NFTTokenID": "527ef338-2e68-4b62-a5d3-d1cb1ec81b30",
            "ContractName": "test",
            "ContractAddress": "0xd0e2fd21764f643fa32b06a4c7d7924f43138d90",
            "Price": [
              {
                "value": 72.5217,
                "unit": "USD"
              },
              {
                "value": 0.04,
                "unit": "WETH"
              }
            ],
            "NetworkID": "c41db347-0ee3-4212-943a-ca213b8e0ea8",
            "TransactionHash": "",
            "FromUserName": "rajesh1",
            "ToUserName": "mainnet3",
            "FromUserAvatar": "U0BpDFXLEKmMNPly",
            "ToUserAvatar": "Ph9sz1la6hyMY3sd",
            "FromWallet": {
              "id": "4e89c916-3663-4d53-b549-1767c1e1a8d1",
              "name": "rajesh account wallet",
              "address": "0xc7e893488a039a341d935959e52f86085976f865"
            },
            "ToWallet": {
              "id": "02eb2545-1c70-4f68-a856-aa7ed25bd013",
              "name": "",
              "address": "0xeAE67de0b3e913Ecb1Fae4d3bB936CD8dc282dD8"
            },
            "InvoiceURL": "",
            "InvoiceID": null,
            "OrderID": "c24a1370-9350-4516-82ab-6312b8ee571a",
            "Status": "EXPIRED",
            "cryptoTax": {
              "cryptoTaxPrice": 0,
              "cryptoTotalPrice": 0.04,
              "USDUnitprice": 0.5,
              "taxPercentage": 0
            },
            "order": {
              "platformFee": 0.001,
              "creatorFee": 0
            }
          }
        ]
      }
    }
 }
```

##### Error
 - error getting organization by id: <orgID> record not found

### transferNFT
It can be able to transfer NFT

```
import { useNFT, TransferNFTData } from "@mojito-inc/core-service";
  const { transferNFT } = useNFT();
  const response: Response<TransferNFTData> = await transferNFT({
          walletId: <WALLET_ID>,
          orgId: <ORG_ID>,
          contractAddress: <CONTRACT_ADDRESS>,
          tokenType: <TOKEN_TYPE>,
          tokenOnChainId: <TOKEN_ONCHAIN_ID>,
          amount: <AMOUNT>,
          transferTo: <TRANSFER_TO>,
          isClaimedToken: <IS_CLAIMEDTOKEN>,
        });
```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|walletId| UUID1|✅|
|orgId| UUID1|✅|
|contractAddress| string|✅| 
|tokenType| TokenType|
|tokenOnChainId| Int|✅|
|amount| Int|
|transferTo| string|✅|
|isClaimedToken| boolean|

##### Response
```
{
  "data": {
    "transferToken": "transfered",
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found

### getAllInvoices
It will provide all the invoices data

```
import { useNFT, getAllInvoices } from "@mojito-inc/core-service";
  const { getAllInvoices } = useNFT();
  const response: Response<GetAllInvoicesData> = await getAllInvoices({
          orgID: <ORG_ID>,
          filter: <FILTER>,
          limit: <LIMIT>,
          offset: <OFFSET> 
        });
```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgID| UUID1|✅|
|filter| enum|✅| [OrderActivityFilters](#OrderActivityFilters)|
|limit| Int|✅|
|offset| Int|✅|

##### OrderActivityFilters
##### enum
|Enum Variable    |value    | 
|:--- | --- |
|LATEST_TO_OLDEST| LATEST_TO_OLDEST|
|LATEST_TO_OLDEST | LATEST_TO_OLDEST |

##### Response
```
 {
    "data: {
      "getAllInvoices": {
        "count": 633,
        "data": [
          {
          "id": "bec11a55-e92e-4491-b215-fa466717537c",
          "createdAt": "2023-08-28T11:06:40Z",
          "isSecondary": true,
          "userID": "aae0fe77-1c48-45cd-a10c-55115713e4d7",
          "status": "COMPLETED",
          "totalPrice": 0.04,
          "PriceCrypto": 0.04,
          "usdItemPrice": 65.44640000000001,
          "quantity": 1,
          "transactionHash": "0x15ebacc1025202c0a9c3bf2200ec38ab4a55b0f446376ebab1acebef5ca7b422",
          "invoiceID": "1cf8d0ab-3b1a-4f9a-bcd8-8e6d9d6d37aa",
          "invoiceNumber": 27388,
          "itemID": "890ee587-50ec-471d-9283-88b61655f5d0",
          "tokenID": "3f24646a-7abe-414b-b510-e51a5e58e9fe",
          "contractAddress": "0xe016a4a7ffa5b3305d1c2e1cdda13d92e11bb2da",
          "onChainTokenID": "2",
          "networkID": null,
          "eventType": "List",
          "fromWalletAddress": "0xa77915a574e1f9b88db152525ceBfEAA8c71bAa4",
          "toWalletAddress": null,
          "image": "https://storage.googleapis.com/mojito-dev-public/organizations/960ce62a-412d-43ee-b60d-da21ee1ea217/nft/assets/3f24646a-7abe-414b-b510-e51a5e58e9fe_2023-08-28T11:24:51.276062873Z.gif",
          "itemName": "The Plague #2",
          "tokenName": "The Plague #2",
          }
        ]
      }
    }
 }
```

##### Error
 - error getting organization by id: <orgID> record not found

### getMyInvoices
import { useNFT, getMyInvoices } from "@mojito-inc/core-service";
const { getMyInvoices } = useNFT();

 const response: Response<GetMyInvoicesData> = await getMyInvoices({
          returnAllStatuses: <RETURN_ALL_STATUSES>,
          filter: <FILTER>,
          limit: <LIMIT>,
          offset: <OFFSET> 
        });

|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|returnAllStatuses| Boolean||
|filter| string || [GetMyInvoiceFilterParam](#GetMyInvoiceFilterParam)|
|limit| Int|✅|
|offset| Int|✅|

##### GetMyInvoiceFilterParam
|Variable    |value    | 
|:--- | --- |
|dropID| string |
|listingID | string |


##### Response
```
 {
    "data: {
      "getAllInvoices": {
      "TotalCount": 3,
      "data": [
        {
          "invoiceID": "c9ae9cc1-15ca-4286-8f23-50aa1efec6a0",
          "invoiceCreatedAt": "2024-07-26T11:45:53.735655Z",
          "invoiceNumber": 31752,
          "status": "Paid",
          "items": [
            {
              "collectionItemTitle": "Test 1155 listing",
              "collectionItemID": "55c031f9-2e62-48d2-823c-c684026d0e64",
              "invoiceItemID": "b897f1a2-7e49-4798-9e3e-90818a388719",
              "destinationAddress": "0xC7B73dE4Ef961300Bb79E04b6CF75a1e32DFd1f2",
              "units": 1,
              "totalPrice": 0,
              "transactionHash": "0x1e2145464e2b21d3eeb9faf305f7928273be7779ba432819e99cef2fa9296a23",
              "transactionStatus": "Delivered",
              "nftImageUrl": "https://gateway.arweave.net/UDdgMysz7IoQWRxjLLBte0P0lbpipVU4oo32huIghU4",
              "nftDetails": [
                {
                  "contractAddress": "0xcc018fad58c8b2c2856ff9e885edcb9faf15d73e",
                  "networkId": "b260424b-bb37-4a3e-86d0-0866175e5e68",
                  "nftTokenID": "c6dcf74d-8261-44d8-8512-ec34ccb032e2",
                  "networkChainID": 11155111,
                  "isRevealed": false,
                  "tokenMetadata": {
                    "name": "1_Dog1_Glow_Blacksad1s",
                    "description": "Test token description",
                    "image": "https://gateway.arweave.net/UDdgMysz7IoQWRxjLLBte0P0lbpipVU4oo32huIghU4"
                  }
                }
              ]
            }
          ]
        }
      ]
    }
    }
 }
```

### getFileSignedURL
It can be able to get the FileSignedURL

```
import { useNFT, FileSignedUrlData } from "@mojito-inc/core-service";
  const { getFileSignedUrl } = useNFT();
  const response: Response<FileSignedUrlData> = await getFileSignedUrl({
          urlInput: <FileSignedWithURL>,
          input: <FileSignedWithGatingInput>,
        });
```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|urlInput| FileSignedWithURL|
|input| FileSignedWithGatingInput|

##### Response
```
{
  "data": {
    "getFileSignedURL": {
      mediaURL: "https://storage.cloud.google.com/mojito-dev-private/nft/0x0b1ee1de78a9d2db7b647834423a86e6c5bf1bdb/videos/1.mp4",
      type: 'mp4'
    },
  }
}
```

##### Error
 - The gated NFT not belongs to the walletAddress 

Offer API can be access via hooks

following the api are 
1. [acceptOffer](#acceptOffer)
2. [cancelOffer](#cancelOffer)
3. [createOffer](#createOffer)
4. [getOffers](#getOffers)
5. [getSignatureForOfferApproval](#getSignatureForOfferApproval)
6. [rejectOffer](#rejectOffer)
7. [submitProofOfOffer](#submitProofOfOffer)


### acceptOffer
It can able to accept offer for an NFT

```
import { useOffer, AcceptOfferData } from "@mojito-inc/core-service";

  const { acceptOffer } = useOffer();

  const response: Response<AcceptOfferData> = await acceptOffer({
          orgId: <ORG_ID>,
          orderId: <ORDER_ID>,
          transactionHash: <TRANSACTION_HASH>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|orderId| UUID1|✅|
|transactionHash| String|✅|

##### Response
```
{
  "data": {
    "acceptOffer": {
      "success":false
      "newNFTID":"5bc739a6-f5d3-4417-b4af-91687e0af525"
    }
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### cancelOffer
It can able to cancel offer for an NFT

```
import { useOffer, CancelOfferData } from "@mojito-inc/core-service";

  const { cancelOffer } = useOffer();

  const response: Response<CancelOfferData> = await cancelOffer({
          orgId: <ORG_ID>,
          orderId: <ORDER_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|orderId| UUID1|✅|

##### Response
```
{
  "data": {
    "cancelOffer": "Offer cancelled."
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### createOffer
It can able to create offer for an NFT

```
import { useOffer, CreateOfferData } from "@mojito-inc/core-service";

  const { createOffer } = useOffer();

  const response: Response<CreateOfferData> = await createOffer({
          orgId: <ORG_ID>,
          nftTokenId: <NFT_TOKEN_ID>,
          buyerAddress: <BUYER_ADDRESS>,
          offerPrice: <OFFER_PRICE>,
          expiryDate: <EXPIRY_DATE>,
          paymentToken: <PAYMENT_TOKEN>,
          currencyId: <CURRENCY_ID>,
          cryptoTax: <CRYPTO_TAX>,
          taxAddress: <TAX_ADDRESS>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|nftTokenId| UUID1|✅|
|buyerAddress| String|✅|
|offerPrice| Number|✅|
|expiryDate| String|✅|
|paymentToken| String|✅|
|currencyId| String|
|cryptoTax| CryptoTax|
|taxAddress| TaxAddressInput|

##### Response
```
{
  "data": {
    "createOffer": {
      "messageToSign":"0xf94d966f32828f3313c3aaa72559ee78bd4c784a6c1b0c4763c297e20f720a96",
      "order": {
        "id":"ac444a12-703a-4495-8e99-b5634bab63ea"
        "nftTokenId":"1942008c-3329-405f-980e-48b2f0ee9a08"
        "tokenId":"10"
        "tokenContract":"0xd0e2fd21764f643fa32b06a4c7d7924f43138d90"
        "quantity":1
        "nftOwnerAddress":"0xf724aE0B5662b8ad6D155D50522eb097247271cB"
        "fixedPrice":0.04
      }
    }
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### getOffers
It can able to get offers list for an NFT

```
import { useOffer, GetOffersData } from "@mojito-inc/core-service";

  const { getOffers } = useOffer();

  const response: Response<GetOffersData> = await getOffers({
          orgId: <ORG_ID>,
          nftTokenId: <NFT_TOKEN_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|nftTokenId| UUID1|✅|

##### Response
```
{
  "data": {
    "getOffers": [
      {
        "id": "ac444a12-703a-4495-8e99-b5634bab63ea"
        "offerExpiryDate": "2023-04-14T10:40:00Z"
        "nftOwnerAddress": "0xf724aE0B5662b8ad6D155D50522eb097247271cB"
        "tokenType": "ERC1155"
        "tokenId": "10"
        "tokenContract": "0xd0e2fd21764f643fa32b06a4c7d7924f43138d90"
        "orderStatus": "PENDING"
        "buyerTax": 0
        "buyerAddress": "0xC7e893488A039A341d935959E52f86085976F865"
        "fixedPrice": 0.04
        "updatedAt": "2023-04-13T10:40:55Z"
        "createdAt": "2023-04-13T10:40:51Z"
      }
    ]
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### getSignatureForOfferApproval
It can able to get signature approval data for an NFT

```
import { useOffer, GetSignatureForOfferApprovalData } from "@mojito-inc/core-service";

  const { getSignatureForOfferApproval } = useOffer();

  const response: Response<GetSignatureForOfferApprovalData> = await getSignatureForOfferApproval({
          orgId: <ORG_ID>,
          orderId: <ORDER_ID>,
          creatorFee: <CREATOR_FEE>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|orderId| UUID1|✅|
|creatorFee| Int|

##### Response
```
{
  "data": {
    "getSignatureForOfferApproval": {
      "proofOfApproval":"0xaf6e0275ba209ae723fdfe1b5411bebdf51f376d103ff9b227cedcc7b317974d09e698d1b9aea58e698a3724acd2fc8d3352eef96cb634bd735898f56f945da21c",
    "order": {
      "id":"d7bef205-2938-4443-b5b9-7f55db25da9a"
      "nftTokenId":"5bc739a6-f5d3-4417-b4af-91687e0af525"
      "tokenId":"6"
      "tokenType":"ERC1155"
      "quantity":1
      "nftOwnerAddress":"0xc7e893488a039a341d935959e52f86085976f865"
      "fixedPrice":0.04
      }
    }
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### rejectOffer
It can able to reject offer for an NFT

```
import { useOffer, RejectOfferData } from "@mojito-inc/core-service";

  const { rejectOffer } = useOffer();

  const response: Response<RejectOfferData> = await rejectOffer({
          orgId: <ORG_ID>,
          orderId: <ORDER_ID>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|orderId| UUID1|✅|

##### Response
```
{
  "data": {
    "rejectOffer": "Offer rejected."
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


### submitProofOfOffer
It can able to submit proof of offer for an NFT

```
import { useOffer, SubmitProofOfOfferData } from "@mojito-inc/core-service";

  const { submitProofOfOffer } = useOffer();

  const response: Response<SubmitProofOfOfferData> = await submitProofOfOffer({
          orgId: <ORG_ID>,
          orderId: <ORDER_ID>,
          signature: <SIGNATURE>,
        });

```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgId| UUID1|✅|
|orderId| UUID1|✅|
|signature| String|✅|

##### Response
```
{
  "data": {
    "submitProofOfOffer":"Signature updated."
  }
}
```

##### Error
 - error getting organization by id: <orgID> record not found


 Token Gating API can be access via hooks

following the api are 
1. [createTokenGating](#createTokenGating)
2. [checkTokenGating](#checkTokenGating)
3. [checkTokenGatingV2](#checkTokenGatingV2)


### createTokenGating

  This API is used to create a Token Gating for an NFT.

```
import { useTokenGating, CreateTokenGatingData } from "@mojito-inc/core-service";

const { createTokenGating } = useTokenGating();

const response: Response<CreateTokenGatingData> = await createTokenGating({
          input: {
            orgID: <ORG_ID>,
            networkId: <NETWORK_ID>,
            rule: <GatingRule>,
            groupName: <GROUP_NAME>,
            groupId: <GROUP_ID>,
          }
        });
```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|orgID| UUID1|✅|
|networkId| UUID1|✅|
|groupId| UUID1|
|groupName| String|
|rule|GatingRule|✅| [GatingRule](#GatingRule)

#### GatingRule

|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|ruleType|enum|✅|[RuleType](#RuleType)
|contractAddress|String|
|contractAddressWithTokenId|contractAddressWithTokenId| |[ContractAddressWithTokenIDGating](#ContractAddressWithTokenIDGating)
|metaData|MetaDataGating||[MetaDataGating](#MetaDataGating)
|onchain|enum| |[OnchainGating](#OnchainGating)

###### ContractAddressWithTokenIDGating
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|contractAddress|String|
|tokenID|Int|

###### MetaDataGating
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|key|String|
|value| String

##### enum
###### RuleType
|Enum Variable    |value    | 
|:--- | --- |
|ContractAddress| ContractAddress|
|ContractAddressWithTokenID| ContractAddressWithTokenID|
|MetaData| MetaData|
|Onchain| Onchain|

##### OnchainGating
|Enum Variable    |value    | 
|:--- | --- |
|ONCHAIN|ONCHAIN|

##### Response
```
{
  "data": {
    "createTokenGatingRule": {
      "id": "8bb24c9a-6b46-44d0-a2f7-3439c4bdd4ef",
      "groupName": "TEST GATING SEPOLIA",
      "networkID": "b260424b-bb37-4a3e-86d0-0866175e5e68",
      "organizationID": "f2f5c627-5421-4c40-9913-edfd09dd98b3",
      "rules": [
        {
          "id": "85d9b667-44c2-4bec-9e8a-ddf0e04cc107",
          "gatingGroupId": "8bb24c9a-6b46-44d0-a2f7-3439c4bdd4ef",
          "ruleType": "MetaData",
          "rules": {
            "metaData": [
              {
                "key": "name",
                "value": "Milady 1"
              },
              {
                "key": "description",
                "value": "Milady Maker is a collection of 10,000 generative pfpNFT's in a aesthetic inspired by street style tribes."
              }
            ]
          }
        }
      ]
    }
  }
}
```

##### Error
 - error getting organization by id: orgID record not found


### checkTokenGating
 This API is used to check whether the nft is Gated or not.

 ```
import { useTokenGating, CheckTokenGatingData } from "@mojito-inc/core-service";

const { checkTokenGating } = useTokenGating();

const response: Response<CheckTokenGatingData> = await checkTokenGating({
          groupID: <GROUP_ID>,
          ruleID: <RULE_ID>,
          buyerAddress: <BUYER_ADDRESS>,
          contractAddress: <CONTRACT_ADDRESS>,
          tokenId: <TOKEN_ID>,
        });
```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|groupID|UUID1|✅|
|ruleID| UUID1|
|buyerAddress|String|
|contractAddress| String|
|tokenId| String|

##### Response
```
{
  "data": {
    "checkTokenGating": {
      "isGated": true,
      "gatedTokens": [
        {
          "id": "1",
          "title": "Milady 1",
          "description": "Milady Maker is a collection of 10,000 generative pfpNFT's in a aesthetic inspired by street style tribes.",
          "tokenURI": "https://www.miladymaker.net/milady/json/1",
          "tokenType": "ERC721",
          "contractName": "Milady",
          "contractAddress": "0x3e9d45ad0da57683b5375d0f3d5bc606429128f9",
          "metadata": {
            "name": "Milady 1",
            "description": "Milady Maker is a collection of 10,000 generative pfpNFT's in a aesthetic inspired by street style tribes.",
            "image": "https://www.miladymaker.net/milady/1.png",
            "attributes": [
              {
                "traitType": "Background",
                "value": {
                  "stringValue": "bjork"
                }
              }
            ],
            "animationURL": "",
            "openSeaImageURL": ""
          }
        }
      ]
    }
  }
}
```

##### Error
 - error getting groupID by id: groupID record not found

### checkTokenGatingV2
 This API is used to check whether the nft is Gated or not.

 ```
import { useTokenGating, CheckTokenGatingV2Data } from "@mojito-inc/core-service";

const { checkTokenGatingV2 } = useTokenGating();

const response: Response<CheckTokenGatingV2Data> = await checkTokenGatingV2({
          groupID: <GROUP_ID>,
          ruleID: <RULE_ID>,
          buyerAddress: <BUYER_ADDRESS>,
        });
```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|groupID|UUID1|✅|
|ruleID| UUID1|
|buyerAddress|String|✅|

##### Response
```
{
  "data": {
    "checkTokenGatingV2": {
      "isGated": true,
      "gatedTokens": [
        {
          "id": "1",
          "title": "Milady 1",
          "description": "Milady Maker is a collection of 10,000 generative pfpNFT's in a aesthetic inspired by street style tribes.",
          "tokenURI": "https://www.miladymaker.net/milady/json/1",
          "tokenType": "ERC721",
          "contractName": "Milady",
          "contractAddress": "0x3e9d45ad0da57683b5375d0f3d5bc606429128f9",
          "metadata": {
            "name": "Milady 1",
            "description": "Milady Maker is a collection of 10,000 generative pfpNFT's in a aesthetic inspired by street style tribes.",
            "image": "https://www.miladymaker.net/milady/1.png",
            "attributes": [
              {
                "traitType": "Background",
                "value": {
                  "stringValue": "bjork"
                }
              }
            ],
            "animationURL": "",
            "openSeaImageURL": ""
          }
        }
      ]
    }
  }
}
```

##### Error
 - error getting groupID by id: groupID record not found 
</br>

 Collection API can be access via hooks

following the api are 
1. [collectionBySlug](#collectionBySlug)

### collectionBySlug
 This API is used to check whether the nft is Gated or not.

 ```
import { useCollection, CollectionBySlugData } from "@mojito-inc/core-service";

const { collectionBySlug } = useCollection();

const response: Response<CollectionBySlugData> = await collectionBySlug({
          slug: <SLUG>,
          marketplaceID: <MARKETPLACE_ID>,
        });
```
|Param    |type    | Required   | Description
|:--- | --- | :---:| :---:|
|slug|string|✅|
|marketplaceID|String|✅|

##### Response
```
{
  "data": {
    "collectionBySlug": {
      "id": "ad538b6a-8d32-4ae6-b12e-53ce8b47ef5c",
    }
  }
}
```

##### Error
 - error getting marketplaceID by id: marketplaceID record not found 
</br>

## development
[Development setup](./Development.md)

---
_Source: https://npm.io/package/@mojito-inc/core-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
