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 šŸ™

Ā© 2026 – Pkg Stats / Ryan Hefner

hop-subgraph-client

v1.0.1

Published

šŸ›  An JavaScript Subgraph Client for Hop Protocol

Readme

Hop Protocol Subgraph Client

šŸ›  An JavaScript Subgraph Client for Hop Protocol

The Graph is an indexing protocol for querying networks like Ethereum and IPFS. Anyone can build and publish open APIs, called subgraphs, making data easily accessible.

Hop Protocol is a scalable rollup-to-rollup general token bridge. It allows users to send tokens from one rollup or sidechain to another almost immediately without having to wait for the networks challenge period.

Hop Protocol Mainnet Subgraph

Hop Subgraph Playground

šŸ’Getting Started

✨To use Hop Subgraph Clients :

Install the lib using npm or yarn

yarn add hop-subgraph-client

✨Subgraph Queries

import { createSubgraphClient } from 'hop-subgraph-client'
const SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/hop-protocol/hop-mainnet'
const client = createSubgraphClient(SUBGRAPH_URL)

To list transfers

import { Transfer_OrderBy, OrderDirection } from 'hop-subgraph-client'
// List transfers
const { transfers } = await client.Transfers({
  first: 2,
  orderBy: Transfer_OrderBy.Value,
  orderDirection: OrderDirection.Desc,
})

To list tokens and TVL

const { tokens } = await client.Tokens()
const { tvls } = await client.Tvls()
console.log('tokens :>> ', tokens)
console.log('tvls :>> ', tvls)

More examples are here


šŸ”§Contributing

Created an .env file with a env variable:

# https://api.thegraph.com/subgraphs/name/hop-protocol/hop-<mainnet, optimism...>
SUBGRAPH_URL=<HOP_SUBGRAPH_URL>

For local developement you can run

yarn dev

For production build:

yarn build

Which will generate a production build on "dist" folder.

To run tests type:

yarn test

Adding new queries

Refer to any existing query in the graphql directory as a reference when first getting started.

  1. Add the query to an existing .graphql file or create a new one in the graphql directory.
  2. Run yarn gen:subgraph
  3. Access the query from the generated client using client.QueryName

All queries get exactly typed, so if you query a partial reference to an underlying model, only the quereied fields will be available. If you need to reference the type created by the query, create a fragment and use that fragment in your query.

fragment SubgraphBlock on Block {
  id
  author
  gasLimit
  difficulty
  gasUsed
  hash
  number
  parentHash
  receiptsRoot
  size
  timestamp
  transactionsRoot
  unclesHash
  totalDifficulty
  stateRoot
}

query Block($id: ID!, $block: Block_height) {
  block(id: $id) {
    ...SubgraphBlock
  }
}

The generated type will be exported from the module suffixed with Fragment. So in this example, your type is named: SubgraphBlockFragment.

import { SubgraphBlockFragment, Block_OrderBy } from 'hop-subgraph-client'

// List blocks
const { blocks } = await client.Blocks({
  first: 5,
  block: { number_gte: blockHeight },
  orderBy: Block_OrderBy.Timestamp,
})

const block: SubgraphMarketFragment = blocks[0]

Resync the schema

Anytime there are schema changes published to hop-mainnet-subgraph, you'll need to resync the local schema by running yarn gen:subgraph.

If the update introduced breaking changes, running yarn gen:subgraph will fail and print the necessary changes that need to be made to the console.

Disclaimer

This is experimental software and is provided on an "as is" and "as available" basis.

We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.

This is 3rd party code, use at your YOUR OWN RISK āš ļø