@microcosmmoney/portal-react 3.13.4 → 3.13.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/main-portal/components/auctions/AuctionsPage.js +2 -2
  2. package/dist/main-portal/components/income/ManagerIncomePage.js +1 -16
  3. package/dist/main-portal/components/layout/AppSidebar.js +1 -1
  4. package/dist/main-portal/components/layout/TerminalSidebar.js +1 -1
  5. package/dist/main-portal/components/mining/MiningModal.js +2 -2
  6. package/dist/main-portal/components/profile/ProfilePage.js +2 -2
  7. package/dist/main-portal/components/providers/SolanaWalletProvider.js +1 -1
  8. package/dist/main-portal/components/queue/QueueStatusPage.js +2 -71
  9. package/dist/main-portal/components/resources/public-mining-modal.js +1 -1
  10. package/dist/main-portal/components/stations/StationDetailPage.js +1 -3
  11. package/dist/main-portal/components/stations/StationListPage.js +2 -4
  12. package/dist/main-portal/components/stations/StationsPage.js +2 -5
  13. package/dist/main-portal/config/menu-config.d.ts +0 -2
  14. package/dist/main-portal/config/menu-config.js +14 -67
  15. package/dist/main-portal/hooks/useAuth.d.ts +1 -2
  16. package/dist/main-portal/hooks/useAuth.js +0 -2
  17. package/dist/main-portal/lib/api/blockchain.d.ts +0 -44
  18. package/dist/main-portal/lib/api/blockchain.js +0 -195
  19. package/dist/main-portal/lib/api/services/index.d.ts +0 -1
  20. package/dist/main-portal/lib/api/services/index.js +0 -1
  21. package/dist/main-portal/lib/api/services/organization.d.ts +1 -6
  22. package/dist/main-portal/lib/api/services/organization.js +0 -12
  23. package/dist/main-portal/lib/oauth-config.js +3 -3
  24. package/dist/main-portal/lib/types/common.types.d.ts +0 -32
  25. package/dist/main-portal/lib/types/user.types.d.ts +1 -33
  26. package/package.json +1 -1
  27. package/dist/main-portal/hooks/useStrategies.d.ts +0 -134
  28. package/dist/main-portal/hooks/useStrategies.js +0 -28
  29. package/dist/main-portal/lib/api/services/ai.d.ts +0 -139
  30. package/dist/main-portal/lib/api/services/ai.js +0 -214
  31. package/dist/main-portal/lib/order-id-generator.d.ts +0 -19
  32. package/dist/main-portal/lib/order-id-generator.js +0 -97
  33. package/dist/main-portal/lib/strategy/defaults.d.ts +0 -2
  34. package/dist/main-portal/lib/strategy/defaults.js +0 -58
  35. package/dist/main-portal/lib/strategy/index.d.ts +0 -3
  36. package/dist/main-portal/lib/strategy/index.js +0 -20
  37. package/dist/main-portal/lib/strategy/tooltips.d.ts +0 -1
  38. package/dist/main-portal/lib/strategy/tooltips.js +0 -50
  39. package/dist/main-portal/lib/strategy/types.d.ts +0 -74
  40. package/dist/main-portal/lib/strategy/types.js +0 -2
@@ -8,18 +8,6 @@ exports.invalidateWalletCache = invalidateWalletCache;
8
8
  exports.getPoolStatus = getPoolStatus;
9
9
  exports.getTokenFromBalance = getTokenFromBalance;
10
10
  exports.formatTokenBalance = formatTokenBalance;
11
- exports.getMcdAccountStatus = getMcdAccountStatus;
12
- exports.ensureUserMcdAccount = ensureUserMcdAccount;
13
- exports.batchGetMcdAccountStatus = batchGetMcdAccountStatus;
14
- exports.getZombieAccounts = getZombieAccounts;
15
- exports.closeMcdAccount = closeMcdAccount;
16
- exports.batchCloseMcdAccounts = batchCloseMcdAccounts;
17
- exports.getRentStatistics = getRentStatistics;
18
- exports.getClosureHistory = getClosureHistory;
19
- exports.getSystemAddresses = getSystemAddresses;
20
- exports.getSystemAddressStats = getSystemAddressStats;
21
- exports.updateSystemAddress = updateSystemAddress;
22
- exports.seedSystemAddresses = seedSystemAddresses;
23
11
  // AI-generated · AI-managed · AI-maintained
