-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathgraphclient.config.ts
More file actions
37 lines (36 loc) · 1.04 KB
/
graphclient.config.ts
File metadata and controls
37 lines (36 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
26
27
28
29
30
31
32
33
34
35
36
37
import {
createRenameFieldTransform,
createRenameTypeTransform,
defineConfig as defineComposeConfig,
loadGraphQLHTTPSubgraph,
} from '@graphprotocol/client-compose-cli'
import { GraphQLID } from 'graphql'
export const composeConfig = defineComposeConfig({
subgraphs: [
{
sourceHandler: loadGraphQLHTTPSubgraph('nft', {
endpoint: 'https://api.thegraph.com/subgraphs/name/amxx/eip721-subgraph',
}),
transforms: [
// Resolve conflicts between subgraphs
createRenameFieldTransform((field, fieldName, typeName) => {
if (typeName === 'Account' && fieldName === 'id') {
field.type = GraphQLID
}
return fieldName
}),
createRenameTypeTransform((type) => {
if (type.name === 'Account') {
return 'User'
}
return type.name
}),
],
},
{
sourceHandler: loadGraphQLHTTPSubgraph('uniswap', {
endpoint: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2',
}),
},
],
})