@cowprotocol/cow-sdk 4.0.6 → 4.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/cow-sdk",
3
- "version": "4.0.6",
3
+ "version": "4.0.7",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "files": [
6
6
  "/dist"
@@ -1,9 +1,13 @@
1
1
  import { LastDaysVolumeQuery, LastHoursVolumeQuery, TotalsQuery } from './graphql';
2
2
  import { DocumentNode } from 'graphql/index';
3
3
  import { Variables } from 'graphql-request';
4
- import { ApiContext, PartialApiContext } from '../common/configs';
4
+ import { ApiContext } from '../common/configs';
5
5
  import { SupportedChainId } from '../common/chains';
6
6
  type SubgraphApiBaseUrls = Record<SupportedChainId, string | null>;
7
+ interface SubgraphApiContext extends Omit<ApiContext, 'baseUrls'> {
8
+ baseUrls?: SubgraphApiBaseUrls;
9
+ }
10
+ type PartialSubgraphApiContext = Partial<SubgraphApiContext>;
7
11
  /**
8
12
  * CoW Protocol Production Subgraph API configuration.
9
13
  * @see {@link https://api.thegraph.com/subgraphs/name/cowprotocol/cow}
@@ -23,45 +27,45 @@ export declare const SUBGRAPH_STAGING_CONFIG: SubgraphApiBaseUrls;
23
27
  */
24
28
  export declare class SubgraphApi {
25
29
  API_NAME: string;
26
- context: ApiContext;
30
+ context: SubgraphApiContext;
27
31
  /**
28
32
  * Create a new CoW Protocol API instance.
29
- * @param context Any properties of the {@link ApiContext} may be overridden by passing a {@link PartialApiContext}.
33
+ * @param context Any properties of the {@link SubgraphApiContext} may be overridden by passing a {@link PartialSubgraphApiContext}.
30
34
  */
31
- constructor(context?: PartialApiContext);
35
+ constructor(context?: PartialSubgraphApiContext);
32
36
  /**
33
37
  * Query the totals from TheGraph for the CoW Protocol.
34
38
  * @param contextOverride Override the context for this call only.
35
39
  * @returns The totals for the CoW Protocol.
36
40
  */
37
- getTotals(contextOverride?: PartialApiContext): Promise<TotalsQuery['totals'][0]>;
41
+ getTotals(contextOverride?: PartialSubgraphApiContext): Promise<TotalsQuery['totals'][0]>;
38
42
  /**
39
43
  * Query the volume over the last N days from TheGraph for the CoW Protocol.
40
44
  * @param {number} days The number of days to query.
41
- * @param {PartialApiContext} contextOverride Override the context for this call only.
45
+ * @param {PartialSubgraphApiContext} contextOverride Override the context for this call only.
42
46
  * @returns The volume for the last N days.
43
47
  */
44
- getLastDaysVolume(days: number, contextOverride?: PartialApiContext): Promise<LastDaysVolumeQuery>;
48
+ getLastDaysVolume(days: number, contextOverride?: PartialSubgraphApiContext): Promise<LastDaysVolumeQuery>;
45
49
  /**
46
50
  * Query the volume over the last N hours from TheGraph for the CoW Protocol.
47
51
  * @param {number} hours The number of hours to query.
48
- * @param {PartialApiContext} contextOverride Override the context for this call only.
52
+ * @param {PartialSubgraphApiContext} contextOverride Override the context for this call only.
49
53
  * @returns The volume for the last N hours.
50
54
  */
51
- getLastHoursVolume(hours: number, contextOverride?: PartialApiContext): Promise<LastHoursVolumeQuery>;
55
+ getLastHoursVolume(hours: number, contextOverride?: PartialSubgraphApiContext): Promise<LastHoursVolumeQuery>;
52
56
  /**
53
57
  * Run a query against the CoW Protocol Subgraph.
54
58
  * @param {string | DocumentNode} query GQL query string or DocumentNode.
55
59
  * @param {Variables | undefined} variables To be passed to the query.
56
- * @param {PartialApiContext} contextOverride Override the context for this call only.
60
+ * @param {PartialSubgraphApiContext} contextOverride Override the context for this call only.
57
61
  * @returns Results of the query.
58
62
  * @throws {@link CowError} if the query fails.
59
63
  */
60
- runQuery<T>(query: string | DocumentNode, variables?: Variables | undefined, contextOverride?: PartialApiContext): Promise<T>;
64
+ runQuery<T>(query: string | DocumentNode, variables?: Variables | undefined, contextOverride?: PartialSubgraphApiContext): Promise<T>;
61
65
  /**
62
66
  * Override parts of the context for a specific call.
63
- * @param {PartialApiContext} contextOverride Override the context for this call only.
64
- * @returns {ApiContext} The context with the override applied.
67
+ * @param {PartialSubgraphApiContext} contextOverride Override the context for this call only.
68
+ * @returns {SubgraphApiContext} The context with the override applied.
65
69
  */
66
70
  private getContextWithOverride;
67
71
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/cow-sdk",
3
- "version": "4.0.6",
3
+ "version": "4.0.7",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "files": [
6
6
  "/dist"