24
12
  const core_1 = require("./core");
25
13
  async function getMccPrice() {
@@ -117,186 +105,3 @@ function formatTokenBalance(balance, decimals = 2) {
117
105
  maximumFractionDigits: decimals
118
106
  });
119
107
  }
120
- async function getMcdAccountStatus(uid) {
121
- try {
122
- const response = await (0, core_1.fetchApi)(`/blockchain/mcd/admin/account-status/${uid}`, { method: 'GET' });
123
- if (response.success && response.data) {
124
- return response.data;
125
- }
126
- return null;
127
- }
128
- catch (error) {
129
- console.error('[Blockchain API] 获取 MCD 账户状态失败:', error);
130
- throw error;
131
- }
132
- }
133
- async function ensureUserMcdAccount(uid) {
134
- try {
135
- const response = await (0, core_1.fetchApi)(`/blockchain/mcd/admin/account/ensure/${uid}`, { method: 'POST' });
136
- if (response.success && response.data) {
137
- return response.data;
138
- }
139
- throw new Error(response.error || '创建 MCD 账户失败');
140
- }
141
- catch (error) {
142
- console.error('[Blockchain API] 创建 MCD 账户失败:', error);
143
- throw error;
144
- }
145
- }
146
- async function batchGetMcdAccountStatus(uids) {
147
- try {
148
- const response = await (0, core_1.fetchApi)(`/blockchain/mcd/admin/batch-status`, {
149
- method: 'POST',
150
- body: JSON.stringify({ uids })
151
- });
152
- if (response.success && response.data) {
153
- return response.data;
154
- }
155
- return {};
156
- }
157
- catch (error) {
158
- console.error('[Blockchain API] 批量获取 MCD 账户状态失败:', error);
159
- return {};
160
- }
161
- }
162
- async function getZombieAccounts(options = {}) {
163
- const { limit = 50, offset = 0, min_inactive_days = 180 } = options;
164
- try {
165
- const response = await (0, core_1.fetchApi)(`/blockchain/mcd/admin/zombie-accounts?limit=${limit}&offset=${offset}&inactive_days=${min_inactive_days}`, { method: 'GET' });
166
- if (response.success && response.data) {
167
- return response.data;
168
- }
169
- throw new Error(response.error || '获取僵尸账户失败');
170
- }
171
- catch (error) {
172
- console.error('[Blockchain API] 获取僵尸账户失败:', error);
173
- throw error;
174
- }
175
- }
176
- async function closeMcdAccount(uid, reason = 'zombie') {
177
- try {
178
- const response = await (0, core_1.fetchApi)(`/blockchain/mcd/admin/close-account/${uid}`, {
179
- method: 'POST',
180
- body: JSON.stringify({ reason })
181
- });
182
- if (response.success && response.data) {
183
- return response.data;
184
- }
185
- throw new Error(response.error || '关闭账户失败');
186
- }
187
- catch (error) {
188
- console.error('[Blockchain API] 关闭 MCD 账户失败:', error);
189
- throw error;
190
- }
191
- }
192
- async function batchCloseMcdAccounts(uids, reason = 'zombie') {
193
- try {
194
- const response = await (0, core_1.fetchApi)(`/blockchain/mcd/admin/batch-close-accounts`, {
195
- method: 'POST',
196
- body: JSON.stringify({ uids, reason })
197
- });
198
- if (response.success && response.data) {
199
- return response.data;
200
- }
201
- throw new Error(response.error || '批量关闭账户失败');
202
- }
203
- catch (error) {
204
- console.error('[Blockchain API] 批量关闭 MCD 账户失败:', error);
205
- throw error;
206
- }
207
- }
208
- async function getRentStatistics(startDate, endDate) {
209
- try {
210
- const params = new URLSearchParams();
211
- if (startDate)
212
- params.append('start_date', startDate);
213
- if (endDate)
214
- params.append('end_date', endDate);
215
- const url = `/blockchain/mcd/admin/rent-statistics${params.toString() ? `?${params.toString()}` : ''}`;
216
- const response = await (0, core_1.fetchApi)(url, { method: 'GET' });
217
- if (response.success && response.data) {
218
- return response.data;
219
- }
220
- throw new Error(response.error || '获取租金统计失败');
221
- }
222
- catch (error) {
223
- console.error('[Blockchain API] 获取租金统计失败:', error);
224
- throw error;
225
- }
226
- }
227
- async function getClosureHistory(options = {}) {
228
- const { limit = 50, offset = 0, reason } = options;
229
- try {
230
- let url = `/blockchain/mcd/admin/closure-history?limit=${limit}&offset=${offset}`;
231
- if (reason)
232
- url += `&reason=${reason}`;
233
- const response = await (0, core_1.fetchApi)(url, { method: 'GET' });
234
- if (response.success && response.data) {
235
- return response.data;
236
- }
237
- throw new Error(response.error || '获取关闭历史失败');
238
- }
239
- catch (error) {
240
- console.error('[Blockchain API] 获取关闭历史失败:', error);
241
- throw error;
242
- }
243
- }
244
- async function getSystemAddresses(options = {}) {
245
- const { category, status, search, limit = 200, offset = 0 } = options;
246
- try {
247
- const params = new URLSearchParams();
248
- params.set('limit', String(limit));
249
- params.set('offset', String(offset));
250
- if (category)
251
- params.set('category', category);
252
- if (status)
253
- params.set('status', status);
254
- if (search)
255
- params.set('search', search);
256
- const response = await (0, core_1.fetchApi)(`/blockchain/system-addresses/admin/list?${params.toString()}`, { method: 'GET' });
257
- if (response.success && response.data) {
258
- return response.data;
259
- }
260
- throw new Error(response.error || 'Failed to load system addresses');
261
- }
262
- catch (error) {
263
- console.error('[Blockchain API] getSystemAddresses failed:', error);
264
- throw error;
265
- }
266
- }
267
- async function getSystemAddressStats() {
268
- try {
269
- const response = await (0, core_1.fetchApi)('/blockchain/system-addresses/admin/stats', { method: 'GET' });
270
- if (response.success && response.data) {
271
- return response.data;
272
- }
273
- throw new Error(response.error || 'Failed to load stats');
274
- }
275
- catch (error) {
276
- console.error('[Blockchain API] getSystemAddressStats failed:', error);
277
- throw error;
278
- }
279
- }
280
- async function updateSystemAddress(id, data) {
281
- try {
282
- const response = await (0, core_1.fetchApi)(`/blockchain/system-addresses/admin/${id}`, {
283
- method: 'PUT',
284
- body: JSON.stringify(data)
285
- });
286
- return response;
287
- }
288
- catch (error) {
289
- console.error('[Blockchain API] updateSystemAddress failed:', error);
290
- throw error;
291
- }
292
- }
293
- async function seedSystemAddresses() {
294
- try {
295
- const response = await (0, core_1.fetchApi)('/blockchain/system-addresses/admin/seed', { method: 'POST' });
296
- return response;
297
- }
298
- catch (error) {
299
- console.error('[Blockchain API] seedSystemAddresses failed:', error);
300
- throw error;
301
- }
302
- }
@@ -1,4 +1,3 @@
1
- export * from './ai';
2
1
  export * from './mining';
