Hats Protocol Docs
hatsprotocol.xyzGithub
  • ๐Ÿ‘‹Welcome to Hats Protocol
  • ๐ŸงขGetting Started with Hats
  • โญQuick Start
  • Using The Hats App
    • ๐Ÿค Essentials For Hat Wearers
    • ๐ŸŽฉCreating My First Hat
    • ๐Ÿง™Admins: Creating, Issuing, and Revising Hats
    • ๐Ÿ‘ฅWhat Hats Do I Need?
    • ๐ŸŒณDrafting, Exporting, and Deploying Tree Changes
    • ๐Ÿ—๏ธSetting a Hat's Basic Properties
    • ๐ŸฅณAdding Wearers
    • ๐Ÿ”Connecting Hats w/ Permissions & Authorities
      • Types of Hat-Powered Authorities
      • Connecting Hats to Token Gates
        • Hats Protocol Contract Addresses
        • Finding a Hat's Token ID
      • Documenting Hat Powers & Responsibilities
    • ๐ŸŒŸRevocation & Eligibility: Requirements for Wearers
    • โšกDeactivating & Reactivating Hats
    • โœ…Making Hats Claimable
    • ๐Ÿ”—Linking Trees Together
    • โ›“๏ธHats Protocol Supported Chains
    • โ“Glossary & FAQ
  • Hats Integrations
    • ๐Ÿ”Permissions & Authorities
      • Coordinape
      • Council Voting Vault
      • Charmverse
      • Discord
        • Collab.Land --> Discord
        • Guild.xyz --> Discord
      • Farcaster Casting Rights
      • Fileverse
      • Google Workspace
      • Hats Account
      • Role-Based Compensation
      • Safe Multisig Signing Authority
      • Telegram
        • Collab.Land --> Telegram
        • Guild.xyz --> Telegram
      • Snapshot: Voting, Weight & Proposal Creation
      • Wonderverse
    • ๐ŸŒŸEligibility & Accountability Criteria
      • Agreement Eligibility
      • Allow-List Eligibility
      • CoLinks Eligibility
      • ERC20 Eligibility
      • ERC721 Eligibility
      • ERC1155 Eligibility
      • Hat-Wearing Eligibility
      • Hats Election Eligibility
      • JokeRace Eligibility
      • Pass-Through (Hat-Based) Eligibility
      • Staking Eligibility
      • Subscription or Membership Fee (Unlock Protocol)
      • Gitcoin Passport Eligibility
    • โšกActivation & Deactivation Criteria
      • Seasonal/ Time-Expiry Toggle
      • Pass-Through (Hat-Based) Toggle
    • ๐Ÿ‘ทHatter Modules
      • Multi Claims Hatter
      • DAOhaus Moloch v3 Membership & Share Allocation
  • For Developers
    • ๐Ÿ‘ทHats Protocol, for Developers
      • Hat Properties
      • Wearing a Hat
      • Hat Admins & Hatter Contracts
      • Hats Trees
      • Hat IDs
      • Linking Hats Trees
      • Eligibility Modules
      • Toggle Modules
      • Hat Mutability and Editing
      • Creating Hats
      • Minting Hats
      • Transfering Hats
      • Renouncing Hats
      • Batch Actions
      • Hat Image URIs
      • ERC1155 Compatibility
      • โ›“๏ธSupported Chains
    • ๐Ÿค–v1 Protocol Spec
      • Hats.sol
      • HatsEvents.sol
      • HatsErrors.sol
      • HatsIdUtilities.sol
      • Interfaces
        • IHats.sol
        • IHatsIdUtilities.sol
        • IHatsEligibility.sol
        • IHatsToggle.sol
    • ๐Ÿ–ฅ๏ธv1 SDK
      • Core
        • Getting Started
        • Onchain Reads
        • Onchain Writes
        • Multicall
        • Claiming Hats
        • Utilities
      • Subgraph
        • Getting Started
        • Fetching Hats
        • Fetching Wearers
        • Fetching Trees
        • Misc
        • Types
      • Hat Details
        • Getting Started
        • Usage
    • ๐Ÿ”ญv1 Subgraphs
    • ๐ŸงฉHats Modules
      • ๐Ÿ”ŒModules SDK
        • Getting Started
        • Get Available Modules
        • Create New Instance/s
        • Composing Modules
        • Interact With Instances
        • Utilities
        • Types
      • โš’๏ธBuilding Hats Modules
        • Inside a Hats Module
          • Immutable Arguments
          • Module Setup
          • Versioning
        • Creating New Modules
        • How Module Instances Are Deployed
        • Modules Registry
        • About Module Chains
    • ๐Ÿ”Hats Signer Gate v2
    • ๐Ÿ‘’Hats Signer Gate SDK
      • Getting Started
      • Creating New Instances
      • Hats Signer Gate
      • Multi Hats Signer Gate
      • HSG & MHSG Handlers
    • ๐Ÿ’ผHats Account SDK
      • 1 of N Hats Account
        • Getting Started
        • Creating New Instances
        • Executing From An Instance
        • Constants
        • Types
    • ๐ŸŒHats Security Audits
  • Legal
    • Terms
      • Terms of Service
      • Acceptable Use
      • Privacy Policy
      • Cookie Policy
      • Attribution
