Class directory and coverage
Read class origins, observed instances, labels, and classification coverage without mistaking a window for a census.
Class directory and coverage
Starkscan's class routes combine a complete indexed origin catalog with bounded usage observations. They are not interchangeable.
Choose the directory sort by question
GET /v1/{chain}/classes supports:
| Sort | Meaning |
|---|---|
instances_desc | Compatibility view ordered by observed class associations. Counts are lower-bound usage observations. |
declared_at_desc | Complete indexed DECLARE and legacy DEPLOY origin catalog, newest first. |
origin_asc | The same indexed origin catalog, oldest first. |
Page with the returned opaque nextCursor; cursors are sort-specific. A declaration-only class can legitimately have zero/null observed usage fields.
Instance counts are not a chain-wide census
GET /v1/{chain}/class/{class_hash} returns instanceCoverage beside every count. Read it before interpreting instanceCount, accountInstanceCount, contractInstanceCount, or unknownInstanceCount.
coverageStatus: partialwithreasonCode: indexed_observation_windowmeans the projection has bounded observations betweenobservedFromBlockandobservedThroughBlock.isLowerBound: truemeans numeric counts can be used only as lower bounds inside that observation contract.isExhaustiveis alwaysfalse; the route never claims a global class-instance census.classificationCoverage: known_for_observed_instancesapplies only to materialized observed rows, not every on-chain instance.coverageStatus: unavailablemeans no trustworthy usage watermark exists. The bounds are null andisLowerBoundis false.
An unknownInstanceCount is an honest classification result, not evidence that the class label is wrong. A reviewed classLabel describes a class family; it does not force every observed address into account or contract classification.
Origins, labels, and source verification
Class origin evidence can come from indexed finalized/head DECLARE or legacy DEPLOY transactions. It establishes the indexed class origin, not source-code verification. classLabel is a reviewed family label; use the separate verification fields/routes when exact source verification matters.
The request path reads materialized facts and does not call RPC or aggregate raw history to fill gaps. Preserve nullable fields and coverage reason codes rather than substituting current class state or zero.
TypeScript SDK
const page = await explorer.getClasses('SN_MAIN', undefined, 50, 'instances_desc');
const firstClass = page.items[0];
if (!firstClass) {
throw new Error('no observed classes are currently published');
}
const detail = await explorer.getClass('SN_MAIN', firstClass.classHash);
if (!detail.instanceCoverage.isExhaustive) {
console.log('observed lower bound', detail.instanceCount);
}Use the API reference for exact cursor and response schemas and API discovery for the caller-specific operation and rate-limit contract.