Class: SubgraphApi
TheGraph API client for CoW Protocol.
Constructors
constructor
• new SubgraphApi(context?
): SubgraphApi
Create a new CoW Protocol API instance.
Parameters
Name | Type | Description |
---|---|---|
context | Partial <SubgraphApiContext > | Any properties of the SubgraphApiContext may be overridden by passing a PartialSubgraphApiContext. |
Returns
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
Name | Type | Description |
---|---|---|
contextOverride | Partial <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
Name | Type | Description |
---|---|---|
env | CowEnv | The 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
Name | Type | Description |
---|---|---|
days | number | The number of days to query. |
contextOverride | Partial <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
Name | Type | Description |
---|---|---|
hours | number | The number of hours to query. |
contextOverride | Partial <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
Name | Type | Description |
---|---|---|
contextOverride | Partial <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
Name | Type | Default value | Description |
---|---|---|---|
query | string | DocumentNode | undefined | GQL query string or DocumentNode. |
variables | undefined | Variables | undefined | To be passed to the query. |
contextOverride | Partial <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