npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nevermined-io/subgraphs

v0.5.1

Published

Nevermined subgraph graphql clients

Downloads

36

Readme

banner

Nevermined Subgraph

Nevermined subraph for The Graph

Tests


Requirements

Subgraph naming convention

In order to have different subraph version for different contracts versions it was important to incorporate both the tag name and version into the subgraph name.

Note that this name is purely conventional and is not related to how the thegraph works. thegraph sees subgraph names only as a flat string.

Example with the DID Registry subgraph deployed for mumbai public:

nevermined-io/publicmumbaiv2didregistry

- nevermined-io/: organization. all nevermined core subgraphs
- public: the contract tag [common, public]
- mumbai: the network name [mumbai, polygon]
- version: the contracts major version [v2]
- contract name: the name of the contract for this subgraph (lower case)

In this example the hosted url would be https://api.thegraph.com/subgraphs/name/nevermined-io/publicmumbaiv2didregistry

Deploying subgraphs locally

# start nevermined-tools
$ ./start_nevermined.sh --latest --no-graph --polygon

# start the graph node locally
$ docker-compose up

# copy the artifacts
$ ./scripts/wait-nevermined.sh

# update the addresses
$ yarn nevermined:update-addresses polygon-localnet

# update startBlock
$ OVERRIDE_SUBGRAPH_STARTING_BLOCK=10 yarn nevermined:update-startblock polygon-localnet

# update the network
# we always use spree in the subgraph manifest for local development networks
$ yarn nevermined:update-network spree

# create the subgraphs
# we use `development` as the tag for local development contracts
# the contracts major version only
$ yarn nevermined:create development polygon-localnet v2

# deploy the subgraphs
$ yarn nevermined:deploy development polygon-localnet v2

Deploying subgraphs to the hosted service

# you need to get the access token from https://thegraph.com/hosted-service/dashboard and authenticate
$ yarn graph auth --product hosted-service <access_token>

# download the artifacts
$ yarn artifacts:download v2.0.5 mumbai common

# update addresses
$ yarn nevermined:update-addresses mumbai

# update start block
$ yarn nevermined:update-startblock mumbai

# update the network
$ yarn nevermined:update-network mumbai

# create the subgraphs
# usage yarn nevermined:create-hosted <tag> <network> <version> <cookie> <account id>
$ yarn nevermined:create-hosted common mumbai v2 "explorerSession_v24=s%3A6zVr0-om..." "MDEy..."

# deploy the subgraphs
$ yarn nevermined:deploy-hosted common mumbai v2

Getting the cookie and account id

The hosted service forces us to create the subgraphs through the online dashboard https://thegraph.com/hosted-service/dashboard.

In order to automate the creation of the subgraphs in the hosted service we need a session cookie and the account id. To get them:

  1. Go to the dashboard and login
  2. Open the browser networking dev tools
  3. Create a test subgraph with any name
  4. Check the POST request to https://api.thegraph.com/explorer/graphql
  5. Get the cookie from the request headers
  6. Get the account id from the request body

Testing


# start nevermined tools
$ ./start_nevermined.sh --no-graph --polygon

# start the graph node locally
$ docker-compose up

# wait and copy artifacts
$ ./scripts/wait-nevermined.sh

# run the tests
$ export SEED_WORDS="<add your mnemonic here>"
$ yarn test

References

License

Copyright 2020 Nevermined AG

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.