Function getMetadataIdForBadgeId

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

    Type Parameters

    Parameters

    Returns bigint | -1 | T

    Remarks

    The badge metadata array is the timeline values (BadgeMetadataTimeline.badgeMetadata), not the cached fetched values from the API.

    Example

    import { getMetadataIdForBadgeId } from 'bitbadgesjs-sdk'
    const collection: BitBadgesCollection<bigint> = { ... }
    const badgeId = 123n
    const metadataId = getMetadataIdForBadgeId(badgeId, collection.getBadgeMetadataTimelineValue())

    Example

    This can also be used with the BitBadges collection interface

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