Skip to main content
link to thegraph's docs showing how to set up a networks.json config for data source addresses
Source Link
MShakeG
  • 1.9k
  • 12
  • 46

The network name can be accessed via dataSource as follows:

import { dataSource } from "@graphprotocol/graph-ts";

const chainName = dataSource.network(); // returns network name

const chainId = ChainIds[chainName];

The list of network's supported on the graphs hosted service can be found here.

You can also configure the data source addresses listed in the subgraph.yaml for multiple networks using a networks.json config as shown in thegraph's docs.

The network name can be accessed via dataSource as follows:

import { dataSource } from "@graphprotocol/graph-ts";

const chainName = dataSource.network(); // returns network name

const chainId = ChainIds[chainName];

The list of network's supported on the graphs hosted service can be found here.

The network name can be accessed via dataSource as follows:

import { dataSource } from "@graphprotocol/graph-ts";

const chainName = dataSource.network(); // returns network name

const chainId = ChainIds[chainName];

The list of network's supported on the graphs hosted service can be found here.

You can also configure the data source addresses listed in the subgraph.yaml for multiple networks using a networks.json config as shown in thegraph's docs.

Source Link
MShakeG
  • 1.9k
  • 12
  • 46

The network name can be accessed via dataSource as follows:

import { dataSource } from "@graphprotocol/graph-ts";

const chainName = dataSource.network(); // returns network name

const chainId = ChainIds[chainName];

The list of network's supported on the graphs hosted service can be found here.