Skip to content

This function returns the Metadata IDs for a specific token URI. Returns an empty array if not found.

getMetadataIdsForUri<T>(uri, tokenMetadata): T[]

Defined in: packages/bitbadgesjs-sdk/src/api-indexer/metadata/metadataIds.ts:86

This function returns the Metadata IDs for a specific token URI. Returns an empty array if not found.

Type Parameters

T

T extends NumberType

Parameters

uri

string

tokenMetadata

TokenMetadata<T>[]

Returns

T[]

Remarks

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

Examples

ts
import { getMetadataIdsForUri } from 'bitbadges'
const collection: BitBadgesCollection<bigint> = { ... }
const uri = 'https://bitbadges.io/collection/1/badge/1'
const metadataIds = getMetadataIdsForUri(uri, collection.getTokenMetadataTimelineValue())

This can also be used with the BitBadges collection interface

ts
import { BitBadgesCollection } from 'bitbadges'
const collection: BitBadgesCollection<bigint> = { ... }
const uri = 'https://bitbadges.io/collection/1/badge/1'
const metadataIds = collection.getMetadataIdsForUri(uri)

Edit this page on GitHub