* Test broker credentials before committing them. Accepts either a full * UTAConfig (during edit) or a draft without an id (during create) — the * server stamps `__test__` if id is absent.
(uta: UTAConfig | Omit<UTAConfig, 'id'>)
| 265 | * server stamps `__test__` if id is absent. |
| 266 | */ |
| 267 | async testConnection(uta: UTAConfig | Omit<UTAConfig, 'id'>): Promise<TestConnectionResult> { |
| 268 | const res = await fetch('/api/trading/config/test-connection', { |
| 269 | method: 'POST', |
| 270 | headers: { 'Content-Type': 'application/json' }, |
| 271 | body: JSON.stringify(uta), |
| 272 | }) |
| 273 | return res.json() |
| 274 | }, |
| 275 | } |
| 276 | |
| 277 | // ==================== Internal helpers ==================== |