☁️ Mojito Modules - Core Service
👨💻 React components for the Mojito Platform, Reference App and third-party projects, including Mojito's core service
Version: 1.0.0
Using this library in your project Core Service
create .npmrc file from root dir and copy & paste following code,
If you have Personal follow step 2
Step - 1
Create Personal token: https://github.com/settings/tokens
Generate New Token (Classic) enable following permission read:packages Download packages from GitHub Package Registry
Step 2
Copy the personal token and replace to <PROFILE_TOKEN>
@mojitoinc:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=<PROFILE_TOKEN>
You can install this project with one of these commands:
npm install --save @mojitoinc/core-service
yarn add @mojitoinc/core-service
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.
import { CoreServiceProvider } from "@mojitoinc/core-service";
<CoreServiceProvider uri={ 'https://api.dev.graphql.com' } token={ 'Bearer <Token>' }>
{ children }
</CoreServiceProvider>
Param type Description uri string skip this param, if client param passed client Apollo Client skip this param, if uri param passed token string Optional
After setup with CoreServiceProvider, API can be access via hooks
following the api are
GetSignature Message LoginWithSignature RedeemClaimable Code
GetSignatureMessage
It will provide a message that should be used for in signing process
import { useClaims, Response, GetSignatureData } from "@mojitoinc/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: record not found
LoginWithSignature
The request receiver retrieves the Signature security token
import { useClaims, Response, LoginWithSignatureData } from "@mojitoinc/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>,
});
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
RedeemClaimableCode
Redeem a claimable code
import { useClaims, Response, RedeemClaimableCodeData } from "@mojitoinc/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
GetUsdConversion
will receives 1 unit crypto equivalent USD price
import { useConversion, Response, USDConversionData } from '@mojitoinc/core-service';
const { getUSDConversion } = useConversion();
const response: Response<USDConversionData> = await getUSDConversion({ 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 '@mojitoinc/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: record not found.
AuctionDetails
Auction Details and Auction History
import { useAuction } from '@mojitoinc/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 '@mojitoinc/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 '@mojitoinc/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
User API can be access via hooks
following the api are
me updateUserOrgSettings
me
It will provide a active user data
import { useUser, GetUserData } from "@mojitoinc/mojito-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
updateUserOrgSettings
It can able to update the user details
import { useUser, updateUserOrgSettingsData } from "@mojitoinc/mojito-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
KYC API can be access via hooks
following the api are
createApplicant createCheck getApplicant getSDKToken updateApplicant
createApplicant
It can able to create form to complete KYC
import { useKYC } from "@mojitoinc/mojito-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: record not found
createCheck
It can able to check the details
import { useKYC } from "@mojitoinc/mojito-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: record not found
getApplicant
It can able to get user kyc details
import { useKYC } from "@mojitoinc/mojito-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: record not found
getSDKToken
It can able to get sdk token
import { useKYC } from "@mojitoinc/mojito-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: record not found
updateApplicant
It can able to update the user kyc details
import { useKYC } from "@mojitoinc/mojito-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: record not found
Connect wallet API can be access via hooks
following the api are
connectExternalWallet getActiveWalletsContent getSupportedNetworks
connectExternalWallet
It can able to connect wallet
import { useConnectWallet, ConnectExternalWalletData } from "@mojitoinc/mojito-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 "@mojitoinc/mojito-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 "@mojitoinc/mojito-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
createSignatureToListNFTForSale removeListing submitProofOfApproval
createSignatureToListNFTForSale
It can able to create list item for sale
import { useListItem, CreateSignatureToListNFTForSaleData } from "@mojitoinc/mojito-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: record not found
removeListing
It can able to remove listing an item
import { useListItem, RemoveListingData } from "@mojitoinc/mojito-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: record not found
submitProofOfApproval
It can able to submit approval for listing an item
import { useListItem, SubmitProofOfApprovalData } from "@mojitoinc/mojito-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: record not found
Tax and fee API can be access via hooks
following the api are
estimateTaxAndRoyaltyFee getTaxQuote
estimateTaxAndRoyaltyFee
It can able to get tax and fee data
import { useFee, EstimateTaxAndRoyaltyFeeData } from "@mojitoinc/mojito-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: record not found
getTaxQuote
It can able to get tax and fee data
import { useFee, GetTaxQuoteData } from "@mojitoinc/mojito-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: record not found
NFT API can be access via hooks
following the api are
getNFTFavoriteListByUser addNFTToFavorite removeNFTFromFavorite getAllRegistryTokens getNFTDetails getNFTHistory getNFTAttributesRarity initiateBuyNFT updateTransactionHash generateSecondaryInvoice userOrderActivity
getNFTFavoriteListByUser
It can able to get favorite NFT list
import { useNFT, GetNFTFavoriteListByUserData } from "@mojitoinc/mojito-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 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: record not found
addNFTToFavorite
It can able to add NFT to favorite
import { useNFT, AddNFTToFavoriteData } from "@mojitoinc/mojito-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 "@mojitoinc/mojito-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 "@mojitoinc/mojito-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 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: record not found
getNFTDetails
It can able to get NFT list
import { useNFT, GetNFTDetailsData } from "@mojitoinc/mojito-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: record not found
getNFTHistory
It can able to get NFT history
import { useNFT, GetNFTHistoryData } from "@mojitoinc/mojito-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: record not found
getNFTAttributesRarity
It can able to get NFT Traits
import { useNFT, GetNFTAttributesRarityData } from "@mojitoinc/mojito-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: record not found
initiateBuyNFT
It can able to get order details
import { useNFT, InitiateBuyNFTData } from "@mojitoinc/mojito-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: record not found
updateTransactionHash
It can able to update the transaction hash
import { useNFT, UpdateTransactionHashData } from "@mojitoinc/mojito-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: record not found
generateSecondaryInvoice
It will give a url to download invoice as a PDF format
import { useNFT, GenerateSecondaryInvoiceData } from "@mojitoinc/mojito-core-service";
const { generateSecondaryInvoice } = useNFT();
const response: Response<GenerateSecondaryInvoiceData> =
await generateSecondaryInvoice({
invoiceID: <INVOICE_ID>,
orderID: <ORDER_ID>,
activityName: <ACTIVITY_NAME>,
invoiceResType: <INVOICE_RES_TYPE>,
});
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: record not found
getUserOrderActivity
It will provide a user order activity data
import { useUser, UserOrderActivityData } from "@mojitoinc/mojito-core-service";
const { userOrderActivity } = useUser();
const response: Response<UserOrderActivityData> = await userOrderActivity({
orgId: <ORG_ID>,
filter: <FILTER>,
limit: <LIMIT>,
offset: <OFFSET>
});
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: record not found
Offer API can be access via hooks
following the api are
acceptOffer cancelOffer createOffer getOffers getSignatureForOfferApproval rejectOffer submitProofOfOffer
acceptOffer
It can able to accept offer for an NFT
import { useOffer, AcceptOfferData } from "@mojitoinc/mojito-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: record not found
cancelOffer
It can able to cancel offer for an NFT
import { useOffer, CancelOfferData } from "@mojitoinc/mojito-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: record not found
createOffer
It can able to create offer for an NFT
import { useOffer, CreateOfferData } from "@mojitoinc/mojito-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: record not found
getOffers
It can able to get offers list for an NFT
import { useOffer, GetOffersData } from "@mojitoinc/mojito-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: record not found
getSignatureForOfferApproval
It can able to get signature approval data for an NFT
import { useOffer, GetSignatureForOfferApprovalData } from "@mojitoinc/mojito-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: record not found
rejectOffer
It can able to reject offer for an NFT
import { useOffer, RejectOfferData } from "@mojitoinc/mojito-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: record not found
submitProofOfOffer
It can able to submit proof of offer for an NFT
import { useOffer, SubmitProofOfOfferData } from "@mojitoinc/mojito-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: record not found
Claim Service development
Development setup