Type Definition
utils/adapter.ts:6
Description
TheLabelledPoints type represents point totals organized by category or label. This is used when a protocol tracks multiple types of points simultaneously (e.g., different seasons, point types, or reward categories).
Each key is a string label describing the point category, and each value is the numeric point total for that category.
Usage in Adapters
Adapters returnLabelledPoints from the total function when they need to report multiple point categories:
utils/adapter.ts:15
Single Total (number)
For protocols with a single point type, return a simple number:adapters/taiko.ts:72
Multiple Categories (LabelledPoints)
For protocols with multiple point categories, return an object:adapters/karak.ts:42
Real-World Examples
Season-Based Points (Harmonix)
The Harmonix adapter tracks points across multiple seasons:adapters/harmonix.ts:101-138
Result:
Protocol-Specific Points (Symbiotic)
The Symbiotic adapter aggregates different point types:adapters/symbiotic.ts:81-86
Result:
Multiple XP Categories (Galxe)
The Galxe adapter returns experience points as a labelled category:adapters/galxe.ts:76-78
Result:
When to Use LabelledPoints
UseLabelledPoints instead of a simple number when:
- Multiple Seasons - The protocol has different seasons or epochs (e.g., Season 1, Season 2)
- Multiple Point Types - Different types of points exist (e.g., XP, Gold, Reputation)
- Category Breakdown - Points are categorized by activity type (e.g., Trading Points, Staking Points)
- Temporal Segmentation - Points are tracked across different time periods
number when:
- The protocol has a single, unified point system
- All points are of the same type and category
Processing by the SDK
The SDK automatically processesLabelledPoints values:
utils/adapter.ts:63-66
- Simple numbers are parsed as floats
LabelledPointsobjects have all values converted to integersundefinedvalues in categories are converted to0
Return Type in AdapterResult
TheAdapterResult type includes the total field:
utils/adapter.ts:22-30
Best Practices
- Consistent Naming - Use clear, descriptive labels (e.g., “S1 Points”, “S2 Points” instead of “p1”, “p2”)
- Handle Missing Data - Return
undefinedfor categories with no data, the SDK will convert to0 - Document Categories - Comment what each category represents
- Match DetailedData - Ensure labels in
totalalign with groups indatafunction
Related Types
- DetailedData - Used alongside
LabelledPointsin thedatafunction - AdapterExport - Defines the
totalfunction signature - AdapterResult - Contains the processed
totalvalue