Workflows for pulling data from The Graph indexer with scheduled cron triggers. These workflows demonstrate the pull pattern where the workflow initiates and fetches data on a schedule.
Directory Structure
- indexer-fetch-go/ (Go): workflow.go, main.go, config.staging.json, config.production.json, workflow.yaml
- indexer-fetch-ts/ (TypeScript): main.ts, config.staging.json, config.production.json, package.json, workflow.yaml
Overview
- Query The Graph indexer using GraphQL
- Use cron triggers to schedule periodic data fetching
- Process and return JSON-formatted indexer data
- Same functionality in Go and TypeScript
Both workflows query the Uniswap V4 subgraph and fetch: pool manager statistics (pool count, tx count, total volume), ETH price from bundles.
Configuration (config.staging.json): schedule (cron), graphqlEndpoint (The Graph gateway/studio), query, variables.
Go: cd indexer-fetch-go, cre workflow simulate my-workflow --target staging-settings
TypeScript: cd indexer-fetch-ts, cre workflow simulate workflow --target staging-settings
Example use cases: monitoring Uniswap V4 pools, tracking token prices, DeFi protocol metrics.
Reference: CRE docs, The Graph docs.