|
21 | 21 | """This script queries the OMEN subgraph to obtain the trades of a given address."""
|
22 | 22 |
|
23 | 23 | import datetime
|
| 24 | +import os |
24 | 25 | import re
|
25 | 26 | from argparse import Action, ArgumentError, ArgumentParser, Namespace
|
26 | 27 | from collections import defaultdict
|
| 28 | +from dotenv import load_dotenv |
27 | 29 | from enum import Enum
|
28 | 30 | from pathlib import Path
|
29 | 31 | from string import Template
|
|
57 | 59 | SCRIPT_PATH = Path(__file__).resolve().parent
|
58 | 60 | STORE_PATH = Path(SCRIPT_PATH, ".trader_runner")
|
59 | 61 | RPC_PATH = Path(STORE_PATH, "rpc.txt")
|
| 62 | +ENV_FILE = Path(STORE_PATH, ".env") |
60 | 63 | WXDAI_CONTRACT_ADDRESS = "0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d"
|
61 | 64 | SCRIPT_PATH = Path(__file__).resolve().parent
|
62 | 65 | STORE_PATH = Path(SCRIPT_PATH, ".trader_runner")
|
63 | 66 | SAFE_ADDRESS_PATH = Path(STORE_PATH, "service_safe_address.txt")
|
64 | 67 |
|
65 | 68 |
|
| 69 | +load_dotenv(ENV_FILE) |
| 70 | + |
| 71 | + |
66 | 72 | headers = {
|
67 | 73 | "Accept": "application/json, multipart/mixed",
|
68 | 74 | "Content-Type": "application/json",
|
@@ -323,7 +329,8 @@ def _query_omen_xdai_subgraph( # pylint: disable=too-many-locals
|
323 | 329 | fpmm_to_timestamp: float = DEFAULT_TO_TIMESTAMP,
|
324 | 330 | ) -> Dict[str, Any]:
|
325 | 331 | """Query the subgraph."""
|
326 |
| - url = "https://api.thegraph.com/subgraphs/name/protofire/omen-xdai" |
| 332 | + subgraph_api_key = os.getenv('SUBGRAPH_API_KEY') |
| 333 | + url = f"https://gateway-arbitrum.network.thegraph.com/api/{subgraph_api_key}/subgraphs/id/9fUVQpFwzpdWS9bq5WkAnmKbNNcoBwatMR4yZq81pbbz" |
327 | 334 |
|
328 | 335 | grouped_results = defaultdict(list)
|
329 | 336 | creationTimestamp_gt = "0"
|
@@ -368,7 +375,8 @@ def _query_omen_xdai_subgraph( # pylint: disable=too-many-locals
|
368 | 375 |
|
369 | 376 | def _query_conditional_tokens_gc_subgraph(creator: str) -> Dict[str, Any]:
|
370 | 377 | """Query the subgraph."""
|
371 |
| - url = "https://api.thegraph.com/subgraphs/name/gnosis/conditional-tokens-gc" |
| 378 | + subgraph_api_key = os.getenv('SUBGRAPH_API_KEY') |
| 379 | + url = f"https://gateway-arbitrum.network.thegraph.com/api/{subgraph_api_key}/subgraphs/id/7s9rGBffUTL8kDZuxvvpuc46v44iuDarbrADBFw5uVp2" |
372 | 380 |
|
373 | 381 | all_results: Dict[str, Any] = {"data": {"user": {"userPositions": []}}}
|
374 | 382 | userPositions_id_gt = ""
|
|
0 commit comments