GraphQL examples
Use one of the official endpoints from Airdrops Indexers. Address filter inputs must be lowercase.
Get recent campaigns for an asset
This query returns recent campaigns for an ERC-20 asset on a specific chain.
- The Graph
- Envio
query getCampaignsForAsset($assetAddress: Bytes!, $chainId: BigInt!, $first: Int = 10) {
campaigns(
first: $first
orderBy: timestamp
orderDirection: desc
where: { chainId: $chainId, asset_: { address: $assetAddress } }
) {
id
address
chainId
category
admin
lockup
aggregateAmount
claimedAmount
claimedCount
totalRecipients
asset {
address
symbol
decimals
}
}
}
query getCampaignsForAsset($assetAddress: String!, $chainId: numeric!, $limit: Int = 10) {
campaigns: Campaign(
limit: $limit
order_by: [{ timestamp: desc }]
where: { chainId: { _eq: $chainId }, asset: { address: { _eq: $assetAddress } } }
) {
id
address
chainId
category
admin
lockup
aggregateAmount
claimedAmount
claimedCount
totalRecipients
asset {
address
symbol
decimals
}
}
}
For larger maintained fixtures, see the Indexers equivalence queries. Schema source: src/schemas/airdrops.graphql.