File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
apps/hip-3-pusher/src/pusher Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 1- from pydantic import BaseModel , Field
1+ from hyperliquid .utils .constants import MAINNET_API_URL , TESTNET_API_URL
2+ from pydantic import BaseModel , model_validator
23from typing import Optional
34
45STALE_TIMEOUT_SECONDS = 5
@@ -28,14 +29,20 @@ class HermesConfig(BaseModel):
2829
2930class HyperliquidConfig (BaseModel ):
3031 hyperliquid_ws_urls : list [str ]
31- backup_push_urls : Optional [list [str ]] = Field ( default_factory = list )
32+ push_urls : Optional [list [str ]] = None
3233 market_name : str
3334 market_symbol : str
3435 use_testnet : bool
3536 oracle_pusher_key_path : str
3637 publish_interval : float
3738 enable_publish : bool
3839
40+ @model_validator (mode = "after" )
41+ def set_default_urls (self ):
42+ if self .push_urls is None :
43+ self .push_urls = [TESTNET_API_URL ] if self .use_testnet else [MAINNET_API_URL ]
44+ return self
45+
3946
4047class Config (BaseModel ):
4148 stale_price_threshold_seconds : int
Original file line number Diff line number Diff line change 55from eth_account import Account
66from eth_account .signers .local import LocalAccount
77from hyperliquid .exchange import Exchange
8- from hyperliquid .utils .constants import TESTNET_API_URL , MAINNET_API_URL
98
109from pusher .config import Config
1110from pusher .kms_signer import KMSSigner
@@ -22,7 +21,7 @@ class Publisher:
2221 def __init__ (self , config : Config , price_state : PriceState , metrics : Metrics ):
2322 self .publish_interval = float (config .hyperliquid .publish_interval )
2423 self .use_testnet = config .hyperliquid .use_testnet
25- self .push_urls = [ TESTNET_API_URL if self . use_testnet else MAINNET_API_URL ] + config .hyperliquid .backup_push_urls
24+ self .push_urls = config .hyperliquid .push_urls
2625
2726 self .kms_signer = None
2827 self .enable_kms = False
You can’t perform that action at this time.
0 commit comments