3
2
  export * from './finance';
4
3
  export * from './organization';
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ai"), exports);
18
17
  __exportStar(require("./mining"), exports);
19
18
  __exportStar(require("./finance"), exports);
20
19
  __exportStar(require("./organization"), exports);
@@ -1,4 +1,4 @@
1
- import type { APIResponse, Unit, Member, Auction, Bid, PlaceBidRequest, AuctionHistoryParams, MiningWeight, TechBonusDetail, StationKPI, UserRank, LevelProgress, UserLevelStatus, LevelSystemConfig, UserQueueStatus, AdminQueueStatus, QueueProcessResult, ExpansionCheckResult, ExpansionTriggerResult, ManagerIncomeSummary, StationIncomeSummary, TeamCustodySummary } from '../../types/api';
1
+ import type { APIResponse, Unit, Member, Auction, Bid, PlaceBidRequest, AuctionHistoryParams, MiningWeight, TechBonusDetail, StationKPI, UserRank, LevelProgress, UserLevelStatus, LevelSystemConfig, UserQueueStatus, ManagerIncomeSummary, StationIncomeSummary } from '../../types/api';
2
2
  export declare const getUnits: (unitType?: string) => Promise<APIResponse<Unit[]>>;
3
3
  export declare const getUnitDetails: (unitId: string) => Promise<APIResponse<Unit>>;
