-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path+page.server.ts
48 lines (43 loc) · 1.07 KB
/
+page.server.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { GraphQLClient } from 'graphql-request';
import dotenv from 'dotenv';
import { graphql } from '../generated/gql';
dotenv.config({ path: './.env.local' });
const API_KEY = process.env.API_KEY;
if (!API_KEY) {
throw new Error('API_KEY env var required');
}
// replace this with your Subgrah URL
const subgraphQueryUrl =
'https://gateway-arbitrum.network.thegraph.com/api/subgraphs/id/DZz4kDTdmzWLWsV373w2bSmoar3umKKH9y82SUKr5qmp';
const client = new GraphQLClient(subgraphQueryUrl, {
headers: {
Authorization: `Bearer ${API_KEY}`
}
});
const Subgraphs = graphql(`
query Subgraphs($first: Int, $skip: Int, $where: Subgraph_filter) {
subgraphs(first: $first, skip: $skip, where: $where) {
id
metadata {
displayName
image
description
}
owner {
id
}
}
}
`);
/** @type {import('./$types').PageLoad} */
export async function load() {
return await client.request(Subgraphs, {
first: 10,
skip: 0,
where: {
metadata_not: null,
metadata_: { description_not: null },
owner_not: '0x0000000000000000000000000000000000000000'
}
});
}