Type Definitions
utils/adapter.ts:7-8
Description
DetailedData and LabelledDetailedData define the structure for detailed point breakdowns returned by the data function in adapters. These types enable rich data export including metadata, point breakdowns, rankings, and other contextual information.
DetailedData
A flat object containing key-value pairs where:- Keys are string labels describing the data point
- Values are either strings (for metadata like usernames, tiers) or numbers (for points, ranks, balances)
LabelledDetailedData
A nested object that groupsDetailedData by category labels. This structure is used when data should be organized into logical groups or categories.
Usage in Adapters
Thedata function in an adapter must return either DetailedData or LabelledDetailedData:
utils/adapter.ts:14
Examples
Flat Structure (DetailedData)
The Taiko adapter returns a flat structure with all data at the top level:adapters/taiko.ts:36-71
Result:
Nested Structure (LabelledDetailedData)
The Galxe adapter returns nested data grouped by category:adapters/galxe.ts:63-75
Result:
Complex Nested Structure (Symbiotic)
The Symbiotic adapter creates multiple nested groups:adapters/symbiotic.ts:70-80
Result:
Time-Based Groups (EtherFi)
The EtherFi adapter organizes points by time periods:adapters/etherfi.ts:17-61
Result:
When to Use Each Structure
Use DetailedData (Flat) When:
- All data points are at the same conceptual level
- No natural grouping or categorization exists
- Simple point breakdowns with metadata
- Single-dimension data (e.g., just points breakdown)
Use LabelledDetailedData (Nested) When:
- Data has clear categorical groups (e.g., seasons, time periods)
- Multiple types of information need separation (e.g., XP vs Profile data)
- Hierarchical organization improves clarity
- Different point categories need their own breakdowns
Value Processing
The SDK automatically normalizes all values in thedata object:
utils/adapter.ts:62
This converts:
- BigInt values to numbers
- String numbers to numbers
- Ensures consistent numeric formatting
Including Metadata
Both structures support string values for metadata:adapters/harmonix.ts:96-97
Best Practices
- Consistent Naming - Use clear, descriptive keys (e.g., “Total Points” not “tp”)
- Proper Grouping - Group related data together in nested structures
- Include Context - Add relevant metadata (usernames, tiers, ranks)
- Match Total Labels - Ensure category names match those in
LabelledPoints - Handle Missing Data - Return empty objects or undefined for missing categories
- Use Number Types - Prefer numbers over string representations of numbers
Return Type in AdapterResult
The processed data appears in theAdapterResult:
utils/adapter.ts:22-30
Data Export Use Cases
DetailedData and LabelledDetailedData enable:
- Dashboard Display - Rich UI showing point breakdowns
- CSV/Excel Export - Structured data for spreadsheet analysis
- API Responses - Complete point history and metadata
- Historical Tracking - Time-series data across seasons/epochs
- User Profiles - Comprehensive user statistics and achievements
Related Types
- LabelledPoints - Used alongside for the
totalfunction - AdapterExport - Defines the
datafunction signature - AdapterResult - Contains the processed
datavalue