Timelines

As you may have noticed, many of the collection fields are timeline-based, meaning they can be scheduled to have different values at different times. Check out the Timeline helpers from bitbadgesjs-sdk in the SDK.

Examples:

If you are using the BitBadgesCollection interface, this is achievable simply with the helper functions. There is one for every timeline.

const manager = collection.getManager(); //Can pass in a time too (defaults to now)

Or, you can do it manually

const manager = getCurrentValuesForCollection(collection).manager;
const manager = getValuesAtTimeForCollection(collection, Date.now() + 1000 * 60).manager;

You can also get all possible values for timelines as such. This will set all missing times with empty or default values.

function getFullManagerTimeline(
    timeline: ManagerTimeline<bigint>[]
): ManagerTimeline<bigint>[];
function getFullCollectionMetadataTimeline(
    timeline: CollectionMetadataTimeline<bigint>[]
): CollectionMetadataTimeline<bigint>[];

And so on for all other timelines.

Last updated