|
4 | 4 |
|
5 | 5 | from hyperliquid.info import Info |
6 | 6 | from hyperliquid.exchange import Exchange |
7 | | -from hyperliquid.utils import constants |
| 7 | +from hyperliquid.utils import constants as hl_constants |
8 | 8 | from hyperliquid.utils.types import Cloid |
9 | 9 | from hyperliquid.utils.signing import ( |
10 | 10 | order_request_to_order_wire, |
@@ -47,10 +47,10 @@ def __init__(self, private_key: str, testnet: bool = False, account_address: str |
47 | 47 | self.logger.setLevel(logging.INFO) |
48 | 48 |
|
49 | 49 | # Set up API URLs |
50 | | - if testnet: |
51 | | - self.base_url = "https://api.hyperliquid.xyz" |
52 | | - else: |
53 | | - self.base_url = "https://api.hyperliquid.xyz" |
| 50 | + mainnet_url = getattr(hl_constants, "MAINNET_API_URL", "https://api.hyperliquid.xyz") |
| 51 | + testnet_url = getattr(hl_constants, "TESTNET_API_URL", "https://api.hyperliquid.xyz") |
| 52 | + self.base_url = testnet_url if testnet else mainnet_url |
| 53 | + self.is_mainnet = not testnet |
54 | 54 |
|
55 | 55 | # Initialize account address and wallet |
56 | 56 | from eth_account import Account |
@@ -111,7 +111,7 @@ def _bulk_orders_with_grouping(self, order_requests, grouping="na", builder=None |
111 | 111 | self.exchange.vault_address, |
112 | 112 | timestamp, |
113 | 113 | expires_after, |
114 | | - self.exchange.base_url == constants.MAINNET_API_URL |
| 114 | + self.is_mainnet |
115 | 115 | ) |
116 | 116 |
|
117 | 117 | # Post the action |
|
0 commit comments