|
@@ -32,6 +32,9 @@ class HyperliquidClient:
|
|
|
self.config['sandbox'] = use_testnet
|
|
|
|
|
|
# Ensure proper CCXT format
|
|
|
+ if not self.config.get('privateKey') and Config.HYPERLIQUID_PRIVATE_KEY:
|
|
|
+ self.config['privateKey'] = Config.HYPERLIQUID_PRIVATE_KEY
|
|
|
+
|
|
|
if not self.config.get('apiKey') and Config.HYPERLIQUID_PRIVATE_KEY:
|
|
|
self.config['apiKey'] = Config.HYPERLIQUID_PRIVATE_KEY
|
|
|
|
|
@@ -42,19 +45,19 @@ class HyperliquidClient:
|
|
|
self.sync_client = None
|
|
|
self.async_client = None
|
|
|
|
|
|
- if self.config.get('apiKey'):
|
|
|
+ if self.config.get('privateKey') or self.config.get('apiKey'):
|
|
|
try:
|
|
|
# Log configuration (safely)
|
|
|
logger.info(f"🔧 Initializing Hyperliquid client with config: {self._safe_config_log()}")
|
|
|
|
|
|
- # Initialize with standard CCXT format
|
|
|
+ # Initialize with Hyperliquid-specific CCXT format
|
|
|
ccxt_config = {
|
|
|
- 'apiKey': self.config['apiKey'],
|
|
|
+ 'privateKey': self.config.get('privateKey') or self.config.get('apiKey'),
|
|
|
'testnet': self.config.get('testnet', False),
|
|
|
'sandbox': self.config.get('sandbox', False),
|
|
|
}
|
|
|
|
|
|
- # Add secret if available
|
|
|
+ # Add secret if available (though Hyperliquid might not need it)
|
|
|
if self.config.get('secret'):
|
|
|
ccxt_config['secret'] = self.config['secret']
|
|
|
|
|
@@ -81,10 +84,10 @@ class HyperliquidClient:
|
|
|
safe_config = self.config.copy()
|
|
|
if 'apiKey' in safe_config and safe_config['apiKey']:
|
|
|
safe_config['apiKey'] = f"{safe_config['apiKey'][:8]}..."
|
|
|
+ if 'privateKey' in safe_config and safe_config['privateKey']:
|
|
|
+ safe_config['privateKey'] = f"{safe_config['privateKey'][:8]}..."
|
|
|
if 'secret' in safe_config and safe_config['secret']:
|
|
|
safe_config['secret'] = f"{safe_config['secret'][:8]}..."
|
|
|
- if 'private_key' in safe_config and safe_config['private_key']:
|
|
|
- safe_config['private_key'] = f"{safe_config['private_key'][:8]}..."
|
|
|
return safe_config
|
|
|
|
|
|
def _safe_ccxt_config_log(self, config: dict) -> dict:
|
|
@@ -92,6 +95,8 @@ class HyperliquidClient:
|
|
|
safe_config = config.copy()
|
|
|
if 'apiKey' in safe_config and safe_config['apiKey']:
|
|
|
safe_config['apiKey'] = f"{safe_config['apiKey'][:10]}..."
|
|
|
+ if 'privateKey' in safe_config and safe_config['privateKey']:
|
|
|
+ safe_config['privateKey'] = f"{safe_config['privateKey'][:10]}..."
|
|
|
if 'secret' in safe_config and safe_config['secret']:
|
|
|
safe_config['secret'] = f"{safe_config['secret'][:10]}..."
|
|
|
return safe_config
|