hypersub-indexer

Subscription Token Protocol (STP) indexer

Stars
6
Committers
1

Subscription Token Protocol (STP) Indexer

Ponder indexer for STP, the protocol behind Hypersub.

Example queries

Get all collections:

{
  collections(limit: 1000, orderBy: "createdAt", orderDirection: "desc") {
    items {
      id
      name
      symbol
      chainId
      totalRewardPoints
      totalCreatorEarnings
      totalReferrerRewards
    }
  }
}

Get all subscriptions for a given address:

{
  subscriptions(
    where: {
      account: "0xb6f6Dce6000cA88cC936B450cEDB16a5c15f157f"
      expiresAt_gt: "1717995000" # timestamp as of this query
    }
  ) {
    items {
      expiresAt
      createdAt
      collection {
        id
        name
        symbol
        chainId
        totalRewardPoints
        totalCreatorEarnings
        totalReferrerRewards
      }
    }
  }
}

Learn more about querying the GraphQL API in Ponder's docs.

Deploy your own

Read more in Ponder's docs.

Run locally

Install dependencies:

pnpm install

Navigate to the ponder app:

cd apps/indexer

Set your environment variables (RPC URLs):

cp .env.example .env.local

Run the indexer:

pnpm dev