This function returns the Metadata ID for a specific badge ID. Returns -1 if not found.
The badge metadata array is the timeline values (BadgeMetadataTimeline.badgeMetadata), not the cached fetched values from the API.
import { getMetadataIdForBadgeId } from 'bitbadgesjs-sdk'const collection: BitBadgesCollection<bigint> = { ... }const badgeId = 123nconst metadataId = getMetadataIdForBadgeId(badgeId, collection.getBadgeMetadataTimelineValue()) Copy
import { getMetadataIdForBadgeId } from 'bitbadgesjs-sdk'const collection: BitBadgesCollection<bigint> = { ... }const badgeId = 123nconst metadataId = getMetadataIdForBadgeId(badgeId, collection.getBadgeMetadataTimelineValue())
This can also be used with the BitBadges collection interface
import { BitBadgesCollection } from 'bitbadgesjs-sdk'const collection: BitBadgesCollection<bigint> = { ... }const badgeId = 123nconst metadataId = collection.getMetadataIdForBadgeId(badgeId) Copy
import { BitBadgesCollection } from 'bitbadgesjs-sdk'const collection: BitBadgesCollection<bigint> = { ... }const badgeId = 123nconst metadataId = collection.getMetadataIdForBadgeId(badgeId)
This function returns the Metadata ID for a specific badge ID. Returns -1 if not found.
Remarks
The badge metadata array is the timeline values (BadgeMetadataTimeline.badgeMetadata), not the cached fetched values from the API.
Example
Example
This can also be used with the BitBadges collection interface