This function returns the Metadata ID for a specific token ID. Returns -1 if not found.
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 = 123nconst metadataId = getMetadataIdForTokenId(tokenId, collection.getTokenMetadataTimelineValue()) Copy
import { getMetadataIdForTokenId } from 'bitbadgesjs-sdk'const collection: BitBadgesCollection<bigint> = { ... }const tokenId = 123nconst 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 = 123nconst metadataId = collection.getMetadataIdForTokenId(tokenId) Copy
import { BitBadgesCollection } from 'bitbadgesjs-sdk'const collection: BitBadgesCollection<bigint> = { ... }const tokenId = 123nconst metadataId = collection.getMetadataIdForTokenId(tokenId)
This function returns the Metadata ID for a specific token ID. Returns -1 if not found.