-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsubgraphs.ts
28 lines (24 loc) · 924 Bytes
/
subgraphs.ts
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
import type { NetworkName } from '@ragetrade/sdk'
import { devtoolsExchange } from '@urql/devtools'
import type { Client } from 'urql'
import { createClient, defaultExchanges } from 'urql'
const exchanges = [devtoolsExchange, ...defaultExchanges]
export const arbitrumClient = createClient({
// url: "https://api.thegraph.com/subgraphs/name/fr0ntenddev/rage-trade-arbitrum-mainnet",
url: 'https://api.thegraph.com/subgraphs/name/fr0ntenddev/rage-trade',
exchanges
})
export const arbitrumGoerliClient = createClient({
url: 'https://api.thegraph.com/subgraphs/name/fr0ntenddev/rage-trade-arbitrum-goerli',
exchanges
})
export function getSubgraph(networkName: NetworkName): Client {
switch (networkName) {
case 'arbmain':
return arbitrumClient
case 'arbgoerli':
return arbitrumGoerliClient
default:
throw new Error(`Subgraph not available for the network: ${networkName}`)
}
}