Function getBadgeIdsForMetadataId

  • This return the badge IDs for a specific Metadata ID. Returns an empty array if not found.

    Type Parameters

    Parameters

    Returns UintRange<T>[]

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

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

    This can also be used with the BitBadges collection interface

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