Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tercel-graphprotocol/graph-cli

 
 

Repository files navigation

the-graph-wasm

This tool compiles data source definitions for WASM runtime of The Graph.

How It Works

the-graph-wasm takes a data-source.yaml data source definition (with references to a GraphQL schema, smart contract ABIs and data source mappings written in TypeScript/AssemblyScript), compiles the mappings to WASM and outputs a ready-to-use version of the data source.

Usage (TypeScript package)

An example of this can be found in examples/memefactory/.

  1. Install the package
    yarn add the-graph-wasm
  2. Add the following tsconfig.json:
    {
      "extends": "./node_modules/the-graph-wasm/tsconfig.json",
      "files": ["mapping.ts"]
    }
  3. Add a GraphQL schema file and a data source definition.
  4. Add the following to package.json:
    {
      "scripts": {
        "codegen": "the-graph-wasm generate-types data-source.yaml",
        "build": "the-graph-wasm compile data-source.yaml"
      }
    }
  5. Generate TypeScript type definitions from contract ABIs used in the data source via:
    yarn codegen
  6. Develop your mapping.ts against those generated types.
  7. Build with
    yarn build

Usage (CLI)

npm install -g https://github.com/graphprotocol/the-graph-wasm
the-graph-wasm compile data-source.yaml

About

The Graph data source runtime for mappings written in WASM

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.1%
  • TypeScript 1.9%