From 9ba55476db4249016723ad9686b96343c7979be0 Mon Sep 17 00:00:00 2001 From: tyler17 Date: Wed, 24 Jul 2024 21:46:31 -0700 Subject: [PATCH] fix env var --- .env.sample | 1 + lib/config.ts | 4 +++- modules/mkr/components/MkrLiquiditySidebar.tsx | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.env.sample b/.env.sample index 0528469b8..98025db6c 100644 --- a/.env.sample +++ b/.env.sample @@ -15,6 +15,7 @@ GASLESS_DISABLED=false DASHBOARD_PASSWORD= NEXT_PUBLIC_TENDERLY_RPC_KEY= NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID= +SUBGRAPH_API_KEY= # this is used to determine which database to fetch data from NEXT_PUBLIC_VERCEL_ENV=development \ No newline at end of file diff --git a/lib/config.ts b/lib/config.ts index c9320e094..0d5bc6e93 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -34,6 +34,7 @@ type SystemConfig = { GASLESS_DISABLED: string; TENDERLY_RPC_KEY: string; USE_MOCK_WALLET: string; + SUBGRAPH_API_KEY: string; }; export const config: SystemConfig = { @@ -63,5 +64,6 @@ export const config: SystemConfig = { GASLESS_BACKDOOR_SECRET: process.env.GASLESS_BACKDOOR_SECRET || '', GASLESS_DISABLED: process.env.GASLESS_DISABLED || '', TENDERLY_RPC_KEY: process.env.NEXT_PUBLIC_TENDERLY_RPC_KEY || '', - USE_MOCK_WALLET: process.env.NEXT_PUBLIC_USE_MOCK_WALLET || '' + USE_MOCK_WALLET: process.env.NEXT_PUBLIC_USE_MOCK_WALLET || '', + SUBGRAPH_API_KEY: process.env.SUBGRAPH_API_KEY || '' }; diff --git a/modules/mkr/components/MkrLiquiditySidebar.tsx b/modules/mkr/components/MkrLiquiditySidebar.tsx index 6a12b95b4..f0aac9fd0 100644 --- a/modules/mkr/components/MkrLiquiditySidebar.tsx +++ b/modules/mkr/components/MkrLiquiditySidebar.tsx @@ -22,6 +22,7 @@ import { Tokens } from 'modules/web3/constants/tokens'; import { SupportedNetworks } from 'modules/web3/constants/networks'; import { getContracts } from 'modules/web3/helpers/getContracts'; import { networkNameToChainId } from 'modules/web3/helpers/chain'; +import { config } from 'lib/config'; const aaveLendingPoolCore = '0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3'; const aaveV2Amkr = '0xc713e5E149D5D0715DcD1c156a020976e7E56B88'; @@ -33,7 +34,7 @@ const sushiswapAddress = '0xba13afecda9beb75de5c56bbaf696b880a5a50dd'; const compoundCTokenAddress = '0x95b4eF2869eBD94BEb4eEE400a99824BF5DC325b'; async function getBalancerV1Mkr(mkrAddress: string) { - const resp = await fetch(`https://gateway-arbitrum.network.thegraph.com/api/${SUBGRAPH_API_KEY}/subgraphs/id/93yusydMYauh7cfe9jEfoGABmwnX4GffHd7in8KJi1XB`, { + const resp = await fetch(`https://gateway-arbitrum.network.thegraph.com/api/${config.SUBGRAPH_API_KEY}/subgraphs/id/93yusydMYauh7cfe9jEfoGABmwnX4GffHd7in8KJi1XB`, { method: 'post', body: JSON.stringify({ query: ` @@ -57,7 +58,7 @@ async function getBalancerV1Mkr(mkrAddress: string) { } async function getBalancerV2Mkr(mkrAddress: string) { - const resp = await fetch(`https://gateway-arbitrum.network.thegraph.com/api/${SUBGRAPH_API_KEY}/subgraphs/id/C4ayEZP2yTXRAB8vSaTrgN4m9anTe9Mdm2ViyiAuV9TV`, { + const resp = await fetch(`https://gateway-arbitrum.network.thegraph.com/api/${config.SUBGRAPH_API_KEY}/subgraphs/id/C4ayEZP2yTXRAB8vSaTrgN4m9anTe9Mdm2ViyiAuV9TV`, { method: 'post', body: JSON.stringify({ query: `