@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
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OnePairSelector - Trading pair selection component for AI trading
|
|
3
|
+
* Part of ONE Ecosystem SDK - can be used by any ecosystem partner
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { View, Text, StyleSheet, TouchableOpacity, ViewStyle, TextStyle } from 'react-native';
|
|
8
|
+
|
|
9
|
+
// Common trading pairs with icons
|
|
10
|
+
export const PAIR_ICONS: Record<string, string> = {
|
|
11
|
+
'BTC/USDT': '₿',
|
|
12
|
+
'ETH/USDT': 'Ξ',
|
|
13
|
+
'SOL/USDT': '◎',
|
|
14
|
+
'BNB/USDT': '◆',
|
|
15
|
+
'XRP/USDT': '✕',
|
|
16
|
+
'DOGE/USDT': 'Ð',
|
|
17
|
+
'ADA/USDT': '◈',
|
|
18
|
+
'AVAX/USDT': '▲',
|
|
19
|
+
'DOT/USDT': '●',
|
|
20
|
+
'MATIC/USDT': '⬡',
|
|
21
|
+
'LINK/USDT': '◇',
|
|
22
|
+
'UNI/USDT': '🦄',
|
|
23
|
+
'ATOM/USDT': '⚛',
|
|
24
|
+
'LTC/USDT': 'Ł',
|
|
25
|
+
'ARB/USDT': '◆',
|
|
26
|
+
'OP/USDT': '◉',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export interface OnePairSelectorProps {
|
|
30
|
+
/** List of supported trading pairs */
|
|
31
|
+
supportedPairs: string[];
|
|
32
|
+
/** Currently selected pairs */
|
|
33
|
+
selectedPairs: string[];
|
|
34
|
+
/** Callback when pair selection changes */
|
|
35
|
+
onTogglePair: (pair: string) => void;
|
|
36
|
+
/** Accent color for selected state */
|
|
37
|
+
accentColor?: string;
|
|
38
|
+
/** Section title */
|
|
39
|
+
title?: string;
|
|
40
|
+
/** Section subtitle */
|
|
41
|
+
subtitle?: string;
|
|
42
|
+
/** Minimum required selections */
|
|
43
|
+
minSelections?: number;
|
|
44
|
+
/** Maximum allowed selections (0 = unlimited) */
|
|
45
|
+
maxSelections?: number;
|
|
46
|
+
/** Custom styles */
|
|
47
|
+
style?: ViewStyle;
|
|
48
|
+
/** Custom title style */
|
|
49
|
+
titleStyle?: TextStyle;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const OnePairSelector: React.FC<OnePairSelectorProps> = ({
|
|
53
|
+
supportedPairs,
|
|
54
|
+
selectedPairs,
|
|
55
|
+
onTogglePair,
|
|
56
|
+
accentColor = '#188775',
|
|
57
|
+
title,
|
|
58
|
+
subtitle,
|
|
59
|
+
minSelections = 1,
|
|
60
|
+
maxSelections = 0,
|
|
61
|
+
style,
|
|
62
|
+
titleStyle,
|
|
63
|
+
}) => {
|
|
64
|
+
const handleToggle = (pair: string) => {
|
|
65
|
+
const isSelected = selectedPairs.includes(pair);
|
|
66
|
+
|
|
67
|
+
// Prevent deselecting below minimum
|
|
68
|
+
if (isSelected && selectedPairs.length <= minSelections) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Prevent selecting above maximum
|
|
73
|
+
if (!isSelected && maxSelections > 0 && selectedPairs.length >= maxSelections) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
onTogglePair(pair);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<View style={[styles.container, style]}>
|
|
82
|
+
{title && <Text style={[styles.title, titleStyle]}>{title}</Text>}
|
|
83
|
+
{subtitle && <Text style={styles.subtitle}>{subtitle}</Text>}
|
|
84
|
+
|
|
85
|
+
<View style={styles.pairsContainer}>
|
|
86
|
+
{supportedPairs.map((pair) => {
|
|
87
|
+
const isSelected = selectedPairs.includes(pair);
|
|
88
|
+
const icon = PAIR_ICONS[pair] || '●';
|
|
89
|
+
const baseSymbol = pair.split('/')[0];
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<TouchableOpacity
|
|
93
|
+
key={pair}
|
|
94
|
+
style={[
|
|
95
|
+
styles.pairChip,
|
|
96
|
+
isSelected && styles.pairChipSelected,
|
|
97
|
+
isSelected && { backgroundColor: accentColor + '15', borderColor: accentColor }
|
|
98
|
+
]}
|
|
99
|
+
onPress={() => handleToggle(pair)}
|
|
100
|
+
activeOpacity={0.7}
|
|
101
|
+
>
|
|
102
|
+
<Text style={styles.pairIcon}>{icon}</Text>
|
|
103
|
+
<Text style={[
|
|
104
|
+
styles.pairText,
|
|
105
|
+
isSelected && { color: accentColor, fontWeight: '600' }
|
|
106
|
+
]}>
|
|
107
|
+
{baseSymbol}
|
|
108
|
+
</Text>
|
|
109
|
+
{isSelected && (
|
|
110
|
+
<Text style={[styles.checkmark, { color: accentColor }]}>✓</Text>
|
|
111
|
+
)}
|
|
112
|
+
</TouchableOpacity>
|
|
113
|
+
);
|
|
114
|
+
})}
|
|
115
|
+
</View>
|
|
116
|
+
|
|
117
|
+
<View style={styles.selectedInfo}>
|
|
118
|
+
<Text style={styles.selectedText}>
|
|
119
|
+
{selectedPairs.length} pair{selectedPairs.length !== 1 ? 's' : ''} selected
|
|
120
|
+
{minSelections > 0 && ` (min: ${minSelections})`}
|
|
121
|
+
{maxSelections > 0 && ` (max: ${maxSelections})`}
|
|
122
|
+
</Text>
|
|
123
|
+
</View>
|
|
124
|
+
</View>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const styles = StyleSheet.create({
|
|
129
|
+
container: {
|
|
130
|
+
marginBottom: 16,
|
|
131
|
+
},
|
|
132
|
+
title: {
|
|
133
|
+
fontSize: 16,
|
|
134
|
+
fontWeight: '600',
|
|
135
|
+
color: '#1a1a1a',
|
|
136
|
+
marginBottom: 4,
|
|
137
|
+
},
|
|
138
|
+
subtitle: {
|
|
139
|
+
fontSize: 12,
|
|
140
|
+
color: '#666',
|
|
141
|
+
marginBottom: 12,
|
|
142
|
+
},
|
|
143
|
+
pairsContainer: {
|
|
144
|
+
flexDirection: 'row',
|
|
145
|
+
flexWrap: 'wrap',
|
|
146
|
+
gap: 8,
|
|
147
|
+
},
|
|
148
|
+
pairChip: {
|
|
149
|
+
flexDirection: 'row',
|
|
150
|
+
alignItems: 'center',
|
|
151
|
+
paddingHorizontal: 12,
|
|
152
|
+
paddingVertical: 8,
|
|
153
|
+
backgroundColor: '#fff',
|
|
154
|
+
borderRadius: 8,
|
|
155
|
+
borderWidth: 1,
|
|
156
|
+
borderColor: '#e5e5e5',
|
|
157
|
+
gap: 6,
|
|
158
|
+
},
|
|
159
|
+
pairChipSelected: {
|
|
160
|
+
borderWidth: 2,
|
|
161
|
+
},
|
|
162
|
+
pairIcon: {
|
|
163
|
+
fontSize: 14,
|
|
164
|
+
},
|
|
165
|
+
pairText: {
|
|
166
|
+
fontSize: 14,
|
|
167
|
+
color: '#666',
|
|
168
|
+
},
|
|
169
|
+
checkmark: {
|
|
170
|
+
fontSize: 14,
|
|
171
|
+
fontWeight: '700',
|
|
172
|
+
},
|
|
173
|
+
selectedInfo: {
|
|
174
|
+
marginTop: 8,
|
|
175
|
+
paddingVertical: 4,
|
|
176
|
+
},
|
|
177
|
+
selectedText: {
|
|
178
|
+
fontSize: 12,
|
|
179
|
+
color: '#888',
|
|
180
|
+
},
|
|
181
|
+
});
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OneTierSelector - Investment tier selection component for AI trading
|
|
3
|
+
* Part of ONE Ecosystem SDK - can be used by any ecosystem partner
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { View, Text, StyleSheet, TouchableOpacity, ViewStyle, TextStyle } from 'react-native';
|
|
8
|
+
|
|
9
|
+
export interface Tier {
|
|
10
|
+
tier: number;
|
|
11
|
+
amount: number;
|
|
12
|
+
label: string;
|
|
13
|
+
label_zh?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface OneTierSelectorProps {
|
|
17
|
+
/** Available investment tiers */
|
|
18
|
+
tiers: Tier[];
|
|
19
|
+
/** Currently selected tier */
|
|
20
|
+
selectedTier: Tier | null;
|
|
21
|
+
/** Callback when tier selection changes */
|
|
22
|
+
onSelectTier: (tier: Tier) => void;
|
|
23
|
+
/** Accent color for selected state */
|
|
24
|
+
accentColor?: string;
|
|
25
|
+
/** Section title */
|
|
26
|
+
title?: string;
|
|
27
|
+
/** Section subtitle */
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
/** Show recommended badge on middle tier */
|
|
30
|
+
showRecommended?: boolean;
|
|
31
|
+
/** Recommended label text */
|
|
32
|
+
recommendedLabel?: string;
|
|
33
|
+
/** Use Chinese labels */
|
|
34
|
+
useZhLabels?: boolean;
|
|
35
|
+
/** Custom styles */
|
|
36
|
+
style?: ViewStyle;
|
|
37
|
+
/** Custom title style */
|
|
38
|
+
titleStyle?: TextStyle;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const OneTierSelector: React.FC<OneTierSelectorProps> = ({
|
|
42
|
+
tiers,
|
|
43
|
+
selectedTier,
|
|
44
|
+
onSelectTier,
|
|
45
|
+
accentColor = '#188775',
|
|
46
|
+
title,
|
|
47
|
+
subtitle,
|
|
48
|
+
showRecommended = true,
|
|
49
|
+
recommendedLabel = 'Recommended',
|
|
50
|
+
useZhLabels = false,
|
|
51
|
+
style,
|
|
52
|
+
titleStyle,
|
|
53
|
+
}) => {
|
|
54
|
+
// Middle tier is usually recommended
|
|
55
|
+
const recommendedTierIndex = Math.floor(tiers.length / 2);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<View style={[styles.container, style]}>
|
|
59
|
+
{title && <Text style={[styles.title, titleStyle]}>{title}</Text>}
|
|
60
|
+
{subtitle && <Text style={styles.subtitle}>{subtitle}</Text>}
|
|
61
|
+
|
|
62
|
+
<View style={styles.tiersContainer}>
|
|
63
|
+
{tiers.map((tier, index) => {
|
|
64
|
+
const isSelected = selectedTier?.tier === tier.tier;
|
|
65
|
+
const isRecommended = showRecommended && index === recommendedTierIndex;
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<TouchableOpacity
|
|
69
|
+
key={tier.tier}
|
|
70
|
+
style={[
|
|
71
|
+
styles.tierCard,
|
|
72
|
+
isSelected && styles.tierCardSelected,
|
|
73
|
+
isSelected && { borderColor: accentColor }
|
|
74
|
+
]}
|
|
75
|
+
onPress={() => onSelectTier(tier)}
|
|
76
|
+
activeOpacity={0.7}
|
|
77
|
+
>
|
|
78
|
+
{isRecommended && (
|
|
79
|
+
<View style={[styles.recommendedBadge, { backgroundColor: accentColor }]}>
|
|
80
|
+
<Text style={styles.recommendedText}>{recommendedLabel}</Text>
|
|
81
|
+
</View>
|
|
82
|
+
)}
|
|
83
|
+
|
|
84
|
+
<Text style={[
|
|
85
|
+
styles.tierLabel,
|
|
86
|
+
isSelected && { color: accentColor },
|
|
87
|
+
isRecommended && styles.tierLabelWithBadge
|
|
88
|
+
]}>
|
|
89
|
+
{useZhLabels && tier.label_zh ? tier.label_zh : tier.label}
|
|
90
|
+
</Text>
|
|
91
|
+
|
|
92
|
+
<Text style={[
|
|
93
|
+
styles.tierAmount,
|
|
94
|
+
isSelected && { color: accentColor }
|
|
95
|
+
]}>
|
|
96
|
+
${tier.amount.toLocaleString()}
|
|
97
|
+
</Text>
|
|
98
|
+
|
|
99
|
+
{isSelected && (
|
|
100
|
+
<View style={[styles.checkCircle, { backgroundColor: accentColor }]}>
|
|
101
|
+
<Text style={styles.checkmark}>✓</Text>
|
|
102
|
+
</View>
|
|
103
|
+
)}
|
|
104
|
+
</TouchableOpacity>
|
|
105
|
+
);
|
|
106
|
+
})}
|
|
107
|
+
</View>
|
|
108
|
+
</View>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const styles = StyleSheet.create({
|
|
113
|
+
container: {
|
|
114
|
+
marginBottom: 16,
|
|
115
|
+
},
|
|
116
|
+
title: {
|
|
117
|
+
fontSize: 16,
|
|
118
|
+
fontWeight: '600',
|
|
119
|
+
color: '#1a1a1a',
|
|
120
|
+
marginBottom: 4,
|
|
121
|
+
},
|
|
122
|
+
subtitle: {
|
|
123
|
+
fontSize: 12,
|
|
124
|
+
color: '#666',
|
|
125
|
+
marginBottom: 12,
|
|
126
|
+
},
|
|
127
|
+
tiersContainer: {
|
|
128
|
+
flexDirection: 'row',
|
|
129
|
+
gap: 8,
|
|
130
|
+
},
|
|
131
|
+
tierCard: {
|
|
132
|
+
flex: 1,
|
|
133
|
+
padding: 16,
|
|
134
|
+
backgroundColor: '#fff',
|
|
135
|
+
borderRadius: 12,
|
|
136
|
+
borderWidth: 2,
|
|
137
|
+
borderColor: '#e5e5e5',
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
position: 'relative',
|
|
140
|
+
overflow: 'hidden',
|
|
141
|
+
},
|
|
142
|
+
tierCardSelected: {
|
|
143
|
+
backgroundColor: '#fff',
|
|
144
|
+
},
|
|
145
|
+
tierLabel: {
|
|
146
|
+
fontSize: 12,
|
|
147
|
+
color: '#666',
|
|
148
|
+
marginBottom: 4,
|
|
149
|
+
},
|
|
150
|
+
tierLabelWithBadge: {
|
|
151
|
+
marginTop: 16,
|
|
152
|
+
},
|
|
153
|
+
tierAmount: {
|
|
154
|
+
fontSize: 20,
|
|
155
|
+
fontWeight: '700',
|
|
156
|
+
color: '#1a1a1a',
|
|
157
|
+
},
|
|
158
|
+
checkCircle: {
|
|
159
|
+
position: 'absolute',
|
|
160
|
+
top: -8,
|
|
161
|
+
right: -8,
|
|
162
|
+
width: 28,
|
|
163
|
+
height: 28,
|
|
164
|
+
borderRadius: 14,
|
|
165
|
+
alignItems: 'center',
|
|
166
|
+
justifyContent: 'center',
|
|
167
|
+
},
|
|
168
|
+
checkmark: {
|
|
169
|
+
fontSize: 14,
|
|
170
|
+
fontWeight: '700',
|
|
171
|
+
color: '#fff',
|
|
172
|
+
},
|
|
173
|
+
recommendedBadge: {
|
|
174
|
+
position: 'absolute',
|
|
175
|
+
top: 0,
|
|
176
|
+
left: 0,
|
|
177
|
+
right: 0,
|
|
178
|
+
paddingVertical: 4,
|
|
179
|
+
alignItems: 'center',
|
|
180
|
+
},
|
|
181
|
+
recommendedText: {
|
|
182
|
+
fontSize: 10,
|
|
183
|
+
fontWeight: '700',
|
|
184
|
+
color: '#fff',
|
|
185
|
+
textTransform: 'uppercase',
|
|
186
|
+
},
|
|
187
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ONE AI Trading Components
|
|
3
|
+
* Reusable UI components for AI trading integration
|
|
4
|
+
* Can be used by any ecosystem partner
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Chain Selection
|
|
8
|
+
export * from './OneChainSelector';
|
|
9
|
+
|
|
10
|
+
// Investment Tier Selection
|
|
11
|
+
export * from './OneTierSelector';
|
|
12
|
+
|
|
13
|
+
// Cycle Selection
|
|
14
|
+
export * from './OneCycleSelector';
|
|
15
|
+
|
|
16
|
+
// Trading Pair Selection
|
|
17
|
+
export * from './OnePairSelector';
|
package/src/components/index.ts
CHANGED
package/src/hooks/index.ts
CHANGED
|
@@ -1,2 +1,22 @@
|
|
|
1
1
|
export { useWalletBalance } from './useWalletBalance';
|
|
2
2
|
export { useTokenPrice, useTokenPrices } from './useTokenPrice';
|
|
3
|
+
|
|
4
|
+
// AI Trading Hooks
|
|
5
|
+
export {
|
|
6
|
+
useAIStrategies,
|
|
7
|
+
useAIStrategy,
|
|
8
|
+
useAIOrders,
|
|
9
|
+
useAIPortfolio,
|
|
10
|
+
useAIMarketData,
|
|
11
|
+
useAITrading,
|
|
12
|
+
setAITradingAccessToken,
|
|
13
|
+
clearAITradingAccessToken,
|
|
14
|
+
type UseAIStrategiesOptions,
|
|
15
|
+
type UseAIStrategiesResult,
|
|
16
|
+
type UseAIStrategyResult,
|
|
17
|
+
type UseAIOrdersOptions,
|
|
18
|
+
type UseAIOrdersResult,
|
|
19
|
+
type UseAIPortfolioResult,
|
|
20
|
+
type UseAIMarketDataResult,
|
|
21
|
+
type UseAITradingResult,
|
|
22
|
+
} from './useAITrading';
|