Manual Video

IPFS: https://ipfs.testnet.inco.org/

Node: https://subgraph.testnet.inco.org/deploy/

You can use example-subgraph easily.

git clone <https://github.com/graphprotocol/example-subgraph>
cd example-subgraph

1. You need to change ipfs and node url in create-local and delpoy-local of package.json.

{
  "name": "example",
  "version": "0.1.0",
  "repository": "<https://github.com/graphprotocol/example-subgraph>",
  "license": "MIT",
  "scripts": {
    "build-contract": "solc contracts/Gravity.sol --abi -o abis --overwrite && solc contracts/Gravity.sol --bin -o bin --overwrite",
    "create": "graph create example --node <https://api.thegraph.com/deploy/>",
    "create-local": "graph create test1 --node <https://subgraph.testnet.inco.org/deploy/>",
    "codegen": "graph codegen",
    "build": "graph build",
    "deploy": "graph deploy example --ipfs <https://api.thegraph.com/ipfs/> --node <https://api.thegraph.com/deploy/>",
    "deploy-local": "graph deploy test1 --ipfs <https://ipfs.testnet.inco.org/> --node <https://subgraph.testnet.inco.org/deploy/>"
  },
  "devDependencies": {
    "@graphprotocol/graph-cli": "^0.30.2",
    "@graphprotocol/graph-ts": "^0.27.0"
  },
  "dependencies": {
    "babel-polyfill": "^6.26.0",
    "babel-register": "^6.26.0",
    "truffle": "^5.0.4",
    "truffle-contract": "^4.0.5",
    "truffle-hdwallet-provider": "^1.0.4"
  }
}

2. Then, deploy contract and change abi file. And also change contract address, start block and network name in subgraph.yaml like follow.

specVersion: 0.0.4
description: Gravatar for Ethereum
repository: <https://github.com/graphprotocol/example-subgraph>
schema:
  file: ./schema.graphql
dataSources:
  - kind: ethereum
    name: Gravity
    network: inco-gentry-1
    source:
      address: '0x57BAFB7e325C089Cef53614ddc5A0906f57d5690'
      abi: Gravity
      startBlock: 132074
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.6
      language: wasm/assemblyscript
      entities:
        - Gravatar
      abis:
        - name: Gravity
          file: ./abis/Gravity.json
      eventHandlers:
        - event: NewGravatar(uint256,address,string,string)
          handler: handleNewGravatar
        - event: UpdatedGravatar(uint256,address,string,string)
          handler: handleUpdatedGravatar
      file: ./src/mapping.ts

3. And the install dependencies.

yarn

4. You can get the subgraph workplace.

yarn create-local

5. Then you can deploy the subgraph.

yarn deploy-local

6. You can see deployed url.

ubuntu@ip-172-31-33-183:~/utility/subgraph/example-subgraph$ yarn deploy-local
yarn run v1.22.19
$ graph deploy test1 --ipfs <https://ipfs.testnet.inco.org/> --node <https://subgraph.testnet.inco.org/deploy/>
Which version label to use? (e.g. "v0.0.1"): "v0.0.4"
  Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2
  Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3
  Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4
  Skip migration: Bump mapping apiVersion from 0.0.4 to 0.0.5
  Skip migration: Bump mapping apiVersion from 0.0.5 to 0.0.6
  Skip migration: Bump manifest specVersion from 0.0.1 to 0.0.2
  Skip migration: Bump manifest specVersion from 0.0.2 to 0.0.4
✔ Apply migrations
⚠ Warnings loading subgraph from subgraph.yaml: Warnings in subgraph.yaml:

    Path: repository
    The repository is still set to <https://github.com/graphprotocol/example-subgraph>.
    Please replace it with a link to your subgraph source code.

    Path: description
    The description is still the one from the example subgraph.
    Please update it to tell users more about your subgraph.

✔ Load subgraph from subgraph.yaml
  Compile data source: Gravity => build/Gravity/Gravity.wasm
✔ Compile subgraph
  Copy schema file build/schema.graphql
  Write subgraph file build/Gravity/abis/Gravity.json
  Write subgraph manifest build/subgraph.yaml
✔ Write compiled subgraph to build/
  Add file to IPFS build/schema.graphql
                .. QmbSFRGGvHM7Cn8YSjDL41diDMxN4LQUDEMqaa5VVc5sC4
  Add file to IPFS build/Gravity/abis/Gravity.json
                .. QmTgE5LFoQWj5UWypXvoRgoh9NMbtPHYUvVpiEuoJzJY8J
  Add file to IPFS build/Gravity/Gravity.wasm
                .. QmNizCTiVUJisrZ7dVaHLPHNLA3LvVpx1URXuXv3GsWPcA
✔ Upload subgraph to IPFS

**Build completed: Qmap3v2HvLmy96dSAU8rA5RpZt59k1b6SVfF69Hn5g8QiX**

**Deployed to <https://subgraph.testnet.inco.org/deploy/subgraphs/name/test1/graphql**>

Subgraph endpoints:
Queries (HTTP):     <https://subgraph.testnet.inco.org/subgraphs/name/test1>

Done in 21.82s.

7. Connect to the deployed url and you can get data using query link follow.