Fetch POAPs
Once POAPs have been minted they can be fetched with PoapsClient.
Fetch single POAP
To retrieve one POAP it can be done with its ID.
import { POAP } from '@poap-xyz/poap-sdk';
const poapId = 999;
const poap: POAP = await client.get(poapId);List POAPs
Paginated POAPs are fetched using offset and limit. They can also be sorted.
import {
POAP,
PoapsSortFields,
Order,
PaginatedResult,
} from '@poap-xyz/poap-sdk';
const paginatedPOAPs: PaginatedResult<POAP> = await client.list({
offset: 0,
limit: 10,
sortField: PoapsSortFields.MintedOn,
sortDir: Order.DESC,
withMintingStats: true,
});By Collector
By giving a collector's address, the list of POAPs owned by that address can be fetched.
import {
POAP,
PoapsSortFields,
Order,
PaginatedResult,
} from '@poap-xyz/poap-sdk';
// The address of the collector.
const collectorAddress = '0xf6B6F07862A02C85628B3A9688beae07fEA9C863';
const collectorPOAPs: PaginatedResult<POAP> = await client.list({
offset: 0,
limit: 10,
sortField: PoapsSortFields.MintedOn,
sortDir: Order.ASC,
collectorAddress,
withCollectorStats: true,
});By Drop
Get all the POAPs associated to a Drop by giving the ID, and optional filter out the zero and dead addresses.
import {
POAP,
PoapsSortFields,
Order,
PaginatedResult,
} from '@poap-xyz/poap-sdk';
const dropId = 14;
const dropPOAPs: PaginatedResult<POAP> = await client.list({
offset: 0,
limit: 10,
sortField: PoapsSortFields.MintedOn,
sortDir: Order.ASC,
filterZeroAddress: true,
filterDeadAddress: true,
dropId,
withDropStats: true,
});