DappHero Docs
  • Getting Started 👋🏽
  • DappHero Basics
    • How does it work? 🧐
    • Setting Up Your Project 🏗️
      • Projects
      • Smart Contracts
    • An Intro to Features 🎁
  • Features
    • Network ⛓️
    • User 🤖
    • 3box 👯‍♂️
    • Smart Contracts 👩🏾‍🔬
      • Adding Smart Contracts 🏗️
        • Contract Details
      • Create a Method Instance
      • Inputs
      • Invoke
      • Outputs
      • Events
      • Advanced: Automatically clearing Inputs
      • Advanced: Getting the Current User's Address Dynamically
      • Advanced: Sending ETH to a contract method
      • Listening to Events
      • Resources: Learn More
      • Resources: Test Contracts
    • Collectibles 🃏
      • Getting Started
      • Single Collectibles
      • Listing Collectibles
      • Displaying Token Metadata
      • Advanced: $CURRENT_USER
      • Advanced: $URL
      • Advanced: $THIS
      • Advanced: Properties
      • Calling Smart Contracts inside Collectibles
      • Collectible Example
  • No-Code Integrations
    • Webflow 🎁
      • Getting Started with Webflow
      • Add DappHero Elements
      • Learn more about WebFlow
  • Examples
    • Coming soon...
  • Advanced
    • Engine Events
    • Force Refresh
    • Database
    • Ethereum Provider
  • Updates
    • ChangeLog
  • Bug Bounty
Powered by GitBook
On this page

Was this helpful?

  1. Features
  2. Collectibles 🃏

Single Collectibles

Retrieving a single collectible and displaying it's data

Collectibles are represented by smart contracts, and this means they have a number of standard properties such as a contract, a deployed contract address, and collectible owners. Depending on what we are trying to do, we will need difficult combinations of these parameters to get the right token.

Get a single Collectible by TokenID and Owner Address

This will return any single token with a TokenId and owned by OwnerAddress If there are multiple tokens with TokenId owned by this address, it will only return the first token that it finds.

<!-- This top level div is the method Instance -->
<div
    data-dh-feature="nft"
    data-dh-property-tag-id="<<uniqueID>>"
    data-dh-property-asset-token-id="<<TokenId>>"
    data-dh-property-asset-owner-address="<<OwnerAddress>>">
    
    <div data-dh-property-tag-id="<<uniqueID>>" 
         data-dh-property-asset-item="true">
         
         <img data-dh-property-asset-json-path="image_url" />
         <h3 data-dh-property-asset-json-path="name"></h3>
         
    </div>
    
</div>

In the case that an owner potentially owns multiple tokens with the same TokenId in different Collectible contracts you can filter by using:

data-dh-property-asset-contract-address="<<Address>>" in the Collectible instance after specifying the asset-owner-address. This will return results only from this specific collectible contract address.

Get a single Collectible by TokenID and Contract Address

If the owner address is not relevant, by suppling only a TokenId and ContractAddress a single token will be returned.

<!-- This top level div is the method Instance -->
<div
    data-dh-feature="nft"
    data-dh-property-tag-id="<uniqueID>>"
    data-dh-property-asset-token-id="<<TokenID>>"
    data-dh-property-asset-contract-address="<<ContractAddress>>">
   
    <div data-dh-property-tag-id="<<uniqueID>>" 
         data-dh-property-asset-item="true">
         
        <img data-dh-property-asset-json-path="image_url" />
        <h3 data-dh-property-asset-json-path="name"></h3>
        
    </div>
      
</div>

PreviousGetting StartedNextListing Collectibles

Last updated 5 years ago

Was this helpful?