Skip to content

Commit

Permalink
fix: superfluid subgraph (#1061)
Browse files Browse the repository at this point in the history
Co-authored-by: Darko Kolev <kolevdarko@gmail.com>
  • Loading branch information
leoslr and KolevDarko committed Feb 16, 2023
1 parent cfea8a3 commit e624c13
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/payment-detection/src/thegraph/superfluid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { GraphQLClient } from 'graphql-request';
import { getSdk } from './generated/graphql-superfluid';

const BASE_URL = `https://api.thegraph.com`;
const NETWORK_TO_URL: Record<string, string> = {
optimism: 'optimism-mainnet',
avalanche: 'avalanche-c',
};

// NB: the GraphQL client is automatically generated based on files present in ./queries,
// using graphql-codegen.
Expand All @@ -25,6 +29,8 @@ export const getTheGraphSuperfluidClient = (
// which is a better security but would require an update of the
// library each time the subgraph is updated, which isn't ideal
// for early testing.
const url = `${baseUrl}/subgraphs/name/superfluid-finance/protocol-v1-${network}`;
const url = `${baseUrl}/subgraphs/name/superfluid-finance/protocol-v1-${
NETWORK_TO_URL[network] || network
}`;
return getSdk(new GraphQLClient(url, options));
};

0 comments on commit e624c13

Please sign in to comment.