Skip to content

Commit 07bca52

Browse files
committedApr 1, 2025
refactor: update stats manifest with new deployment ids, move to an npm workspace
1 parent ed2a603 commit 07bca52

File tree

11 files changed

+3337
-27
lines changed

11 files changed

+3337
-27
lines changed
 

‎.gitignore

+40
Original file line numberDiff line numberDiff line change
@@ -1 +1,41 @@
1+
# Dependencies
2+
node_modules
3+
.pnpm-store
4+
5+
# Graph
6+
generated
7+
build
8+
.env
9+
10+
# IDE
111
.idea
12+
.vscode
13+
*.swp
14+
*.swo
15+
16+
# OS
17+
.DS_Store
18+
Thumbs.db
19+
20+
# Logs
21+
logs
22+
*.log
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
pnpm-debug.log*
27+
28+
# Local Graph Node
29+
graph-node
30+
data
31+
32+
# Build outputs
33+
dist
34+
build
35+
*.wasm
36+
*.wasm.map
37+
38+
# Environment variables
39+
.env
40+
.env.local
41+
.env.*.local

‎block-cost-subgraph/package.json

-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,5 @@
77
"create-local": "graph create --node http://localhost:8020/ block-cost-subgraph",
88
"remove-local": "graph remove --node http://localhost:8020/ block-cost-subgraph",
99
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001/ block-cost-subgraph"
10-
},
11-
"devDependencies": {
12-
"@graphprotocol/graph-cli": "0.95.0",
13-
"@graphprotocol/graph-ts": "0.37.0"
1410
}
1511
}

‎block-cost-subgraph/pnpm-lock.yaml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎block-size-subgraph/package.json

-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,5 @@
77
"create-local": "graph create --node http://localhost:8020/ block-size-subgraph",
88
"remove-local": "graph remove --node http://localhost:8020/ block-size-subgraph",
99
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001/ block-size-subgraph"
10-
},
11-
"devDependencies": {
12-
"@graphprotocol/graph-cli": "0.95.0",
13-
"@graphprotocol/graph-ts": "0.37.0"
1410
}
1511
}

‎block-stats-subgraph/package.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22
"name": "block-stats-subgraph",
33
"license": "MIT",
44
"scripts": {
5-
"codegen": "graph codegen --ipfs http://localhost:5001/",
5+
"codegen": "graph codegen",
66
"build": "graph build",
77
"create-local": "graph create --node http://localhost:8020/ block-stats-subgraph",
88
"remove-local": "graph remove --node http://localhost:8020/ block-stats-subgraph",
99
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001/ block-stats-subgraph"
10-
},
11-
"devDependencies": {
12-
"@graphprotocol/graph-cli": "0.95.0",
13-
"@graphprotocol/graph-ts": "0.37.0"
1410
}
1511
}

‎block-stats-subgraph/src/mapping.ts

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {BigInt, Bytes, EntityOp, store} from "@graphprotocol/graph-ts";
2-
import {Block, BlockDataSource} from "../generated/schema";
3-
import {BlockTime} from "../generated/subgraph-QmcKB3XQyfNM2Uzzeyd9UmGqsw83Ysh8t9LGQD94DdfSS7";
4-
import {BlockCost} from "../generated/subgraph-QmQ2kJphSSsSUXqnSAKLvxmhPGNxjVtrTsLTUPeCszns17";
5-
import {BlockSize} from "../generated/subgraph-QmQRWu5c2EqssTHjGJyD9cUKRrArX6TGtVUWdYajdeC4My";
1+
import { BigInt, Bytes, store } from "@graphprotocol/graph-ts";
2+
import { Block, BlockDataSource } from "../generated/schema";
3+
import { BlockTime } from "../generated/subgraph-QmVZTjnDRD7LNpg7gAPQCJEcSUX3LzvdRkER852Gqhmr7w";
4+
import { BlockCost } from "../generated/subgraph-QmTnon3zvaUiufvGNCVDcScYqM5r9QH7DpvTy3V4Zobvfi";
5+
import { BlockSize } from "../generated/subgraph-QmeMoJaBgt82j1ByNM8XBhfc8wM8z7dbzETsYXwt9HdMUA";
66

77
export function handleBlockTime(blockTime: BlockTime): void {
88
let blockData = loadOrCreateBlockData(blockTime.id, blockTime.number);
@@ -43,11 +43,15 @@ function loadOrCreateBlockData(id: string, number: BigInt): BlockDataSource {
4343
}
4444

4545
function maybeCreateBlock(blockData: BlockDataSource): void {
46-
if (blockData.blockTime === null || blockData.gasUsed === null || blockData.size === null) {
46+
if (
47+
blockData.blockTime === null ||
48+
blockData.gasUsed === null ||
49+
blockData.size === null
50+
) {
4751
return;
4852
}
4953

50-
let block = new Block('auto');
54+
let block = new Block("auto");
5155

5256
block.hash = Bytes.fromHexString(blockData.id);
5357
block.number = blockData.number;

‎block-stats-subgraph/subgraph.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dataSources:
1818
#
1919
# Any change to the source subgraph will generate a new deployment ID,
2020
# and the address should be updated to reflect the changes.
21-
address: "QmcKB3XQyfNM2Uzzeyd9UmGqsw83Ysh8t9LGQD94DdfSS7"
21+
address: "QmVZTjnDRD7LNpg7gAPQCJEcSUX3LzvdRkER852Gqhmr7w"
2222

2323
# The same start block as in the source subgraph.
2424
startBlock: 10000000
@@ -49,7 +49,7 @@ dataSources:
4949
#
5050
# Any change to the source subgraph will generate a new deployment ID,
5151
# and the address should be updated to reflect the changes.
52-
address: "QmQ2kJphSSsSUXqnSAKLvxmhPGNxjVtrTsLTUPeCszns17"
52+
address: "QmTnon3zvaUiufvGNCVDcScYqM5r9QH7DpvTy3V4Zobvfi"
5353

5454
# The same start block as in the source subgraph.
5555
startBlock: 10000000
@@ -80,7 +80,7 @@ dataSources:
8080
#
8181
# Any change to the source subgraph will generate a new deployment ID,
8282
# and the address should be updated to reflect the changes.
83-
address: "QmQRWu5c2EqssTHjGJyD9cUKRrArX6TGtVUWdYajdeC4My"
83+
address: "QmeMoJaBgt82j1ByNM8XBhfc8wM8z7dbzETsYXwt9HdMUA"
8484

8585
# The same start block as in the source subgraph.
8686
startBlock: 10000000

‎block-time-subgraph/package.json

-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,5 @@
77
"create-local": "graph create --node http://localhost:8020/ block-time-subgraph",
88
"remove-local": "graph remove --node http://localhost:8020/ block-time-subgraph",
99
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001/ block-time-subgraph"
10-
},
11-
"devDependencies": {
12-
"@graphprotocol/graph-cli": "0.95.0",
13-
"@graphprotocol/graph-ts": "0.37.0"
1410
}
1511
}

‎package.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "subgraph-composition-example",
3+
"private": true,
4+
"scripts": {
5+
"codegen": "pnpm -r run codegen",
6+
"build": "pnpm -r run build",
7+
"deploy-local": "pnpm -r run deploy-local"
8+
},
9+
"devDependencies": {
10+
"@graphprotocol/graph-cli": "0.95.0",
11+
"@graphprotocol/graph-ts": "0.37.0"
12+
}
13+
}

0 commit comments

Comments
 (0)
Please sign in to comment.