5SKY
  • ✨Introduction
  • Products
    • 🌌5SKY NFT Project
      • 5SKY LTI (Core)
      • Lottery Smart Contract
    • 🪙5SKY Token Project
      • Token Specifications
      • Tokenomics Explained
      • Token Features
      • Functions Overview
  • Getting Started
    • Create a Wallet
    • Overview of the 5SKY NFT
      • Connecting MetaMask
      • Connecting Trust Wallet
  • 💻DEVELOPERS
    • Decentralization & Transparent Commitment
      • Plan Structure
      • NFTData Structure
      • TokenURI function
      • Purchase function
      • Upgrade function
  • 🎇FAQ
    • 5Sky Ecosystem
    • NFT Project
    • LTI Smart Contract
    • Lottery Smart Contract
    • Token Project
  • ☎️Contact Us
    • Customer Support
    • Social Accounts & Communities
Powered by GitBook
On this page
  1. DEVELOPERS
  2. Decentralization & Transparent Commitment

NFTData Structure

The NFTData structure is designed to hold information about a specific Non-Fungible Token (NFT) in the context of the given application. This structure contains the following fields:

  1. plan: An instance of the previously described Plan structure. This indicates which plan or level the NFT is associated with.

  2. inviteCode: A string that presumably represents a unique code associated with this NFT, possibly for referral or invitation purposes.

  3. childrenCount: Represents the number of children or subsets associated with this NFT. This could be used to track how many other NFTs or entities are linked or derived from this particular NFT.

  4. parentTokenId: The ID of the parent NFT. This suggests a hierarchical or tree-like structure where an NFT can be derived or spawned from another NFT.

The nftData Mapping:

nftData is a mapping that links a unique uint256 token ID to its associated NFTData structure. This allows for easy retrieval and storage of data for each NFT based on its unique identifier.

In a practical application, when an NFT is minted or transferred, the associated data in the NFTData structure can be updated or queried using this mapping.

using web3.js to retrieve the NFTData for a specific token ID:

// First, initialize an instance of web3
const Web3 = require('web3');
const web3 = new Web3('https://bsc-dataseed.binance.org/');

// Define the ABI (Application Binary Interface) of the smart contract
// Note: You should provide the full ABI of the smart contract here
const contractABI = [...]; // Smart contract ABI

// Define the smart contract address
const contractAddress = '0x511B52B473aB081B08E98F679501492eBBaB509f';

// Initialize an instance of the smart contract using its ABI and address
const contract = new web3.eth.Contract(contractABI, contractAddress);

// Function to retrieve the NFTData for a specific token ID
async function getNFTData(tokenId) {
    try {
        const data = await contract.methods.nftData(tokenId).call();
        console.log(data);
        return data;
    } catch (error) {
        console.error("Error fetching NFT data:", error);
    }
}

// Use the function to retrieve the data
const tokenId = 123; // As an example
getNFTData(tokenId);
PreviousPlan StructureNextTokenURI function

Last updated 1 year ago

💻