Giter VIP home page Giter VIP logo

nft-toolbox's Introduction

NFT-Toolbox

An npm package for seamless integration of all NFT related functionalities in Web2 projects.

Supported Functionalities

  1. Generate NFT Collection Images and Metadata files from Layer Images
  2. Upload NFT Collection Assets and Metadata Files to IPFS (or alternative) Platforms via any of the following services:
  3. Draft ERC721/ERC1155 Smart Contracts from scratch with Open Zeppelin Wizard
  4. Deploy a Smart Contract to blockchain. Mainnets and Testnets of the following are supported are supported.
    • Ethereum: Mainnet, Ropsten, Rinkeby, Goerli, Kovan
    • Polygon: Mainnet, Mumbai
  5. Mint NFTs on a Smart Contract deployed on any of the supported networks.

Project Workflows

Project Workflows

Folder structure

  • /src : Package source code
    • /src/index.ts : Toolbox class, the single default export from the package
    • /src/classes : Core classes of the package that implement functionalities
    • /src/helpers : Helper classes that are used by core classes
  • /tests : Tests for all core classes
  • /examples : Example scripts for all functionalities
  • /docs : Markdown documentation
  • /documentation : Docusaurus project for documentation website

Contributor Guidelines

  • This project is an NPM package. All dependencies must be installed with npm install.
  • Dependencies for Upload functionality that are required based only in some cases based on user's specification are installed dynamically using child-process. They are included in dev-dependencies but not in dependencies. (For example @pinata/sdk).
  • Mocha, Chai and Sinon have been used for testing. Run all tests with npm test.
  • ESLint has been configured to lint for Typescript. Run linting with npm run lint.

Development setup

  1. Fork the scorelab/NFT-Toolbox repository Follow these instructions on how to fork a repository

  2. Clone the repository Navigate to the location on your computer where you want to host your code. Once in the appropriate folder, run the following command to clone the repository to your local machine.

    git clone https://github.com/{your-username}/NFT-Toolbox.git
    
  3. Install the dependencies, Setup the project with Node Package Manager.

    cd NFT-Toolbox
    npm install
    
  4. You are ready to go!

    To run an example script, update the required credentials in examples/*.json file and run

    ts-node examples/generate.ts
    

    To run Tests, update the required credentials in tests/test_specs.json file and run

    npm test
    

Documentation

Documentation has been generated using Docusaurus.

The Docusaurus project is present in documentation directory. Install the dependencies

cd documentation
npm install

Run the development live server for Documentation

npm start

nft-toolbox's People

Contributors

jim-test11 avatar

Stargazers

Anmol Sirola avatar

Watchers

Charitha Madusanka avatar Ammoniya avatar Wathsara Wishwantha Daluwatta avatar Mohit Bhat avatar Anmol Sirola avatar

nft-toolbox's Issues

Adding support for Dynamic and Nested NFTs

To Implement Support for Dynamic and Nested NFTs, we add the following changes to our project:

First, we will create an ERC-721 compliant smart contract. This contract will include the standard functions required by the ERC-721 standard. To support metadata for each NFT, the contract will implement the tokenURI function, which returns a unique URI for each NFT. This URI can point to a JSON file containing metadata such as the NFT's name, description, image, and other properties.

With this basic ERC-721 contract in place, we can proceed to make the necessary changes to support dynamic and nested NFTs:

1) Smart Contracts:

  • Add an NftType enum to differentiate between static, dynamic, and nested NFTs.
  • Modify the NftData struct to include fields for nftType, parentId, and childIds.
  • Adding the createStaticNft function that creates a new static NFT with the specified recipient and token ID.
  • Adding the createDynamicNft function that creates a new dynamic NFT with a new token ID and the specified recipient.
  • Adding the createNestedNft function that creates a new nested NFT with a new token ID, the specified recipient, and the parent NFT ID. It also adds the child NFT ID to the childIds array of the parent NFT.
  • Adding the getChildNfts function that returns an array of child NFT IDs for a given parent NFT ID. (used to retrieve child NFTs for the nested NFTs)

2) Contract Interaction Functions:

  • First we will update the deployment functions to include the new NftType enum and NftData struct.
  • Then we will modify the minting functions to support dynamic and nested NFTs, accepting parameters for NFT type and parent ID.
  • We will also implement new functions for creating dynamic and nested NFTs, interacting with the corresponding smart contract functions.
  • At last, we will add a function to retrieve child NFTs of a parent NFT.

3) Collection and Contract Classes:

  • We will then update the Collection class to include properties and methods related to dynamic and nested NFTs, such as creating, retrieving, and updating metadata.
  • After that the contract class is updated to incorporate the NftType enum and NftData struct, we will update the relevant methods accordingly.
  • At last we will handle the Storage and Metadata Management by:
    • Firstly, enhancing the storage classes to handle metadata for dynamic and nested NFTs, including methods for updating and versioning metadata.
    • Secondly, modifying the metadata structure to include fields for NFT type parent ID, and child IDs.

Refactor the codebase

Introducing a refined folder structure that categorizes functionalities based on their respective chains. Specifically, creating separate folders for each chain, where the related contracts and associated functions will reside. At the same time also fixing bugs and updating documentation.

Adding additional storage providers supported by web3stash module

Currently we are supporting NFT.Storage, Pinata, Infura IPFS (temporarily unavailable), Storj, Arweave with our storage classes

We can support additional storage providers such as Helia, web3storage, lighthouse, moralis ipfs, bundlr with the help of web3stash module in the project to provide an option for the users to choose from variety of our services

This would be just an additional small piece of code for every storage provider and would not require any special config than the previous config (PR raised here )

Let me know if this sounds right and i will raise a PR for the same

Feel free to suggest any additional changes

Adding support for SPL standard for Solana

This standard allows for the creation and management of token assets on the Solana blockchain, supporting various use cases including fungible and non-fungible tokens.

Utilize web3Stash Library for Metadata Upload, Deprecating Storage Classes

Currently, you will find there are storage classes used for uploading metadata through multiple providers. Remove that code and instead use web3Stash https://github.com/mbcse/web3stash Library to upload metadata.

Description:
Presently, our codebase employs storage classes for uploading metadata across various providers. This proposal suggests deprecating the existing storage class implementation and transitioning to the use of the web3Stash library (https://github.com/mbcse/web3stash) for a more streamlined and standardized metadata upload process.

Proposed Changes:

Deprecation of Storage Classes: Remove the existing code that utilizes storage classes for metadata uploads.
Integration of web3Stash Library: Incorporate the web3Stash library into the codebase for a unified and efficient metadata uploading mechanism.

Restructure and Refactor the file structure and code

Description

As our project advances towards the integration of additional chains and functionalities, it becomes imperative to enhance the organization of our codebase for improved maintainability and clarity. The proposed solution involves a thorough refactor of the current folder structure, specifically segregating functionalities into distinct folders.

Objective

To establish a more organized and scalable folder structure that accommodates the growing complexity of integrating various chains and functions seamlessly.

Proposed Changes

Introduce a refined folder structure that categorizes functionalities based on their respective chains. Specifically, create separate folders for each chain, where the related contracts and associated functions will reside.

Example

project-root/
|-- chain1/
|   |-- contracts/
|   |-- functions/
|-- chain2/
|   |-- contracts/
|   |-- functions/
|-- shared/
|   |-- common/
|   |-- utilities/
|-- other_folders_and_files...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.