# @pinax/graph-networks-registry

> TypeScript types and helpers for The Graph Networks Registry

Latest version **0.7.1** (published 2025-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @pinax/graph-networks-registry
pnpm add @pinax/graph-networks-registry
yarn add @pinax/graph-networks-registry
bun add @pinax/graph-networks-registry
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.1 |
| Published | 2025-07-03 |
| First published | 2024-11-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 165.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Yaro Shkvorets |
| Maintainers | soa432, dominicf96eos, deniscarriere, yaroshkvorets, 0237h |
| Keywords | graph, blockchain, registry, firehose, substreams, subgraph, ethereum |

## Links

- npm: https://www.npmjs.com/package/@pinax/graph-networks-registry
- Repository: https://github.com/pinax-network/graph-networks-libs
- Homepage: https://github.com/pinax-network/graph-networks-libs#readme
- Issues: https://github.com/pinax-network/graph-networks-libs/issues
- npm.io page: https://npm.io/package/@pinax/graph-networks-registry

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 0.7.1 (latest) — 2025-07-03
- 0.7.0 — 2025-07-03
- 0.6.7 — 2024-12-18
- 0.6.6 — 2024-12-16
- 0.6.5 — 2024-12-01
- 0.6.4 — 2024-11-27
- 0.6.3 — 2024-11-20
- 0.6.2 — 2024-11-19
- 0.6.1 — 2024-11-19
- 0.6.0 — 2024-11-19

## README

# The Graph Networks Registry Typescript Library

[![npm version](https://badge.fury.io/js/%40pinax%2Fgraph-networks-registry.svg)](https://www.npmjs.com/package/@pinax/graph-networks-registry) [![Documentation](https://img.shields.io/badge/docs-TypeDoc-blue)](https://pinax-network.github.io/graph-networks-libs/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

TypeScript types and helpers for [The Graph Networks Registry](https://github.com/graphprotocol/networks-registry).

Documentation available [here](https://pinax-network.github.io/graph-networks-libs/).

## Installation

```bash
npm install @pinax/graph-networks-registry
```

## Usage

### Loading the Registry

```typescript
import { NetworksRegistry } from '@pinax/graph-networks-registry';

// Load from the latest compatible registry JSON at networks-registry.thegraph.com
const registry = await NetworksRegistry.fromLatestVersion();

// Load from specific version tag at networks-registry.thegraph.com
const registry = await NetworksRegistry.fromExactVersion('0.7.0');
const registry = await NetworksRegistry.fromExactVersion('0.7.x');

// Load from URL
const registry = await NetworksRegistry.fromUrl('https://networks-registry.thegraph.com/TheGraphNetworksRegistry.json');

// Load from local file
const registry = NetworksRegistry.fromFile('./TheGraphNetworksRegistry.json');

// Load from JSON string
const registry = NetworksRegistry.fromJson(jsonString);
```

### Working with Networks

```typescript
// Find network by graph ID (works with both network ID and alias)
const mainnet = registry.getNetworkByGraphId('mainnet');
if (mainnet) {
    console.log(mainnet.fullName); // "Ethereum Mainnet"
    console.log(mainnet.caip2Id); // "eip155:1"
}

// You can also use an alias with getNetworkByGraphId
const ethereum = registry.getNetworkByGraphId('eth');
if (ethereum) {
    console.log(ethereum.fullName); // "Ethereum Mainnet"
}

// Find network by CAIP-2 chain ID
const ethereumByChainId = registry.getNetworkByCaip2Id('eip155:1');
if (ethereumByChainId) {
    console.log(ethereumByChainId.fullName); // "Ethereum Mainnet"
    console.log(ethereumByChainId.id); // "mainnet"
}

// Invalid format will produce a warning and return undefined
const invalidNetwork = registry.getNetworkByCaip2Id('invalid-format');
// Warning: CAIP-2 Chain ID should be in the format '[namespace]:[reference]', e.g., 'eip155:1'

// Deprecated methods (will be removed in future versions)
// Find network by ID
// @deprecated Use getNetworkByGraphId instead
const mainnetById = registry.getNetworkById('mainnet');

// Find network by alias
// @deprecated Use getNetworkByGraphId instead
const mainnetByAlias = registry.getNetworkByAlias('eth');
```

---
_Source: https://npm.io/package/@pinax/graph-networks-registry · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
