Code Monkey home page Code Monkey logo

lens-graph-subgraph's Introduction

Lens Protocol Subgraph

This is Subgraph for the Lens Protocol.

You can find the subgraph api here and can query that using the playground.

Example query

// This will fetch the profiles of the users
{
  profiles(first: 10) {
    id
    handle
    isFollowedByMe
  }
  _meta {
    block {
      number
    }
  }
}

This requires the Lens Protocol Contract to be ingested by the subgraph, with the events that were sourced to be stored in the subgraph database:

  • LensHub.sol
    • event ProfileCreated
    • event Transfer
    • event Approval
    • event AprrovalForAll
  • TransparentUpgradeableProxy.sol
    • event AdminChanged
    • event BeaconUpgraded
    • event Upgraded

All of the other contracts don't emit events that are relevant for this subgraph.

This can be used for the Mumbai and Polygon Mainnet contracts. In order to do so the subgraph.yaml file will need to have the contract addresses changed to point to the correct address for each respective network.

Expect the subgraph to take ~10 hours to ingest all the events when connected to infura for mainnet

How to deploy

  1. Clone the repository
  2. Add a Subgraph in https://thegraph.com/hosted-service/
  3. yarn install into the subgraph directory
  4. yarn deploy

Link to the hosted service subgraph : https://thegraph.com/hosted-service/subgraph/rtomas/lens-subgraph (there are some saved queries to play with the subgraph)


Contract from the collection : https://polygonscan.com/address/0x20f4D7DdeE23029048C53B42dc73A02De19F1c9E

Official Website : https://lens.xyz/

Developer Docs https://docs.lens.xyz/docs

Brief Description of the Graph Node Setup

This subgraph has three types of files which tell the Graph Node to ingest events from specific contracts. They are:

  • The subgraph manifest (subgraph.yaml)
  • A GraphQL schema (schema.graphql)
  • Mapping scripts (lens-hub.ts, transparent-upgradeable-proxy.ts) This repository has these files created and ready to compile, so a user can start this subgraph on their own. The only thing that needs to be edited is the contract addresses in the subgraph.yaml file to change between Kovan, Ropsten or Mainnet.

We have provided a quick guide on how to start up the Lens-Protocol-Subgraph graph node. If these steps aren't descriptive enough, the getting started guide has in depth details on running a subgraph.

lens-graph-subgraph's People

Contributors

deepak-likes-code avatar deepakaccelchain avatar nazeeh21 avatar

Stargazers

 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.