@one_deploy/sdk 1.0.3 → 1.0.5
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.
- package/dist/{engine-CrlhH0nw.d.mts → engine-BeVuHpVx.d.mts} +163 -0
- package/dist/{engine-5ndtBaCr.d.ts → engine-DSc1Em4V.d.ts} +163 -0
- package/dist/hooks/index.d.mts +132 -3
- package/dist/hooks/index.d.ts +132 -3
- package/dist/hooks/index.js +351 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +345 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +352 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +345 -2
- package/dist/index.mjs.map +1 -1
- package/dist/providers/index.d.mts +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +98 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +98 -0
- package/dist/providers/index.mjs.map +1 -1
- package/dist/react-native.d.mts +140 -3
- package/dist/react-native.d.ts +140 -3
- package/dist/react-native.js +642 -0
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +636 -1
- package/dist/react-native.mjs.map +1 -1
- package/dist/services/index.d.mts +99 -79
- package/dist/services/index.d.ts +99 -79
- package/dist/services/index.js +254 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs +252 -1
- package/dist/services/index.mjs.map +1 -1
- package/dist/supabase-BT0c7q9e.d.mts +82 -0
- package/dist/supabase-BT0c7q9e.d.ts +82 -0
- package/package.json +5 -1
- package/src/components/OneSwapWidget.tsx +1 -1
- package/src/components/ai/OneChainSelector.tsx +183 -0
- package/src/components/ai/OneCycleSelector.tsx +187 -0
- package/src/components/ai/OnePairSelector.tsx +181 -0
- package/src/components/ai/OneTierSelector.tsx +187 -0
- package/src/components/ai/index.ts +17 -0
- package/src/components/index.ts +3 -0
- package/src/hooks/index.ts +20 -0
- package/src/hooks/useAITrading.ts +444 -0
- package/src/index.ts +20 -0
- package/src/react-native.ts +23 -0
- package/src/services/engine.ts +184 -0
- package/src/services/index.ts +16 -0
- package/src/services/usage.ts +249 -0
- package/.turbo/turbo-build.log +0 -0
- package/.turbo/turbo-type-check.log +0 -0
- package/tsconfig.json +0 -22
- package/tsup.config.ts +0 -25
|
@@ -850,6 +850,94 @@ declare class OneEngineClient {
|
|
|
850
850
|
adminClearRateLimits(identifier: string): Promise<ApiResponse<{
|
|
851
851
|
success: boolean;
|
|
852
852
|
}>>;
|
|
853
|
+
/**
|
|
854
|
+
* Get all AI agent configurations
|
|
855
|
+
* This returns the full agent setup including tiers, cycles, and trading parameters
|
|
856
|
+
*/
|
|
857
|
+
getAgentConfigs(options?: {
|
|
858
|
+
includeInactive?: boolean;
|
|
859
|
+
agentId?: string;
|
|
860
|
+
}): Promise<ApiResponse<{
|
|
861
|
+
agents?: Array<{
|
|
862
|
+
id: string;
|
|
863
|
+
name: string;
|
|
864
|
+
name_zh: string;
|
|
865
|
+
description: string;
|
|
866
|
+
description_zh: string;
|
|
867
|
+
category: string;
|
|
868
|
+
risk_level: number;
|
|
869
|
+
icon: string;
|
|
870
|
+
color: string;
|
|
871
|
+
tiers: Array<{
|
|
872
|
+
tier: number;
|
|
873
|
+
amount: number;
|
|
874
|
+
label: string;
|
|
875
|
+
label_zh: string;
|
|
876
|
+
}>;
|
|
877
|
+
supported_cycles: number[];
|
|
878
|
+
default_cycle: number;
|
|
879
|
+
supported_pairs: string[];
|
|
880
|
+
supported_chains: string[];
|
|
881
|
+
is_active: boolean;
|
|
882
|
+
preview: {
|
|
883
|
+
tier: {
|
|
884
|
+
tier: number;
|
|
885
|
+
amount: number;
|
|
886
|
+
label: string;
|
|
887
|
+
};
|
|
888
|
+
cycle: number;
|
|
889
|
+
dailyLots: number;
|
|
890
|
+
stabilityScore: number;
|
|
891
|
+
roiRange: {
|
|
892
|
+
min: number;
|
|
893
|
+
max: number;
|
|
894
|
+
userMin: number;
|
|
895
|
+
userMax: number;
|
|
896
|
+
};
|
|
897
|
+
shareRate: number;
|
|
898
|
+
profitEstimate: {
|
|
899
|
+
monthlyMin: number;
|
|
900
|
+
monthlyMax: number;
|
|
901
|
+
cycleMin: number;
|
|
902
|
+
cycleMax: number;
|
|
903
|
+
};
|
|
904
|
+
};
|
|
905
|
+
}>;
|
|
906
|
+
agent?: any;
|
|
907
|
+
shareRates?: Record<number, number>;
|
|
908
|
+
}>>;
|
|
909
|
+
/**
|
|
910
|
+
* Calculate subscription parameters for an agent
|
|
911
|
+
*/
|
|
912
|
+
calculateAgentParams(params: {
|
|
913
|
+
agentId: string;
|
|
914
|
+
amount: number;
|
|
915
|
+
cycleDays: number;
|
|
916
|
+
}): Promise<ApiResponse<{
|
|
917
|
+
dailyLots: number;
|
|
918
|
+
effectiveCapital: number;
|
|
919
|
+
stabilityScore: number;
|
|
920
|
+
roiRange: {
|
|
921
|
+
min: number;
|
|
922
|
+
max: number;
|
|
923
|
+
userMin: number;
|
|
924
|
+
userMax: number;
|
|
925
|
+
};
|
|
926
|
+
shareRate: number;
|
|
927
|
+
profitEstimate: {
|
|
928
|
+
monthlyMin: number;
|
|
929
|
+
monthlyMax: number;
|
|
930
|
+
cycleMin: number;
|
|
931
|
+
cycleMax: number;
|
|
932
|
+
};
|
|
933
|
+
}>>;
|
|
934
|
+
/**
|
|
935
|
+
* Get supported trading pairs from agents
|
|
936
|
+
*/
|
|
937
|
+
getTradingPairs(): Promise<ApiResponse<{
|
|
938
|
+
pairs: string[];
|
|
939
|
+
byAgent: Record<string, string[]>;
|
|
940
|
+
}>>;
|
|
853
941
|
/**
|
|
854
942
|
* Get all AI trading strategies
|
|
855
943
|
*/
|
|
@@ -1029,6 +1117,81 @@ declare class OneEngineClient {
|
|
|
1029
1117
|
activeCryptocurrencies: number;
|
|
1030
1118
|
};
|
|
1031
1119
|
}>>;
|
|
1120
|
+
/**
|
|
1121
|
+
* Get user's projects
|
|
1122
|
+
*/
|
|
1123
|
+
getProjects(options?: {
|
|
1124
|
+
isActive?: boolean;
|
|
1125
|
+
}): Promise<ApiResponse<{
|
|
1126
|
+
projects: AdminProject[];
|
|
1127
|
+
total: number;
|
|
1128
|
+
}>>;
|
|
1129
|
+
/**
|
|
1130
|
+
* Create a new project for ecosystem partners
|
|
1131
|
+
*/
|
|
1132
|
+
createProject(params: {
|
|
1133
|
+
name: string;
|
|
1134
|
+
slug: string;
|
|
1135
|
+
settings?: Record<string, unknown>;
|
|
1136
|
+
}): Promise<ApiResponse<{
|
|
1137
|
+
project: AdminProject;
|
|
1138
|
+
}>>;
|
|
1139
|
+
/**
|
|
1140
|
+
* Get project details
|
|
1141
|
+
*/
|
|
1142
|
+
getProject(projectId: string): Promise<ApiResponse<{
|
|
1143
|
+
project: AdminProject;
|
|
1144
|
+
}>>;
|
|
1145
|
+
/**
|
|
1146
|
+
* Update project settings
|
|
1147
|
+
*/
|
|
1148
|
+
updateProject(projectId: string, updates: {
|
|
1149
|
+
name?: string;
|
|
1150
|
+
isActive?: boolean;
|
|
1151
|
+
settings?: Record<string, unknown>;
|
|
1152
|
+
}): Promise<ApiResponse<{
|
|
1153
|
+
project: AdminProject;
|
|
1154
|
+
}>>;
|
|
1155
|
+
/**
|
|
1156
|
+
* Get project features status
|
|
1157
|
+
*/
|
|
1158
|
+
getProjectFeatures(projectId: string): Promise<ApiResponse<{
|
|
1159
|
+
features: Record<string, {
|
|
1160
|
+
enabled: boolean;
|
|
1161
|
+
name: string;
|
|
1162
|
+
description: string;
|
|
1163
|
+
description_zh: string;
|
|
1164
|
+
}>;
|
|
1165
|
+
availableFeatures: string[];
|
|
1166
|
+
}>>;
|
|
1167
|
+
/**
|
|
1168
|
+
* Enable/disable features for a project
|
|
1169
|
+
*/
|
|
1170
|
+
updateProjectFeatures(projectId: string, features: {
|
|
1171
|
+
wallet?: boolean;
|
|
1172
|
+
swap?: boolean;
|
|
1173
|
+
contracts?: boolean;
|
|
1174
|
+
fiat?: boolean;
|
|
1175
|
+
payments?: boolean;
|
|
1176
|
+
quant?: boolean;
|
|
1177
|
+
ai?: boolean;
|
|
1178
|
+
x402?: boolean;
|
|
1179
|
+
}): Promise<ApiResponse<{
|
|
1180
|
+
project: AdminProject;
|
|
1181
|
+
message: string;
|
|
1182
|
+
}>>;
|
|
1183
|
+
/**
|
|
1184
|
+
* Regenerate project API key
|
|
1185
|
+
*/
|
|
1186
|
+
regenerateProjectApiKey(projectId: string): Promise<ApiResponse<{
|
|
1187
|
+
apiKey: string;
|
|
1188
|
+
}>>;
|
|
1189
|
+
/**
|
|
1190
|
+
* Delete project
|
|
1191
|
+
*/
|
|
1192
|
+
deleteProject(projectId: string): Promise<ApiResponse<{
|
|
1193
|
+
deleted: boolean;
|
|
1194
|
+
}>>;
|
|
1032
1195
|
}
|
|
1033
1196
|
declare function createOneEngineClient(options?: {
|
|
1034
1197
|
baseUrl?: string;
|
|
@@ -850,6 +850,94 @@ declare class OneEngineClient {
|
|
|
850
850
|
adminClearRateLimits(identifier: string): Promise<ApiResponse<{
|
|
851
851
|
success: boolean;
|
|
852
852
|
}>>;
|
|
853
|
+
/**
|
|
854
|
+
* Get all AI agent configurations
|
|
855
|
+
* This returns the full agent setup including tiers, cycles, and trading parameters
|
|
856
|
+
*/
|
|
857
|
+
getAgentConfigs(options?: {
|
|
858
|
+
includeInactive?: boolean;
|
|
859
|
+
agentId?: string;
|
|
860
|
+
}): Promise<ApiResponse<{
|
|
861
|
+
agents?: Array<{
|
|
862
|
+
id: string;
|
|
863
|
+
name: string;
|
|
864
|
+
name_zh: string;
|
|
865
|
+
description: string;
|
|
866
|
+
description_zh: string;
|
|
867
|
+
category: string;
|
|
868
|
+
risk_level: number;
|
|
869
|
+
icon: string;
|
|
870
|
+
color: string;
|
|
871
|
+
tiers: Array<{
|
|
872
|
+
tier: number;
|
|
873
|
+
amount: number;
|
|
874
|
+
label: string;
|
|
875
|
+
label_zh: string;
|
|
876
|
+
}>;
|
|
877
|
+
supported_cycles: number[];
|
|
878
|
+
default_cycle: number;
|
|
879
|
+
supported_pairs: string[];
|
|
880
|
+
supported_chains: string[];
|
|
881
|
+
is_active: boolean;
|
|
882
|
+
preview: {
|
|
883
|
+
tier: {
|
|
884
|
+
tier: number;
|
|
885
|
+
amount: number;
|
|
886
|
+
label: string;
|
|
887
|
+
};
|
|
888
|
+
cycle: number;
|
|
889
|
+
dailyLots: number;
|
|
890
|
+
stabilityScore: number;
|
|
891
|
+
roiRange: {
|
|
892
|
+
min: number;
|
|
893
|
+
max: number;
|
|
894
|
+
userMin: number;
|
|
895
|
+
userMax: number;
|
|
896
|
+
};
|
|
897
|
+
shareRate: number;
|
|
898
|
+
profitEstimate: {
|
|
899
|
+
monthlyMin: number;
|
|
900
|
+
monthlyMax: number;
|
|
901
|
+
cycleMin: number;
|
|
902
|
+
cycleMax: number;
|
|
903
|
+
};
|
|
904
|
+
};
|
|
905
|
+
}>;
|
|
906
|
+
agent?: any;
|
|
907
|
+
shareRates?: Record<number, number>;
|
|
908
|
+
}>>;
|
|
909
|
+
/**
|
|
910
|
+
* Calculate subscription parameters for an agent
|
|
911
|
+
*/
|
|
912
|
+
calculateAgentParams(params: {
|
|
913
|
+
agentId: string;
|
|
914
|
+
amount: number;
|
|
915
|
+
cycleDays: number;
|
|
916
|
+
}): Promise<ApiResponse<{
|
|
917
|
+
dailyLots: number;
|
|
918
|
+
effectiveCapital: number;
|
|
919
|
+
stabilityScore: number;
|
|
920
|
+
roiRange: {
|
|
921
|
+
min: number;
|
|
922
|
+
max: number;
|
|
923
|
+
userMin: number;
|
|
924
|
+
userMax: number;
|
|
925
|
+
};
|
|
926
|
+
shareRate: number;
|
|
927
|
+
profitEstimate: {
|
|
928
|
+
monthlyMin: number;
|
|
929
|
+
monthlyMax: number;
|
|
930
|
+
cycleMin: number;
|
|
931
|
+
cycleMax: number;
|
|
932
|
+
};
|
|
933
|
+
}>>;
|
|
934
|
+
/**
|
|
935
|
+
* Get supported trading pairs from agents
|
|
936
|
+
*/
|
|
937
|
+
getTradingPairs(): Promise<ApiResponse<{
|
|
938
|
+
pairs: string[];
|
|
939
|
+
byAgent: Record<string, string[]>;
|
|
940
|
+
}>>;
|
|
853
941
|
/**
|
|
854
942
|
* Get all AI trading strategies
|
|
855
943
|
*/
|
|
@@ -1029,6 +1117,81 @@ declare class OneEngineClient {
|
|
|
1029
1117
|
activeCryptocurrencies: number;
|
|
1030
1118
|
};
|
|
1031
1119
|
}>>;
|
|
1120
|
+
/**
|
|
1121
|
+
* Get user's projects
|
|
1122
|
+
*/
|
|
1123
|
+
getProjects(options?: {
|
|
1124
|
+
isActive?: boolean;
|
|
1125
|
+
}): Promise<ApiResponse<{
|
|
1126
|
+
projects: AdminProject[];
|
|
1127
|
+
total: number;
|
|
1128
|
+
}>>;
|
|
1129
|
+
/**
|
|
1130
|
+
* Create a new project for ecosystem partners
|
|
1131
|
+
*/
|
|
1132
|
+
createProject(params: {
|
|
1133
|
+
name: string;
|
|
1134
|
+
slug: string;
|
|
1135
|
+
settings?: Record<string, unknown>;
|
|
1136
|
+
}): Promise<ApiResponse<{
|
|
1137
|
+
project: AdminProject;
|
|
1138
|
+
}>>;
|
|
1139
|
+
/**
|
|
1140
|
+
* Get project details
|
|
1141
|
+
*/
|
|
1142
|
+
getProject(projectId: string): Promise<ApiResponse<{
|
|
1143
|
+
project: AdminProject;
|
|
1144
|
+
}>>;
|
|
1145
|
+
/**
|
|
1146
|
+
* Update project settings
|
|
1147
|
+
*/
|
|
1148
|
+
updateProject(projectId: string, updates: {
|
|
1149
|
+
name?: string;
|
|
1150
|
+
isActive?: boolean;
|
|
1151
|
+
settings?: Record<string, unknown>;
|
|
1152
|
+
}): Promise<ApiResponse<{
|
|
1153
|
+
project: AdminProject;
|
|
1154
|
+
}>>;
|
|
1155
|
+
/**
|
|
1156
|
+
* Get project features status
|
|
1157
|
+
*/
|
|
1158
|
+
getProjectFeatures(projectId: string): Promise<ApiResponse<{
|
|
1159
|
+
features: Record<string, {
|
|
1160
|
+
enabled: boolean;
|
|
1161
|
+
name: string;
|
|
1162
|
+
description: string;
|
|
1163
|
+
description_zh: string;
|
|
1164
|
+
}>;
|
|
1165
|
+
availableFeatures: string[];
|
|
1166
|
+
}>>;
|
|
1167
|
+
/**
|
|
1168
|
+
* Enable/disable features for a project
|
|
1169
|
+
*/
|
|
1170
|
+
updateProjectFeatures(projectId: string, features: {
|
|
1171
|
+
wallet?: boolean;
|
|
1172
|
+
swap?: boolean;
|
|
1173
|
+
contracts?: boolean;
|
|
1174
|
+
fiat?: boolean;
|
|
1175
|
+
payments?: boolean;
|
|
1176
|
+
quant?: boolean;
|
|
1177
|
+
ai?: boolean;
|
|
1178
|
+
x402?: boolean;
|
|
1179
|
+
}): Promise<ApiResponse<{
|
|
1180
|
+
project: AdminProject;
|
|
1181
|
+
message: string;
|
|
1182
|
+
}>>;
|
|
1183
|
+
/**
|
|
1184
|
+
* Regenerate project API key
|
|
1185
|
+
*/
|
|
1186
|
+
regenerateProjectApiKey(projectId: string): Promise<ApiResponse<{
|
|
1187
|
+
apiKey: string;
|
|
1188
|
+
}>>;
|
|
1189
|
+
/**
|
|
1190
|
+
* Delete project
|
|
1191
|
+
*/
|
|
1192
|
+
deleteProject(projectId: string): Promise<ApiResponse<{
|
|
1193
|
+
deleted: boolean;
|
|
1194
|
+
}>>;
|
|
1032
1195
|
}
|
|
1033
1196
|
declare function createOneEngineClient(options?: {
|
|
1034
1197
|
baseUrl?: string;
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as EngineWalletBalance } from '../engine-
|
|
2
|
-
import { Token, TokenPrice } from '../types/index.mjs';
|
|
1
|
+
import { a as EngineWalletBalance } from '../engine-BeVuHpVx.mjs';
|
|
2
|
+
import { Token, TokenPrice, StrategyCategory, AIStrategy, AINavSnapshot, AIMarketData, AIOrderStatus, AIOrder, CreateAIOrderRequest, ApiResponse, AIPortfolioSummary, AITradeAllocation } from '../types/index.mjs';
|
|
3
3
|
|
|
4
4
|
interface UseWalletBalanceOptions {
|
|
5
5
|
chains?: number[];
|
|
@@ -53,4 +53,133 @@ interface UseTokenPricesReturn {
|
|
|
53
53
|
}
|
|
54
54
|
declare function useTokenPrices(symbols: string[], options?: UseTokenPriceOptions): UseTokenPricesReturn;
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
* AI Trading Hooks for ONE SDK
|
|
58
|
+
*
|
|
59
|
+
* React hooks for AI quantitative trading features.
|
|
60
|
+
* These hooks provide easy access to AI strategies, orders, and portfolio management.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Set the access token for authenticated requests
|
|
65
|
+
*/
|
|
66
|
+
declare function setAITradingAccessToken(token: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Clear the access token
|
|
69
|
+
*/
|
|
70
|
+
declare function clearAITradingAccessToken(): void;
|
|
71
|
+
interface UseAIStrategiesOptions {
|
|
72
|
+
category?: StrategyCategory;
|
|
73
|
+
riskLevel?: number;
|
|
74
|
+
minTvl?: number;
|
|
75
|
+
isActive?: boolean;
|
|
76
|
+
autoRefresh?: boolean;
|
|
77
|
+
refreshInterval?: number;
|
|
78
|
+
}
|
|
79
|
+
interface UseAIStrategiesResult {
|
|
80
|
+
strategies: AIStrategy[];
|
|
81
|
+
isLoading: boolean;
|
|
82
|
+
error: string | null;
|
|
83
|
+
refresh: () => Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Hook to fetch and manage AI trading strategies
|
|
87
|
+
*/
|
|
88
|
+
declare function useAIStrategies(options?: UseAIStrategiesOptions): UseAIStrategiesResult;
|
|
89
|
+
/**
|
|
90
|
+
* Hook to fetch a single AI strategy with performance data
|
|
91
|
+
*/
|
|
92
|
+
interface UseAIStrategyResult {
|
|
93
|
+
strategy: AIStrategy | null;
|
|
94
|
+
performance: AINavSnapshot[];
|
|
95
|
+
marketData: AIMarketData[];
|
|
96
|
+
isLoading: boolean;
|
|
97
|
+
error: string | null;
|
|
98
|
+
refresh: () => Promise<void>;
|
|
99
|
+
}
|
|
100
|
+
declare function useAIStrategy(strategyId: string | undefined, include?: ('performance' | 'market' | 'trades')[]): UseAIStrategyResult;
|
|
101
|
+
interface UseAIOrdersOptions {
|
|
102
|
+
strategyId?: string;
|
|
103
|
+
status?: AIOrderStatus;
|
|
104
|
+
autoRefresh?: boolean;
|
|
105
|
+
refreshInterval?: number;
|
|
106
|
+
}
|
|
107
|
+
interface UseAIOrdersResult {
|
|
108
|
+
orders: AIOrder[];
|
|
109
|
+
isLoading: boolean;
|
|
110
|
+
error: string | null;
|
|
111
|
+
refresh: () => Promise<void>;
|
|
112
|
+
createOrder: (request: CreateAIOrderRequest) => Promise<ApiResponse<{
|
|
113
|
+
order: AIOrder;
|
|
114
|
+
}>>;
|
|
115
|
+
pauseOrder: (orderId: string) => Promise<ApiResponse<{
|
|
116
|
+
order: AIOrder;
|
|
117
|
+
message: string;
|
|
118
|
+
}>>;
|
|
119
|
+
resumeOrder: (orderId: string) => Promise<ApiResponse<{
|
|
120
|
+
order: AIOrder;
|
|
121
|
+
message: string;
|
|
122
|
+
}>>;
|
|
123
|
+
redeemOrder: (orderId: string) => Promise<ApiResponse<any>>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Hook to manage AI trading orders
|
|
127
|
+
*/
|
|
128
|
+
declare function useAIOrders(options?: UseAIOrdersOptions): UseAIOrdersResult;
|
|
129
|
+
interface UseAIPortfolioResult {
|
|
130
|
+
portfolio: AIPortfolioSummary | null;
|
|
131
|
+
allocations: AITradeAllocation[];
|
|
132
|
+
activeOrders: AIOrder[];
|
|
133
|
+
isLoading: boolean;
|
|
134
|
+
error: string | null;
|
|
135
|
+
refresh: () => Promise<void>;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Hook to fetch AI trading portfolio summary
|
|
139
|
+
*/
|
|
140
|
+
declare function useAIPortfolio(autoRefresh?: boolean): UseAIPortfolioResult;
|
|
141
|
+
interface UseAIMarketDataResult {
|
|
142
|
+
prices: Record<string, {
|
|
143
|
+
price: number;
|
|
144
|
+
change24h: number;
|
|
145
|
+
}>;
|
|
146
|
+
isLoading: boolean;
|
|
147
|
+
error: string | null;
|
|
148
|
+
refresh: () => Promise<void>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Hook to fetch real-time market data for AI trading pairs
|
|
152
|
+
*/
|
|
153
|
+
declare function useAIMarketData(symbols?: string[], autoRefresh?: boolean): UseAIMarketDataResult;
|
|
154
|
+
interface UseAITradingResult {
|
|
155
|
+
strategies: AIStrategy[];
|
|
156
|
+
strategiesLoading: boolean;
|
|
157
|
+
orders: AIOrder[];
|
|
158
|
+
ordersLoading: boolean;
|
|
159
|
+
portfolio: AIPortfolioSummary | null;
|
|
160
|
+
portfolioLoading: boolean;
|
|
161
|
+
prices: Record<string, {
|
|
162
|
+
price: number;
|
|
163
|
+
change24h: number;
|
|
164
|
+
}>;
|
|
165
|
+
createOrder: (request: CreateAIOrderRequest) => Promise<ApiResponse<{
|
|
166
|
+
order: AIOrder;
|
|
167
|
+
}>>;
|
|
168
|
+
pauseOrder: (orderId: string) => Promise<ApiResponse<{
|
|
169
|
+
order: AIOrder;
|
|
170
|
+
message: string;
|
|
171
|
+
}>>;
|
|
172
|
+
resumeOrder: (orderId: string) => Promise<ApiResponse<{
|
|
173
|
+
order: AIOrder;
|
|
174
|
+
message: string;
|
|
175
|
+
}>>;
|
|
176
|
+
redeemOrder: (orderId: string) => Promise<ApiResponse<any>>;
|
|
177
|
+
refreshAll: () => Promise<void>;
|
|
178
|
+
error: string | null;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Combined hook for all AI trading functionality
|
|
182
|
+
*/
|
|
183
|
+
declare function useAITrading(): UseAITradingResult;
|
|
184
|
+
|
|
185
|
+
export { type UseAIMarketDataResult, type UseAIOrdersOptions, type UseAIOrdersResult, type UseAIPortfolioResult, type UseAIStrategiesOptions, type UseAIStrategiesResult, type UseAIStrategyResult, type UseAITradingResult, clearAITradingAccessToken, setAITradingAccessToken, useAIMarketData, useAIOrders, useAIPortfolio, useAIStrategies, useAIStrategy, useAITrading, useTokenPrice, useTokenPrices, useWalletBalance };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as EngineWalletBalance } from '../engine-
|
|
2
|
-
import { Token, TokenPrice } from '../types/index.js';
|
|
1
|
+
import { a as EngineWalletBalance } from '../engine-DSc1Em4V.js';
|
|
2
|
+
import { Token, TokenPrice, StrategyCategory, AIStrategy, AINavSnapshot, AIMarketData, AIOrderStatus, AIOrder, CreateAIOrderRequest, ApiResponse, AIPortfolioSummary, AITradeAllocation } from '../types/index.js';
|
|
3
3
|
|
|
4
4
|
interface UseWalletBalanceOptions {
|
|
5
5
|
chains?: number[];
|
|
@@ -53,4 +53,133 @@ interface UseTokenPricesReturn {
|
|
|
53
53
|
}
|
|
54
54
|
declare function useTokenPrices(symbols: string[], options?: UseTokenPriceOptions): UseTokenPricesReturn;
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
* AI Trading Hooks for ONE SDK
|
|
58
|
+
*
|
|
59
|
+
* React hooks for AI quantitative trading features.
|
|
60
|
+
* These hooks provide easy access to AI strategies, orders, and portfolio management.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Set the access token for authenticated requests
|
|
65
|
+
*/
|
|
66
|
+
declare function setAITradingAccessToken(token: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Clear the access token
|
|
69
|
+
*/
|
|
70
|
+
declare function clearAITradingAccessToken(): void;
|
|
71
|
+
interface UseAIStrategiesOptions {
|
|
72
|
+
category?: StrategyCategory;
|
|
73
|
+
riskLevel?: number;
|
|
74
|
+
minTvl?: number;
|
|
75
|
+
isActive?: boolean;
|
|
76
|
+
autoRefresh?: boolean;
|
|
77
|
+
refreshInterval?: number;
|
|
78
|
+
}
|
|
79
|
+
interface UseAIStrategiesResult {
|
|
80
|
+
strategies: AIStrategy[];
|
|
81
|
+
isLoading: boolean;
|
|
82
|
+
error: string | null;
|
|
83
|
+
refresh: () => Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Hook to fetch and manage AI trading strategies
|
|
87
|
+
*/
|
|
88
|
+
declare function useAIStrategies(options?: UseAIStrategiesOptions): UseAIStrategiesResult;
|
|
89
|
+
/**
|
|
90
|
+
* Hook to fetch a single AI strategy with performance data
|
|
91
|
+
*/
|
|
92
|
+
interface UseAIStrategyResult {
|
|
93
|
+
strategy: AIStrategy | null;
|
|
94
|
+
performance: AINavSnapshot[];
|
|
95
|
+
marketData: AIMarketData[];
|
|
96
|
+
isLoading: boolean;
|
|
97
|
+
error: string | null;
|
|
98
|
+
refresh: () => Promise<void>;
|
|
99
|
+
}
|
|
100
|
+
declare function useAIStrategy(strategyId: string | undefined, include?: ('performance' | 'market' | 'trades')[]): UseAIStrategyResult;
|
|
101
|
+
interface UseAIOrdersOptions {
|
|
102
|
+
strategyId?: string;
|
|
103
|
+
status?: AIOrderStatus;
|
|
104
|
+
autoRefresh?: boolean;
|
|
105
|
+
refreshInterval?: number;
|
|
106
|
+
}
|
|
107
|
+
interface UseAIOrdersResult {
|
|
108
|
+
orders: AIOrder[];
|
|
109
|
+
isLoading: boolean;
|
|
110
|
+
error: string | null;
|
|
111
|
+
refresh: () => Promise<void>;
|
|
112
|
+
createOrder: (request: CreateAIOrderRequest) => Promise<ApiResponse<{
|
|
113
|
+
order: AIOrder;
|
|
114
|
+
}>>;
|
|
115
|
+
pauseOrder: (orderId: string) => Promise<ApiResponse<{
|
|
116
|
+
order: AIOrder;
|
|
117
|
+
message: string;
|
|
118
|
+
}>>;
|
|
119
|
+
resumeOrder: (orderId: string) => Promise<ApiResponse<{
|
|
120
|
+
order: AIOrder;
|
|
121
|
+
message: string;
|
|
122
|
+
}>>;
|
|
123
|
+
redeemOrder: (orderId: string) => Promise<ApiResponse<any>>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Hook to manage AI trading orders
|
|
127
|
+
*/
|
|
128
|
+
declare function useAIOrders(options?: UseAIOrdersOptions): UseAIOrdersResult;
|
|
129
|
+
interface UseAIPortfolioResult {
|
|
130
|
+
portfolio: AIPortfolioSummary | null;
|
|
131
|
+
allocations: AITradeAllocation[];
|
|
132
|
+
activeOrders: AIOrder[];
|
|
133
|
+
isLoading: boolean;
|
|
134
|
+
error: string | null;
|
|
135
|
+
refresh: () => Promise<void>;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Hook to fetch AI trading portfolio summary
|
|
139
|
+
*/
|
|
140
|
+
declare function useAIPortfolio(autoRefresh?: boolean): UseAIPortfolioResult;
|
|
141
|
+
interface UseAIMarketDataResult {
|
|
142
|
+
prices: Record<string, {
|
|
143
|
+
price: number;
|
|
144
|
+
change24h: number;
|
|
145
|
+
}>;
|
|
146
|
+
isLoading: boolean;
|
|
147
|
+
error: string | null;
|
|
148
|
+
refresh: () => Promise<void>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Hook to fetch real-time market data for AI trading pairs
|
|
152
|
+
*/
|
|
153
|
+
declare function useAIMarketData(symbols?: string[], autoRefresh?: boolean): UseAIMarketDataResult;
|
|
154
|
+
interface UseAITradingResult {
|
|
155
|
+
strategies: AIStrategy[];
|
|
156
|
+
strategiesLoading: boolean;
|
|
157
|
+
orders: AIOrder[];
|
|
158
|
+
ordersLoading: boolean;
|
|
159
|
+
portfolio: AIPortfolioSummary | null;
|
|
160
|
+
portfolioLoading: boolean;
|
|
161
|
+
prices: Record<string, {
|
|
162
|
+
price: number;
|
|
163
|
+
change24h: number;
|
|
164
|
+
}>;
|
|
165
|
+
createOrder: (request: CreateAIOrderRequest) => Promise<ApiResponse<{
|
|
166
|
+
order: AIOrder;
|
|
167
|
+
}>>;
|
|
168
|
+
pauseOrder: (orderId: string) => Promise<ApiResponse<{
|
|
169
|
+
order: AIOrder;
|
|
170
|
+
message: string;
|
|
171
|
+
}>>;
|
|
172
|
+
resumeOrder: (orderId: string) => Promise<ApiResponse<{
|
|
173
|
+
order: AIOrder;
|
|
174
|
+
message: string;
|
|
175
|
+
}>>;
|
|
176
|
+
redeemOrder: (orderId: string) => Promise<ApiResponse<any>>;
|
|
177
|
+
refreshAll: () => Promise<void>;
|
|
178
|
+
error: string | null;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Combined hook for all AI trading functionality
|
|
182
|
+
*/
|
|
183
|
+
declare function useAITrading(): UseAITradingResult;
|
|
184
|
+
|
|
185
|
+
export { type UseAIMarketDataResult, type UseAIOrdersOptions, type UseAIOrdersResult, type UseAIPortfolioResult, type UseAIStrategiesOptions, type UseAIStrategiesResult, type UseAIStrategyResult, type UseAITradingResult, clearAITradingAccessToken, setAITradingAccessToken, useAIMarketData, useAIOrders, useAIPortfolio, useAIStrategies, useAIStrategy, useAITrading, useTokenPrice, useTokenPrices, useWalletBalance };
|