-
Notifications
You must be signed in to change notification settings - Fork 261
Expand file tree
/
Copy pathsubgraphApiSlice.ts
More file actions
25 lines (20 loc) · 1.04 KB
/
subgraphApiSlice.ts
File metadata and controls
25 lines (20 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import {type CreateApi} from '@reduxjs/toolkit/query';
import {coreModuleName} from '@reduxjs/toolkit/query';
import {typeGuard} from '../../../utils';
import {cacheTagTypes} from '../cacheTags/CacheTagTypes';
import {CacheTime} from '../cacheTime';
import {getSerializeQueryArgs} from '../getSerializeQueryArgs';
type ModuleName = typeof coreModuleName;
import {subgraphBaseQuery} from './subgraphBaseQuery';
import {SubgraphEndpointBuilder} from './subgraphEndpointBuilder';
import {SubgraphReducerPath} from './subgraphReducerPath';
export const createSubgraphApiSlice = <T extends ModuleName>(createRtkQueryApi: CreateApi<T>) =>
createRtkQueryApi({
keepUnusedDataFor: CacheTime.OneMinute,
reducerPath: typeGuard<SubgraphReducerPath>('superfluid_subgraph'),
baseQuery: subgraphBaseQuery(),
tagTypes: cacheTagTypes,
endpoints: (_builder: SubgraphEndpointBuilder) => ({}),
serializeQueryArgs: getSerializeQueryArgs(),
});
export type SubgraphApiSliceEmpty = ReturnType<typeof createSubgraphApiSlice>;