4
4
  export declare const createUnit: (unitData: {
@@ -152,10 +152,5 @@ export declare function getQueueStatus(): Promise<UserQueueStatus>;
152
152
  export declare function cancelQueue(): Promise<APIResponse<{
153
153
  message: string;
154
154
  }>>;
155
- export declare function getAdminQueueStatus(): Promise<AdminQueueStatus>;
156
- export declare function processQueue(batchSize?: number): Promise<QueueProcessResult>;
157
- export declare function checkExpansionNeeded(): Promise<ExpansionCheckResult>;
158
- export declare function triggerExpansion(): Promise<ExpansionTriggerResult>;
159
155
  export declare function getStationIncome(stationId: string, startDate?: string, endDate?: string): Promise<StationIncomeSummary>;
160
156
  export declare function getManagerIncome(startDate?: string, endDate?: string): Promise<ManagerIncomeSummary>;
161
- export declare function getTeamCustodySummary(): Promise<TeamCustodySummary>;
@@ -6,13 +6,8 @@ exports.leaveStation = leaveStation;
6
6
  exports.joinStationQueue = joinStationQueue;
7
7
  exports.getQueueStatus = getQueueStatus;
8
8
  exports.cancelQueue = cancelQueue;
9
- exports.getAdminQueueStatus = getAdminQueueStatus;
10
- exports.processQueue = processQueue;
11
- exports.checkExpansionNeeded = checkExpansionNeeded;
12
- exports.triggerExpansion = triggerExpansion;
13
9
  exports.getStationIncome = getStationIncome;
14
10
  exports.getManagerIncome = getManagerIncome;
15
- exports.getTeamCustodySummary = getTeamCustodySummary;
16
11
  const core_1 = require("../core");
17
12
  const getUnits = async (unitType) => {
18
13
  const query = unitType ? `?unit_type=${unitType}` : '';
@@ -112,12 +107,6 @@ async function joinStationQueue(preferredTerritoryId) {
112
107
  }
113
108
  async function getQueueStatus() { return (0, core_1.fetchApi)('/organization-service/station/queue/status'); }
114
109
  async function cancelQueue() { return (0, core_1.fetchApi)('/organization-service/station/queue', { method: 'DELETE' }); }
115
- async function getAdminQueueStatus() { return (0, core_1.fetchApi)('/organization-service/station/queue/admin'); }
116
- async function processQueue(batchSize = 50) {
117
- return (0, core_1.fetchApi)('/organization-service/station/queue/process', { method: 'POST', body: JSON.stringify({ batch_size: batchSize }) });
118
- }
119
- async function checkExpansionNeeded() { return (0, core_1.fetchApi)('/organization-service/station/expansion/check'); }
120
- async function triggerExpansion() { return (0, core_1.fetchApi)('/organization-service/station/expansion/trigger', { method: 'POST' }); }
121
110
  async function getStationIncome(stationId, startDate, endDate) {
122
111
  const p = new URLSearchParams();
123
112
  if (startDate)
@@ -136,4 +125,3 @@ async function getManagerIncome(startDate, endDate) {
136
125
  const qs = p.toString();
137
126
  return (0, core_1.fetchApi)(`/organization-service/manager/income${qs ? `?${qs}` : ''}`);
138
127
  }
139
- async function getTeamCustodySummary() { return (0, core_1.fetchApi)('/organization-service/team-custody/summary'); }
@@ -10,11 +10,11 @@ exports.OAUTH_CONFIG = {
10
10
  authorizationEndpoint: process.env.NEXT_PUBLIC_OAUTH_AUTH_ENDPOINT || 'https://microcosm.money/login',
11
11
  tokenEndpoint: process.env.NEXT_PUBLIC_OAUTH_TOKEN_ENDPOINT || 'https://microcosm.money/api/oauth/token',
12
12
  firebaseTokenEndpoint: process.env.NEXT_PUBLIC_OAUTH_FIREBASE_ENDPOINT || 'https://microcosm.money/api/oauth/firebase-token',
13
- clientId: process.env.NEXT_PUBLIC_OAUTH_CLIENT_ID || 'doublehelix',
13
+ clientId: process.env.NEXT_PUBLIC_OAUTH_CLIENT_ID || '',
14
14
  redirectUri: typeof window !== 'undefined'
15
15
  ? `${window.location.origin}/auth/callback`
16
- : process.env.NEXT_PUBLIC_OAUTH_REDIRECT_URI || 'https://doublehelix.money/auth/callback',
17
- scopes: ['openid', 'profile', 'email', 'trading'],
16
+ : process.env.NEXT_PUBLIC_OAUTH_REDIRECT_URI || '',
17
+ scopes: ['openid', 'profile', 'email'],
18
18
  };
19
19
  function generateState() {
20
20
  const array = new Uint8Array(32);
@@ -129,38 +129,6 @@ export interface UserQueueStatus {
129
129
  status?: QueueStatus;
130
130
  error?: string;
131
131
  }
132
- export interface AdminQueueStatus {
133
- success: boolean;
134
- pending_count: number;
135
- processing_count: number;
136
- oldest_pending?: string;
137
- total_in_queue: number;
138
- error?: string;
139
- }
140
- export interface QueueProcessResult {
141
- success: boolean;
142
- processed: number;
143
- assigned: number;
144
- failed: number;
145
- errors?: string[];
146
- }
147
- export interface ExpansionCheckResult {
148
- success: boolean;
149
- needs_expansion: boolean;
150
- reason?: string;
151
- current_stats: {
152
- total_stations: number;
153
- full_stations: number;
154
- avg_occupancy: number;
155
- pending_queue: number;
156
- };
157
- }
158
- export interface ExpansionTriggerResult {
159
- success: boolean;
160
- new_territory_id?: string;
161
- message?: string;
162
- error?: string;
163
- }
164
132
  export interface PreparedTransaction {
165
133
  transaction: string;
166
134
  message: string;
@@ -25,7 +25,7 @@ export interface TransactionResult {
25
25
  balanceAfter: number;
26
26
  transaction: Transaction;
27
27
  }
28
- export type UserRole = 'admin' | 'agent' | 'user';
28
+ export type UserRole = 'agent' | 'user';
29
29
  export interface UserInfo {
30
30
  uid: string;
31
31
  email: string | null;
@@ -209,35 +209,3 @@ export interface IncomeHistoryResponse {
209
209
  page_size: number;
210
210
  error?: string;
211
211
  }
212
- export interface StrategyConfig {
213
- symbol: string;
214
- leverage: number;
215
- position_size: number;
216
- stop_loss?: number;
217
- take_profit?: number;
218
- parameters: Record<string, unknown>;
219
- }
220
- export interface BinanceOrderResponse {
221
- success: boolean;
222
- order?: {
223
- orderId: number;
224
- clientOrderId: string;
225
- symbol: string;
226
- status: string;
227
- price: string;
228
- avgPrice: string;
229
- origQty: string;
230
- executedQty: string;
231
- type: string;
232
- side: string;
233
- positionSide: string;
234
- time: number;
235
- updateTime: number;
236
- };
237
- error?: string;
238
- }
239
- export interface BinanceCancelResponse {
240
- success: boolean;
241
- cancelled?: boolean;
242
- error?: string;
243
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microcosmmoney/portal-react",
3
- "version": "3.13.4",
3
+ "version": "3.13.6",
4
4
  "description": "Microcosm Portal UI components for React/Next.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,134 +0,0 @@
1
- interface PositionData {
2
- amount?: number;
3
- entryPrice?: number;
4
- }
5
- interface PowerStartCheck {
6
- profit_check?: {
7
- passed: boolean;
8
- current: number;
9
- threshold: number;
10
- };
11
- gap_check?: {
12
- passed: boolean;
13
- current: number;
14
- threshold: number;
15
- };
16
- thickness_check?: {
17
- passed: boolean;
18
- thickness_pct: number;
19
- };
20
- orders_check?: {
21
- passed: boolean;
22
- long_count: number;
23
- short_count: number;
24
- max_orders: number;
25
- };
26
- }
27
- export interface LiveState {
28
- total_unrealized_pnl?: number;
29
- energy_unrealized_pnl?: number;
30
- price_gap_pct?: number;
31
- price_gap_abs?: number;
32
- current_drawdown_pct?: number;
33
- current_price?: number;
34
- wallet_balance?: number;
35
- total_long_pos_amount?: number;
36
- total_short_pos_amount?: number;
37
- power_open_orders_long?: number;
38
- power_open_orders_short?: number;
39
- power_tp_orders_long?: number;
40
- power_tp_orders_short?: number;
41
- power_total_realized_pnl?: number;
42
- power_closed_trades_long?: number;
43
- power_closed_trades_short?: number;
44
- energy_realized_pnl?: number;
45
- user_manual_long_position?: number;
46
- user_manual_short_position?: number;
47
- user_manual_realized_pnl?: number;
48
- power_start_mode?: string;
49
- power_start_check?: PowerStartCheck;
50
- positions?: {
51
- energy?: {
52
- LONG?: PositionData;
53
- SHORT?: PositionData;
54
- };
55
- power?: {
56
- LONG?: {
57
- amount?: number;
58
- open_orders?: number;
59
- tp_orders?: number;
60
- };
61
- SHORT?: {
62
- amount?: number;
63
- open_orders?: number;
64
- tp_orders?: number;
65
- };
66
- };
67
- total_long?: PositionData;
68
- total_short?: PositionData;
69
- };
70
- raw_snapshot?: {
71
- positions?: Array<{
72
- positionSide: 'LONG' | 'SHORT';
73
- unRealizedProfit: string;
74
- positionAmt: string;
75
- entryPrice: string;
76
- markPrice: string;
77
- }>;
78
- };
79
- start_time?: string;
80
- duration?: string;
81
- power_today_realized_pnl?: number;
82
- energy_today_realized_pnl?: number;
83
- power_win_rate?: number;
84
- power_profit_factor?: number;
85
- energy_win_rate?: number;
86
- energy_profit_factor?: number;
87
- energy_hedge_count?: number;
88
- energy_sync_hedge_count?: number;
89
- energy_tp_form_a_count?: number;
90
- energy_tp_form_b_count?: number;
91
- power_stale_converted_count?: number;
92
- power_avg_holding_duration?: number;
93
- power_longest_stale_duration?: number;
94
- power_avg_stale_duration?: number;
95
- power_stale_cleanup_count?: number;
96
- power_protection_trigger_count?: number;
97
- power_total_fees?: number;
98
- energy_total_fees?: number;
99
- power_today_fees?: number;
100
- energy_today_fees?: number;
101
- power_month_fees?: number;
102
- energy_month_fees?: number;
103
- manual_open_count?: number;
104
- manual_close_count?: number;
105
- manual_chase_count?: number;
106
- manual_cancel_count?: number;
107
- }
108
- export interface PowerParams {
109
- start_price_gap_pct?: number;
110
- open_pos_quantity?: number;
111
- start_pos_thickness_pct?: number;
112
- max_open_orders?: number;
113
- start_energy_profit_pct?: number;
114
- }
115
- export interface Strategy {
116
- id: string;
117
- name?: string;
118
- strategy_name?: string;
119
- symbol?: string;
120
- is_active: boolean;
121
- base?: {
122
- symbol?: string;
123
- };
124
- power?: PowerParams;
125
- params?: {
126
- power?: PowerParams;
127
- };
128
- live_state?: LiveState;
129
- created_at?: string;
130
- updated_at?: string;
131
- }
132
- export declare function useStrategies(refreshInterval?: number): import("swr").SWRResponse<Strategy[], any, import("swr").SWRConfiguration<Strategy[], any, import("swr").BareFetcher<Strategy[]>> | undefined>;
133
- export declare function useStrategyDetails(strategyId: string | null, refreshInterval?: number): import("swr").SWRResponse<Strategy, any, import("swr").SWRConfiguration<Strategy, any, import("swr").BareFetcher<Strategy>> | undefined>;
134
- export {};
@@ -1,28 +0,0 @@
1
- "use strict";
2
- // AI-generated · AI-managed · AI-maintained
3
- 'use client';
4
- var __importDefault = (this && this.__importDefault) || function (mod) {
5
- return (mod && mod.__esModule) ? mod : { "default": mod };
6
- };
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.useStrategies = useStrategies;
9
- exports.useStrategyDetails = useStrategyDetails;
10
- const swr_1 = __importDefault(require("swr"));
11
- const api_service_1 = require("../lib/api-service");
12
- const fetcher = async (url) => (0, api_service_1.fetchApi)(url);
13
- function useStrategies(refreshInterval = 15000) {
14
- return (0, swr_1.default)('/strategies', fetcher, {
15
- refreshInterval,
16
- revalidateOnFocus: true,
17
- dedupingInterval: 5000,
18
- errorRetryCount: 3,
19
- });
20
- }
21
- function useStrategyDetails(strategyId, refreshInterval = 15000) {
22
- return (0, swr_1.default)(strategyId ? `/strategies/${strategyId}` : null, fetcher, {
23
- refreshInterval,
24
- revalidateOnFocus: true,
25
- dedupingInterval: 5000,
26
- errorRetryCount: 3,
27
- });
28
- }
@@ -1,139 +0,0 @@
1
- import type { APIResponse, AIProductsResponse, AIProductDetailResponse, AIRequestsResponse, AIRequestDetailResponse, SubmitAIRequestResponse, AIChatResponse, StrategyConfig, BinanceOrderResponse, BinanceCancelResponse } from '../../types/api';
2
- export declare function getAIProducts(params?: {
3
- status?: 'active' | 'all';
4
- risk_level?: 'low' | 'medium' | 'high' | 'all';
5
- sort?: 'risk' | 'return' | 'popularity';
6
- }): Promise<AIProductsResponse>;
7
- export declare function getAIProductDetail(productId: string): Promise<AIProductDetailResponse>;
8
- export declare function submitAIRequest(data: {
9
- ai_product_id: string;
10
- exchange: string;
11
- amount: number;
12
- }): Promise<SubmitAIRequestResponse>;
13
- export declare function getUserAIRequests(status?: string): Promise<AIRequestsResponse>;
14
- export declare function getAIRequestDetail(requestId: string): Promise<AIRequestDetailResponse>;
15
- export declare function cancelAIRequest(requestId: string): Promise<APIResponse<void>>;
16
- export declare function stopAIStrategy(requestId: string, reason?: string): Promise<APIResponse<void>>;
17
- export declare function getPendingAIRequests(): Promise<AIRequestsResponse>;
18
- export declare function acceptAIRequest(requestId: string): Promise<APIResponse<void>>;
19
- export declare function configureAIStrategy(requestId: string, config: StrategyConfig): Promise<APIResponse<void>>;
20
- export declare function startAIStrategy(requestId: string): Promise<APIResponse<void>>;
21
- export declare function rejectAIRequest(requestId: string, reason: string): Promise<APIResponse<void>>;
22
- export declare function chatWithAIProduct(data: {
23
- product_id: string;
24
- product_info: Record<string, unknown>;
25
- message: string;
26
- history?: Array<{
27
- role: string;
28
- content: string;
29
- }>;
30
- }): Promise<AIChatResponse>;
31
- export declare function getMyAIRequests(status?: string): Promise<AIRequestsResponse>;
32
- export interface AISuggestion {
33
- suggestion_id: string;
34
- strategy_id: string;
35
- symbol: string;
36
- uid: string;
37
- status: 'pending' | 'approved' | 'rejected' | 'modified' | 'executed' | 'expired';
38
- suggestions: Array<{
39
- param_name: string;
40
- current_value: number;
41
- suggested_value: number;
42
- change_pct: number;
43
- reason: string;
44
- }>;
45
- market_analysis: {
46
- market_state: string;
47
- trend_direction: string;
48
- atr_pct: number;
49
- adx: number;
50
- plus_di: number;
51
- minus_di: number;
52
- volatility: number;
53
- snapshot_time: string;
54
- analysis_reason: string;
55
- };
56
- expected_outcomes: {
57
- risk_change: string;
58
- profit_impact?: string;
59
- confidence: number;
60
- };
61
- trader_feedback?: string;
62
- trader_modified_values?: Record<string, number>;
63
- created_at: string;
64
- reviewed_at?: string;
65
- executed_at?: string;
66
- expires_at: string;
67
- reviewed_by?: string;
68
- strategy_name?: string;
69
- current_params?: Record<string, unknown>;
70
- }
71
- export interface AISuggestionsResponse {
72
- success: boolean;
73
- count: number;
74
- suggestions: AISuggestion[];
75
- error?: string;
76
- }
77
- export interface AISuggestionDetailResponse {
78
- success: boolean;
79
- suggestion: AISuggestion;
80
- error?: string;
81
- }
82
- export interface AISuggestionStatsResponse {
83
- success: boolean;
84
- period: string;
85
- stats: Record<string, {
86
- count: number;
87
- strategies: number;
88
- symbols: number;
89
- }>;
90
- error?: string;
91
- }
92
- export declare function getAISuggestions(params?: {
93
- trader_uid?: string;
94
- status?: string;
95
- limit?: number;
96
- }): Promise<AISuggestionsResponse>;
97
- export declare function getAISuggestionDetail(suggestionId: string): Promise<AISuggestionDetailResponse>;
98
- export declare function approveAISuggestion(suggestionId: string, reviewer: string, modifiedValues?: Record<string, number>): Promise<APIResponse<void>>;
99
- export declare function rejectAISuggestion(suggestionId: string, reviewer: string, feedback: string): Promise<APIResponse<void>>;
100
- export declare function generateAISuggestions(timeframe?: string): Promise<APIResponse<{
101
- total: number;
102
- generated: number;
103
- skipped: number;
104
- errors: number;
105
- }>>;
106
- export declare function getAISuggestionStats(trader_uid?: string): Promise<AISuggestionStatsResponse>;
107
- export declare function getMarketState(symbol: string, timeframe?: string, refresh?: boolean): Promise<APIResponse<{
108
- symbol: string;
109
- timeframe: string;
110
- market_state: string;
111
- trend_direction: string;
112
- indicators: {
113
- atr: number;
114
- atr_pct: number;
115
- adx: number;
116
- plus_di: number;
117
- minus_di: number;
118
- volatility: number;
119
- };
120
- suggestion: {
121
- risk_level: string;
122
- adjustments: Record<string, {
123
- direction: string;
124
- range: string;
125
- }>;
126
- reason: string;
127
- };
128
- }>>;
129
- export declare function cancelBinanceOrder(symbol: string, clientOrderId: string): Promise<BinanceCancelResponse>;
130
- export declare function placeBinanceOrder(data: {
131
- symbol: string;
132
- side: string;
133
- positionSide: string;
134
- quantity: number;
135
- orderType?: string;
136
- price?: number;
137
- clientOrderId?: string;
138
- }): Promise<BinanceOrderResponse>;
139
- export declare function modifyBinanceOrder(symbol: string, clientOrderId: string, newPrice: number): Promise<BinanceOrderResponse>;