A unique stringified document ID
Optional
_idA unique document ID (Mongo DB ObjectID)
The fetched activity for this collection. Returned collections will only fetch the current page. Use the pagination to fetch more. To be used in conjunction with views.
The alias cosmos address for the collection
The fetched approval trackers for this collection. Returned collections will only fetch the current page. Use the pagination to fetch more. To be used in conjunction with views.
The badge metadata timeline for this collection, with off-chain metadata populated.
The type of balances (i.e. "Standard", "Off-Chain - Indexed", "Non-Public, "Off-Chain - Non-Indexed")
Details about any off-chain claims for this collection. Only applicable when outsourced to BitBadges.
The collection approvals for this collection, with off-chain metadata populated.
The collection ID
The collection metadata timeline for this collection, with off-chain metadata populated.
The collection permissions for this collection, with off-chain metadata populated.
The block number when this collection was created
The cosmos address of the user who created this collection
The timestamp when this collection was created (milliseconds since epoch)
The custom data timeline
The default balances for users upon genesis, with off-chain metadata populated.
The is archived timeline
The manager timeline
The fetched merkle challenges for this collection. Returned collections will only fetch the current page. Use the pagination to fetch more. To be used in conjunction with views.
Optional
nsfwThe badge IDs in this collection that are marked as NSFW.
The off-chain balances metadata timeline
The fetched owners of this collection. Returned collections will only fetch the current page. Use the pagination to fetch more. To be used in conjunction with views.
Optional
reportedThe badge IDs in this collection that have been reported.
Optional
reservedThe reserved map for the account. This is created and managed on-chain through the x/maps module.
The standards timeline
The update history of this collection
Valid badge IDs for the collection
The views for this collection and their pagination Doc. Views will only include the doc _ids. Use the pagination to fetch more. To be used in conjunction with activity, announcements, reviews, owners, merkleChallenges, and approvalTrackers. For example, if you want to fetch the activity for a view, you would use the view's pagination to fetch the doc _ids, then use the corresponding activity array to find the matching docs.
Checks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for TimedUpdatePermission.check.
Optional
time: NumberTypeChecks if this permission is executable at a specific time (Date.now() by default).
Wrapper for ActionPermission.check.
Optional
time: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Optional
time: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for TimedUpdatePermission.check.
Optional
time: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for TimedUpdatePermission.check.
Optional
time: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for TimedUpdatePermission.check.
Optional
time: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for TimedUpdatePermission.check.
Optional
time: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for TimedUpdatePermission.check.
Optional
time: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for TimedUpdatePermission.check.
Optional
time: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for TimedUpdatePermission.check.
Optional
time: NumberTypeDeep copies the object and returns a new instance.
Converts the object to a different NumberType equivalent.
Compares this object's fields to another object's fields for equality. Equality is determined by comparing the JSON representations of the objects.
If normalizeNumberTypes
is true, then all number types will be compared as strings (i.e. "1n" === "1" === 1). Else, they will be compared as their native types (i.e. 1n !== 1 !== "1").
Optional
normalizeNumberTypes: booleanFetches the entire view (all pages) for a specific view. This will update the current collection with the new response information.
There is a 1 second delay between each page fetch to prevent rate limiting.
Optional
oldestFirst: booleanOptional
address: stringSpecify a new fetch request for the current collection. This will update the current collection with the new response information. For example, paginations, metadata, views, etc. will all be handled automatically.
Optional
forceful: booleanFetches the owner information (balances) for a specific address for the current collection. This will update the current collection with the new response information.
Optional
forceful: booleanWrapper for fetchAndUpdate that fetches collection metadata.
Optional
forceful: booleanFetches the next page for a specific view. This will update the current collection with the new response information (handling paginations).
If the view has no more pages, this will do nothing.
Optional
oldestFirst: booleanOptional
address: stringExecute a filter query for the collection. You have to handle the pagination yourself.
Generates the alias for a specific badge ID. Collection alias is stored in the root of the collection.
Wrapper for generateAlias.
Gets the documents for a specific view.
Gets the documents for a specific view.
Get the badge activity for a specific badge ID. You have to handle the pagination yourself.
Gets the badge balance document for a specific address from the cached owners array. Returns undefined if not fetched yet. The balance document includes the balances, outgoing approvals, and other details. Use getBadgeBalances to only get the balances.
This does not fetch the balance from the API. It only returns the cached balance. To fetch the balance, this can either be done directly, or if the collection balances are indexable then the balances can also be fetched via the views and / or the other fetch methods.
const collection: BitBadgesCollection<bigint> = { ... }
const address = 'cosmos1...'
const balance = collection.getBadgeBalance(address)
console.log(balance?.balances)
console.log(balance?.outgoingApprovals)
Gets the badge balances for a specific address from the cached owners array. Returns undefined if not fetched yet. This returns the balances only, not the other details. Use getBadgeBalanceInfo to get the other details for a user balance store (approvals, etc.).
This does not fetch the balance from the API. It only returns the cached balance. To fetch the balance, this can either be done directly, or if the collection balances are indexable (i.e. balances type is anything but Off-Chain - Non-Indexed), then the balances can also be fetched via the views and / or the other fetch methods.
const collection: BitBadgesCollection<bigint> = { ... }
const address = 'cosmos1...'
const balances = collection.getBadgeBalances(address)
console.log(balances)
Gets a UintRangeArray of 1 - Max Badge ID for the collection (i.e. [{ start: 1n, end: maxBadgeId }]).
Get the metadata for a specific badge ID. This is the fetched metadata, not the timeline values.
This only returns the metadata object (name, image, etc.) and not the URI or other accompanying details. For those, use getBadgeMetadataDetails.
Gets the details for a specific badge ID. This includes the metadata, URI, and custom data.
If you only want the metadata, use getBadgeMetadata, or you can access it via result.metadata.
Gets the badge metadata at a specific time (Date.now() by default).
This gets the timeline value. For the actual fetched value, use getBadgeMetadata()
instead.
Optional
time: NumberTypeGets the collection metadata at a specific time (Date.now() by default).
This gets the timeline value. For the actual fetched value, use getCollectionMetadata()
instead.
Optional
time: NumberTypeGets the custom data at a specific time (Date.now() by default).
Optional
time: NumberTypeCreates a blank balance object with the genesis default approvals and balances.
Gets the is archived at a specific time (Date.now() by default).
Optional
time: NumberTypeGets the manager at a specific time (Date.now() by default).
Optional
time: NumberTypeGets the documents for a specific view.
Returns all the mint collection approvals.
Wrapper for getMintApprovals.
Returns all the non-mint collection approvals.
Wrapper for getNonMintApprovals.
Gets the off-chain balances metadata at a specific time (Date.now() by default).
Optional
time: NumberTypeGets the owners for a specific badge. You have to handle the pagination yourself.
Gets the documents for a specific view.
Check the refresh queue status for the collection via the API.
Gets the standards at a specific time (Date.now() by default).
Optional
time: NumberTypeReturns all the unhandled collection approvals. Unhandled means disapproved.
Wrapper for getUnhandledCollectionApprovals.
Returns the pagination information for a specific view ({ hasMore, bookmark }).
Wrapper for getBadgeBalanceInfo that throws an error if the balance is not found in the document.
Wrapper for getBadgeBalances that throws an error if the balance is not found in the document.
For a metadata fetch request, prune the request to only request the metadata that is not already fetched.
Prunes a new collection API request body to only request the data that is not already fetched.
Trigger a refresh for the collection via the API. Note there is a cooldown period for refreshing.
Sets the badge metadata for certain times (defaults to all times).
Optional
timelineTimesToSet: iUintRange<T>[]Sets the collection metadata for certain times (defaults to all times).
Optional
timelineTimesToSet: iUintRange<T>[]Updates the current collection with a new response from the API. If forceful is true, we fully overwrite the current collection with the new response. Else, we will append the new response to the current collection while handling duplicates, paginations, etc.
Optional
forceful: booleanValidates if a state transition (old badge metadata -> new badge metadata) is valid, given the current state of the collection and its permissions.
Wrapper for BadgeMetadataTimeline.validateUpdate.
Validates if a state transition (old approvals -> new approvals) is valid, given the current state of the collection and its permissions.
Wrapper for CollectionApprovalWithDetails.validateUpdate.
Validates if a state transition (old custom data -> new custom data) is valid, given the current state of the collection and its permissions.
Wrapper for CustomDataTimeline.validateUpdate.
Validates if a state transition (old isArchived -> new isArchived) is valid, given the current state of the collection and its permissions.
Wrapper for IsArchivedTimeline.validateUpdate.
Validates if a state transition (old manager -> new manager) is valid, given the current state of the collection and its permissions.
Wrapper for ManagerTimeline.validateUpdate.
Validates if a state transition (old off-chain balances metadata -> new off-chain balances metadata) is valid, given the current state of the collection and its permissions.
Wrapper for OffChainBalancesMetadataTimeline.validateUpdate.
Validates if a single permission type is updated correctly. Cannot edit anything permanently frozen.
This is validating the updatability of the permissions. To validate whether a permission is executable, use the checkCan* functions.
Validates if a state transition (old permissions -> new permissions) is valid. Must not update any permanently frozen permissions.
Wrapper for CollectionPermissionsWithDetails.validateUpdate.
Validates if a state transition (old standards -> new standards) is valid, given the current state of the collection and its permissions.
Wrapper for StandardsTimeline.validateUpdate.
Static
FetchFetches and initializes a new BitBadgesCollection object from an API request. Must pass in a valid API instance.
Static
FetchFetches and initializes a batch of new BitBadgesCollection objects from an API request. Must pass in a valid API instance.
Static
FilterExecute a filter query for the collection. You have to handle the pagination yourself.
Static
GetGets activity for a specific badge ID. You have to handle the pagination yourself.
Static
GetGets the badge balance for a specific address for a specific collection. Must pass in a valid API instance.
Optional
body: GetBadgeBalanceByAddressPayloadStatic
GetGets collections from the API. Must pass in a valid API instance.
Static
GetGets owners for a specific badge ID. You have to handle the pagination yourself.
Static
GetReturns the status of this collection in the refresh queue.
Static
RefreshTrigger a refresh for the collection via the API. Note there is a cooldown period for refreshing.
Optional
body: RefreshMetadataPayload
BitBadgesCollection is the type for collections returned by the BitBadges API. It extends the base CollectionDoc type and adds additional accompanying Docrmation such as metadata, activity, balances, preferred chain, etc.