Skip to content

walt-id/waltid-nftkit

Repository files navigation

NFT Kit

by walt.id

Use digital assets like non-fungible tokens (NFTs)

Join community! Follow @walt_id

Getting Started

Checkout the Official Documentation, to find out more.

What is the NFT Kit?

A Kotlin library for managing NFTs

Features

  • Deployment and Access Management of NFT smart contracts on multiple chains
  • Base functionalities like minting NFTs, managing NFT metadata and much more
  • Verification of NFT ownership and token traits
  • Smart Contract extensions to add for example token transfer control

Example

  • Deployment of ERC721 smart contract
  • Minting of a new token
  • Fetching of NFT metadata
fun main() {
    
        // Deploy new ERC721 smart contract instance on polygon network
        val deploymentOptions = DeploymentOptions(AccessControl.OWNABLE, TokenStandard.ERC721)
        val deploymentParameter = DeploymentParameter("Metaverse", "MTV",DeploymentParameter.Options(true, true))
        val result = NftService.deploySmartContractToken(Chain.POLYGON, deploymentParameter, deploymentOptions)
    
        // Mint new NFT
        val attribute1 : NftMetadata.Attributes = NftMetadata.Attributes(trait_type = "trait_type1", value = "value1")
        val attribute2 : NftMetadata.Attributes = NftMetadata.Attributes(trait_type = "trait_type2", value = "value2")
        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)       

        // Fetch NFT Metadata URI 
        val result = NftService.getNftMetadataUri(Chain.POLYGON, "0xFd9426f82Ae1edBC6b5eC2B0Ea5416D34Ca6E9b6", BigInteger.valueOf(26))

        // Fetch NFT Metadata
        val result = NftService.getNftMetadata(Chain.POLYGON, "0xFd9426f82Ae1edBC6b5eC2B0Ea5416D34Ca6E9b6", BigInteger.valueOf(26))
    }

Join the community

License

Licensed under the Apache License, Version 2.0