A unique stringified document ID
Optional_A 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 (non-wrapping) paths for the collection, with off-chain metadata populated.
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 fetched merkle challenge 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.
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 for this collection, with off-chain metadata populated.
The collection permissions for this collection, with off-chain metadata populated.
The IBC wrapper paths for the collection, with off-chain metadata populated.
The block number when this collection was created
The BitBadges address of the user who created this collection
The timestamp when this collection was created (milliseconds since epoch)
The custom data
The default balances for users upon genesis, with off-chain metadata populated.
Collection-level invariants that cannot be broken. These are set upon genesis and cannot be modified.
The is archived flag
The listings for this collection.
The manager
Mint escrow address
OptionalnsfwThe token IDs in this collection that are marked as NSFW.
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.
OptionalreportedThe token IDs in this collection that have been reported.
The standards
OptionalstatsThe stats for this collection.
OptionaltokenThe floor prices for this collection.
The token metadata for this collection, with off-chain metadata populated.
The update history of this collection
Valid token 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. 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 at a specific time (Date.now() by default).
Wrapper for ActionPermission.check.
Optionaltime: NumberTypeChecks if this permission is executable at a specific time (Date.now() by default).
Wrapper for ActionPermission.check.
Optionaltime: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for ActionPermission.check.
Optionaltime: NumberTypeChecks if this permission is executable at a specific time (Date.now() by default).
Wrapper for ActionPermission.check.
Optionaltime: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for CollectionApprovalPermission.check.
Optionaltime: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for ActionPermission.check.
Optionaltime: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for ActionPermission.check.
Optionaltime: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for ActionPermission.check.
Optionaltime: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for ActionPermission.check.
Optionaltime: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Optionaltime: NumberTypeChecks if this permission is executable for the provided values at a specific time (Date.now() by default).
Wrapper for TimedUpdatePermission.check.
Optionaltime: NumberTypeDeep copies the object and returns a new instance.
Converts the object to a different NumberType equivalent.
Optionaloptions: ConvertOptionsCompares 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").
OptionalnormalizeNumberTypes: 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.
OptionaloldestFirst: booleanOptionaladdress: 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.
Optionalforceful: booleanFetches the owner information (balances) for a specific address for the current collection. This will update the current collection with the new response information.
Optionalforceful: booleanWrapper for fetchAndUpdate that fetches collection metadata.
Optionalforceful: 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.
OptionaloldestFirst: booleanOptionaladdress: stringExecute a filter query for the collection. You have to handle the pagination yourself.
Generates the alias for a specific token ID. Collection alias is stored in the root of the collection.
Wrapper for generateAlias.
Gets the 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 getBalances to only get the balances.
Gets the 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 getBalanceInfo 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.
Gets the documents for a specific view.
Gets default display currency, if set. Defaults to ubadge.
Creates a blank balance object with the genesis default approvals and balances.
Gets the maximum token ID for the collection. Checks both the circulating supplys + genesis default balances.
Precondition: The Total balance must be fetched.
Returns all the mint collection approvals.
Wrapper for getMintApprovals.
Returns all the non-mint collection approvals.
Wrapper for getNonMintApprovals.
Internal helper method to convert the number fields of the object to a different NumberType equivalent.
Gets the owners for a specific token. You have to handle the pagination yourself.
Check the refresh queue status for the collection via the API.
Get the token activity for a specific token ID. You have to handle the pagination yourself.
Gets a UintRangeArray of 1 - Max Token ID for the collection (i.e. [{ start: 1n, end: maxTokenId }]).
Gets the token metadata at a specific time (Date.now() by default).
This gets the timeline value. For the actual fetched value, use getTokenMetadataForTokenId() instead.
Gets the details for a specific token ID. This includes the metadata, URI, and custom data.
If you only want the metadata, use getTokenMetadata, or you can access it via result.metadata.
Returns all the unhandled collection approvals. Unhandled means disapproved.
Wrapper for getUnhandledCollectionApprovals.
Type agnostic get view function. Uses the viewType to determine the type of view to fetch.
Returns the bookmark for a specific view. This is used to fetch the next page.
Returns the pagination information for a specific view ({ hasMore, bookmark }).
Checks if the object has number fields.
Returns if a new collection API request body is redundant (meaning we already have the data cached).
Wrapper for getBalanceInfo that throws an error if the balance is not found in the document.
Wrapper for getBalances 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.
Converts the object to a JSON object with all primitive types.
Converts the object to a JSON string.
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.
Optionalforceful: booleanValidates 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 collection metadata -> new collection metadata) is valid, given the current state of the collection and its permissions.
Wrapper for validateCollectionMetadataUpdate.
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 validateCustomDataUpdate.
Validates if a state transition (old isArchived -> new isArchived) is valid, given the current state of the collection and its permissions.
Wrapper for validateIsArchivedUpdate.
Validates if a state transition (old manager -> new manager) is valid, given the current state of the collection and its permissions.
Wrapper for validateManagerUpdate.
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 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 standards -> new standards) is valid, given the current state of the collection and its permissions.
Wrapper for validateStandardsUpdate.
Validates if a state transition (old token metadata -> new token metadata) is valid, given the current state of the collection and its permissions.
Wrapper for validateTokenMetadataUpdate.
Returns if the view has more pages to fetch.
StaticFetchFetches and initializes a new BitBadgesCollection object from an API request. Must pass in a valid API instance.
StaticFetchFetches and initializes a batch of new BitBadgesCollection objects from an API request. Must pass in a valid API instance.
StaticFilterExecute a filter query for the collection. You have to handle the pagination yourself.
StaticGetGets the balance for a specific address for a specific collection. Must pass in a valid API instance.
Optionalpayload: iGetBalanceByAddressPayloadStaticGetGets collections from the API. Must pass in a valid API instance.
StaticGetGets owners for a specific token ID. You have to handle the pagination yourself.
Optionalpayload: iGetOwnersPayloadStaticGetReturns the status of this collection in the refresh queue.
StaticGetGets activity for a specific token ID. You have to handle the pagination yourself.
Optionalpayload: iGetTokenActivityPayloadStaticRefreshTrigger a refresh for the collection via the API. Note there is a cooldown period for refreshing.
Optionalbody: iRefreshMetadataPayload
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.