Skip to content

Commit 0e3de27

Browse files
saihajazf20
andauthored
chore: migrate example subpgrahs (#1204)
* move near/blocks-example * move near/recepits-example * move ethereum/gravatar-example * move arweave/blocks-transactions * move cosmos/validator-rewards * move cosmos/validator-delegation * move cosmos/osmosis-token-swaps * move cosmos/block-filtering * add readme * style run prettier * update repo * rename event handler example * example subgroah * update name * add cli dep for basic example * Revert "example subgroah" This reverts commit bf09f85. * fix test * revert * more revert * trying * remove yarn lock * scrypt needs to release a patch but for now * fix comment * prettier * remove what i can * remove truffle * prettier * use hardhat for test * trying * fix docker and tests (#1311) * fix docker and tests * run prettier * remove wasm * fix lockfile * remove yarn lock --------- Co-authored-by: Saihajpreet Singh <[email protected]> --------- Co-authored-by: Adam Fuller <[email protected]>
1 parent 2260c4e commit 0e3de27

File tree

117 files changed

+4753
-3672
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+4753
-3672
lines changed

.changeset/config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"baseBranch": "main",
1212
"updateInternalDependencies": "patch",
1313
"ignore": [
14-
"basic-event-handlers",
1514
"example-*"
1615
],
1716
"snapshot": {

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
command: pnpm run test:cli -- --forceExit
6060

6161
event-handler:
62-
name: Basic Event Handlers
62+
name: Ethereum Basic Event Handlers
6363
needs: [lint]
6464
runs-on: ubuntu-latest
6565
steps:
@@ -75,12 +75,15 @@ jobs:
7575
- name: Build Packages
7676
run: pnpm build
7777

78+
- name: Should re-link local workspace deps?
79+
run: pnpm i
80+
7881
- name: Run Tests
7982
uses: nick-fields/retry@v2
8083
with:
8184
timeout_minutes: 10
8285
max_attempts: 3
83-
command: pnpm run --filter="basic-event-handlers" test
86+
command: pnpm run --filter="example-ethereum-basic-event-handlers" test
8487

8588
ts:
8689
name: Graph TS

.gitignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ typings/
5858
.next
5959

6060
# Example subgraph build
61-
examples/example-subgraph/build
62-
examples/example-subgraph/generated
63-
examples/example-subgraph/node_modules
61+
examples/*/build
62+
examples/*/generated
63+
examples/*/node_modules
64+
examples/*/data
6465

6566
# validation tests output
6667
*/tests/cli/validation/*/generated
@@ -76,6 +77,7 @@ dist
7677

7778
# Oclif manifest
7879
oclif.manifest.json
79-
8080
# Oclif pack
8181
tmp
82+
83+
*.wasm

examples/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Example Subgraphs
2+
3+
A collection of subgraph examples to help developers get started with The Graph. Please see
4+
[the documentation](https://thegraph.com/docs) for more information.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
build/
2+
generated/
3+
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
11+
# Runtime data
12+
pids
13+
*.pid
14+
*.seed
15+
*.pid.lock
16+
17+
# Directory for instrumented libs generated by jscoverage/JSCover
18+
lib-cov
19+
20+
# Coverage directory used by tools like istanbul
21+
coverage
22+
23+
# nyc test coverage
24+
.nyc_output
25+
26+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
27+
.grunt
28+
29+
# Bower dependency directory (https://bower.io/)
30+
bower_components
31+
32+
# node-waf configuration
33+
.lock-wscript
34+
35+
# Compiled binary addons (https://nodejs.org/api/addons.html)
36+
build/Release
37+
38+
# Dependency directories
39+
node_modules/
40+
jspm_packages/
41+
42+
# TypeScript v1 declaration files
43+
typings/
44+
45+
# Optional npm cache directory
46+
.npm
47+
48+
# Optional eslint cache
49+
.eslintcache
50+
51+
# Optional REPL history
52+
.node_repl_history
53+
54+
# Output of 'npm pack'
55+
*.tgz
56+
57+
# Yarn Integrity file
58+
.yarn-integrity
59+
60+
# dotenv environment variables file
61+
.env
62+
63+
# next.js build output
64+
.next
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Arweave Blocks and Transactions Example
2+
3+
This subgraph is indexing blocks, transactions, tags, and POAs. Make sure to replace the `owner`
4+
field inside the .yaml file with the owner id.
5+
6+
> NOTE: The id of an owner is not required, the subgraph can index all blocks and transactions.
7+
8+
### Dev Dependencies
9+
10+
To be able to build an Arweave subgraph, you need a graph-cli version of 0.30.2 or above. Run the
11+
command below to update to the latest version:
12+
13+
```
14+
npm-update -g i @graphprotocol/graph-cli
15+
```
16+
17+
### Querying the Subgraph
18+
19+
With the following query, you can retrieve all the appended blocks between two dates:
20+
21+
```graphql
22+
query BlocksBetweenDates($timestamp_start: BigInt!, $timestamp_end: BigInt!) {
23+
blocks(where: { timestamp_gt: $timestamp_start, timestamp_lt: $timestamp_end }) {
24+
id
25+
timestamp
26+
height
27+
}
28+
}
29+
```
30+
31+
For more information see the docs on https://thegraph.com/docs/.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "example-arweave-blocks-transactions",
3+
"version": "0.1.0",
4+
"description": "subgraph example for Arweave",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/graphprotocol/graph-tooling",
8+
"directory": "examples/arweave-blocks-transactions"
9+
},
10+
"license": "MIT",
11+
"private": true,
12+
"scripts": {
13+
"build": "graph build",
14+
"codegen": "graph codegen",
15+
"create": "graph create arweave-example --node https://api.thegraph.com/deploy/",
16+
"create-local": "graph create arweave-example --node http://localhost:8020",
17+
"deploy": "graph deploy arweave-example --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
18+
"deploy-local": "graph deploy arweave-example -l v0.1.0 --ipfs http://localhost:5001 --node http://localhost:8020",
19+
"remove-local": "graph remove arweave-example --node http://localhost:8020"
20+
},
21+
"devDependencies": {
22+
"@graphprotocol/graph-cli": "workspace:*",
23+
"@graphprotocol/graph-ts": "workspace:*"
24+
}
25+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
type Block @entity {
2+
id: ID!
3+
4+
timestamp: BigInt!
5+
last_retarget: BigInt!
6+
height: BigInt!
7+
indep_hash: Bytes!
8+
nonce: Bytes!
9+
previous_block: Bytes!
10+
diff: Bytes!
11+
hash: Bytes!
12+
tx_root: Bytes!
13+
txs: [Bytes!]!
14+
wallet_list: Bytes!
15+
reward_addr: Bytes!
16+
tags: [Tag!]!
17+
reward_pool: Bytes!
18+
weave_size: Bytes!
19+
block_size: Bytes!
20+
cumulative_diff: Bytes!
21+
hash_list_merkle: Bytes!
22+
poa: Poa
23+
}
24+
25+
type Transaction @entity {
26+
id: ID!
27+
28+
block: Block!
29+
tx_id: Bytes!
30+
last_tx: Bytes!
31+
owner: Bytes!
32+
tags: [Tag!]!
33+
target: Bytes!
34+
quantity: Bytes!
35+
data: Bytes!
36+
data_size: Bytes!
37+
data_root: Bytes!
38+
signature: Bytes!
39+
reward: Bytes!
40+
}
41+
42+
type Poa @entity {
43+
id: ID!
44+
45+
option: String!
46+
tx_path: Bytes!
47+
data_path: Bytes!
48+
chunk: Bytes!
49+
}
50+
51+
type Tag @entity {
52+
id: ID!
53+
54+
name: Bytes!
55+
value: Bytes!
56+
}

0 commit comments

Comments
 (0)