LYNC
DashboardSupport
  • 👋Introducing LYNC
  • Products
    • LYNC Account Abstraction SDK
    • LYNC Account Abstraction WebGL SDK
    • Metamask Wallet
    • LYNC Metamask PC SDK
    • OKX Wallet
    • LYNC In-Game Marketplace SDK
    • NFT Fetcher
    • No-Code Smart Contract Deployer
    • EVM Lootbox SDK
      • Getting Started
      • Using the SDK
        • Creating a new lootbox
        • Opening a lootbox
        • Claiming rewards
        • Whitelisting users using lootbox
        • Lootbox admin functions
        • Useful information functions from LyncLootBox class
        • Multicall : opening and claiming multiple lootboxes in a single transaction
      • Example Codes in React & TypeScript
        • Example code for creating a new lootbox
        • Example code for opening a lootbox
        • Example code for claiming a lootbox
    • Launch your products on Telegram
      • Configure Your Telegram Bot
      • Deploying Your Product on TG
  • APTOS
    • LYNC Paymaster - Supporting Aptos
      • How to Register on LYNC Dashboard
      • How to Create Paymaster
      • How to Fund the Paymaster
      • Module & Function Whitelist
      • How to Integrate Paymaster
        • Unity
        • API
        • JavaScript/ TypeScript
    • LYNC Unity Aptos SDK
    • Keyless Accounts
      • Configure Your OIDC Provider
      • Integrate Keyless in Unity
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
        • Send generic transactions on Aptos
    • LYNC Social Login SDK on Aptos
      • Getting Started
      • Using the SDK
      • Example Codes in React & TypeScript
      • Types Used in the Methods Provided by the SDK
      • Other Specification
    • LYNC Aptos Lootbox
      • Getting Started
      • Creating a Lootbox
      • Opening a Lootbox
      • Claiming the Rewards
      • Conclusion
  • Movement Labs
    • 📇Indexer
      • How to run index custom data?
      • Example Queries
        • Get Token Info
        • Get Token Balances
        • Get NFTs Owned by an Account
    • NFT Deployer
    • LYNC Social Login SDK on Movement
      • Getting Started
      • Using the SDK
      • Example Codes in React & TypeScript
      • Types and Enums Used in the Methods Provided by the SDK
      • Other Specification
    • LYNC Unity Movement SDK
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
    • LYNC Paymaster - Supporting Movement
      • How to Register on LYNC Dashboard
      • How to Create Paymaster
      • How to Fund the Paymaster
      • Module & Function Whitelist
      • How to Integrate Paymaster
        • JavaScript/ TypeScript
  • Supra
    • LYNC Paymaster - Supporting Supra L1
      • How to Register on LYNC Dashboard
      • How to Create Paymaster
      • How to Fund the Paymaster
      • Module & Function Whitelist
      • How to Integrate Paymaster
        • JavaScript/ TypeScript
    • LYNC Unity SUPRA SDK
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
  • Fuel
    • LYNC Unity Fuel SDK
    • LYNC NFT Deployer
      • Introduction
      • Getting Started
      • Deploying Your NFTs
        • Launch Your Entire Collection
      • Troubleshooting and FAQs
    • LYNC Fuel Lootbox
      • Getting Started
      • Creating a Lootbox
      • Opening a Lootbox
      • Claiming the Rewards
      • Conclusion
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
    • Fuel Marketplace NPM SDK
      • Getting Started
      • Using the SDK
        • Using hooks to get the marketplace data
        • Using services provided by the SDK to list, buy, and manage tokens
        • Some useful functions provided by the SDK
        • Error codes for the SDK
        • Interfaces and Enums provided by the SDK
      • Support
  • Metis
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
  • NPM Packages
    • Marketplace
      • Hook: useAllCollectionNFT
      • Hook: useAllBuyNFT
      • Hook: useAllOwnerNFT
      • Hook: useNFTDetails
      • Hook: useAllNFTForRent
Powered by GitBook
On this page
  • useAllNftsInCollection
  • useCollections
  • useListings
  • useNft
  1. Fuel
  2. Fuel Marketplace NPM SDK
  3. Using the SDK

Using hooks to get the marketplace data

The SDK provides a set of hooks that you can use to get the marketplace data. Here is the list of hooks provided by the SDK:

