Fetching Wearers
Last updated
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
},
},
},
});const wearers = await hatsSubgraphClient.getWearersOfHatPaginated({
chainId,
hatId,
props,
page,
perPage,
});{
chainId: number;
hatId: bigint;
props: WearerPropsConfig;
page: number;
perPage: number;
}Wearer[]// 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,
});