Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use subgraphs from The Graph Network #172

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`;
mdtanrikulu marked this conversation as resolved.
Show resolved Hide resolved
break;
default:
throw new UnsupportedNetwork(`Unknown network '${network}'`, 501);
Expand Down
Loading