@@ -1576,22 +1578,23 @@ function ExchangeConfigModal({
onClose: () => void
language: Language
}) {
- const [selectedExchangeId, setSelectedExchangeId] = useState(editingExchangeId || '');
- const [apiKey, setApiKey] = useState('');
- const [secretKey, setSecretKey] = useState('');
- const [passphrase, setPassphrase] = useState('');
- const [testnet, setTestnet] = useState(false);
- const [showGuide, setShowGuide] = useState(false);
+ const [selectedExchangeId, setSelectedExchangeId] = useState(
+ editingExchangeId || ''
+ )
+ const [apiKey, setApiKey] = useState('')
+ const [secretKey, setSecretKey] = useState('')
+ const [passphrase, setPassphrase] = useState('')
+ const [testnet, setTestnet] = useState(false)
+ const [showGuide, setShowGuide] = useState(false)
const [serverIP, setServerIP] = useState<{
- public_ip: string;
- message: string;
- } | null>(null);
- const [loadingIP, setLoadingIP] = useState(false);
- const [copiedIP, setCopiedIP] = useState(false);
+ public_ip: string
+ message: string
+ } | null>(null)
+ const [loadingIP, setLoadingIP] = useState(false)
+ const [copiedIP, setCopiedIP] = useState(false)
// 币安配置指南展开状态
- const [showBinanceGuide, setShowBinanceGuide] = useState(false);
-
+ const [showBinanceGuide, setShowBinanceGuide] = useState(false)
// Aster 特定字段
const [asterUser, setAsterUser] = useState('')
@@ -1611,9 +1614,6 @@ function ExchangeConfigModal({
setPassphrase('') // Don't load existing passphrase for security
setTestnet(selectedExchange.testnet || false)
- // Hyperliquid 字段
- setHyperliquidWalletAddr(selectedExchange.hyperliquidWalletAddr || '')
-
// Aster 字段
setAsterUser(selectedExchange.asterUser || '')
setAsterSigner(selectedExchange.asterSigner || '')
@@ -1624,26 +1624,27 @@ function ExchangeConfigModal({
// 加载服务器IP(当选择binance时)
useEffect(() => {
if (selectedExchangeId === 'binance' && !serverIP) {
- setLoadingIP(true);
- api.getServerIP()
- .then(data => {
- setServerIP(data);
+ setLoadingIP(true)
+ api
+ .getServerIP()
+ .then((data) => {
+ setServerIP(data)
})
- .catch(err => {
- console.error('Failed to load server IP:', err);
+ .catch((err) => {
+ console.error('Failed to load server IP:', err)
})
.finally(() => {
- setLoadingIP(false);
- });
+ setLoadingIP(false)
+ })
}
- }, [selectedExchangeId]);
+ }, [selectedExchangeId])
const handleCopyIP = (ip: string) => {
navigator.clipboard.writeText(ip).then(() => {
- setCopiedIP(true);
- setTimeout(() => setCopiedIP(false), 2000);
- });
- };
+ setCopiedIP(true)
+ setTimeout(() => setCopiedIP(false), 2000)
+ })
+ }
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
@@ -1789,104 +1790,151 @@ function ExchangeConfigModal({
{selectedExchange && (
<>
{/* Binance 和其他 CEX 交易所的字段 */}
- {(selectedExchange.id === 'binance' || selectedExchange.type === 'cex') && selectedExchange.id !== 'hyperliquid' && selectedExchange.id !== 'aster' && (
- <>
- {/* 币安用户配置提示 (D1 方案) */}
- {selectedExchange.id === 'binance' && (
-
setShowBinanceGuide(!showBinanceGuide)}
- >
-
-
-
ℹ️
-
- 币安用户必读:
- 使用「现货与合约交易」API,不要用「统一账户 API」
+ {(selectedExchange.id === 'binance' ||
+ selectedExchange.type === 'cex') &&
+ selectedExchange.id !== 'hyperliquid' &&
+ selectedExchange.id !== 'aster' && (
+ <>
+ {/* 币安用户配置提示 (D1 方案) */}
+ {selectedExchange.id === 'binance' && (
+ setShowBinanceGuide(!showBinanceGuide)}
+ >
+
+
+ ℹ️
+
+ 币安用户必读:
+ 使用「现货与合约交易」API,不要用「统一账户 API」
+
+
+
+ {showBinanceGuide ? '▲' : '▼'}
-
- {showBinanceGuide ? '▲' : '▼'}
-
-
- {/* 展开的详细说明 */}
- {showBinanceGuide && (
- e.stopPropagation()}
- >
-
- 原因:统一账户 API 权限结构不同,会导致订单提交失败
-
-
-
- 正确配置步骤:
-
-
- - 登录币安 → 个人中心 → API 管理
- - 创建 API → 选择「系统生成的 API 密钥」
- - 勾选「现货与合约交易」(不选统一账户)
- - IP 限制选「无限制」或添加服务器 IP
-
-
-
- 💡 多资产模式用户注意:
- 如果您开启了多资产模式,将强制使用全仓模式。建议关闭多资产模式以支持逐仓交易。
-
-
-
e.stopPropagation()}
>
- 📖 查看币安官方教程 ↗
-
-
- )}
+
+ 原因:统一账户 API
+ 权限结构不同,会导致订单提交失败
+
+
+
+ 正确配置步骤:
+
+
+ -
+ 登录币安 → 个人中心 → API 管理
+
+ -
+ 创建 API → 选择「
+ 系统生成的 API 密钥」
+
+ -
+ 勾选「现货与合约交易」(
+
+ 不选统一账户
+
+ )
+
+ -
+ IP 限制选「无限制」或添加服务器
+ IP
+
+
+
+
+ 💡 多资产模式用户注意:
+ 如果您开启了多资产模式,将强制使用全仓模式。建议关闭多资产模式以支持逐仓交易。
+
+
+
+ 📖 查看币安官方教程 ↗
+
+
+ )}
+
+ )}
+
+
+
+ setApiKey(e.target.value)}
+ placeholder={t('enterAPIKey', language)}
+ className="w-full px-3 py-2 rounded"
+ style={{
+ background: '#0B0E11',
+ border: '1px solid #2B3139',
+ color: '#EAECEF',
+ }}
+ required
+ />
- )}
-
-
- setApiKey(e.target.value)}
- placeholder={t('enterAPIKey', language)}
- className="w-full px-3 py-2 rounded"
- style={{ background: '#0B0E11', border: '1px solid #2B3139', color: '#EAECEF' }}
- required
- />
-
-
-
-
- setSecretKey(e.target.value)}
- placeholder={t('enterSecretKey', language)}
- className="w-full px-3 py-2 rounded"
- style={{ background: '#0B0E11', border: '1px solid #2B3139', color: '#EAECEF' }}
- required
- />
-
+
+
+ setSecretKey(e.target.value)}
+ placeholder={t('enterSecretKey', language)}
+ className="w-full px-3 py-2 rounded"
+ style={{
+ background: '#0B0E11',
+ border: '1px solid #2B3139',
+ color: '#EAECEF',
+ }}
+ required
+ />
+