Skip to content

Commit 6675626

Browse files
authored
Bump versions and add esm and cjs examples (#81)
1 parent e47dbab commit 6675626

File tree

15 files changed

+653
-65
lines changed

15 files changed

+653
-65
lines changed

.changeset/tender-tigers-repair.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@graphprotocol/client-auto-pagination': patch
3+
'@graphprotocol/client-block-tracking': patch
4+
'@graphprotocol/client-cli': patch
5+
---
6+
7+
Bump versions

examples/composition/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
},
1111
"dependencies": {
1212
"@graphprotocol/client-cli": "0.0.9",
13-
"@graphql-mesh/transform-prefix": "0.11.38",
14-
"@graphql-mesh/transform-rename": "0.12.39",
15-
"@graphql-mesh/transform-type-merging": "0.3.48",
13+
"@graphql-mesh/transform-prefix": "0.11.41",
14+
"@graphql-mesh/transform-rename": "0.12.42",
15+
"@graphql-mesh/transform-type-merging": "0.3.51",
1616
"concurrently": "7.1.0",
1717
"graphql": "16.3.0",
1818
"nodemon": "2.0.15",

examples/javascript-cjs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.graphclient
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
sources:
2+
- name: uniswapv2
3+
handler:
4+
graphql:
5+
endpoint: https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2
6+
- name: compoundv2
7+
handler:
8+
graphql:
9+
endpoint: https://api.thegraph.com/subgraphs/name/graphprotocol/compound-v2
10+
11+
documents:
12+
- ./example-query.graphql
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
query ExampleQuery {
2+
# this one is coming from compound-v2
3+
markets(first: 7) {
4+
borrowRate
5+
cash
6+
collateralFactor
7+
}
8+
# this one is coming from uniswap-v2
9+
pair(id: "0x00004ee988665cdda9a1080d5792cecd16dc1220") {
10+
id
11+
token0 {
12+
id
13+
symbol
14+
name
15+
}
16+
token1 {
17+
id
18+
symbol
19+
name
20+
}
21+
}
22+
}

examples/javascript-cjs/index.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const { execute } = require('./.graphclient')
2+
3+
async function main() {
4+
const response = await execute(
5+
/* GraphQL */ `
6+
{
7+
# this one is coming from compound-v2
8+
markets(first: 7) {
9+
borrowRate
10+
cash
11+
collateralFactor
12+
}
13+
# this one is coming from uniswap-v2
14+
pair(id: "0x00004ee988665cdda9a1080d5792cecd16dc1220") {
15+
id
16+
token0 {
17+
id
18+
symbol
19+
name
20+
}
21+
token1 {
22+
id
23+
symbol
24+
name
25+
}
26+
}
27+
}
28+
`,
29+
{},
30+
)
31+
32+
console.log(response)
33+
}
34+
35+
main().catch((e) => console.error(`Failed to run example:`, e))
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "javascript-cjs-example",
3+
"private": true,
4+
"version": "0.0.0",
5+
"scripts": {
6+
"start": "node index.js",
7+
"build-client": "graphclient build --fileType json",
8+
"graphiql": "graphclient serve-dev",
9+
"check": "exit 0"
10+
},
11+
"dependencies": {
12+
"@graphprotocol/client-cli": "0.0.8",
13+
"graphql": "16.3.0"
14+
}
15+
}

examples/javascript-esm/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.graphclient
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
sources:
2+
- name: uniswapv2
3+
handler:
4+
graphql:
5+
endpoint: https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2
6+
- name: compoundv2
7+
handler:
8+
graphql:
9+
endpoint: https://api.thegraph.com/subgraphs/name/graphprotocol/compound-v2
10+
11+
documents:
12+
- ./example-query.graphql
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
query ExampleQuery {
2+
# this one is coming from compound-v2
3+
markets(first: 7) {
4+
borrowRate
5+
cash
6+
collateralFactor
7+
}
8+
# this one is coming from uniswap-v2
9+
pair(id: "0x00004ee988665cdda9a1080d5792cecd16dc1220") {
10+
id
11+
token0 {
12+
id
13+
symbol
14+
name
15+
}
16+
token1 {
17+
id
18+
symbol
19+
name
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)