@microcosmmoney/portal-react 3.13.5 → 3.13.7

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 +113 -81
  6. package/dist/main-portal/components/profile/ProfilePage.js +2 -2
  7. package/dist/main-portal/components/queue/QueueStatusPage.js +2 -71
  8. package/dist/main-portal/components/stations/StationDetailPage.js +1 -3
  9. package/dist/main-portal/components/stations/StationListPage.js +2 -4
  10. package/dist/main-portal/components/stations/StationsPage.js +2 -5
  11. package/dist/main-portal/config/menu-config.d.ts +0 -2
  12. package/dist/main-portal/config/menu-config.js +14 -67
  13. package/dist/main-portal/hooks/useAuth.d.ts +1 -2
  14. package/dist/main-portal/hooks/useAuth.js +0 -2
  15. package/dist/main-portal/lib/api/blockchain.d.ts +0 -44
  16. package/dist/main-portal/lib/api/blockchain.js +0 -195
  17. package/dist/main-portal/lib/api/services/index.d.ts +0 -1
  18. package/dist/main-portal/lib/api/services/index.js +0 -1
  19. package/dist/main-portal/lib/api/services/mining.d.ts +15 -5
  20. package/dist/main-portal/lib/api/services/mining.js +1 -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 +2 -2
  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
@@ -46,9 +46,6 @@ export interface McdAccountResult {
46
46
  status: 'created' | 'exists';
47
47
  tx_signature?: string;
48
48
  }
49
- export declare function getMcdAccountStatus(uid: string): Promise<McdAccountStatus | null>;
50
- export declare function ensureUserMcdAccount(uid: string): Promise<McdAccountResult>;
51
- export declare function batchGetMcdAccountStatus(uids: string[]): Promise<Record<string, McdAccountStatus>>;
52
49
  export interface ZombieAccount {
53
50
  uid: string;
54
51
  email: string;
@@ -113,19 +110,6 @@ export interface ClosureHistory {
113
110
  }>;
114
111
  total: number;
115
112
  }
116
- export declare function getZombieAccounts(options?: {
117
- limit?: number;
118
- offset?: number;
119
- min_inactive_days?: number;
120
- }): Promise<ZombieAccountsResult>;
121
- export declare function closeMcdAccount(uid: string, reason?: 'zombie' | 'user_request' | 'admin'): Promise<ClosureResult>;
122
- export declare function batchCloseMcdAccounts(uids: string[], reason?: 'zombie' | 'admin'): Promise<BatchClosureResult>;
123
- export declare function getRentStatistics(startDate?: string, endDate?: string): Promise<RentStatistics>;
124
- export declare function getClosureHistory(options?: {
125
- limit?: number;
126
- offset?: number;
127
- reason?: string;
128
- }): Promise<ClosureHistory>;
129
113
  export interface SystemAddress {
130
114
  id: number;
131
115
  category: string;
@@ -148,31 +132,3 @@ export interface SystemAddressStats {
148
132
  by_category: Record<string, number>;
149
133
  by_status: Record<string, number>;
150
134
  }
151
- export declare function getSystemAddresses(options?: {
152
- category?: string;
153
- status?: string;
154
- search?: string;
155
- limit?: number;
156
- offset?: number;
157
- }): Promise<{
158
- addresses: SystemAddress[];
159
- total: number;
160
- }>;
161
- export declare function getSystemAddressStats(): Promise<SystemAddressStats>;
162
- export declare function updateSystemAddress(id: number, data: {
163
- description?: string;
164
- status?: string;
165
- archived_reason?: string;
166
- }): Promise<{
167
- success: boolean;
168
- id?: number;
169
- name?: string;
170
- status?: string;
171
- error?: string;
172
- }>;
173
- export declare function seedSystemAddresses(): Promise<{
174
- success: boolean;
175
- inserted: number;
176
- updated: number;
177
- total: number;
178
- }>;
@@ -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);
@@ -43,12 +43,22 @@ export declare const getX402MiningHistory: (limit?: number, offset?: number) =>
43
43
  }>>;
44
44
  export declare const getMiningRequestStatus: (requestId: string) => Promise<APIResponse<{
45
45
  request_id: string;
46
- status: "pending" | "confirmed" | "expired" | "failed";
46
+ status: "created" | "submitted" | "distributing" | "completed" | "failed" | "expired";
47
47
  mcc_amount: number;
48
- usdc_amount: number;
49
- created_at: string;
50
- confirmed_at?: string;
51
- tx_signature?: string;
48
+ payment_amount: number;
49
+ stablecoin_type: string;
50
+ payer_wallet?: string;
51
+ payment_tx_signature?: string;
52
+ onchain_tx_signature?: string;
53
+ mcc_distributed?: {
54
+ user: number;
55
+ lp_reserve: number;
56
+ magistrate: number;
57
+ station_mcd: number;
58
+ };
59
+ error?: string;
60
+ created_at?: string;
61
+ updated_at?: string;
52
62
  }>>;
53
63
  export interface MiningPreflightResult {
54
64
  ready: boolean;
@@ -39,7 +39,7 @@ const getX402MiningHistory = (limit = 20, offset = 0) => {
39
39
  };
40
40
  exports.getX402MiningHistory = getX402MiningHistory;
41
41
  const getMiningRequestStatus = (requestId) => {
42
- return (0, core_1.fetchApi)(`/blockchain-service/mining/request/${requestId}`);
42
+ return (0, core_1.fetchApi)(`/blockchain-service/mining/request/${requestId}/status`);
43
43
  };
44
44
  exports.getMiningRequestStatus = getMiningRequestStatus;
45
45
  const getPublicMiningPreflight = async () => {
@@ -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.5",
3
+ "version": "3.13.7",
4
4
  "description": "Microcosm Portal UI components for React/Next.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -82,4 +82,4 @@
82
82
  "type": "git",
83
83
  "url": "https://github.com/MicrocosmMoney/Microcosm"
84
84
  }
85
- }
85
+ }
@@ -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
- }