Subgraph

Hungry for data? Hot n' fresh Superfluid subgraphs ready to consume!

Get useful insights into Superfluid using our subgraphs. Use the GraphQL Playground to start testing on any network.

URLs

Click a link to start testing queries in the playground:

Resources

Contributing & Local Deployment

If you'd like to help improve the subgraph, there is a complete development guide available in the repo:

Helpful Tips

  • All addresses (id, underlyingAddress, etc.) are lowercase. Be sure to convert addresses to lowercase first before making queries.

Examples

There are many different ways to get the same data using graphql. Here are just some examples to help get you started using the Superfluid subgraphs:

How many tokens are there?

The number of items returned by a query can sometimes be limited. In this example, we are explicitly requesting that up to 1000 items should be returned, by using the first parameter.

{
tokens(first: 1000) {
id
symbol
name
underlyingAddress
}
}

How much USDCx has Alice streamed to Bob?

The Subgraph can only return a flow's sum since the last on-chain event (flowUpdated, flowCreated, or flowDeleted). Therefore, if flowRate is greater than zero, you will need to calculate the tokens flowed since the last event. Use this equation to get the the total sum of tokens flowed:

​totalSum=sum+flowRate(currentTimestampβˆ’lastUpdate)totalSum = sum + flowRate(currentTimestamp-lastUpdate)

{
tokens(where: { symbol: "USDCx" }) {
flows(
where: {
owner: "0x658e1b019f2f30c8089a9ae3ae5820f335bd9ce4"
recipient: "0xd66e40b0c30595bec72153b502ac1e0c4785991b"
}
) {
sum
flowRate
lastUpdate
}
}
}

Your query here!

If you design a useful query, let us know and we will share it here!

@superfluid-finance/data-js-sdk

Coming soon is a handy library that will "wraps" subgraph. Instead of spinning up Apollo-graphql, and hand-crafting queries, you can do something like this:

const totalSum = sfData.flowed({ owner, recipient, tokenAddress });