Skip to content

izana-dev/subgraph

Repository files navigation

Subgraph

Description

Define subgraph for crawling data from blockchain.

Subgraph commands

Install Graph CLI using NPM

npm install -g @graphprotocol/graph-cli

Install Graph CLI using Yarn

yarn global add @graphprotocol/graph-cli

Authenticate in CLI

graph auth --studio [api key]

Build subgraph

graph codegen && graph build

Deploy subgraph

graph deploy --studio test-sub

Project guides

Update ./subgraph.yaml file

Items to update each time build~deploy:

  • network: set cli name of network (Refer Link)
  • source/address: set appropriate address of contract that deployed on the network.
  • source/startBlock: set block number

Refer content of [./subgraph.yaml] file

dataSources:
  - kind: ethereum
    name: AddCollectionSC
    network: polygon-amoy
    source:
      address: "0xf499483d090dd097010B659dc29db83FB143A00e"
      abi: AddCollectionSC
      startBlock: 5960501
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.7
      language: wasm/assemblyscript
      entities:
        - Collection
      abis:
        - name: AddCollectionSC
          file: ./abis/AddCollectionSC.json
      eventHandlers:
        - event: AddCollection(address)
          handler: handleAddCollection
      file: ./src/mapping.ts

About

subgraph

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •