Skip to content

Commit

Permalink
update subgraph functions + envs
Browse files Browse the repository at this point in the history
  • Loading branch information
Space-Bean committed Sep 14, 2024
1 parent 4ad7138 commit 790a660
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 0 deletions.
33 changes: 33 additions & 0 deletions projects/ui/codegen-individual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,36 @@ generates:
- https://graph.node.bean.money/subgraphs/name/beanft
plugins:
- "schema-ast"



# # Use this file to generate schemas for individual subgraphs.
# # This is particularly useful when a schema that isn't in production needs to be used.
# # A more optimal solution would involve generating a different schema for each entry in src/graph.endpoints.ts.
# overwrite: true
# generates:
# ./src/graph/schema-beanstalk.graphql:
# schema:
# - https://graph.bean.money/beanstalk
# plugins:
# - "schema-ast"
# ./src/graph/schema-bean.graphql:
# schema:
# - https://graph.bean.money/bean
# plugins:
# - "schema-ast"
# ./src/graph/schema-snapshot1.graphql:
# schema:
# - https://hub.snapshot.org/graphql
# plugins:
# - "schema-ast"
# #./src/graph/schema-snapshot2.graphql:
# # schema:
# # - https://api.thegraph.com/subgraphs/name/snapshot-labs/snapshot
# # plugins:
# # - "schema-ast"
# ./src/graph/schema-beanft.graphql:
# schema:
# - https://graph.node.bean.money/subgraphs/name/beanft
# plugins:
# - "schema-ast"
59 changes: 59 additions & 0 deletions projects/ui/src/graph/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,62 @@ export const apolloClient = new ApolloClient({
),
cache,
});



// // L2 subgraphs
// const beanstalkLink = new HttpLink({
// uri: sgEnv.subgraphs.beanstalk,
// });

// const beanLink = new HttpLink({
// uri: sgEnv.subgraphs.bean,
// });

// // L1 subgraphs
// const beanstalkEthLink = new HttpLink({
// uri: sgEnv.subgraphs.beanstalk_eth,
// });

// const beanEthLink = new HttpLink({
// uri: sgEnv.subgraphs.bean_eth,
// });

// const snapshotLink = new HttpLink({
// uri: 'https://hub.snapshot.org/graphql',
// headers: {
// 'x-api-key': SNAPSHOT_API_KEY,
// },
// });

// const snapshotLabsLink = new HttpLink({
// uri: `https://gateway-arbitrum.network.thegraph.com/api/${import.meta.env.VITE_THEGRAPH_API_KEY}/subgraphs/id/5MkoYVE5KREBTe2x45FuPdqWKGc2JgrHDteMzi6irSGD`,
// });

// /// ///////////////////////// Client ////////////////////////////

// export const apolloClient = new ApolloClient({
// connectToDevTools: true,
// link: ApolloLink.split(
// (operation) => operation.getContext().subgraph === 'bean_eth',
// beanEthLink, // true
// ApolloLink.split(
// ({ getContext }) => getContext().subgraph === 'beanstalk_eth',
// beanstalkEthLink, // true
// ApolloLink.split(
// ({ getContext }) => getContext().subgraph === 'snapshot',
// snapshotLink, // true
// ApolloLink.split(
// ({ getContext }) => getContext().subgraph === 'snapshot-labs',
// snapshotLabsLink, // true
// ApolloLink.split(
// ({ getContext }) => getContext().subgraph === 'bean',
// beanLink, // true
// beanstalkLink // false
// )
// )
// )
// )
// ),
// cache,
// });
53 changes: 53 additions & 0 deletions projects/ui/src/graph/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,56 @@ export const SUBGRAPH_ENVIRONMENTS: Record<SGEnvironments, SGEnvironment> = {
},
},
};


// export enum SGEnvironments {
// BF_PROD = 'bf-prod',
// BF_DEV = 'bf-dev',
// BF_TEST = 'bf-test',
// }

// type SGEnvironment = {
// name: string;
// subgraphs: {
// beanstalk: string;
// bean: string;
// // beanft: string;
// beanstalk_eth: string;
// bean_eth: string;
// };
// };

// const ENDPOINT = 'https://graph.bean.money';

// export const SUBGRAPH_ENVIRONMENTS: Record<SGEnvironments, SGEnvironment> = {
// [SGEnvironments.BF_PROD]: {
// name: 'Beanstalk Farms / Production',
// subgraphs: {
// beanstalk: `${ENDPOINT}/beanstalk`,
// bean: `${ENDPOINT}/bean`,
// beanstalk_eth: `${ENDPOINT}/beanstalk_eth`,
// bean_eth: `${ENDPOINT}/bean_eth`,
// },
// },
// [SGEnvironments.BF_DEV]: {
// name: 'Beanstalk Farms / Development',
// subgraphs: {
// beanstalk: `${ENDPOINT}/beanstalk-dev`,
// bean: `${ENDPOINT}/bean-dev`,
// beanstalk_eth: `${ENDPOINT}/beanstalk-dev_eth`,
// bean_eth: `${ENDPOINT}/bean-dev_eth`,
// },
// },
// [SGEnvironments.BF_TEST]: {
// name: 'Beanstalk Farms / Test',
// subgraphs: {
// beanstalk: `${ENDPOINT}/beanstalk-testing`,
// bean: `${ENDPOINT}/bean-testing`,
// beanstalk_eth: `${ENDPOINT}/beanstalk-testing_eth`,
// bean_eth: `${ENDPOINT}/bean-testing_eth`,
// },
// },
// };

// // keeping as reference
// // beanft: 'https://graph.node.bean.money/subgraphs/name/beanft',

0 comments on commit 790a660

Please sign in to comment.