Digital marketing has become increasingly fast-paced, so staying ahead of the curve is essential for brand success. As of today, SubQuery projects are now a useful data source for your next credential. Let's explore how and why you should leverage SubQuery projects to supercharge your next Galxe campaign, enabling you to connect with your audience based on their interactions with your smart contracts.
GraphQL-sourced credentials, including SubQuery-based credentials, allow Galxe to pull data from your SubQuery projects or any SubQuery projects that you can publicly access.
In the following example, we are going to use a credential that confirms if a given user has ever delegated to the SubQuery Kepler Network.
In order to verify a user on Galxe, Galxe constructs a GraphQL query containing the user's address as the argument and sends it to the specified endpoint. When using a SubQuery Project as the data source, upon creating a credential simply use the “Subgraph” credential type. Note that since the GraphQL endpoint of a SubQuery project and a Subgraph are the same, you can use them interchangeably.
SubQuery maintains an official public SubQuery Project (https://explorer.subquery.network/subquery/subquery/kepler-network) that indexes key event data from the SubQuery Kepler network, which is used to power the Kepler app.
We’re going to add the GraphQL endpoint from that project (https://api.subquery.network/sq/subquery/kepler-network) to the endpoint field, and then provide the following query.
query info($address: String!) {
delegations(first: 1, filter:{delegatorId:{equalToInsensitive:$address}}) {
nodes {
id
}
}
}
This is a GraphQL query that returns the number of delegations made by a given address $address. You can use similar GraphQL query languages to make similar credentials (e.g. only deletions to a specific indexer, or reward only those that are actively indexing). Any valid GraphQL query is possible, you are limited only by the data in the project you are querying from!
Galxe then requires you to run a function to verify the validity of the response. The expression is used to evaluate against the response to check if the address is eligible for the credential. The function should return either number 1 or 0, representing if the address is eligible for this subgraph credential. You can read more about this here.
function(data) {
return data && data.delegations && data.delegations.nodes && data.delegations.nodes.length > 0 ? 1 : 0;
}
After a response is received, it will be passed to the Javascript expression, where it will return 0(false)/1(true) to indicate whether the wallet address is eligible.
And that’s it, you can quickly test the query and credential in Galxe’s UI before setting it live.
The possibilities here are endless, for example, you could use this to provide credentials to:
- Users holding or transacting with a certain token
- Users that have performed an action in your dApp (like delegating)
- Users that have a certain class of NFT
- Users that have completed a cross-chain activity, using SubQuery’s multi-chain indexing capability
Galxe's SubQuery support allows a revolution in web3 community engagement, offering opportunities for hyper-personalization, elevated engagement, invaluable data-driven insights, and optimised marketing budgets. By utilising SubQuery projects as credentials in your next campaign, you can create campaigns that deeply resonate with your audience, ensuring your brand stands out in a fiercely competitive landscape.
Embrace the power of SubQuery and watch your Galxe campaign transform into a highly effective, targeted, and results-driven community engagement masterpiece. Don't miss out on this opportunity to redefine your community engagement strategy and elevate your brand's presence in the web3 space.
SubQuery’s Galxe Campaign 🎁
The Kepler Delegation campaign used as an example above is a real campaign SubQuery is currently running and 5 random participants will be selected to share the 250 USDC prize pool. All you need to do is obtain some kSQT tokens and start delegating to your favourite indexers in the SubQuery Kepler network (and you’ll earn rewards for doing so!)
Head over to join the campaign here: https://galxe.com/subquery/campaign/GC4A4tUBkd
About SubQuery
SubQuery is a leading blockchain data indexer that provides developers with fast, flexible, universal, and decentralised APIs for web3 projects. We empower developers from over 110+ ecosystems including Ethereum, Polygon, Polkadot, Cosmos, Algorand, NEAR, and Avalanche with rich indexed data to allow them to build intuitive and immersive decentralised applications. This blockchain developer toolkit enables developers to focus on their core use case and front-end without wasting time building a custom backend for data processing activities. In the near future, the SubQuery Network will replicate this scalable and reliable solution in a completely decentralised manner.
Linktree | Website | Discord | Telegram | Twitter | Matrix | LinkedIn | YouTube