TypeScript Interfaces
ENSRainbow’s TypeScript APIs expose two companion interfaces that describe which label sets are available (server-side) or requested (client-side).
Server Label Set
Section titled “Server Label Set”EnsRainbowServerLabelSet
Section titled “EnsRainbowServerLabelSet”Returned by GET /version
and stored in database metadata:
interface EnsRainbowServerLabelSet { labelSetId: string; // active label set ID (e.g. "subgraph") highestLabelSetVersion: number; // highest label set version the server has ingested for the label set id}
Fields
Section titled “Fields”labelSetId
identifies which label set the server is currently serving.highestLabelSetVersion
is the highest version available through the server for the label set id. The server will not return labels from a version greater than this value (unless it ingests another incremental label set).
Client Label Set
Section titled “Client Label Set”EnsRainbowClientLabelSet
Section titled “EnsRainbowClientLabelSet”Provided when constructing new EnsRainbowApiClient({ labelSet: … })
to pin client expectations:
interface EnsRainbowClientLabelSet { labelSetId?: string; // optional – require a particular label set labelSetVersion?: number; // optional – maximum label set version accepted}
Usage Guidelines
Section titled “Usage Guidelines”- Neither field → accept any labelset and use the latest version (default behaviour).
- Only
labelSetId
→ insist on a specific labelset and use the latest version. - Both fields → insist on a specific labelset and version, locking the client to an exact snapshot.
This handshake that occurs when both fields are set ensures both client and server interpret every heal operation against the same logical labelset snapshot, enabling deterministic and reproducible healing results across time.
Example Usage
Section titled “Example Usage”Using the Client SDK
Section titled “Using the Client SDK”import { EnsRainbowApiClient } from '@ensnode/ensrainbow-sdk';
// Default: use latest version of any labelsetconst client1 = new EnsRainbowApiClient({ baseUrl: 'https://api.ensrainbow.io'});
// Pin to subgraph labelset, use latest versionconst client2 = new EnsRainbowApiClient({ baseUrl: 'https://api.ensrainbow.io', labelSet: { labelSetId: 'subgraph' }});
// Pin to exact labelset snapshot for deterministic results across timeconst client3 = new EnsRainbowApiClient({ baseUrl: 'https://api.ensrainbow.io', labelSet: { labelSetId: 'subgraph', labelSetVersion: 0 }});
Related Documentation
Section titled “Related Documentation”- Client SDK - How to use these interfaces in practice
- API Reference - HTTP API endpoints that return these types
- Label Sets & Versioning - Understanding the versioning concepts