Powered by GitBook
On this page
  • Hat Types
  • Hat
  • HatPropsConfig
  • HatsConfig
  • Wearer Types
  • Wearer
  • WearerPropsConfig
  • WearersConfig
  • Tree Types
  • Tree
  • TreePropsConfig
  • TreesConfig
  • Event Types
  • HatsEventBase
  • HatsEventPropsConfig
  • HatCreatedEvent
  • HatMintedEvent
  • HatBurnedEvent
  • HatMutabilityChangedEvent
  • HatStatusChangedEvent
  • HatDetailsChangedEvent
  • HatEligibilityChangedEvent
  • HatToggleChangedEvent
  • HatMaxSupplyChangedEvent
  • HatImageURIChangedEvent
  • TopHatLinkRequestedEvent
  • TopHatLinkedEvent
  • WearerStandingChangedEvent
  • HatsEvent
  • Claims Hatter Types
  • ClaimsHatter
  • ClaimsHatterPropsConfig
  • ClaimsHattersConfig
  • More
  • EndpointsConfig
  1. For Developers
  2. v1 SDK
  3. Subgraph

Types

Hat Types

Hat

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

Query configuration for a Hat's properties.

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 HatPropsConfig {
  prettyId?: boolean;
  status?: boolean;
  createdAt?: boolean;
  details?: boolean;
  maxSupply?: boolean;
  eligibility?: boolean;
  toggle?: boolean;
  mutable?: boolean;
  imageUri?: boolean;
  levelAtLocalTree?: boolean;
  currentSupply?: boolean;
  tree?: TreePropsConfig;
  wearers?: WearersConfig;
  badStandings?: WearersConfig;
  admin?: HatPropsConfig;
  subHats?: HatsConfig;
  linkRequestFromTree?: TreesConfig;
  linkedTrees?: TreesConfig;
  claimableBy?: ClaimsHattersConfig;
  claimableForBy?: ClaimsHattersConfig;
  events?: HatsEventsConfig;
}

HatsConfig

Query configuration for a multi Hats property, i.e. a property that returns multiple Hats.

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

Query configuration for a Wearer's properties.

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 {
 currentHats?: HatsConfig;
  mintEvent?: HatsEventsConfig;
  burnEvent?: HatsEventsConfig;
}

WearersConfig

Query configuration for a multi Wearers property, i.e. a property that returns multiple Wearers.

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

Query configuration for a Tree's properties.

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 {
  hats?: HatsConfig;
  childOfTree?: TreePropsConfig;
  parentOfTrees?: TreesConfig;
  linkedToHat?: HatPropsConfig;
  linkRequestFromTree?: TreesConfig;
  requestedLinkToTree?: TreePropsConfig;
  requestedLinkToHat?: HatPropsConfig;
  events?: HatsEventsConfig;
}

TreesConfig

