@graphprotocol/interfaces
TypeScript icon, indicating that this package has built-in type declarations

0.2.5 • Public • Published

@graphprotocol/interfaces

Contract interfaces and types for The Graph protocol.

Overview

This package contains contract interfaces and types used in dependent packages, which makes building systems that interact with The Graph contracts simpler, as the implementation information is not included.

Installation

pnpm add @graphprotocol/interfaces

Usage

Contract interfaces

Solidity contract interfaces can be imported from @graphprotocol/interfaces/contracts/...:

pragma solidity 0.8.27;

import { IGraphPayments } from "@graphprotocol/interfaces/contracts/horizon/IGraphPayments.sol";

contract GraphPayments is IGraphPayments {
    ...
}

Note that contracts in the toolshed/ directory are not meant to be imported by Solidity code, they only exist to generate complete TypeScript types.

TypeScript types

This package provides types generated with Typechain compatible with ethers v6. To use them import with:

import {
  GraphPayments,
  GraphTallyCollector,
  HorizonStaking,
  L2GraphToken,
  PaymentsEscrow,
  SubgraphService,
} from '@graphprotocol/interfaces'

TypeScript library

Additionally, the package exposes a few helper functions to facilitate the creation of fully typed ethers v6 contracts:

Function Name Description
getInterface Retrieves the contract interface for a given contract name.
getMergedInterface Loads and merges interfaces from multiple contract names.
getAbi Gets the ABI for a given contract name.
import {
    getInterface,
    SubgraphService
} from '@graphprotocol/interfaces

const subgraphService = new ethers.Contract('0x12...90', getInterface('SubgraphService')) as SubgraphService

Readme

Keywords

none

Package Sidebar

Install

npm i @graphprotocol/interfaces

Weekly Downloads

17

Version

0.2.5

License

GPL-2.0-or-later

Unpacked Size

12.2 MB

Total Files

1408

Last publish

Collaborators

  • nasmr
  • neysofu
  • a3k5
  • fordn
  • lutter
  • tmigone
  • juanmardefago
  • dnfodjo
  • theodus
  • cmwhited
  • benface
  • migueldeelias
  • andras_en
  • pcarranzav_edgeandnode
  • mitchhs12
  • dwerner-en
  • lnsd
  • edge-and-node
  • nomativ
  • yaroshkvorets
  • pdiogo-tgf
  • bairun
  • nikgraf