useAllNftsInCollection

This hook returns all the NFTs in a collection. You can use this hook to get all the NFTs in a collection.

import { Networks, useAllNftsInCollection } from '@lyncworld/fuel-marketplace';

const { fetching, data, error } = useAllNftsInCollection({
  network: Networks.Testnet,
  // Select from "NFT" or "SEMI_FT" according to actual token standard
  nftStandard: 'SEMI_FT',
  // Replace this demo contract address with actual contract address
  contractAddress: '0x...',
});
  • Returns -

{
  fetching: boolean;
  data: TokensInCollection[];
  error: unknown
}
  • Types -

interface TokensInCollection {
  tokenName: string;
  tokenImage: string;
  tokenAssetMedia: string;
  description: string;
  contractAddress: `0x${string}`;
  tokenId: `0x${string}`;
  assetId: `0x${string}`;
  tokenStandard: 'NFT' | 'SEMI_FT';
  contractName: string;
  contractSymbol: string;
}

useCollections

This hook returns all the collections whose at least one token is listed on the marketplace.

import { Networks, useCollections } from '@lyncworld/fuel-marketplace';

const { fetching, data, error } = useCollections({
  network: Networks.Testnet,
  // You can pass the limit to get the top N collections or remove it to get all collections
  limit: 10,
});
  • Returns -

{
  fetching: boolean;
  data: MarketplaceCollections[];
  error: unknown
}
  • Types -

interface MarketplaceCollections {
  contractAddress: `0x${string}`;
  tokenStandard: 'NFT' | 'SEMI_FT';
  collectionName: string;
  collectionSymbol: string;
  floorPrice: string;
  totalItemsListed: number;
  bannerImage: string;
}

useListings

This hook returns all the tokens listed on the marketplace for buying.

import { Networks, useListings } from '@lyncworld/fuel-marketplace';

const { fetching, data, error } = useListings({
  network: Networks.Testnet,
  // You can pass the limit to get the top N listings or remove it to get all listings
  limit: 10,
});
  • Returns -

{
  fetching: boolean;
  data: MarketplaceListings[];
  error: unknown
}
  • Types -

interface MarketplaceListings {
  listingId: number;
  isActive: boolean;
  nftAddress: `0x${string}`;
  tokenStandard: 'NFT' | 'SEMI_FT';
  tokenId: `0x${string}`;
  assetId: `0x${string}`;
  tokenQuantity: number;
  pricePerItem: string;
  sellerAddress: `0x${string}`;
  tokenName: string;
  tokenImage: string;
  tokenAssetMedia: string;
}

useNft

This hook return all the listing details of a specific token by its contract address, token standard, and token ID.

import { Networks, useNft } from '@lyncworld/fuel-marketplace';

const { fetching, data, error } = useNft({
  network: Networks.Testnet,
  // Select from "NFT" or "SEMI_FT" according to actual token standard
  nftStandard: 'SEMI_FT',
  // Replace this demo contract address with actual contract address of the token
  contractAddress: '0x...',
  // Replace this demo token id with actual token id (or sub id) of the token
  tokenId: '0x...',
  // You can pass the limit to get the top N listing or remove it to get all the listing of the token
  limit: 10,
});
  • Returns -

{
  fetching: boolean;
  data: NftDetails;
  error: unknown
}
  • Types -

interface NftDetails {
  listingData: OmittedMarketplaceListings[];
  nftMetadata: NftMetadata;
}

interface OmittedMarketplaceListings
  extends Omit<MarketplaceListings, 'tokenName' | 'tokenImage' | 'tokenAssetMedia'> {}

interface MarketplaceListings {
  listingId: number;
  isActive: boolean;
  nftAddress: `0x${string}`;
  tokenStandard: 'NFT' | 'SEMI_FT';
  tokenId: `0x${string}`;
  assetId: `0x${string}`;
  tokenQuantity: number;
  pricePerItem: string;
  sellerAddress: `0x${string}`;
  tokenName: string;
  tokenImage: string;
  tokenAssetMedia: string;
}

interface NftMetadata {
  tokenName: string;
  tokenImage: string;
  tokenAssetMedia: string;
  description: string;
}
PreviousUsing the SDKNextUsing services provided by the SDK to list, buy, and manage tokens

Last updated 3 months ago