Query configuration for a multi Trees property, i.e. a property that returns multiple Trees.

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 HatsEventConfig {
  timestamp?: boolean;
  blockNumber?: boolean;
  transactionID?: boolean;
  hat?: HatPropsConfig;
  tree?: HatPropsConfig;
}

Following are the various Hats Events, emitted from Hats-Protocol in response to various actions.

Fetched events will include the event's base properties, as well as the additional properties that are included in each specific event, according to its type.

HatCreatedEvent

interface HatCreatedEvent extends HatsEventBase {
  __typename: "HatCreatedEvent";
  hatDetails: string;
  hatMaxSupply: `0x${string}`;
  hatEligibility: `0x${string}`;
  hatToggle: string;
  hatMutable: boolean;
  hatImageUri: string;
}

HatMintedEvent

interface HatMintedEvent extends HatsEventBase {
  __typename: "HatMintedEvent";
  wearer: {
    id: `0x${string}`;
  };
  operator: `0x${string}`;
}

HatBurnedEvent

interface HatBurnedEvent extends HatsEventBase {
  __typename: "HatBurnedEvent";
  wearer: {
    id: `0x${string}`;
  };
  operator: `0x${string}`;
}

HatMutabilityChangedEvent

interface HatMutabilityChangedEvent extends HatsEventBase {
  __typename: "HatMutabilityChangedEvent";
}

HatStatusChangedEvent

interface HatStatusChangedEvent extends HatsEventBase {
  __typename: "HatStatusChangedEvent";
  hatNewStatus: boolean;
}

HatDetailsChangedEvent

interface HatDetailsChangedEvent extends HatsEventBase {
  __typename: "HatDetailsChangedEvent";
  hatNewDetails: string;
}

HatEligibilityChangedEvent

interface HatEligibilityChangedEvent extends HatsEventBase {
  __typename: "HatEligibilityChangedEvent";
  hatNewEligibility: `0x${string}`;
}

HatToggleChangedEvent

interface HatToggleChangedEvent extends HatsEventBase {
  __typename: "HatToggleChangedEvent";
  hatNewToggle: `0x${string}`;
}

HatMaxSupplyChangedEvent

interface HatMaxSupplyChangedEvent extends HatsEventBase {
  __typename: "HatMaxSupplyChangedEvent";
  hatNewMaxSupply: string;
}

HatImageURIChangedEvent

interface HatImageURIChangedEvent extends HatsEventBase {
  __typename: "HatImageURIChangedEvent";
  hatNewImageURI: string;
}

TopHatLinkRequestedEvent

interface TopHatLinkRequestedEvent extends HatsEventBase {
  __typename: "TopHatLinkRequestedEvent";
  newAdmin: `0x${string}`;
}

TopHatLinkedEvent

interface TopHatLinkedEvent extends HatsEventBase {
  __typename: "TopHatLinkedEvent";
  newAdmin: `0x${string}`;
}

WearerStandingChangedEvent

interface WearerStandingChangedEvent extends HatsEventBase {
  __typename: "WearerStandingChangedEvent";
  wearer: {
    id: `0x${string}`;
  };
  wearerStanding: boolean;
}

HatsEvent

type HatsEvent =
  | HatCreatedEvent
  | HatMintedEvent
  | HatBurnedEvent
  | HatMutabilityChangedEvent
  | HatStatusChangedEvent
  | HatDetailsChangedEvent
  | HatEligibilityChangedEvent
  | HatToggleChangedEvent
  | HatMaxSupplyChangedEvent
  | HatImageURIChangedEvent
  | TopHatLinkRequestedEvent
  | TopHatLinkedEvent
  | WearerStandingChangedEvent;

Claims Hatter Types

ClaimsHatter

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 ClaimsHatterPropsConfig {
  claimableHats?: HatsConfig;
  claimableForHats?: HatsConfig;
}

ClaimsHattersConfig

Query configuration for a multi ClaimsHatters property, e.g. a property that returns multiple Claims Hatters.

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.

interface EndpointsConfig {
  [chainId: number]: { endpoint: string };
}
PreviousMiscNextHat Details

Last updated 1 year ago

๐Ÿ–ฅ๏ธ