🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@pinax/graph-networks-registry

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pinax/graph-networks-registry

TypeScript types and helpers for The Graph Networks Registry

0.6.7
latest
Source
npm
Version published
Weekly downloads
7.1K
-17.03%
Maintainers
4
Weekly downloads
 
Created
Source

The Graph Networks Registry Typescript Library

npm version Documentation License: MIT

TypeScript types and helpers for The Graph Networks Registry.

Documentation available here.

Installation

npm install @pinax/graph-networks-registry

Usage

Loading the Registry

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.6.0');
const registry = await NetworksRegistry.fromExactVersion('0.6.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

// Find network by ID
const mainnet = registry.getNetworkById('mainnet');
if (mainnet) {
    console.log(mainnet.fullName); // "Ethereum Mainnet"
    console.log(mainnet.caip2Id); // "eip155:1"
}
// Find network by alias
const mainnet = registry.getNetworkByAlias('eth');
if (mainnet) {
    console.log(mainnet.fullName); // "Ethereum Mainnet"
}

Keywords

graph

FAQs

Package last updated on 18 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts