From 6ddb80a5fd68463522c5fe474e1469d9aacd149a Mon Sep 17 00:00:00 2001 From: Rorry Date: Tue, 20 Aug 2024 10:32:21 +0200 Subject: [PATCH] feat: Creates env vars to handle our subgraph API endpoints (#200) --- packages/sdk/src/vaults/constants.ts | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/sdk/src/vaults/constants.ts b/packages/sdk/src/vaults/constants.ts index e49f786d..e87ab051 100644 --- a/packages/sdk/src/vaults/constants.ts +++ b/packages/sdk/src/vaults/constants.ts @@ -56,13 +56,25 @@ export const COW_SETTLEMENT_ADDRESS_LIST: Record = { [ChainId.ARBITRUM]: COW_SETTLEMENT_ADDRESS, }; -const STACKLY_SUBGRAPH_API_KEY = - process.env.STACKLY_SUBGRAPH_API_KEY ?? "e7b7ff845e506590498946cd6bf83bf6"; +const API_BASE_URL = "https://gateway-arbitrum.network.thegraph.com/api"; +const SUBGRAPH_API_KEY = process.env.STACKLY_SUBGRAPH_API_KEY ?? ""; + +const ETHEREUM_SUBGRAPH_ENDPOINT_URL = + process.env.ETHEREUM_SUBGRAPH_API_URL ?? + `${API_BASE_URL}/${SUBGRAPH_API_KEY}/subgraphs/id/7s9rGBffUTL8kDZuxvvpuc46v44iuDarbrADBFw5uVp2`; + +const GNOSIS_SUBGRAPH_ENDPOINT_URL = + process.env.GNOSIS_SUBGRAPH_API_URL ?? + `${API_BASE_URL}/${SUBGRAPH_API_KEY}/subgraphs/id/9fUVQpFwzpdWS9bq5WkAnmKbNNcoBwatMR4yZq81pbbz`; + +const ARBITRUM_SUBGRAPH_ENDPOINT_URL = + process.env.ARBITRUM_SUBGRAPH_API_URL ?? + `${API_BASE_URL}/${SUBGRAPH_API_KEY}/subgraphs/id/D58aXwnRLfosFtRaVJAbAjjvKZ11bEsbdiDLkJJRdSC9`; export const SUBGRAPH_ENDPOINT_LIST: Readonly> = { - [ChainId.ETHEREUM]: `https://gateway-arbitrum.network.thegraph.com/api/${STACKLY_SUBGRAPH_API_KEY}/subgraphs/id/35bL4ohk2tnXqDnrp7NSyAKW8bbUmGDapyfe2ddCxV8H`, - [ChainId.GNOSIS]: `https://gateway-arbitrum.network.thegraph.com/api/${STACKLY_SUBGRAPH_API_KEY}/subgraphs/id/72Lysd4A2kZFqMqJtPQk3zMEEBExFfXeZbkJGTx8phRL`, - [ChainId.ARBITRUM]: `https://gateway-arbitrum.network.thegraph.com/api/${STACKLY_SUBGRAPH_API_KEY}/subgraphs/id/FNmemHB6tUh7eHmJnBFKYFf27U5GUAzXnatry4ZbrF7f`, + [ChainId.ETHEREUM]: ETHEREUM_SUBGRAPH_ENDPOINT_URL, + [ChainId.GNOSIS]: GNOSIS_SUBGRAPH_ENDPOINT_URL, + [ChainId.ARBITRUM]: ARBITRUM_SUBGRAPH_ENDPOINT_URL, }; /**