bitbadgesjs-sdk - v0.22.7
    Preparing search index...

    Function getMetadataIdForTokenId

    • This function returns the Metadata ID for a specific token ID. Returns -1 if not found.

      Type Parameters

      Parameters

      Returns bigint | -1 | T

      The token metadata array is the timeline values (TokenMetadataTimeline.tokenMetadata), not the cached fetched values from the API.

      import { getMetadataIdForTokenId } from 'bitbadgesjs-sdk'
      const collection: BitBadgesCollection<bigint> = { ... }
      const tokenId = 123n
      const metadataId = getMetadataIdForTokenId(tokenId, collection.getTokenMetadataTimelineValue())

      This can also be used with the BitBadges collection interface

      import { BitBadgesCollection } from 'bitbadgesjs-sdk'
      const collection: BitBadgesCollection<bigint> = { ... }
      const tokenId = 123n
      const metadataId = collection.getMetadataIdForTokenId(tokenId)