@one_deploy/sdk 1.0.0
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/.turbo/turbo-build.log +0 -0
- package/.turbo/turbo-type-check.log +0 -0
- package/dist/config/index.d.mts +74 -0
- package/dist/config/index.d.ts +74 -0
- package/dist/config/index.js +242 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/index.mjs +224 -0
- package/dist/config/index.mjs.map +1 -0
- package/dist/engine-5ndtBaCr.d.ts +1039 -0
- package/dist/engine-CrlhH0nw.d.mts +1039 -0
- package/dist/hooks/index.d.mts +56 -0
- package/dist/hooks/index.d.ts +56 -0
- package/dist/hooks/index.js +1360 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +1356 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +356 -0
- package/dist/index.d.ts +356 -0
- package/dist/index.js +5068 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4949 -0
- package/dist/index.mjs.map +1 -0
- package/dist/price-CgqXPnT3.d.ts +13 -0
- package/dist/price-ClbLHHjv.d.mts +13 -0
- package/dist/providers/index.d.mts +121 -0
- package/dist/providers/index.d.ts +121 -0
- package/dist/providers/index.js +1642 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/index.mjs +1600 -0
- package/dist/providers/index.mjs.map +1 -0
- package/dist/react-native.d.mts +120 -0
- package/dist/react-native.d.ts +120 -0
- package/dist/react-native.js +1792 -0
- package/dist/react-native.js.map +1 -0
- package/dist/react-native.mjs +1755 -0
- package/dist/react-native.mjs.map +1 -0
- package/dist/services/index.d.mts +85 -0
- package/dist/services/index.d.ts +85 -0
- package/dist/services/index.js +1466 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/index.mjs +1458 -0
- package/dist/services/index.mjs.map +1 -0
- package/dist/types/index.d.mts +759 -0
- package/dist/types/index.d.ts +759 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +3 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/utils/index.d.mts +36 -0
- package/dist/utils/index.d.ts +36 -0
- package/dist/utils/index.js +164 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +142 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +101 -0
- package/src/components/OneConnectButton.tsx +143 -0
- package/src/components/OneNFTGallery.tsx +324 -0
- package/src/components/OneOfframpWidget.tsx +660 -0
- package/src/components/OneOnrampWidget.tsx +596 -0
- package/src/components/OnePayWidget.tsx +160 -0
- package/src/components/OneReceiveWidget.tsx +272 -0
- package/src/components/OneSendWidget.tsx +248 -0
- package/src/components/OneSwapWidget.tsx +715 -0
- package/src/components/OneTransactionButton.tsx +150 -0
- package/src/components/OneWalletBalance.tsx +354 -0
- package/src/components/index.ts +24 -0
- package/src/config/index.ts +299 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useTokenPrice.ts +162 -0
- package/src/hooks/useWalletBalance.ts +98 -0
- package/src/index.ts +193 -0
- package/src/providers/OneProvider.tsx +452 -0
- package/src/providers/ThirdwebProvider.tsx +203 -0
- package/src/providers/index.ts +26 -0
- package/src/react-native.ts +378 -0
- package/src/services/engine.ts +1854 -0
- package/src/services/index.ts +30 -0
- package/src/services/price.ts +164 -0
- package/src/services/supabase.ts +180 -0
- package/src/types/index.ts +887 -0
- package/src/utils/index.ts +200 -0
- package/tsconfig.json +22 -0
- package/tsup.config.ts +25 -0
|
@@ -0,0 +1,887 @@
|
|
|
1
|
+
// ===== User Types =====
|
|
2
|
+
export interface User {
|
|
3
|
+
id: string;
|
|
4
|
+
email: string;
|
|
5
|
+
walletAddress: string | null;
|
|
6
|
+
smartAccountAddress: string | null;
|
|
7
|
+
kycStatus: KycStatus;
|
|
8
|
+
kycLevel: KycLevel;
|
|
9
|
+
membershipTier: MembershipTier;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type KycStatus = 'none' | 'pending' | 'verified' | 'rejected';
|
|
14
|
+
export type KycLevel = 0 | 1 | 2 | 3;
|
|
15
|
+
export type MembershipTier = 'basic' | 'premium' | 'pro';
|
|
16
|
+
|
|
17
|
+
export interface UserProfile {
|
|
18
|
+
id: string;
|
|
19
|
+
userId: string;
|
|
20
|
+
displayName: string | null;
|
|
21
|
+
avatarUrl: string | null;
|
|
22
|
+
phoneNumber: string | null;
|
|
23
|
+
country: string | null;
|
|
24
|
+
kycStatus: KycStatus;
|
|
25
|
+
kycLevel: KycLevel;
|
|
26
|
+
membershipTier: MembershipTier;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface UserSettings {
|
|
30
|
+
userId: string;
|
|
31
|
+
language: string;
|
|
32
|
+
currency: string;
|
|
33
|
+
theme: 'light' | 'dark' | 'system';
|
|
34
|
+
notifications: NotificationSettings;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface NotificationSettings {
|
|
38
|
+
push: boolean;
|
|
39
|
+
email: boolean;
|
|
40
|
+
sms: boolean;
|
|
41
|
+
transactions: boolean;
|
|
42
|
+
marketing: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ===== Token & Asset Types =====
|
|
46
|
+
export interface Token {
|
|
47
|
+
id: string;
|
|
48
|
+
symbol: string;
|
|
49
|
+
name: string;
|
|
50
|
+
icon: string;
|
|
51
|
+
balance: number;
|
|
52
|
+
balanceUsd?: number;
|
|
53
|
+
price: number;
|
|
54
|
+
value: number;
|
|
55
|
+
change24h: number;
|
|
56
|
+
priceChange24h?: number;
|
|
57
|
+
chainId?: number;
|
|
58
|
+
chain: string;
|
|
59
|
+
chainName?: string;
|
|
60
|
+
chainIcon?: string;
|
|
61
|
+
contractAddress?: string;
|
|
62
|
+
address?: string;
|
|
63
|
+
decimals?: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface WalletBalance {
|
|
67
|
+
totalUsd: number;
|
|
68
|
+
change24h: number;
|
|
69
|
+
changePercent24h: number;
|
|
70
|
+
tokens: Token[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface OnChainBalance {
|
|
74
|
+
tokenAddress: string | null;
|
|
75
|
+
tokenSymbol: string;
|
|
76
|
+
tokenDecimals: number;
|
|
77
|
+
balance: string;
|
|
78
|
+
balanceFormatted: string;
|
|
79
|
+
chain: string;
|
|
80
|
+
chainId: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface TokenPrice {
|
|
84
|
+
symbol: string;
|
|
85
|
+
price: number;
|
|
86
|
+
change24h: number;
|
|
87
|
+
changePercent24h: number;
|
|
88
|
+
priceChange24h?: number; // Alias for backwards compatibility
|
|
89
|
+
marketCap?: number;
|
|
90
|
+
volume24h?: number;
|
|
91
|
+
updatedAt?: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ===== Transaction Types =====
|
|
95
|
+
export type TransactionType = 'send' | 'receive' | 'swap' | 'buy' | 'sell' | 'deposit' | 'withdraw' | 'bridge';
|
|
96
|
+
export type TransactionStatus = 'pending' | 'confirmed' | 'failed' | 'completed';
|
|
97
|
+
|
|
98
|
+
export interface Transaction {
|
|
99
|
+
id: string;
|
|
100
|
+
type: TransactionType;
|
|
101
|
+
status: TransactionStatus;
|
|
102
|
+
amount: number;
|
|
103
|
+
symbol?: string;
|
|
104
|
+
tokenSymbol?: string;
|
|
105
|
+
tokenName?: string;
|
|
106
|
+
amountUsd?: number;
|
|
107
|
+
from?: string;
|
|
108
|
+
to?: string;
|
|
109
|
+
fromAddress?: string;
|
|
110
|
+
toAddress?: string;
|
|
111
|
+
txHash?: string | null;
|
|
112
|
+
chainId?: number;
|
|
113
|
+
chain?: string;
|
|
114
|
+
timestamp: string;
|
|
115
|
+
fee?: number;
|
|
116
|
+
note?: string | null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// ===== AI Quant Trading Types =====
|
|
120
|
+
|
|
121
|
+
export type StrategyCategory =
|
|
122
|
+
| 'conservative'
|
|
123
|
+
| 'balanced'
|
|
124
|
+
| 'aggressive'
|
|
125
|
+
| 'hedge'
|
|
126
|
+
| 'arbitrage'
|
|
127
|
+
| 'trend'
|
|
128
|
+
| 'grid'
|
|
129
|
+
| 'dca';
|
|
130
|
+
|
|
131
|
+
export type AIOrderStatus =
|
|
132
|
+
| 'pending'
|
|
133
|
+
| 'active'
|
|
134
|
+
| 'paused'
|
|
135
|
+
| 'completed'
|
|
136
|
+
| 'cancelled'
|
|
137
|
+
| 'pending_redemption'
|
|
138
|
+
| 'redeemed';
|
|
139
|
+
|
|
140
|
+
export type TradeAction =
|
|
141
|
+
| 'buy'
|
|
142
|
+
| 'sell'
|
|
143
|
+
| 'long'
|
|
144
|
+
| 'short'
|
|
145
|
+
| 'close_long'
|
|
146
|
+
| 'close_short';
|
|
147
|
+
|
|
148
|
+
export type RiskLevel = 'conservative' | 'moderate' | 'aggressive';
|
|
149
|
+
|
|
150
|
+
export interface AIStrategy {
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
description: string | null;
|
|
154
|
+
category: StrategyCategory;
|
|
155
|
+
riskLevel: number; // 1-10
|
|
156
|
+
minInvestment: number;
|
|
157
|
+
maxInvestment: number | null;
|
|
158
|
+
lockPeriodDays: number;
|
|
159
|
+
expectedApyMin: number | null;
|
|
160
|
+
expectedApyMax: number | null;
|
|
161
|
+
managementFeeRate: number;
|
|
162
|
+
performanceFeeRate: number;
|
|
163
|
+
supportedPairs: string[];
|
|
164
|
+
supportedChains: string[];
|
|
165
|
+
leverageMin: number;
|
|
166
|
+
leverageMax: number;
|
|
167
|
+
isActive: boolean;
|
|
168
|
+
tvl: number;
|
|
169
|
+
totalUsers: number;
|
|
170
|
+
totalTrades: number;
|
|
171
|
+
winRate: number;
|
|
172
|
+
maxDrawdown: number;
|
|
173
|
+
sharpeRatio: number;
|
|
174
|
+
currentNav: number;
|
|
175
|
+
createdAt: string;
|
|
176
|
+
metadata?: Record<string, unknown>;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface AIOrder {
|
|
180
|
+
id: string;
|
|
181
|
+
userId: string;
|
|
182
|
+
strategyId: string;
|
|
183
|
+
strategyName?: string;
|
|
184
|
+
amount: number;
|
|
185
|
+
currency: string;
|
|
186
|
+
chain: string;
|
|
187
|
+
status: AIOrderStatus;
|
|
188
|
+
startDate: string;
|
|
189
|
+
lockEndDate: string;
|
|
190
|
+
lockPeriodDays: number;
|
|
191
|
+
pauseCount: number;
|
|
192
|
+
totalPauseDays: number;
|
|
193
|
+
currentPauseStart: string | null;
|
|
194
|
+
realizedProfit: number;
|
|
195
|
+
unrealizedProfit: number;
|
|
196
|
+
totalFeesPaid: number;
|
|
197
|
+
currentNav: number | null;
|
|
198
|
+
shareRatio: number;
|
|
199
|
+
shares: number;
|
|
200
|
+
redemptionRequestedAt: string | null;
|
|
201
|
+
redemptionAmount: number | null;
|
|
202
|
+
earlyWithdrawalPenaltyRate: number | null;
|
|
203
|
+
penaltyAmount: number;
|
|
204
|
+
txHashDeposit: string | null;
|
|
205
|
+
txHashRedemption: string | null;
|
|
206
|
+
createdAt: string;
|
|
207
|
+
updatedAt: string;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface AITradeExecution {
|
|
211
|
+
id: string;
|
|
212
|
+
batchId: string;
|
|
213
|
+
strategyId: string;
|
|
214
|
+
tradeSeq: number;
|
|
215
|
+
action: TradeAction;
|
|
216
|
+
pair: string;
|
|
217
|
+
entryPrice: number;
|
|
218
|
+
exitPrice: number | null;
|
|
219
|
+
amount: number;
|
|
220
|
+
leverage: number;
|
|
221
|
+
pnl: number;
|
|
222
|
+
pnlPct: number;
|
|
223
|
+
fee: number;
|
|
224
|
+
status: 'open' | 'closed' | 'liquidated' | 'cancelled';
|
|
225
|
+
openedAt: string;
|
|
226
|
+
closedAt: string | null;
|
|
227
|
+
aiConfidence: number | null;
|
|
228
|
+
aiReasoning: string | null;
|
|
229
|
+
externalOrderId: string | null;
|
|
230
|
+
metadata?: Record<string, unknown>;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface AITradeAllocation {
|
|
234
|
+
id: string;
|
|
235
|
+
executionId: string;
|
|
236
|
+
orderId: string;
|
|
237
|
+
userId: string;
|
|
238
|
+
allocatedAmount: number;
|
|
239
|
+
allocatedPnl: number;
|
|
240
|
+
allocatedFee: number;
|
|
241
|
+
shareRatio: number;
|
|
242
|
+
createdAt: string;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface AINavSnapshot {
|
|
246
|
+
id: string;
|
|
247
|
+
strategyId: string;
|
|
248
|
+
snapshotDate: string;
|
|
249
|
+
nav: number;
|
|
250
|
+
dailyPnl: number;
|
|
251
|
+
dailyPnlPct: number;
|
|
252
|
+
cumulativePnl: number;
|
|
253
|
+
cumulativePnlPct: number;
|
|
254
|
+
totalAum: number;
|
|
255
|
+
createdAt: string;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface AIPortfolioSummary {
|
|
259
|
+
userId: string;
|
|
260
|
+
totalInvested: number;
|
|
261
|
+
currentValue: number;
|
|
262
|
+
totalPnl: number;
|
|
263
|
+
totalPnlPct: number;
|
|
264
|
+
realizedPnl: number;
|
|
265
|
+
unrealizedPnl: number;
|
|
266
|
+
totalFeesPaid: number;
|
|
267
|
+
activeOrders: number;
|
|
268
|
+
strategies: Array<{
|
|
269
|
+
strategyId: string;
|
|
270
|
+
strategyName: string;
|
|
271
|
+
invested: number;
|
|
272
|
+
currentValue: number;
|
|
273
|
+
pnl: number;
|
|
274
|
+
pnlPct: number;
|
|
275
|
+
}>;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export interface AIRedemptionResult {
|
|
279
|
+
success: boolean;
|
|
280
|
+
redemptionAmount: number;
|
|
281
|
+
penaltyRate: number;
|
|
282
|
+
penaltyAmount: number;
|
|
283
|
+
completionRate: number;
|
|
284
|
+
finalAmount: number;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export interface AIMarketData {
|
|
288
|
+
symbol: string;
|
|
289
|
+
price: number;
|
|
290
|
+
change24h: number;
|
|
291
|
+
volume24h: number;
|
|
292
|
+
high24h: number;
|
|
293
|
+
low24h: number;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export interface CreateAIOrderRequest {
|
|
297
|
+
strategyId: string;
|
|
298
|
+
amount: number;
|
|
299
|
+
currency?: string;
|
|
300
|
+
chain?: string;
|
|
301
|
+
lockPeriodDays?: number;
|
|
302
|
+
txHashDeposit?: string;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface Position {
|
|
306
|
+
id: string;
|
|
307
|
+
strategyId: string;
|
|
308
|
+
strategyName: string;
|
|
309
|
+
status: 'active' | 'paused' | 'closed' | 'pending';
|
|
310
|
+
investedAmount: number;
|
|
311
|
+
currentValue: number;
|
|
312
|
+
pnl: number;
|
|
313
|
+
pnlPercent: number;
|
|
314
|
+
entryDate: string;
|
|
315
|
+
exitDate?: string;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// ===== Card Types =====
|
|
319
|
+
export type CardStatus = 'pending' | 'active' | 'frozen' | 'cancelled';
|
|
320
|
+
export type CardTier = 'standard' | 'gold' | 'platinum' | 'black';
|
|
321
|
+
|
|
322
|
+
export interface Card {
|
|
323
|
+
id: string;
|
|
324
|
+
tier: CardTier;
|
|
325
|
+
status: CardStatus;
|
|
326
|
+
lastFour: string;
|
|
327
|
+
expiryDate: string;
|
|
328
|
+
balance?: number;
|
|
329
|
+
spendLimit: number;
|
|
330
|
+
spentThisMonth: number;
|
|
331
|
+
cardNumber?: string;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export interface CardTransaction {
|
|
335
|
+
id: string;
|
|
336
|
+
cardId: string;
|
|
337
|
+
merchant: string;
|
|
338
|
+
category: string;
|
|
339
|
+
amount: number;
|
|
340
|
+
currency: string;
|
|
341
|
+
timestamp: string;
|
|
342
|
+
status: 'pending' | 'completed' | 'declined';
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// ===== Notification Types =====
|
|
346
|
+
export interface Notification {
|
|
347
|
+
id: string;
|
|
348
|
+
type: 'transaction' | 'security' | 'promotion' | 'system';
|
|
349
|
+
title: string;
|
|
350
|
+
message: string;
|
|
351
|
+
read: boolean;
|
|
352
|
+
timestamp: string;
|
|
353
|
+
actionUrl?: string;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// ===== API Types =====
|
|
357
|
+
export interface ApiResponse<T> {
|
|
358
|
+
success: boolean;
|
|
359
|
+
data?: T;
|
|
360
|
+
error?: {
|
|
361
|
+
code: string;
|
|
362
|
+
message: string;
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// ===== Chain Types =====
|
|
367
|
+
export interface ChainConfig {
|
|
368
|
+
id: number;
|
|
369
|
+
name: string;
|
|
370
|
+
shortName: string;
|
|
371
|
+
icon: string;
|
|
372
|
+
nativeCurrency: {
|
|
373
|
+
name: string;
|
|
374
|
+
symbol: string;
|
|
375
|
+
decimals: number;
|
|
376
|
+
};
|
|
377
|
+
rpcUrls: string[];
|
|
378
|
+
blockExplorerUrls: string[];
|
|
379
|
+
testnet: boolean;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// ===== NFT Types =====
|
|
383
|
+
export interface NFT {
|
|
384
|
+
id: string;
|
|
385
|
+
tokenId: string;
|
|
386
|
+
contractAddress: string;
|
|
387
|
+
chainId: number;
|
|
388
|
+
chain: string;
|
|
389
|
+
name: string;
|
|
390
|
+
description?: string;
|
|
391
|
+
image?: string;
|
|
392
|
+
imageUrl?: string;
|
|
393
|
+
thumbnailUrl?: string;
|
|
394
|
+
animationUrl?: string;
|
|
395
|
+
tokenType: 'ERC721' | 'ERC1155';
|
|
396
|
+
metadata?: Record<string, any>;
|
|
397
|
+
attributes?: NFTAttribute[];
|
|
398
|
+
owner: string;
|
|
399
|
+
collection?: NFTCollection;
|
|
400
|
+
floorPrice?: number;
|
|
401
|
+
lastPrice?: number;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export interface NFTAttribute {
|
|
405
|
+
traitType: string;
|
|
406
|
+
value: string | number;
|
|
407
|
+
displayType?: string;
|
|
408
|
+
maxValue?: number;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export interface NFTCollection {
|
|
412
|
+
address: string;
|
|
413
|
+
name: string;
|
|
414
|
+
symbol?: string;
|
|
415
|
+
description?: string;
|
|
416
|
+
image?: string;
|
|
417
|
+
bannerImage?: string;
|
|
418
|
+
chainId: number;
|
|
419
|
+
totalSupply?: number;
|
|
420
|
+
floorPrice?: number;
|
|
421
|
+
verified?: boolean;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export interface NFTTransfer {
|
|
425
|
+
id: string;
|
|
426
|
+
type: 'mint' | 'transfer' | 'sale' | 'burn';
|
|
427
|
+
from: string;
|
|
428
|
+
to: string;
|
|
429
|
+
tokenId: string;
|
|
430
|
+
contractAddress: string;
|
|
431
|
+
transactionHash: string;
|
|
432
|
+
timestamp: string;
|
|
433
|
+
price?: number;
|
|
434
|
+
currency?: string;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// ===== Contract Types =====
|
|
438
|
+
export interface Contract {
|
|
439
|
+
id: string;
|
|
440
|
+
address: string;
|
|
441
|
+
chainId: number;
|
|
442
|
+
name: string;
|
|
443
|
+
symbol?: string;
|
|
444
|
+
contractType: ContractType;
|
|
445
|
+
abi?: any[];
|
|
446
|
+
verified?: boolean;
|
|
447
|
+
deployedAt?: string;
|
|
448
|
+
deployer?: string;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export type ContractType = 'erc20' | 'erc721' | 'erc1155' | 'custom' | 'marketplace' | 'staking' | 'governance';
|
|
452
|
+
|
|
453
|
+
export interface ContractReadParams {
|
|
454
|
+
contractAddress: string;
|
|
455
|
+
chainId: number;
|
|
456
|
+
functionName: string;
|
|
457
|
+
args?: any[];
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export interface ContractWriteParams {
|
|
461
|
+
contractAddress: string;
|
|
462
|
+
chainId: number;
|
|
463
|
+
functionName: string;
|
|
464
|
+
args?: any[];
|
|
465
|
+
value?: string;
|
|
466
|
+
gasLimit?: string;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export interface ContractDeployParams {
|
|
470
|
+
chainId: number;
|
|
471
|
+
contractType: string;
|
|
472
|
+
name: string;
|
|
473
|
+
symbol?: string;
|
|
474
|
+
constructorArgs?: any[];
|
|
475
|
+
metadata?: Record<string, any>;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// ===== Bill Payment Types =====
|
|
479
|
+
export interface BillProvider {
|
|
480
|
+
id: string;
|
|
481
|
+
name: string;
|
|
482
|
+
category: BillCategory;
|
|
483
|
+
icon?: string;
|
|
484
|
+
countries: string[];
|
|
485
|
+
minAmount: number;
|
|
486
|
+
maxAmount: number;
|
|
487
|
+
fees: number;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export type BillCategory = 'electricity' | 'water' | 'gas' | 'internet' | 'phone' | 'tv' | 'insurance' | 'tax' | 'other';
|
|
491
|
+
|
|
492
|
+
export interface BillPayment {
|
|
493
|
+
id: string;
|
|
494
|
+
providerId: string;
|
|
495
|
+
providerName: string;
|
|
496
|
+
category: BillCategory;
|
|
497
|
+
accountNumber: string;
|
|
498
|
+
amount: number;
|
|
499
|
+
currency: string;
|
|
500
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
501
|
+
reference?: string;
|
|
502
|
+
createdAt: string;
|
|
503
|
+
completedAt?: string;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// ===== Offramp Types =====
|
|
507
|
+
export interface OfframpQuote {
|
|
508
|
+
provider: string;
|
|
509
|
+
cryptoCurrency: string;
|
|
510
|
+
cryptoAmount: number;
|
|
511
|
+
fiatCurrency: string;
|
|
512
|
+
fiatAmount: number;
|
|
513
|
+
rate: number;
|
|
514
|
+
fees: {
|
|
515
|
+
network: number;
|
|
516
|
+
provider: number;
|
|
517
|
+
total: number;
|
|
518
|
+
};
|
|
519
|
+
payoutMethod: string;
|
|
520
|
+
estimatedTime: string;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export interface OfframpRequest {
|
|
524
|
+
cryptoCurrency: string;
|
|
525
|
+
cryptoAmount: number;
|
|
526
|
+
fiatCurrency: string;
|
|
527
|
+
payoutMethod: string;
|
|
528
|
+
payoutDetails: Record<string, string>;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export interface OfframpTransaction {
|
|
532
|
+
id: string;
|
|
533
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
534
|
+
cryptoAmount: number;
|
|
535
|
+
cryptoCurrency: string;
|
|
536
|
+
fiatAmount: number;
|
|
537
|
+
fiatCurrency: string;
|
|
538
|
+
txHash?: string;
|
|
539
|
+
payoutReference?: string;
|
|
540
|
+
createdAt: string;
|
|
541
|
+
completedAt?: string;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// ===== Staking Types =====
|
|
545
|
+
export interface StakingPool {
|
|
546
|
+
id: string;
|
|
547
|
+
name: string;
|
|
548
|
+
token: string;
|
|
549
|
+
rewardToken: string;
|
|
550
|
+
chainId: number;
|
|
551
|
+
apy: number;
|
|
552
|
+
totalStaked: number;
|
|
553
|
+
minStake: number;
|
|
554
|
+
lockPeriod: number;
|
|
555
|
+
status: 'active' | 'paused' | 'ended';
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export interface StakingPosition {
|
|
559
|
+
id: string;
|
|
560
|
+
poolId: string;
|
|
561
|
+
poolName: string;
|
|
562
|
+
stakedAmount: number;
|
|
563
|
+
rewardsEarned: number;
|
|
564
|
+
startDate: string;
|
|
565
|
+
unlockDate?: string;
|
|
566
|
+
status: 'active' | 'unlocked' | 'withdrawn';
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// ===== Referral Types =====
|
|
570
|
+
export interface ReferralInfo {
|
|
571
|
+
code: string;
|
|
572
|
+
link: string;
|
|
573
|
+
totalReferrals: number;
|
|
574
|
+
totalEarnings: number;
|
|
575
|
+
pendingEarnings: number;
|
|
576
|
+
tier: 'bronze' | 'silver' | 'gold' | 'platinum';
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
export interface Referral {
|
|
580
|
+
id: string;
|
|
581
|
+
referredUserId: string;
|
|
582
|
+
status: 'pending' | 'active' | 'rewarded';
|
|
583
|
+
earnings: number;
|
|
584
|
+
createdAt: string;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// ===== Bridge Types =====
|
|
588
|
+
export interface BridgeQuote {
|
|
589
|
+
quoteId: string;
|
|
590
|
+
fromChainId: number;
|
|
591
|
+
toChainId: number;
|
|
592
|
+
fromToken: string;
|
|
593
|
+
toToken: string;
|
|
594
|
+
fromAmount: string;
|
|
595
|
+
toAmount: string;
|
|
596
|
+
estimatedTime: string;
|
|
597
|
+
fees: {
|
|
598
|
+
bridge: number;
|
|
599
|
+
gas: number;
|
|
600
|
+
total: number;
|
|
601
|
+
};
|
|
602
|
+
route: BridgeRoute[];
|
|
603
|
+
expiresAt: string;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export interface BridgeRoute {
|
|
607
|
+
protocol: string;
|
|
608
|
+
fromChain: string;
|
|
609
|
+
toChain: string;
|
|
610
|
+
estimatedTime: string;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
export interface BridgeTransaction {
|
|
614
|
+
id: string;
|
|
615
|
+
status: 'pending' | 'source_confirmed' | 'bridging' | 'completed' | 'failed';
|
|
616
|
+
fromChainId: number;
|
|
617
|
+
toChainId: number;
|
|
618
|
+
fromAmount: string;
|
|
619
|
+
toAmount?: string;
|
|
620
|
+
sourceTxHash?: string;
|
|
621
|
+
destinationTxHash?: string;
|
|
622
|
+
createdAt: string;
|
|
623
|
+
completedAt?: string;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// ===== Gas Types =====
|
|
627
|
+
export interface GasEstimate {
|
|
628
|
+
gasLimit: string;
|
|
629
|
+
gasPrice: string;
|
|
630
|
+
maxFeePerGas?: string;
|
|
631
|
+
maxPriorityFeePerGas?: string;
|
|
632
|
+
estimatedCostWei: string;
|
|
633
|
+
estimatedCostUsd: number;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
export interface GasPrice {
|
|
637
|
+
chainId: number;
|
|
638
|
+
slow: { gasPrice: string; estimatedTime: string };
|
|
639
|
+
standard: { gasPrice: string; estimatedTime: string };
|
|
640
|
+
fast: { gasPrice: string; estimatedTime: string };
|
|
641
|
+
baseFee?: string;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// ===== Wallet Import/Export Types =====
|
|
645
|
+
export interface WalletExport {
|
|
646
|
+
address: string;
|
|
647
|
+
encryptedPrivateKey?: string;
|
|
648
|
+
mnemonic?: string;
|
|
649
|
+
publicKey: string;
|
|
650
|
+
chainId: number;
|
|
651
|
+
type: 'eoa' | 'smart' | 'imported';
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
export interface WalletImportRequest {
|
|
655
|
+
privateKey?: string;
|
|
656
|
+
mnemonic?: string;
|
|
657
|
+
chainId?: number;
|
|
658
|
+
label?: string;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// ===== Session Types =====
|
|
662
|
+
export interface Session {
|
|
663
|
+
userId: string;
|
|
664
|
+
accessToken: string;
|
|
665
|
+
refreshToken: string;
|
|
666
|
+
expiresAt: string;
|
|
667
|
+
deviceId?: string;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
// ===== Analytics Types =====
|
|
671
|
+
export interface PortfolioHistory {
|
|
672
|
+
date: string;
|
|
673
|
+
totalValue: number;
|
|
674
|
+
change: number;
|
|
675
|
+
changePercent: number;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export interface AssetAllocation {
|
|
679
|
+
category: string;
|
|
680
|
+
value: number;
|
|
681
|
+
percentage: number;
|
|
682
|
+
tokens: { symbol: string; value: number; percentage: number }[];
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
export interface PortfolioAnalytics {
|
|
686
|
+
totalValue: number;
|
|
687
|
+
allTimeProfit: number;
|
|
688
|
+
allTimeProfitPercent: number;
|
|
689
|
+
bestPerformer: { symbol: string; change: number };
|
|
690
|
+
worstPerformer: { symbol: string; change: number };
|
|
691
|
+
history: PortfolioHistory[];
|
|
692
|
+
allocation: AssetAllocation[];
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// ===== Advanced Trading Types =====
|
|
696
|
+
export interface TradingCondition {
|
|
697
|
+
type: 'stop_loss' | 'take_profit' | 'trailing_stop';
|
|
698
|
+
triggerPrice: number;
|
|
699
|
+
triggerPercent?: number;
|
|
700
|
+
action: 'sell' | 'notify';
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export interface LimitOrder {
|
|
704
|
+
id: string;
|
|
705
|
+
type: 'buy' | 'sell';
|
|
706
|
+
tokenSymbol: string;
|
|
707
|
+
amount: number;
|
|
708
|
+
limitPrice: number;
|
|
709
|
+
status: 'pending' | 'filled' | 'cancelled' | 'expired';
|
|
710
|
+
conditions?: TradingCondition[];
|
|
711
|
+
createdAt: string;
|
|
712
|
+
expiresAt?: string;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
// ===== Event Types for SDK =====
|
|
716
|
+
export type SDKEventType =
|
|
717
|
+
| 'auth:login'
|
|
718
|
+
| 'auth:logout'
|
|
719
|
+
| 'wallet:connected'
|
|
720
|
+
| 'wallet:disconnected'
|
|
721
|
+
| 'transaction:pending'
|
|
722
|
+
| 'transaction:confirmed'
|
|
723
|
+
| 'transaction:failed'
|
|
724
|
+
| 'balance:updated'
|
|
725
|
+
| 'price:updated'
|
|
726
|
+
| 'notification:received';
|
|
727
|
+
|
|
728
|
+
export interface SDKEvent {
|
|
729
|
+
type: SDKEventType;
|
|
730
|
+
payload: any;
|
|
731
|
+
timestamp: string;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
// ===== Permission Types =====
|
|
735
|
+
export type Permission =
|
|
736
|
+
| 'wallet:read'
|
|
737
|
+
| 'wallet:write'
|
|
738
|
+
| 'wallet:sign'
|
|
739
|
+
| 'trade:read'
|
|
740
|
+
| 'trade:execute'
|
|
741
|
+
| 'profile:read'
|
|
742
|
+
| 'profile:write'
|
|
743
|
+
| 'admin:all';
|
|
744
|
+
|
|
745
|
+
export interface PermissionScope {
|
|
746
|
+
permissions: Permission[];
|
|
747
|
+
expiresAt?: string;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// ===== Webhook Types =====
|
|
751
|
+
export type WebhookEventType =
|
|
752
|
+
| 'user.created'
|
|
753
|
+
| 'user.updated'
|
|
754
|
+
| 'wallet.created'
|
|
755
|
+
| 'transaction.pending'
|
|
756
|
+
| 'transaction.confirmed'
|
|
757
|
+
| 'transaction.failed'
|
|
758
|
+
| 'payment.created'
|
|
759
|
+
| 'payment.paid'
|
|
760
|
+
| 'payment.failed'
|
|
761
|
+
| 'position.opened'
|
|
762
|
+
| 'position.closed'
|
|
763
|
+
| 'order.filled'
|
|
764
|
+
| 'strategy.signal';
|
|
765
|
+
|
|
766
|
+
export interface Webhook {
|
|
767
|
+
id: string;
|
|
768
|
+
projectId: string;
|
|
769
|
+
url: string;
|
|
770
|
+
events: WebhookEventType[];
|
|
771
|
+
secret?: string;
|
|
772
|
+
isActive: boolean;
|
|
773
|
+
metadata?: Record<string, unknown>;
|
|
774
|
+
createdAt: string;
|
|
775
|
+
updatedAt: string;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
export interface WebhookDelivery {
|
|
779
|
+
id: string;
|
|
780
|
+
webhookId: string;
|
|
781
|
+
event: WebhookEventType;
|
|
782
|
+
payload: unknown;
|
|
783
|
+
status: 'pending' | 'success' | 'failed';
|
|
784
|
+
statusCode?: number;
|
|
785
|
+
responseTime?: number;
|
|
786
|
+
error?: string;
|
|
787
|
+
attempts: number;
|
|
788
|
+
createdAt: string;
|
|
789
|
+
deliveredAt?: string;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
export interface CreateWebhookInput {
|
|
793
|
+
url: string;
|
|
794
|
+
events: WebhookEventType[];
|
|
795
|
+
secret?: string;
|
|
796
|
+
isActive?: boolean;
|
|
797
|
+
metadata?: Record<string, unknown>;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
export interface UpdateWebhookInput {
|
|
801
|
+
url?: string;
|
|
802
|
+
events?: WebhookEventType[];
|
|
803
|
+
secret?: string;
|
|
804
|
+
isActive?: boolean;
|
|
805
|
+
metadata?: Record<string, unknown>;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// ===== Admin Types =====
|
|
809
|
+
export interface AdminUser {
|
|
810
|
+
id: string;
|
|
811
|
+
email?: string;
|
|
812
|
+
phone?: string;
|
|
813
|
+
role: 'user' | 'admin';
|
|
814
|
+
kycStatus: 'none' | 'pending' | 'verified' | 'rejected';
|
|
815
|
+
isActive: boolean;
|
|
816
|
+
walletCount: number;
|
|
817
|
+
createdAt: string;
|
|
818
|
+
lastActiveAt?: string;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
export interface AdminProject {
|
|
822
|
+
id: string;
|
|
823
|
+
name: string;
|
|
824
|
+
slug: string;
|
|
825
|
+
ownerId: string;
|
|
826
|
+
ownerEmail?: string;
|
|
827
|
+
apiKey: string;
|
|
828
|
+
isActive: boolean;
|
|
829
|
+
settings: Record<string, unknown>;
|
|
830
|
+
createdAt: string;
|
|
831
|
+
updatedAt: string;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
export interface SystemStats {
|
|
835
|
+
overview: {
|
|
836
|
+
totalUsers: number;
|
|
837
|
+
newUsers: number;
|
|
838
|
+
totalWallets: number;
|
|
839
|
+
totalTransactions: number;
|
|
840
|
+
totalProjects: number;
|
|
841
|
+
totalStrategies: number;
|
|
842
|
+
activePositions: number;
|
|
843
|
+
totalPayments: number;
|
|
844
|
+
fiatVolume: number;
|
|
845
|
+
};
|
|
846
|
+
userGrowth: Array<{ date: string; count: number }>;
|
|
847
|
+
chainVolume: Array<{ chainId: number; count: number }>;
|
|
848
|
+
kycBreakdown: Record<string, number>;
|
|
849
|
+
period: {
|
|
850
|
+
days: number;
|
|
851
|
+
startDate: string;
|
|
852
|
+
endDate: string;
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
export interface PaginatedResult<T> {
|
|
857
|
+
data: T[];
|
|
858
|
+
total: number;
|
|
859
|
+
page: number;
|
|
860
|
+
limit: number;
|
|
861
|
+
totalPages: number;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
export interface AdminListOptions {
|
|
865
|
+
page?: number;
|
|
866
|
+
limit?: number;
|
|
867
|
+
search?: string;
|
|
868
|
+
sortBy?: string;
|
|
869
|
+
sortOrder?: 'asc' | 'desc';
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
export interface SystemLog {
|
|
873
|
+
id: string;
|
|
874
|
+
level: 'info' | 'warn' | 'error';
|
|
875
|
+
service: string;
|
|
876
|
+
message: string;
|
|
877
|
+
metadata?: Record<string, unknown>;
|
|
878
|
+
createdAt: string;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
export interface RateLimitInfo {
|
|
882
|
+
identifier: string;
|
|
883
|
+
endpoint: string;
|
|
884
|
+
count: number;
|
|
885
|
+
windowStart: string;
|
|
886
|
+
windowEnd: string;
|
|
887
|
+
}
|