NFT | Creation & Management
Description of the main functions to manage NFTs: smart contract deployment, minting tokens, etc.
API Docs
Smart Contracts
The NFT-Kit supports the ERC-721 standard with the option to be deployed as regular contract for NFTs or modified for Soulbound Tokens.
Do you want to modify your contract further? Have a look at our Smart Contract Extension Sections:
Smart Contract Extensions - Pause token minting and burning.
Smart Contract Access Control - Enable role-based access control
NFT Contract Deployment | ERC-721
Ensure that the GasProvider is configured with the appropriate gasPrice and gasLimit based on current market conditions prior to smart contract deployment, to ensure successful transactions.
curl -X POST http://0.0.0.0:7000/nftkit/nft/chain/MUMBAI/contract/deploy \
-H "Content-Type: application/json" \
-d '{"name":"Ticket","symbol":"TK","tokenStandard":"ERC721","accessControl":"OWNABLE","options":{"transferable":true,"burnable":true}}'Path parameter:
chain: chain to work with.
Main chains: ETHEREUM, POLYGON
Testnet chains: SEPOLIA, GOERLI, MUMBAI, SHIMMEREVM
After you have successflully deployed the contract, you can start minting NFTs to your users.
{
"name": "string",
"symbol": "string",
"tokenStandard": "ERC721",
"accessControl": "OWNABLE|ROLE_BASED_ACCESS_CONTROL",
"options": {
"transferable": true,
"burnable": true
}
}
name: [string] the human-readable name of the contract.symbol: [string] the abbreviated symbol of the contract.tokenStandard: [string] NFTs smart contract standard. Supported values: ERC721.accessControl: [string] access control approach for the smart contract. Supported values: OWNABLE, ROLE_BASED_ACCESS_CONTROL. For more details about access control approaches.transferable: [boolean] activate/deactivate token transfer.burnable: [boolean] activate/deactivate token burn.
val deploymentOptions = DeploymentOptions(AccessControl.OWNABLE, TokenStandard.ERC721)
val deploymentParameter = DeploymentParameter("Metaverse", "MTV",DeploymentParameter.Options(true, true))
val result = NftService.deploySmartContractToken(Chain.POLYGON, deploymentParameter, deploymentOptions)Soulbound Token Contract Deployment | ERC-721 with extension
Ensure that the GasProvider is configured with the appropriate gasPrice and gasLimit based on current market conditions prior to smart contract deployment, to ensure successful transactions. In the contract deployment call we set the transferable option to false, which deploys a soulbound token contract. This contract prevents any token transfers after the initial mint.
curl -X POST http://0.0.0.0:7000/nftkit/nft/chain/MUMBAI/contract/deploy \
-H "Content-Type: application/json" \
-d '{"name":"Ticket","symbol":"TK","tokenStandard":"ERC721","accessControl":"OWNABLE","options":{"transferable":false,"burnable":true}}'Path parameter:
chain: chain to work with.
Main chains: ETHEREUM, POLYGON
Testnet chains: SEPOLIA, GOERLI, MUMBAI, SHIMMEREVM
After you have successflully deployed the contract, you can start minting NFTs to your users.
{
"name": "string",
"symbol": "string",
"tokenStandard": "ERC721",
"accessControl": "OWNABLE|ROLE_BASED_ACCESS_CONTROL",
"options": {
"transferable": false,
"burnable": true
}
}
name: [string] the human-readable name of the contract.symbol: [string] the abbreviated symbol of the contract.tokenStandard: [string] NFTs smart contract standard. Supported values: ERC721.accessControl: [string] access control approach for the smart contract. Supported values: OWNABLE, ROLE_BASED_ACCESS_CONTROL. For more details about access control approaches.transferable: [boolean] in order to make sure a soulbound token contract is created we need to set this option to false otherwise it will create a regular NFT contract as shown in the section above.burnable: [boolean] activate/deactivate token burn.
val deploymentOptions = DeploymentOptions(AccessControl.OWNABLE, TokenStandard.ERC721)
val deploymentParameter = DeploymentParameter("Metaverse", "MTV",DeploymentParameter.Options(false, true))
val result = NftService.deploySmartContractToken(Chain.POLYGON, deploymentParameter, deploymentOptions)Mint an NFT
It is a rich API to mint a new NFT token. It manages NFT metadata in multiple ways. You can generate token URI by yourself or let the NFT KIT generate it.
Ensure that the GasProvider is configured with the appropriate gasPrice and gasLimit based on current market conditions prior to minting, to ensure successful transactions.
curl -X POST "http://0.0.0.0:7000/nftkit/nft/chain/MUMBAI/contract/0xf277be034881ee38a9b270e5b6c5c6f333af2517/token/mint" \
-H "Content-Type: application/json" \
-d '{"metadataUri":"","metadata":{"description":"Ticket #1 Description","name":"Ticket #1","image":"ipfs://bafkreibpc3wpdg4mq3bbkesqrxtoho25s3shnfhyotd6rymsag3bcfpeni","attributes":[{"trait_type":"Trait 1","value":"Value 1"}]},"recipientAddress":"0x2555e3a97c4ac9705D70b9e5B9b6cc6Fe2977A74","metadataStorageType":"ON_CHAIN"}'
Path parameter:
chain: chain to work with.
Main chains: ETHEREUM, POLYGON
Testnet chains: SEPOLIA, GOERLI, MUMBAI, SHIMMEREVM
contract: smart contract address
{
"metadataUri": "string",
"metadata": {
"description": "string",
"name": "string",
"image": "string",
"image_data": "string",
"external_url": "string",
"attributes": [
{
"trait_type": "string",
"value": "string"
}
]
},
"recipientAddress": "string",
"metadataStorageType": "ON_CHAIN|OFF_CHAIN"
}metadataUri: [string] metadata URI of the new token.If you want to generate metadata URI using NFT KIT, set the "metadataUri "value as an empty string.metadata: NFT KIT will use values inside metadata to generate metadata URI of the new token. It confirms the structure defined by ERC721 and ERC1155 standards. For more details about NFT metadata standard.description: [string] a description of the tokenname: [string] the name of this specific tokenimage: [string] this is the URL to the image of the item. Can be just about any type of image and can be IPFS URLs or paths.image_data: [string] Raw SVG image data, if you want to generate images on the fly (not recommended). Only use this if you're not including the image parameter.external_url: [string] This is the URL that will appear below the asset's image on OpenSea and will allow users to leave OpenSea and view the item on your site.attributes: [string] To give your items a little more pizazz, we also allow you to add custom "attributes" to your metadata that will show up underneath each of your assets.trait_type: [string] the name of the traitvalue: [string] the value of the traitrecipientAddress: [string] the account address who will receive the NFTmetadataStorageType: [string] when you let the NFT KIT to generate metadata URI, you need to specify how the metadata will be stored. Supported values: ON_CHAIN, OFF_CHAIN. You can use ON_CHAIN if you want to store NFT metadata on the chain. You can use OFF_CHAIN if you want store NFT metadata off chain using IPFS.
val attribute1 : NftMetadata.Attributes = NftMetadata.Attributes(trait_type = "trait_type1", value = JsonPrimitive("value1"))
val attribute2 : NftMetadata.Attributes = NftMetadata.Attributes(trait_type = "trait_type2", value = JsonPrimitive("value1"))
val attributes = mutableListOf(attribute1, attribute2)
val nftMetadata : NftMetadata = NftMetadata(name = "name", description = "description", image = "", attributes = attributes)
val mintingParameter = MintingParameter("", "0xaf87c5Ce7a1fb6BD5aaDB6dd9C0b8EF51EF1BC31",nftMetadata)
val mintingOptions = MintingOptions(MetadataStorageType.ON_CHAIN)
val result = NftService.mintToken(Chain.POLYGON,"0xFd9426f82Ae1edBC6b5eC2B0Ea5416D34Ca6E9b6", mintingParameter, mintingOptions)Revoke NFT
Owner of a soul bound NFT smart contract , can revoke a minted Token.
curl -X GET "http://0.0.0.0:7000/nftkit/nft/chain/SHIMMEREVM/contract/0x3A4D948a123824Fc34FDDA0654D3C8D0D29c2FA9/token/1/revokeToken"Path parameter:
chain: chain to work with.
Main chains: ETHEREUM, POLYGON
Testnet chains: SEPOLIA, GOERLI, MUMBAI, SHIMMEREVM
contract: smart contract address
token: token ID
val result = NftService.revokeToken(Chain.SHIMMEREVM, "0xFd9426f82Ae1edBC6b5eC2B0Ea5416D34Ca6E9b6", BigInteger.valueOf(26))NFT metadata
Find out more information about your NFTs with the following actions.
Fetch NFT metadata URI
curl -X GET "http://0.0.0.0:7000/nftkit/nft/chain/MUMBAI/contract/0xf277BE034881eE38A9b270E5b6C5c6f333Af2517/token/1/metadataUri"Path parameter:
chain: chain to work with.
Main chains: ETHEREUM, POLYGON
Testnet chains: SEPOLIA, GOERLI, MUMBAI, SHIMMEREVM
contract: smart contract address
token: token ID
val result = NftService.getNftMetadataUri(Chain.POLYGON, "0xFd9426f82Ae1edBC6b5eC2B0Ea5416D34Ca6E9b6", BigInteger.valueOf(26))Fetch NFT metadata
curl -X GET "http://0.0.0.0:7000/nftkit/nft/chain/MUMBAI/contract/0xf277BE034881eE38A9b270E5b6C5c6f333Af2517/token/1/metadata" Path parameter:
chain: chain to work with.
Main chains: ETHEREUM, POLYGON
Testnet chains: SEPOLIA, GOERLI, MUMBAI, SHIMMEREVM
contract: smart contract address
token: token ID
val result = NftService.getNftMetadata(Chain.POLYGON, "0xFd9426f82Ae1edBC6b5eC2B0Ea5416D34Ca6E9b6", BigInteger.valueOf(26))Update NFTs metadata trait
Managing a dynamic NFT required us to update the NFT metadata
curl -X POST "http://0.0.0.0:7000/nftkit/nft/chain/ETHEREUM/contract/0xf277BE034881eE38A9b270E5b6C5c6f333Af2517/token/1/metadata" \
-H "Content-Type: application/json" \
-d '{"key":"key1","value":"value1"}'Path parameter:
chain: chain to work with.
Main chains: ETHEREUM, POLYGON
Testnet chains: SEPOLIA, GOERLI, MUMBAI, SHIMMEREVM
contract: smart contract address
token: token ID
{
"key": "string",
"value": "string"
}key: [string] the name of the metadata attribute that you want to update.value: [string] the new value of the attribute
Get Account balance
curl -X GET "http://0.0.0.0:7000/nftkit/nft/chain/MUMBAI/contract/0xf277BE034881eE38A9b270E5b6C5c6f333Af2517/owner/0x2555e3a97c4ac9705d70b9e5b9b6cc6fe2977a74/balance" Path parameter:
chain: chain to work with.
Main chains: ETHEREUM, POLYGON
Testnet chains: SEPOLIA, GOERLI, MUMBAI, SHIMMEREVM
contract: smart contract address
owner: account address
Get Token owner
curl -X GET "http://0.0.0.0:7000/nftkit/nft/chain/MUMBAI/contract/0xf277BE034881eE38A9b270E5b6C5c6f333Af2517/token/1/owner" Path parameter:
chain: chain to work with.
Main chains: ETHEREUM, POLYGON
Testnet chains: SEPOLIA, GOERLI, MUMBAI, SHIMMEREVM
contract: smart contract address
token: token ID
Get collection info
curl -X GET "http://0.0.0.0:7000/nftkit/nft/chain/MUMBAI/contract/0xf277BE034881eE38A9b270E5b6C5c6f333Af2517/info" Path parameter:
chain: chain to work with.
Main chains: ETHEREUM, POLYGON
Testnet chains: SEPOLIA, GOERLI, MUMBAI, SHIMMEREVM
contract: smart contract address
Get NFTs by account
It will return a list of all NFTs which are associated with the provided account address.
curl -X GET "http://0.0.0.0:7000/nftkit/nft/chain/MUMBAI/owner/0x2555e3a97c4ac9705d70b9e5b9b6cc6fe2977a74" Path parameter:
chain: chain to work with.
Main chains: ETHEREUM, POLYGON
Testnet chains: SEPOLIA, GOERLI, MUMBAI, SHIMMEREVM
owner: account address
Last updated
Was this helpful?
