interface Hat {
id: `0x${string}`; // Hat ID
prettyId?: string; // pretty ID format
status?: boolean; // 'true' if active, 'false' otherwise
createdAt?: string | null; // timestamp of hat creation, null if not created yet
details?: string; // Hat's details field
maxSupply?: string; // max amount of wearers
eligibility?: `0x${string}`; // eligibility address
toggle?: `0x${string}`; // toggle address
mutable?: boolean; // 'true' if mutable, 'false' otherwise
imageUri?: string; // Hat's image URI
levelAtLocalTree?: number; // Hat's level at its local tree (not including linked trees)
currentSupply?: string; // current amount of hat wearers
tree?: Tree; // Tree which contains the Hat
wearers?: Wearer[]; // Hat's Wearers
badStandings?: Wearer[]; // Hat's Wearers in bad standing
admin?: Hat; // Hat's admin Hat
subHats?: Hat[]; // Hat's children Hats
linkRequestFromTree?: Tree[]; // Link requests from Trees
linkedTrees?: Tree[]; // Trees linked to the Hat
claimableBy?: ClaimsHatter[]; // Claims Hatters that the Hat is made claimable by
claimableForBy?: ClaimsHatter[]; // Claims Hatters that the Hat is made claimable for by
events?: HatsEvent[]; // Hat's events
}
HatPropsConfig
The Hat's ID property is required and thus is not included in the config. The rest of the properties are optional.
To choose Scalar properties (non-object), include their key with a value of true.
To choose an Object property, include its key with a value compatible with the object's config type:
For single-object properties (e.g. tree), the config type includes the object's available properties without filters.
For multi-object properties (e.g. wearers), the config type includes both the object's available properties and optional filters (currently supports only the 'first' filter).
interface HatsConfig {
props: HatPropsConfig; // properties to include in each hat
filters?: { // filters to apply on the property query
first?: number; // fetch only the 'first' amount of hats
};
}
Wearer Types
Wearer
interface Wearer {
id: `0x${string}`; // Wearer's address
currentHats?: Hat[]; // Wearer's current Hats
mintEvent?: HatsEvent[]; // Hat mint events for the Wearer
burnEvent?: HatsEvent[]; // Hat burn events for the Wearer
}
WearerPropsConfig
The Wearer's ID property is required and thus is not included in the config. The rest of the properties are optional.
To choose Scalar properties (non-object), include their key with a value of true.
To choose an Object property, include its key with a value compatible with the object's config type:
For single-object properties (e.g. the tree property of a Hat), the config type includes the object's available properties.
For multi-object properties (e.g. currentHats), the config type includes both the object's available properties and optional filters (currently supports only the 'first' filter).
interface WearerPropsConfig {
props: WearerPropsConfig; // properties to include in each wearer
filters?: { // filters to apply on the property query
first?: number; // fetch only the 'first' amount of wearers
};
}
Tree Types
Tree
interface Tree {
id: `0x${string}`; // Tree ID (Tree's top-hat domain - first 4 bytes of the top-hat ID)
hats?: Hat[]; // Tree's Hats
childOfTree?: Tree; // if linked, the Tree which this Tree is linked to
parentOfTrees?: Tree[]; // Trees which are linked to this Tree
linkedToHat?: Hat; // if linked, the Hat which this Tree is linked to
linkRequestFromTree?: Tree[]; // Trees with a linkage request to this Tree
requestedLinkToTree?: Tree; // Tree which this Tree has a linkage request to
requestedLinkToHat?: Hat; // Hat which this Tree has a linkage request to
events?: HatsEvent[]; // Tree's events
}
TreePropsConfig
The Tree's ID property is required and thus is not included in the config. The rest of the properties are optional.
To choose Scalar properties (non-object), include their key with a value of true.
To choose an Object property, include its key with a value compatible with the object's config type:
For single-object properties (e.g. childOfTree), the config type includes the object's available properties.
For multi-object properties (e.g. hats), the config type includes both the object's available properties and optional filters (currently supports only the 'first' filter).
interface TreePropsConfig {
props: TreePropsConfig; // properties to include in each tree
filters?: { // filters to apply on the property query
first?: number; // fetch only the 'first' amount of trees
};
}
Event Types
HatsEventBase
Base type, which contains the common properties of Hats Events, and which is then extended by each specific event.
interface HatsEventBase {
id: string; // Event's ID
timestamp?: bigint; // Event's timestamp
blockNumber?: number; // Event's block number
transactionID?: string; // transaction ID which the Event was emitted in
hat?: Hat; // Hat that relates to the Event
tree?: Tree; // Tree that relates to the Event
}
HatsEventPropsConfig
Query configuration for the basic properties of a Hats Event.
The HatsEvent's ID property is required and thus is not included in the config. The rest of the properties are optional.
To choose Scalar properties (non-object), include their key with a value of true. To choose an Object property, include its key with a value compatible with the object's config.
interface ClaimsHatter {
id: string; // ClaimsHatter's ID
claimableHats?: Hat[]; // Hats made claimable by this Hatter
claimableForHats?: Hat[]; // Hats made 'claimable for' by this Hatter
}
ClaimsHatterPropsConfig
Query configuration for a ClaimsHatter's properties.
The ClaimsHatter's ID property is required and thus is not included in the config. The rest of the properties are optional.
interface ClaimsHattersConfig {
props: ClaimsHatterPropsConfig; // properties to include in each claims hatter
filters?: { // filters to apply on the property query
first?: number; // fetch only the 'first' amount of hatters
};
}
More
EndpointsConfig
Subgraph endpoints configuration, optionally provided at the client's creation.