Installation
Features
- SubgraphApi Client - Dedicated client for subgraph querying
- Pre-built Queries - Common queries for protocol statistics
- Multi-chain Support - Currently available on Ethereum, Gnosis Chain, Arbitrum One, Base, and Sepolia (subset of all supported CoW Protocol chains)
- Type-safe Responses - All GraphQL responses are fully typed
- Custom Query Support - Execute custom GraphQL queries with type safety
Constructor
string
required
API key from TheGraph Studio
SubgraphApiOptions
Optional configuration
Methods
getTotals
Get overall protocol statistics including tokens, orders, traders, settlements, volume, and fees.string
Total number of unique tokens traded
string
Total number of orders placed
string
Total number of unique traders
string
Total number of settlements
string
Total trading volume in USD
string
Total fees collected in USD
getLastDaysVolume
Get historical volume data for a specified number of days.number
required
Number of days to query (e.g., 7, 30)
DailyTotal[]
Array of daily volume totals
getLastHoursVolume
Get historical volume data for a specified number of hours.number
required
Number of hours to query (e.g., 24, 48)
HourlyTotal[]
Array of hourly volume totals
runQuery
Execute a custom GraphQL query with full type safety.string | DocumentNode
required
GraphQL query string or parsed DocumentNode
object
Optional query variables
Usage Examples
Basic Setup
Query Protocol Metrics
Query Historical Data
Custom Queries
Multi-Chain Queries
Supported Chains
The SubgraphApi currently supports the following networks (a subset of the full CoW Protocol chain list):- Ethereum Mainnet
- Gnosis Chain
- Arbitrum One
- Base
- Sepolia Testnet