Skip to main content

Class: SubgraphApi

TheGraph API client for CoW Protocol.

Constructors

constructor

new SubgraphApi(context?): SubgraphApi

Create a new CoW Protocol API instance.

Parameters

NameTypeDescription
contextPartial<SubgraphApiContext>Any properties of the SubgraphApiContext may be overridden by passing a PartialSubgraphApiContext.

Returns

SubgraphApi

Defined in

external/cow-sdk/src/subgraph/api.ts:54

Properties

API_NAME

API_NAME: string = 'CoW Protocol Subgraph'

Defined in

external/cow-sdk/src/subgraph/api.ts:46


context

context: SubgraphApiContext

Defined in

external/cow-sdk/src/subgraph/api.ts:48

Methods

getContextWithOverride

getContextWithOverride(contextOverride?): SubgraphApiContext

Override parts of the context for a specific call.

Parameters

NameTypeDescription
contextOverridePartial<SubgraphApiContext>Override the context for this call only.

Returns

SubgraphApiContext

The context with the override applied.

Defined in

external/cow-sdk/src/subgraph/api.ts:129


getEnvConfigs

getEnvConfigs(env): SubgraphApiBaseUrls

Get the base URLs for the given environment.

Parameters

NameTypeDescription
envCowEnvThe environment to get the base URLs for.

Returns

SubgraphApiBaseUrls

The base URLs for the given environment.

Defined in

external/cow-sdk/src/subgraph/api.ts:138


getLastDaysVolume

getLastDaysVolume(days, contextOverride?): Promise<LastDaysVolumeQuery>

Query the volume over the last N days from TheGraph for the CoW Protocol.

Parameters

NameTypeDescription
daysnumberThe number of days to query.
contextOverridePartial<SubgraphApiContext>Override the context for this call only.

Returns

Promise<LastDaysVolumeQuery>

The volume for the last N days.

Defined in

external/cow-sdk/src/subgraph/api.ts:77


getLastHoursVolume

getLastHoursVolume(hours, contextOverride?): Promise<LastHoursVolumeQuery>

Query the volume over the last N hours from TheGraph for the CoW Protocol.

Parameters

NameTypeDescription
hoursnumberThe number of hours to query.
contextOverridePartial<SubgraphApiContext>Override the context for this call only.

Returns

Promise<LastHoursVolumeQuery>

The volume for the last N hours.

Defined in

external/cow-sdk/src/subgraph/api.ts:87


getTotals

getTotals(contextOverride?): Promise<{ __typename?: "Total" ; feesEth?: any ; feesUsd?: any ; orders: any ; settlements: any ; tokens: any ; traders: any ; volumeEth?: any ; volumeUsd?: any }>

Query the totals from TheGraph for the CoW Protocol.

Parameters

NameTypeDescription
contextOverridePartial<SubgraphApiContext>Override the context for this call only.

Returns

Promise<{ __typename?: "Total" ; feesEth?: any ; feesUsd?: any ; orders: any ; settlements: any ; tokens: any ; traders: any ; volumeEth?: any ; volumeUsd?: any }>

The totals for the CoW Protocol.

Defined in

external/cow-sdk/src/subgraph/api.ts:66


runQuery

runQuery<T>(query, variables?, contextOverride?): Promise<T>

Run a query against the CoW Protocol Subgraph.

Type parameters

Name
T

Parameters

NameTypeDefault valueDescription
querystring | DocumentNodeundefinedGQL query string or DocumentNode.
variablesundefined | VariablesundefinedTo be passed to the query.
contextOverridePartial<SubgraphApiContext>{}Override the context for this call only.

Returns

Promise<T>

Results of the query.

Throws

CowError if the query fails.

Defined in

external/cow-sdk/src/subgraph/api.ts:102