UNPKG

@venly/venly-core-sdk

Version:

Javascrip/Typescript SDK for Venly's Web3 Services

470 lines 23.4 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.VyNftAPI_Gen = void 0; const core_1 = require("../core"); const json_1 = require("../helpers/json"); const nft = __importStar(require("../models/nft/index")); const shared = __importStar(require("../models/shared/index")); const enums = __importStar(require("../models/enums/index")); class VyNftAPI_Gen { constructor(_apiBase) { this._apiBase = _apiBase; this._apiEndpoint = enums.VyApiEndpoint.Nft; } /** * This endpoint is used to check the current health of the **NFT-API**. It returns the API health status as either **UP** or **DOWN**. * @returns {VyHealthCheckNftv2Response} */ checkHealth() { var reqData = core_1.VyRequestData.get("/actuator/health", this._apiEndpoint) .setEnveloped(false) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, nft.VyHealthCheckNftv2Response); } /** * This endpoint fetches all of your contracts. * @returns {VyTokenContractSummaryDto[]} */ getContracts() { var reqData = core_1.VyRequestData.get("/api/v2/contracts", this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, nft.VyTokenContractSummaryDto); } /** * This endpoint is used to fetch the metadata of as contract. * @param {VyChain} chain - The blockchain of the contract. * @param {string} contractAddress - The contract address whose metadata you want to fetch. * @returns {VyTokenContractMetadataDto} */ getContractMetadata(chain, contractAddress) { var reqData = core_1.VyRequestData.get(`/api/v2/contracts/${chain}/${contractAddress}/metadata`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, nft.VyTokenContractMetadataDto); } /** * This endpoint is used to update the metadata of a contract. * @param {VyChain} chain - The blockchain of the contract. * @param {string} contractAddress - The contract address whose metadata you want to update. * @param {VyUpdateContractMetadataDto} reqParams - Request data for the operation * @returns {VyTokenContractMetadataDto} */ updateContractMetadata(chain, contractAddress, reqParams) { var reqData = core_1.VyRequestData.patch(`/api/v2/contracts/${chain}/${contractAddress}/metadata`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true) .addJsonContent(reqParams, nft.VyUpdateContractMetadataDto); return this._apiBase.makeRequest(reqData, nft.VyTokenContractMetadataDto); } /** * * @param {VyChain} chain - The blockchain of the contract. * @param {string} contractAddress - The contract address. * @returns {VyTokenTypeSummaryDto[]} */ getTokenTypes(chain, contractAddress) { var reqData = core_1.VyRequestData.get(`/api/v2/contracts/${chain}/${contractAddress}/token-types`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, nft.VyTokenTypeSummaryDto); } /** * This endpoint is used to fetch the metadata of a token-type * @param {VyChain} chain - The blockchain of the contract. * @param {string} contractAddress - The contract address. * @param {number} tokenTypeId - The `id` of the token-type whose metadata ypu want to fetch. * @returns {Any} */ getTokenTypeMetadata(chain, contractAddress, tokenTypeId) { var reqData = core_1.VyRequestData.get(`/api/v2/contracts/${chain}/${contractAddress}/token-types/${tokenTypeId}/metadata`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, json_1.Any); } /** * This endpoint is used to update the metadata of a token-type. * @param {VyChain} chain - The blockchain of the contract. * @param {string} contractAddress - The contract address. * @param {number} tokenTypeId - The `id` of the token-type whose metadata you want to update. * @param {VyUpdateTokenTypeMetadataDto} reqParams - Request data for the operation * @returns {Any} */ updateTokenTypeMetadata(chain, contractAddress, tokenTypeId, reqParams) { var reqData = core_1.VyRequestData.put(`/api/v2/contracts/${chain}/${contractAddress}/token-types/${tokenTypeId}/metadata`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true) .addJsonContent(reqParams, nft.VyUpdateTokenTypeMetadataDto); return this._apiBase.makeRequest(reqData, json_1.Any); } /** * This endpoint is used to get all tokens in a contract. * @param {VyChain} chain - The blockchain of the contract. * @param {string} contractAddress - The contract address whose tokens you want to fetch. * @param {VyQuery_GetAllTokens} query - Query to filter the operation results * @returns {VyTokenSummaryDto[]} */ getAllTokens(chain, contractAddress, query) { var reqData = core_1.VyRequestData.get(`/api/v2/contracts/${chain}/${contractAddress}/tokens`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true) .addQuery(query); return this._apiBase.makeRequest(reqData, nft.VyTokenSummaryDto); } /** * This endpoint fetches the metadata of a token by `tokenId`. * @param {VyChain} chain - The blockchain of the contract. * @param {string} contractAddress - The contract address. * @param {number} tokenId - The `id` of the token whose metadata you want to fetch. * @returns {Any} */ getTokenMetadata(chain, contractAddress, tokenId) { var reqData = core_1.VyRequestData.get(`/api/v2/contracts/${chain}/${contractAddress}/tokens/${tokenId}/metadata`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, json_1.Any); } /** * This endpoint is used to update a property for a specific NFT. * @param {VyChain} chain - The blockchain of the NFT collection * @param {string} contractAddress - The NFT contract address * @param {number} tokenId - The `ID` of the token you want to update * @param {VyTokenPropertyName2} propertyName - The name of the property you want to update (**NOTE**: This param is case sensitive.) * @param {VyUpdateTokenPropertyDto} reqParams - Request data for the operation * @returns {Any} */ updateTokenProperty(chain, contractAddress, tokenId, propertyName, reqParams) { var reqData = core_1.VyRequestData.put(`/api/v2/contracts/${chain}/${contractAddress}/tokens/${tokenId}/metadata/${propertyName}`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true) .addJsonContent(reqParams, nft.VyUpdateTokenPropertyDto); return this._apiBase.makeRequest(reqData, json_1.Any); } /** * This endpoint is used to delete a property for a specific NFT. * @param {VyChain} chain - The blockchain of the NFT collection * @param {string} contractAddress - The NFT contract address * @param {number} tokenId - The `ID` of the token you want to update * @param {VyTokenPropertyName1} propertyName - The name of the property you want to update (**NOTE**: This param is case sensitive.) * @returns {Any} */ deleteTokenProperty(chain, contractAddress, tokenId, propertyName) { var reqData = core_1.VyRequestData.delete(`/api/v2/contracts/${chain}/${contractAddress}/tokens/${tokenId}/metadata/${propertyName}`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, json_1.Any); } /** * This endpoint is used to add attributes to a specific NFT. * @param {VyChain} chain - The blockchain of the NFT collection * @param {string} contractAddress - The NFT contract address * @param {number} tokenId - The `ID` of the token * @param {VyTokenAttributeDto} reqParams - Request data for the operation * @returns {Any} */ addTokenAttribute(chain, contractAddress, tokenId, reqParams) { var reqData = core_1.VyRequestData.post(`/api/v2/contracts/${chain}/${contractAddress}/tokens/${tokenId}/metadata/attributes`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true) .addJsonContent(reqParams, nft.VyTokenAttributeDto); return this._apiBase.makeRequest(reqData, json_1.Any); } /** * This endpoint is used to update an attribute's data for a specific NFT. * @param {VyChain} chain - The blockchain of the NFT collection * @param {string} contractAddress - The NFT contract address * @param {number} tokenId - The `ID` of the token you want to update * @param {string} attributeName - The name of the attribute you want to update (**NOTE**: This param is case sensitive.) * @param {VyUpdateTokenAttributeDto} reqParams - Request data for the operation * @returns {Any} */ updateAttribute(chain, contractAddress, tokenId, attributeName, reqParams) { var reqData = core_1.VyRequestData.put(`/api/v2/contracts/${chain}/${contractAddress}/tokens/${tokenId}/metadata/attributes/${attributeName}`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true) .addJsonContent(reqParams, nft.VyUpdateTokenAttributeDto); return this._apiBase.makeRequest(reqData, json_1.Any); } /** * This endpoint is used to delete an attribute for a specific NFT. * @param {VyChain} chain - The blockchain of the NFT collection * @param {string} contractAddress - The NFT contract address * @param {number} tokenId - The `ID` of the token for which you want to delete the attribute * @param {string} attributeName - The name of the attribute you want to delete. (**NOTE**: This param is case sensitive.) * @returns {Any} */ deleteAttribute(chain, contractAddress, tokenId, attributeName) { var reqData = core_1.VyRequestData.delete(`/api/v2/contracts/${chain}/${contractAddress}/tokens/${tokenId}/metadata/attributes/${attributeName}`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, json_1.Any); } /** * This endpoint is used to update the `animationUrls` for a specific NFT. * @param {VyChain} chain - The blockchain of the NFT collection * @param {string} contractAddress - The NFT contract address * @param {number} tokenId - The `ID` of the token you want to update * @param {VyTypeValueDto[]} reqParams - Request data for the operation * @returns {Any} */ updateAnimationUrLs(chain, contractAddress, tokenId, reqParams) { var reqData = core_1.VyRequestData.put(`/api/v2/contracts/${chain}/${contractAddress}/tokens/${tokenId}/metadata/animationUrls`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true) .addJsonContent(reqParams, shared.VyTypeValueDto); return this._apiBase.makeRequest(reqData, json_1.Any); } /** * This endpoint is used to delete `animationUrls` for a specific NFT. * @param {VyChain} chain - The blockchain of the NFT collection * @param {string} contractAddress - The NFT contract address * @param {number} tokenId - The `ID` of the token * @returns {Any} */ deleteAnimationUrls(chain, contractAddress, tokenId) { var reqData = core_1.VyRequestData.delete(`/api/v2/contracts/${chain}/${contractAddress}/tokens/${tokenId}/metadata/animationUrls`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, json_1.Any); } /** * This endpoint retrieves all company minter wallets. * @param {VyQuery_GetAllCompanyWallets} query - Query to filter the operation results * @returns {VyPagedOrgWalletBalanceDto} */ getAllCompanyWallets(query) { var reqData = core_1.VyRequestData.get("/api/v2/wallets", this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true) .addQuery(query); return this._apiBase.makeRequest(reqData, nft.VyPagedOrgWalletBalanceDto); } /** * This endpoint is used to create company minter wallets per blockchain. * @param {VyCreateCompanyWalletRequest} reqParams - Request data for the operation * @returns {VyCompanyWalletBase} */ createCompanyWallet(reqParams) { var reqData = core_1.VyRequestData.post("/api/v2/wallets", this._apiEndpoint) .setEnveloped(false) .setAuth_OAuth2(true) .addJsonContent(reqParams, nft.VyCreateCompanyWalletRequest); return this._apiBase.makeRequest(reqData, nft.VyCompanyWalletBase); } /** * This endpoint is used to retrieve all of your token mint requests. * @param {VyQuery_GetAllTokenMints} query - Query to filter the operation results * @returns {VyPagedTokenMintResponseDto} */ getAllTokenMints(query) { var reqData = core_1.VyRequestData.get("/api/v2/tokens/mints", this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true) .addQuery(query); return this._apiBase.makeRequest(reqData, nft.VyPagedTokenMintResponseDto); } /** * This endpoint is used to mint fungible or non-fungible tokens. * @param {VyMintTokensDto} reqParams - Request data for the operation * @returns {VyMintTokensResponseDto} */ mintTokens(reqParams) { var reqData = core_1.VyRequestData.post("/api/v2/tokens/mints", this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true) .addJsonContent(reqParams, nft.VyMintTokensDto); return this._apiBase.makeRequest(reqData, nft.VyMintTokensResponseDto); } /** * This endpoint is used to create a token-type. * @param {VyCreateTokenTypeDto} reqParams - Request data for the operation * @returns {VyTokenTypeCreationStatusDto} */ createTokenType(reqParams) { var reqData = core_1.VyRequestData.post("/api/v2/token-types/creations", this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true) .addJsonContent(reqParams, nft.VyCreateTokenTypeDto); return this._apiBase.makeRequest(reqData, nft.VyTokenTypeCreationStatusDto); } /** * This endpoint is used to upload a media file to our servers. * @param {VyAddMediaRequest} reqParams - Request data for the operation * @returns {VyTokenMediaDto} */ uploadMediaFile(reqParams) { var reqData = core_1.VyRequestData.post("/api/v2/media", this._apiEndpoint) .setEnveloped(false) .setAuth_OAuth2(true) .addJsonContent(reqParams, nft.VyAddMediaRequest); return this._apiBase.makeRequest(reqData, nft.VyTokenMediaDto); } /** * This endpoint is used to upload an NFT image to our servers. Make sure to only upload images to with this endpoint. * @param {VyAddNftImageRequest} reqParams - Request data for the operation * @returns {VyTokenImageDto} */ uploadImage(reqParams) { var reqData = core_1.VyRequestData.post("/api/v2/images", this._apiEndpoint) .setEnveloped(false) .setAuth_OAuth2(true) .addJsonContent(reqParams, nft.VyAddNftImageRequest); return this._apiBase.makeRequest(reqData, nft.VyTokenImageDto); } /** * This endpoint is used to create a contract. * @param {VyCreateContractDto} reqParams - Request data for the operation * @returns {VyDeployedContractDto} */ createContract(reqParams) { var reqData = core_1.VyRequestData.post("/api/v2/contracts/deployments", this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true) .addJsonContent(reqParams, nft.VyCreateContractDto); return this._apiBase.makeRequest(reqData, nft.VyDeployedContractDto); } /** * This endpoint is used to check the status of the contract creation request. * @param {string} deploymentId - To track the status of contract creation. It is in the response body of the create contract endpoint as `result.id`. * @returns {VyDeployedContractDto} */ getContractDeploymentStatus(deploymentId) { var reqData = core_1.VyRequestData.get(`/api/v2/contracts/deployments/${deploymentId}`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, nft.VyDeployedContractDto); } /** * This endpoint retrieves company minter wallets by blockchain. * @param {VyChain} chain - The blockchain to filter the result by * @param {VyQuery_GetCompanyWallets} query - Query to filter the operation results * @returns {VyPagedOrgWalletBalanceDto} */ getCompanyWallets(chain, query) { var reqData = core_1.VyRequestData.get(`/api/v2/wallets/${chain}`, this._apiEndpoint) .setEnveloped(false) .setAuth_OAuth2(true) .addQuery(query); return this._apiBase.makeRequest(reqData, nft.VyPagedOrgWalletBalanceDto); } /** * This endpoint is used to check the status of a token mint request. * @param {string} mintId - To track the status of token mint. It is in the response body of the mint tokens endpoint as `result.mints.id`. * @returns {VyTokenMintStatusDto} */ getTokenMintStatus(mintId) { var reqData = core_1.VyRequestData.get(`/api/v2/tokens/mints/${mintId}`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, nft.VyTokenMintStatusDto); } /** * This endpoint is used to check the status of token-type creation request. * @param {string} creationId - To track the status of token-type creation. It is in the response body of the create token-type endpoint as `result.id`. * @returns {VyTokenTypeCreationDetailView} */ getTokenTypeCreationStatus(creationId) { var reqData = core_1.VyRequestData.get(`/api/v2/token-types/creations/${creationId}`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, nft.VyTokenTypeCreationDetailView); } /** * This endpoint is used to get a specific contract by blockchain and contract address. * @param {VyChain} chain - The blockchain of the contract * @param {string} contractAddress - The contract address whose details you want to fetch. * @returns {VyTokenContractDto} */ getContract(chain, contractAddress) { var reqData = core_1.VyRequestData.get(`/api/v2/contracts/${chain}/${contractAddress}`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, nft.VyTokenContractDto); } /** * This endpoint is used to delete a contract. * @param {VyChain} chain - The blockchain of the contract. * @param {string} contractAddress - The contract address that you want to delete. */ deleteContract(chain, contractAddress) { var reqData = core_1.VyRequestData.delete(`/api/v2/contracts/${chain}/${contractAddress}`, this._apiEndpoint) .setEnveloped(false) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, json_1.Any); } /** * This endpoint fetches the details of a specific token by tokenId. * @param {string} contractAddress - The contract address. * @param {number} tokenId - The `id` of the token whose details you want to fetch. * @param {VyChain} chain - The blockchain of the contract. * @returns {VyTokenDto} */ getToken(contractAddress, tokenId, chain) { var reqData = core_1.VyRequestData.get(`/api/v2/contracts/${chain}/${contractAddress}/tokens/${tokenId}`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, nft.VyTokenDto); } /** * This endpoint fetches the details of a specific token-type by `tokenTypeId`. * @param {VyChain} chain - Thge blockchain of the contract. * @param {string} contractAddress - The contract address * @param {number} tokenTypeId - This is the `id` of the token-type. * @returns {VyTokenTypeDto} */ getTokenType(chain, contractAddress, tokenTypeId) { var reqData = core_1.VyRequestData.get(`/api/v2/contracts/${chain}/${contractAddress}/token-types/${tokenTypeId}`, this._apiEndpoint) .setEnveloped(true) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, nft.VyTokenTypeDto); } /** * This endpoint is used to delete a token-type. * @param {VyChain} chain - * @param {string} contractAddress - The contract address. * @param {number} tokenTypeId - The `id` of the token-type that you want to delete. */ deleteTokenType(chain, contractAddress, tokenTypeId) { var reqData = core_1.VyRequestData.delete(`/api/v2/contracts/${chain}/${contractAddress}/token-types/${tokenTypeId}`, this._apiEndpoint) .setEnveloped(false) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, json_1.Any); } /** * This endpoint deletes a company wallet by blockchain and wallet address. * @param {VyChain} chain - The blockchain of the company wallet. * @param {string} address - This is the wallet `address` of the company wallet. * @returns {VyResponseEnvelope} */ deleteCompanyWallet(chain, address) { var reqData = core_1.VyRequestData.delete(`/api/v2/wallets/${chain}/${address}`, this._apiEndpoint) .setEnveloped(false) .setAuth_OAuth2(true); return this._apiBase.makeRequest(reqData, nft.VyResponseEnvelope); } } exports.VyNftAPI_Gen = VyNftAPI_Gen; //# sourceMappingURL=VyNftAPI.generated.js.map