Git Product home page Git Product logo

regen-score-squid's Introduction

Open in Gitpod

Squid ABI template

An experimental template is used to generate a squid that indexes EVM logs and transactions of choice from a contract address. Supports automatic ABI lookups for public contracts using the Etherscan API

Usage

  1. Install the Squid CLI:
npm i -g @subsquid/cli
  1. Init the template and install the dependencies
sqd init my-abi-squid --template https://github.com/subsquid/squid-abi-template
cd my-abi-squid
npm i
  1. Run sqd generate with the appropriate flags.
Usage: sqd generate [options]

Options:
  --address <contract>      contract address
  --archive <url>           archive endpoint 
  --abi <path>              (Optional) path or URL to the abi file. If omitted, the Etherscan API is used.
  -e, --event <name...>     one or multiple events to be indexed. '*' will index all events
  -f, --function <name...>. one or multiple contract functions to be indexed. '*' will index all functions
  --from <block>            start indexing from the given block. 
  --etherscan-api <url>     (Optional) an Etherscan-compatible API to fetch contract ABI by a known address. Default: https://api.etherscan.io/
  1. Build and run the squid
sqd build
sqd up
sqd migration:generate
sqd process

The indexing will start.

In a separate window, start the GraphQL API server at localhost:4350/graphql:

sqd serve
  1. Inspect schema.graphql, src/processor.ts and start hacking!

For more details on how to build and deploy a squid, see the docs.

Example

Generate

npx squid-gen-abi \
--address 0x2E645469f354BB4F5c8a05B3b30A929361cf77eC \
--archive https://eth.archive.subsquid.io \
--event NewGravatar \
--event UpdatedGravatar \
--function createGravatar \
--from 6000000

Explore

query MyQuery {
  events(orderBy: block_timestamp_ASC) {
    id
    name
    block {
      number
      timestamp
    }
    ... on NewGravatarEvent {
      id0
      imageUrl
      owner
    }
    ... on UpdatedGravatarEvent {
      id0
      imageUrl
      owner
    }
  }
}

Example

regen-score-squid's People

Contributors

mateodaza avatar vacekj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.