Skip to content

Commit

Permalink
Merge branch 'main' into for-new-stake
Browse files Browse the repository at this point in the history
  • Loading branch information
Cast0001 committed Oct 2, 2024
2 parents 319b964 + b86a1c0 commit 04f2c8e
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,28 @@ import { Network } from './src/utils/enums'
import configs from './src/utils/configs'


// For every network we have same gql schema, so we can use just Mainnet here
const urls = configs[Network.Holesky].api
let network: Network = Network.Holesky

if (process.env.NETWORK === 'mainnet') {
network = Network.Mainnet
}
if (process.env.NETWORK === 'gnosis') {
network = Network.Gnosis
}

const config = configs[network]
const subgraphIndex = Number(process.env.SUBGRAPH_INDEX || 0)

const subgraphUrl = Array.isArray(config.api.subgraph)
? config.api.subgraph[subgraphIndex]
: config.api.subgraph

const urls: Record<string, string> = {
backend: config.api.backend,
subgraph: subgraphUrl,
}

console.log(`Generating types for network: ${config.network.id}`, urls)

// https://the-guild.dev/graphql/codegen/plugins/typescript/typescript
const typesConfig = {
Expand Down

0 comments on commit 04f2c8e

Please sign in to comment.