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

@edgeandnode/contract-utils

v2.1.2

Published

Exposes contract utils to interact with The Graph Network contracts.

Downloads

566

Readme

@edgeandnode/contract-utils

Exposes contract utils to interact with The Graph Network contracts.

Usage

# install the dependency

## pnpm
pnpm add @edgeandnode/contract-utils
## yarn
yarn add @edgeandnode/contract-utils
## bun
bun add @edgeandnode/contract-utils

Retrieve the contract address of a Graph Network contract on the specified network

import { resolveContractAddress } from '@edgeandnode/contract-utils'

// retrieve correct GNS address for arbitrum
const L2GNSAddress = resolveContractAddress({ network: 42161, contract: 'GNS' })
// retrieve correct GraphToken address for sepolia
const SepoliaGraphTokenAddress = resolveContractAddress({
  network: 11155111,
  contract: 'GraphToken',
})

Call the mintSignal L2GNS contract function from the generated actions.

import { createClient } from 'viem'
import { createConfig, http } from 'wagmi'
import { arbitrum, arbitrumSepolia, mainnet, sepolia } from 'wagmi/chains'
import { coinbaseWallet, injected, safe, walletConnect } from 'wagmi/connectors'

import { buildConfig, writeL2GnsMintSignal } from '@edgeandnode/contract-utils'

async function mint() {
  const config = createConfig({
    chains: [arbitrum, arbitrumSepolia, mainnet, sepolia],
    ssr,
    client({ chain }) {
      return createClient({ chain, transport: http() })
    },
    connectors: [
      coinbaseWallet({ appName: 'The Graph' }),
      injected(),
      safe({ allowedDomains: [/app.safe.global$/] }),
      walletConnect({
        projectId: 'WALLETCONNECT_PROJECT_ID',
        metadata: {
          name: 'The Graph',
          description: 'The Graph Network suite of apps wallet integration',
          url: 'https://thegraph.com',
          icons: [''],
        },
        qrModalOptions: {
          themeMode: 'dark',
        },
      }),
    ],
  })

  const mintTx = await writeL2GnsMintSignal(config, {
    account: `0x`,
    args: [0n, 0n, 0n],
  })
}

Generating wagmi types

# required a `.env.local` file with env vars (see below)
pnpm generate
# or
pnpm wagmi generate

Env vars (used to run wagmi generate)

  • ARBISCAN_KEY -> api key for reading contract ABIs from arbiscan.io
  • ETHERSCAN_KEY -> api key for reading contract ABIs from etherscan.io

References