https://github.com/maticnetwork/subgraphs
Subgraph for Matic contracts
https://github.com/maticnetwork/subgraphs
Last synced: 9 months ago
JSON representation
Subgraph for Matic contracts
- Host: GitHub
- URL: https://github.com/maticnetwork/subgraphs
- Owner: maticnetwork
- License: mit
- Created: 2020-09-23T04:48:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-22T18:21:29.000Z (over 2 years ago)
- Last Synced: 2025-06-22T01:47:56.971Z (12 months ago)
- Language: TypeScript
- Size: 931 KB
- Stars: 63
- Watchers: 24
- Forks: 46
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Subgraphs
Subgraph for Matic contracts
Please take a look at [Graph protocol](https://github.com/graphprotocol/graph-node) for more information.
## Polygon hosted node endpoints
**Root**
- Mainnet: `https://thegraph.com/hosted-service/subgraph/maticnetwork/mainnet-root-subgraphs`
- Goerli: `https://thegraph.com/hosted-service/subgraph/maticnetwork/mumbai-root-subgraphs`
## For Mumbai hosted node endpoints
- Graph node: `https://mumbai-graph.matic.today`
- GraphQL endpoint: `https://api.mumbai-graph.matic.today/subgraphs/name///graphql`
- HTTP endpoint: `https://api.mumbai-graph.matic.today/subgraphs/name//`
- IPFS endpoint: `https://ipfs.infura.io:5001/`
## Subgraphs
This repository contains subgraphs for two chains: `root` (Ethereum) and `child` (Matic) with respective testnets.
**To prepare root (Ethereum) subgraphs**
```bash
cd root
# install dependencies
npm install
# For goerli
npm run prepare:goerli
# For mainnet
# npm run prepare:mainnet
```
**To prepare child (Matic) subgraphs**
```bash
cd child
# install dependencies
npm install
# For mumbai
npm run prepare:mumbai
# For mainnet
# npm run prepare:mainnet
```
### Build
```bash
# generate code
npm run codegen
# build
npm run build
```
### Deploy locally
**For goerli**
```bash
# create sub graph in local node
npm run graph -- create --node http://localhost:8020/ maticnetwork/goerli-matic-subgraph
# deploy sub graph locally
npm run graph -- deploy --node http://localhost:8020/ --ipfs https://ipfs.infura.io:5001/ maticnetwork/goerli-matic-subgraph
```
### Deploy on Graph's hosted node
**For goerli**
```bash
# create sub graph in local node
npm run graph -- create --node https://api.thegraph.com/deploy/ maticnetwork/goerli-matic-subgraph
# deploy sub graph locally
npm run graph -- deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ maticnetwork/goerli-matic-subgraph
```
**For mumbai**
```bash
# create sub graph in local node
npm run graph -- create --node https://mumbai-graph.matic.today nglglhtr/mumbai-matic-subgraph
# deploy sub graph locally
npm run graph -- deploy --node https://mumbai-graph.matic.today --ipfs https://ipfs.infura.io:5001/ nglglhtr/mumbai-matic-subgraph
```
## Run local graph node
```bash
$ cargo run -p graph-node --release -- \
--postgres-url postgresql://localhost:5432/token-transfer \
--ethereum-rpc http://localhost:8545/ \
--ipfs 127.0.0.1:5001 \
--subgraph
```
You can open graphiQL UI at http://localhost:8000
## License
MIT