# Fetching Wearers

### <mark style="color:purple;">getWearer</mark>

Get a Wearer by its address.

```typescript
const wearer = await hatsSubgraphClient.getWearer({
    chainId,
    wearerAddress,
    props,
});
```

***Arguments***:

```typescript
{
    chainId: number;
    wearerAddress:`0x${string}`;
    props: WearerPropsConfig;
}
```

* `chainId` - ID of the chain to fetch from.
* `wearerAddress` - Wearer's address.
* `props` - Wearer's properties to fetch, including the ones of nested objects. Check the [WearerPropsConfig](/for-developers/v1-sdk/subgraph/types.md#wearerpropsconfig) type for the available properties and query filters.

***Response***:

```typescript
Wearer
```

A [Wearer object](/for-developers/v1-sdk/subgraph/types.md#wearer), containing the chosen properties.

***Example:***

```typescript
const res = await client.getWearer({
  chainId: 10, // optimism
  wearerAddress: "0x1230000000000000000000000000000000000000",
  props: {
    currentHats: { // get the wearer's hats
      props: {
        status: true, // for each hat, include its status (active/inactive)
      },
    },
    mintEvent: { // get the wearer's hat minting events
      props: {
        blockNumber: true, // for each event, include its block number
      },
      filters: {
        first: 1, // fetch only the latest event
      },
    },
  },
});
```

### <mark style="color:purple;">getWearersOfHatPaginated</mark>

Paginate over the Wearers of a Hat.

```typescript
const wearers = await hatsSubgraphClient.getWearersOfHatPaginated({
    chainId,
    hatId,
    props,
    page,
    perPage,
});
```

***Arguments***:

```typescript
{
    chainId: number;
    hatId: bigint;
    props: WearerPropsConfig;
    page: number;
    perPage: number;
}
```

* `chainId` - ID of the chain to fetch from.
* `hatId` - ID of the hat of which wearers to fetch.
* `props` - Wearer's properties to fetch, including the ones of nested objects. Check the [WearerPropsConfig](/for-developers/v1-sdk/subgraph/types.md#wearerpropsconfig) type for the available properties and query filters.
* `page` - Number of page to fetch.
* `perPage` - Number of Wearers to fetch in each page.

***Response***:

```typescript
Wearer[]
```

An array of  [Wearer objects](/for-developers/v1-sdk/subgraph/types.md#wearer), containing the chosen properties.

***Example:***

```typescript
// get the first 10 wearers of a given hat
const res = await client.getWearersOfHatPaginated({
  chainId: 10,
  props: {}, // for each wearer, include only its ID (address)
  hatId: BigInt("0x0000000100020001000100000000000000000000000000000000000000000000"),
  page: 0,
  perPage: 10,
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hatsprotocol.xyz/for-developers/v1-sdk/subgraph/fetching-wearers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
