@sliksafe/mint
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Mint NFTs

Slik offers you the ability to deploy an ERC-721 contract and MINT an NFT in a single API call and as a drop in NPM package.


Using the @sliksafe/mint package, you can enable NFT minting for users within your app, while storing their NFT across decentralized storage networks like Arweave or Filecoin.

API Keys

Before getting started you would need an API key. Create an API key via the console: https://console.developers.sliksafe.com

Demo

You can play around with the demo app that uses the mint SDK at: https://slikmintdemo.web.app/

Docs

Please see a few samples below, but you can find the detailed docs here: https://slik.gitbook.io/docs/packages/upload-and-download-files

Install via yarn

yarn add @sliksafe/protect

Deploy NFT Contract

All NFTs minted on Ethereum or Polygon need to have a contract address. This contract address helps in grouping a collection of NFTs, like the Azuki NFTs or the BAYC NFTs.

// Import SlikMint
import { SlikMint } from '@sliksafe/mint'

// Initialize 
const initParams = { apiKey: "api_key_string" }
const mintHandler = await SlikMint.initialize(initParams)

// Contract options
const contractOptions = { 
    tokenName: "BoredApeYachtClub",
    tokenSymbol: "BAYC",
    chain: "polygon",
    protocol: "ERC721",
}

mintHandler.deployContract(contractOptions, (response, err) => {
    console.log("The contract was deployed with id: ", response.contractAddress);
});

Mint a File as NFT

Using the contract address obtained after deploying a contract , you can mint NFTs corresponding to the deployed contract.

// Specify the metadata that is associated with the NFT. 
// Note: the metadataJSON is not editable once the NFT is minted.

const metadataJSON = { 
    name: "My Awesome NFT #1",
    description: "This is the description of my awesome NFT!"
}

const file: File = // The file object selected by the user

const mintOptions = {
    walletAddress: "0x5c14E7A5e9D4568Bb8B1ebEE2ceB2E32Faee1311",
    contractAddress: "0x468DF3FfC8D87EF3ee0e71AB8Ec0afd0E79e57A0",
    file: file,
    storageNetwork: "filecoin", // or "arweave"
    chain: "polygon",
    metadata: metadataJSON,
}

mintHandler.mintNFT(mintOptions, (response, err) => {
    if (!!err) {
        console.error("Failed to mint NFTs");
        return
    }
    const txId = response.txId;
    console.log("NFT minting completed. Transaction id: ", txId);
});

Scalability

The Slik infrastructure has been designed to scale with the needs of the developer. It is currently used by thousands of users worldwide to backup terabytes of data.

Package Sidebar

Install

npm i @sliksafe/mint

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

28.3 MB

Total Files

27

Last publish

Collaborators

  • manisoni28
  • arpwal