Skip to content

Commit

Permalink
Merge pull request #172 from schmidsi/schmidsi/the-graph-network
Browse files Browse the repository at this point in the history
Use subgraphs from The Graph Network
  • Loading branch information
mdtanrikulu authored Jun 6, 2024
2 parents 6ceba97 + be2723a commit 0c8adcd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .env.org
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ IPFS_GATEWAY= # https://ipfs.io
HOST= # metadata.ens.domains
ENV= # prod / local
NODE_PROVIDER= # google / cloudflare / infura / geth
NODE_PROVIDER_URL= # https://infura.io/v3/API_KEY
NODE_PROVIDER_URL= # https://infura.io/v3/API_KEY
THE_GRAPH_API_KEY= # Go to https://thegraph.com/studio to create a one for free
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const INFURA_API_KEY = process.env.INFURA_API_KEY || '';
const OPENSEA_API_KEY = process.env.OPENSEA_API_KEY || '';
const NODE_PROVIDER = process.env.NODE_PROVIDER || 'geth';
const NODE_PROVIDER_URL = process.env.NODE_PROVIDER_URL || 'http://localhost:8545';
const THE_GRAPH_API_KEY = process.env.THE_GRAPH_API_KEY || '';

// undocumented, temporary keys
const NODE_PROVIDER_URL_CF = process.env.NODE_PROVIDER_URL_CF || '';
Expand Down Expand Up @@ -60,4 +61,5 @@ export {
NODE_PROVIDER_URL_SEPOLIA,
RESPONSE_TIMEOUT,
SERVER_URL,
THE_GRAPH_API_KEY
};
4 changes: 3 additions & 1 deletion src/service/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
NODE_PROVIDER_URL_CF,
NODE_PROVIDER_URL_GOERLI,
NODE_PROVIDER_URL_SEPOLIA,
THE_GRAPH_API_KEY,
} from '../config';

const NODE_PROVIDERS = {
Expand Down Expand Up @@ -77,7 +78,8 @@ export default function getNetwork(network: NetworkName): {
'https://api.studio.thegraph.com/query/49574/enssepolia/version/latest';
break;
case NETWORK.MAINNET:
SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/ensdomains/ens';
SUBGRAPH_URL =
`https://gateway-arbitrum.network.thegraph.com/api/${THE_GRAPH_API_KEY}/subgraphs/id/5XqPmWe6gjyrJtFn9cLy237i4cWw2j9HcUJEXsP5qGtH`;
break;
default:
throw new UnsupportedNetwork(`Unknown network '${network}'`, 501);
Expand Down

0 comments on commit 0c8adcd

Please sign in to comment.