@one_deploy/sdk 1.0.7 → 1.2.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/README.md +339 -0
- package/dist/ForexPoolDataGenerator--__twRwl.d.mts +76 -0
- package/dist/ForexPoolDataGenerator-eUgwsU_B.d.ts +76 -0
- package/dist/OneForexTradeHistory-TlKxjbFF.d.ts +250 -0
- package/dist/OneForexTradeHistory-iDySMcw0.d.mts +250 -0
- package/dist/components/index.d.mts +539 -0
- package/dist/components/index.d.ts +539 -0
- package/dist/components/index.js +7295 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +7243 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/config/index.d.mts +1 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/console-BfTMA7ah.d.mts +504 -0
- package/dist/console-BfTMA7ah.d.ts +504 -0
- package/dist/hooks/index.d.mts +323 -1
- package/dist/hooks/index.d.ts +323 -1
- package/dist/hooks/index.js +3223 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +3204 -1
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +18 -352
- package/dist/index.d.ts +18 -352
- package/dist/index.js +8646 -574
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8449 -432
- package/dist/index.mjs.map +1 -1
- package/dist/providers/index.d.mts +31 -31
- package/dist/providers/index.d.ts +31 -31
- package/dist/providers/index.js +140 -153
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +100 -109
- package/dist/providers/index.mjs.map +1 -1
- package/dist/react-native.d.mts +8 -144
- package/dist/react-native.d.ts +8 -144
- package/dist/react-native.js +2640 -689
- package/dist/react-native.js.map +1 -1
- package/dist/react-native.mjs +2610 -691
- package/dist/react-native.mjs.map +1 -1
- package/dist/services/index.d.mts +85 -4
- package/dist/services/index.d.ts +85 -4
- package/dist/services/index.js +1621 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs +1619 -1
- package/dist/services/index.mjs.map +1 -1
- package/dist/types/index.d.mts +203 -1
- package/dist/types/index.d.ts +203 -1
- package/dist/types/index.js +275 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +251 -0
- package/dist/types/index.mjs.map +1 -1
- package/dist/useForexTrading-BleeSor8.d.mts +80 -0
- package/dist/useForexTrading-ZgW_G40Q.d.ts +80 -0
- package/package.json +9 -2
- package/src/components/OneConnectButton.tsx +24 -1
- package/src/components/OneNFTGallery.tsx +13 -7
- package/src/components/OneOfframpWidget.tsx +4 -3
- package/src/components/OnePayWidget.tsx +10 -1
- package/src/components/OneSendWidget.tsx +3 -3
- package/src/components/OneSwapWidget.tsx +4 -4
- package/src/components/OneTransactionButton.tsx +28 -3
- package/src/components/OneWalletBalance.tsx +1 -1
- package/src/components/ai/OneChainSelector.tsx +63 -336
- package/src/components/ai/OneForexCapitalSplit.tsx +112 -0
- package/src/components/ai/OneForexConsoleView.tsx +90 -0
- package/src/components/ai/OneForexPairSelector.tsx +101 -0
- package/src/components/ai/OneForexPoolCard.tsx +105 -0
- package/src/components/ai/OneForexTradeHistory.tsx +107 -0
- package/src/components/ai/OnePairSelector.tsx +77 -434
- package/src/components/ai/console/OneAIQuantConsole.tsx +423 -0
- package/src/components/ai/console/OneAgentCard.tsx +383 -0
- package/src/components/ai/console/OneAgentConsole.tsx +469 -0
- package/src/components/ai/console/OneDecisionTimeline.tsx +433 -0
- package/src/components/ai/console/OneMetricsDashboard.tsx +493 -0
- package/src/components/ai/console/OnePositionCard.tsx +406 -0
- package/src/components/ai/console/OnePositionDetail.tsx +600 -0
- package/src/components/ai/console/OneRiskIndicator.tsx +464 -0
- package/src/components/ai/console/OneTradingConsole.tsx +660 -0
- package/src/components/ai/console/index.ts +17 -0
- package/src/components/ai/index.ts +10 -0
- package/src/hooks/index.ts +46 -0
- package/src/hooks/useAIDecisions.ts +280 -0
- package/src/hooks/useAIPositions.ts +349 -0
- package/src/hooks/useAIQuantConsole.ts +283 -0
- package/src/hooks/useAIRiskStatus.ts +276 -0
- package/src/hooks/useAITrading.ts +190 -0
- package/src/hooks/useBotSimulation.ts +201 -0
- package/src/hooks/useForexTrading.ts +430 -0
- package/src/hooks/useTradingConsole.ts +243 -0
- package/src/index.ts +123 -5
- package/src/providers/OneProvider.tsx +181 -5
- package/src/providers/index.ts +22 -8
- package/src/react-native.ts +41 -0
- package/src/services/forex/BotSimulationEngine.ts +968 -0
- package/src/services/forex/ForexPoolDataGenerator.ts +542 -0
- package/src/services/forex/ForexSimulationEngine.ts +482 -0
- package/src/services/forex/index.ts +21 -0
- package/src/services/index.ts +16 -0
- package/src/types/aiTrading.ts +151 -0
- package/src/types/console.ts +380 -0
- package/src/types/forex.ts +282 -0
- package/src/types/index.ts +106 -0
- package/dist/price-CgqXPnT3.d.ts +0 -13
- package/dist/price-ClbLHHjv.d.mts +0 -13
- package/dist/supabase-BT0c7q9e.d.mts +0 -82
- package/dist/supabase-BT0c7q9e.d.ts +0 -82
package/dist/types/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
1
|
+
{"version":3,"sources":["../../src/types/forex.ts","../../src/types/aiTrading.ts","../../src/types/console.ts"],"names":[],"mappings":";AAOO,IAAM,mBAAA,GAAsB;AAAA,EACjC,YAAA,EAAc,GAAA;AAAA,EACd,cAAA,EAAgB;AAClB;AAEO,SAAS,uBAAuB,MAAA,EAMrC;AACA,EAAA,MAAM,iBAAA,GAAoB,SAAS,mBAAA,CAAoB,YAAA;AACvD,EAAA,MAAM,cAAA,GAAiB,SAAS,mBAAA,CAAoB,cAAA;AACpD,EAAA,OAAO;AAAA,IACL,cAAA;AAAA,IACA,iBAAA;AAAA,IACA,UAAU,iBAAA,GAAoB,GAAA;AAAA,IAC9B,SAAS,iBAAA,GAAoB,GAAA;AAAA,IAC7B,WAAW,iBAAA,GAAoB;AAAA,GACjC;AACF;AAWO,IA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IAAI,IAAA,CAAK,GAAA,CAAI,GAAG,CAAA,IAAK,GAAA,EAAM;AACzB,IAAA,OAAO,GAAG,IAAI,CAAA,CAAA,EAAA,CAAK,MAAM,GAAA,EAAM,OAAA,CAAQ,CAAC,CAAC,CAAA,CAAA,CAAA;AAAA,EAC3C;AACA,EAAA,OAAO,GAAG,IAAI,CAAA,CAAA,EAAI,GAAA,CAAI,OAAA,CAAQ,CAAC,CAAC,CAAA,CAAA;AAClC;AAEO,SAAS,aAAA,CAAc,KAAA,EAAe,QAAA,GAAW,IAAA,EAAc;AACpE,EAAA,MAAM,IAAA,GAAO,QAAA,IAAY,KAAA,IAAS,CAAA,GAAI,GAAA,GAAM,EAAA;AAC5C,EAAA,OAAO,GAAG,IAAI,CAAA,EAAG,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAC,CAAA,CAAA,CAAA;AACnC","file":"index.mjs","sourcesContent":["// ══════════════════════════════════════════════════════════════════════════════\n// ONE SDK - StableFX On-Chain Forex Types & Constants\n// Shared types for stablecoin foreign exchange pool trading\n// ══════════════════════════════════════════════════════════════════════════════\n\n// ── Capital Split ────────────────────────────────────────────────────────────\n\nexport const FOREX_CAPITAL_SPLIT = {\n poolReserves: 0.50,\n tradingCapital: 0.50,\n} as const;\n\nexport function computePoolAllocations(amount: number): {\n tradingCapital: number;\n totalPoolReserves: number;\n clearing: number;\n hedging: number;\n insurance: number;\n} {\n const totalPoolReserves = amount * FOREX_CAPITAL_SPLIT.poolReserves;\n const tradingCapital = amount * FOREX_CAPITAL_SPLIT.tradingCapital;\n return {\n tradingCapital,\n totalPoolReserves,\n clearing: totalPoolReserves * 0.50,\n hedging: totalPoolReserves * 0.30,\n insurance: totalPoolReserves * 0.20,\n };\n}\n\n// ── Cycle Options ────────────────────────────────────────────────────────────\n\nexport interface ForexCycleOption {\n days: number;\n feeRate: number;\n commissionRate: number;\n label: string;\n}\n\nexport const FOREX_CYCLE_OPTIONS: ForexCycleOption[] = [\n { days: 30, feeRate: 0.10, commissionRate: 0.60, label: '30D' },\n { days: 60, feeRate: 0.08, commissionRate: 0.70, label: '60D' },\n { days: 90, feeRate: 0.07, commissionRate: 0.75, label: '90D' },\n { days: 180, feeRate: 0.05, commissionRate: 0.85, label: '180D' },\n { days: 360, feeRate: 0.03, commissionRate: 0.90, label: '360D' },\n];\n\n// ── Currency Pairs ───────────────────────────────────────────────────────────\n\nexport interface ForexCurrencyPair {\n id: string;\n base: string;\n quote: string;\n symbol: string;\n flag: string;\n name: string;\n basePrice: number;\n pipSize: number;\n spreadPips: number;\n}\n\nexport const FOREX_CURRENCY_PAIRS: ForexCurrencyPair[] = [\n { id: 'USDC_EURC', base: 'USDC', quote: 'EURC', symbol: 'USDC/EURC', flag: '\\u{1F1EA}\\u{1F1FA}', name: 'Euro', basePrice: 0.9230, pipSize: 0.0001, spreadPips: 1.2 },\n { id: 'USDC_GBPC', base: 'USDC', quote: 'GBPC', symbol: 'USDC/GBPC', flag: '\\u{1F1EC}\\u{1F1E7}', name: 'British Pound', basePrice: 0.7890, pipSize: 0.0001, spreadPips: 1.5 },\n { id: 'USDC_JPYC', base: 'USDC', quote: 'JPYC', symbol: 'USDC/JPYC', flag: '\\u{1F1EF}\\u{1F1F5}', name: 'Japanese Yen', basePrice: 154.50, pipSize: 0.01, spreadPips: 1.0 },\n { id: 'USDC_AUDC', base: 'USDC', quote: 'AUDC', symbol: 'USDC/AUDC', flag: '\\u{1F1E6}\\u{1F1FA}', name: 'Australian Dollar', basePrice: 1.5380, pipSize: 0.0001, spreadPips: 1.8 },\n { id: 'USDC_CADC', base: 'USDC', quote: 'CADC', symbol: 'USDC/CADC', flag: '\\u{1F1E8}\\u{1F1E6}', name: 'Canadian Dollar', basePrice: 1.3640, pipSize: 0.0001, spreadPips: 1.5 },\n { id: 'USDC_CHFC', base: 'USDC', quote: 'CHFC', symbol: 'USDC/CHFC', flag: '\\u{1F1E8}\\u{1F1ED}', name: 'Swiss Franc', basePrice: 0.8750, pipSize: 0.0001, spreadPips: 1.3 },\n];\n\n// ── Pools ────────────────────────────────────────────────────────────────────\n\nexport type ForexPoolType = 'clearing' | 'hedging' | 'insurance';\n\nexport interface ForexPool {\n id: ForexPoolType;\n nameKey: string;\n descriptionKey: string;\n allocation: number;\n totalSize: number;\n utilization: number;\n color: string;\n apy7d: number;\n apy30d: number;\n netFlow24h: number;\n txCount24h: number;\n txCountTotal: number;\n totalDeposits: number;\n totalWithdrawals: number;\n profitDistributed: number;\n lastUpdated: number;\n}\n\nexport const FOREX_POOL_DEFAULTS: ForexPool[] = [\n { id: 'clearing', nameKey: 'forex.pool_clearing', descriptionKey: 'forex.pool_clearing_desc', allocation: 0.50, totalSize: 12500000, utilization: 0.78, color: '#3B82F6', apy7d: 12.8, apy30d: 11.5, netFlow24h: 185000, txCount24h: 42, txCountTotal: 12840, totalDeposits: 45200000, totalWithdrawals: 32700000, profitDistributed: 1850000, lastUpdated: Date.now() },\n { id: 'hedging', nameKey: 'forex.pool_hedging', descriptionKey: 'forex.pool_hedging_desc', allocation: 0.30, totalSize: 7500000, utilization: 0.65, color: '#F59E0B', apy7d: 8.1, apy30d: 7.6, netFlow24h: 72000, txCount24h: 24, txCountTotal: 7620, totalDeposits: 28500000, totalWithdrawals: 21000000, profitDistributed: 980000, lastUpdated: Date.now() },\n { id: 'insurance', nameKey: 'forex.pool_insurance', descriptionKey: 'forex.pool_insurance_desc', allocation: 0.20, totalSize: 5000000, utilization: 0.42, color: '#10B981', apy7d: 4.8, apy30d: 4.5, netFlow24h: 35000, txCount24h: 14, txCountTotal: 4280, totalDeposits: 15800000, totalWithdrawals: 10800000, profitDistributed: 520000, lastUpdated: Date.now() },\n];\n\n// ── Pool Transactions ────────────────────────────────────────────────────────\n\nexport type ForexPoolTransactionType =\n | 'deposit' | 'withdrawal' | 'profit_distribution'\n | 'loss_absorption' | 'inter_pool_transfer' | 'fee_collection' | 'reserve_rebalance';\n\nexport interface ForexPoolTransaction {\n id: string;\n poolId: ForexPoolType;\n type: ForexPoolTransactionType;\n amount: number;\n balanceBefore: number;\n balanceAfter: number;\n txHash: string;\n blockNumber: number;\n timestamp: number;\n description: string;\n}\n\n// ── Pool Daily Snapshots ────────────────────────────────────────────────────\n\nexport interface ForexPoolDailySnapshot {\n poolId: ForexPoolType;\n date: string;\n openBalance: number;\n closeBalance: number;\n deposits: number;\n withdrawals: number;\n netFlow: number;\n dailyPnl: number;\n dailyPnlPct: number;\n cumulativePnl: number;\n utilization: number;\n txCount: number;\n activeUsers: number;\n}\n\n// ── Positions ────────────────────────────────────────────────────────────────\n\nexport interface ForexPosition {\n id: string;\n pairId: string;\n side: 'BUY' | 'SELL';\n lots: number;\n pips: number;\n entryPrice: number;\n currentPrice: number;\n pnl: number;\n openTime: number;\n}\n\n// ── Investment ───────────────────────────────────────────────────────────────\n\nexport interface ForexInvestment {\n id: string;\n userId?: string;\n amount: number;\n currentValue: number;\n profit: number;\n status: 'active' | 'completed' | 'pending' | 'redeemed' | 'cancelled';\n selectedPairs: string[];\n cycleDays: number;\n cycleOption: ForexCycleOption;\n feeRate?: number;\n commissionRate?: number;\n startDate: string;\n endDate: string;\n tradingCapital: number;\n totalPoolReserves: number;\n poolAllocations: {\n clearing: number;\n hedging: number;\n insurance: number;\n };\n tradeWeight: number;\n totalLots: number;\n totalPips: number;\n totalTrades: number;\n positions: ForexPosition[];\n tradeHistory: ForexTradeRecord[];\n redeemedAt?: string;\n createdAt?: string;\n updatedAt?: string;\n}\n\n// ── Trade Records ────────────────────────────────────────────────────────────\n\nexport type ForexTradeStatus = 'RFQ' | 'QUOTED' | 'MATCHED' | 'SETTLED' | 'FAILED';\n\nexport interface ForexTradeRecord {\n id: string;\n timestamp: number;\n pairId: string;\n pairSymbol: string;\n side: 'BUY' | 'SELL';\n rfqPrice: number;\n quotePrice: number;\n matchPrice: number;\n settlePrice: number;\n lots: number;\n pips: number;\n pnl: number;\n status: ForexTradeStatus;\n pvpSettled: boolean;\n clearingFee?: number;\n hedgingCost?: number;\n insuranceReserve?: number;\n txHash?: string;\n blockNumber?: number;\n cycleDay?: number;\n cumulativePnl?: number;\n}\n\n// ── Console Log Types ────────────────────────────────────────────────────────\n\nexport type ForexLogType =\n | 'RFQ' | 'QUOTE' | 'MATCH' | 'SETTLE' | 'PVP'\n | 'HEDGE' | 'CLEAR' | 'POSITION' | 'PNL' | 'SYSTEM';\n\nexport interface ForexLogEntry {\n id: string;\n timestamp: number;\n type: ForexLogType;\n message: string;\n data?: Record<string, any>;\n importance: 'low' | 'medium' | 'high';\n pairId?: string;\n}\n\n// ── Agent ────────────────────────────────────────────────────────────────────\n\nexport interface ForexAgent {\n id: string;\n nameKey: string;\n descriptionKey: string;\n icon: string;\n color: string;\n supportedPairs: string[];\n dailyRoiMin: number;\n dailyRoiMax: number;\n totalManaged: number;\n totalUsers: number;\n winRate: number;\n}\n\nexport const FOREX_AGENT: ForexAgent = {\n id: 'stablefx-01',\n nameKey: 'forex.agent_name',\n descriptionKey: 'forex.agent_description',\n icon: '\\u{1F4B1}',\n color: '#0EA5E9',\n supportedPairs: FOREX_CURRENCY_PAIRS.map(p => p.id),\n dailyRoiMin: 0.002,\n dailyRoiMax: 0.005,\n totalManaged: 25000000,\n totalUsers: 3847,\n winRate: 72.5,\n};\n\n// ── Profit Calculation ───────────────────────────────────────────────────────\n\nexport function calculateForexNetProfit(\n grossProfit: number,\n cycleOption: ForexCycleOption,\n): { feeAmount: number; postFeeProfit: number; netProfit: number } {\n const feeAmount = grossProfit * cycleOption.feeRate;\n const postFeeProfit = grossProfit - feeAmount;\n const netProfit = postFeeProfit * cycleOption.commissionRate;\n return { feeAmount, postFeeProfit, netProfit };\n}\n\nexport function estimateForexProfit(\n amount: number,\n cycleDays: number,\n agent: ForexAgent = FOREX_AGENT,\n): { grossProfit: number; feeAmount: number; netProfit: number; dailyRate: number } {\n const cycleOption = FOREX_CYCLE_OPTIONS.find(c => c.days === cycleDays) || FOREX_CYCLE_OPTIONS[0];\n const estimatedApy = ((agent.dailyRoiMin + agent.dailyRoiMax) / 2) * 365 * 100;\n const dailyRate = estimatedApy / 100 / 365;\n const grossProfit = amount * dailyRate * cycleDays;\n const { feeAmount, netProfit } = calculateForexNetProfit(grossProfit, cycleOption);\n return { grossProfit, feeAmount, netProfit, dailyRate };\n}\n","// ══════════════════════════════════════════════════════════════════════════════\n// ONE SDK - AI Trading Types & Constants\n// Shared types for AI-powered crypto trading strategies\n// ══════════════════════════════════════════════════════════════════════════════\n\nexport type StrategyCategory = 'conservative' | 'balanced' | 'aggressive' | 'hedge' | 'arbitrage' | 'trend' | 'grid' | 'dca';\nexport type OrderStatus = 'pending' | 'active' | 'paused' | 'completed' | 'cancelled' | 'pending_redemption' | 'redeemed';\nexport type TradeAction = 'buy' | 'sell' | 'long' | 'short' | 'close_long' | 'close_short';\nexport type TradeStatus = 'open' | 'closed' | 'liquidated' | 'cancelled';\nexport type FeeType = 'management' | 'performance' | 'withdrawal' | 'early_redemption_penalty';\nexport type OrderEventType = 'created' | 'activated' | 'paused' | 'resumed' | 'redemption_requested' | 'redeemed' | 'cancelled' | 'fee_deducted' | 'profit_realized';\n\nexport interface AIStrategyConfig {\n id: string;\n name: string;\n description: string | null;\n category: StrategyCategory;\n riskLevel: 1 | 2 | 3 | 4 | 5;\n minInvestment: number;\n maxInvestment: number | null;\n lockPeriodDays: number;\n expectedApyMin: number | null;\n expectedApyMax: number | null;\n managementFeeRate: number;\n performanceFeeRate: number;\n supportedPairs: string[];\n supportedChains: string[];\n supportedCurrencies: string[];\n leverageMin: number;\n leverageMax: number;\n isActive: boolean;\n}\n\nexport interface AIOrderCreateInput {\n strategyId: string;\n amount: number;\n currency: string;\n chain: string;\n lockPeriodDays: number;\n}\n\nexport interface AIOrderSummary {\n orderId: string;\n strategyId: string;\n strategyName: string;\n amount: number;\n currentValue: number;\n profit: number;\n profitPercent: number;\n status: OrderStatus;\n daysRemaining: number;\n lockProgress: number;\n}\n\nexport interface AIPortfolioSummary {\n totalInvested: number;\n totalValue: number;\n totalProfit: number;\n totalProfitPercent: number;\n activeOrders: number;\n totalTrades: number;\n profitToday: number;\n profit7d: number;\n profit30d: number;\n}\n\nexport interface AITradeLog {\n id: string;\n timestamp: string;\n action: TradeAction;\n pair: string;\n entryPrice: number;\n exitPrice: number | null;\n amount: number;\n pnl: number;\n pnlPercent: number;\n leverage: number;\n status: TradeStatus;\n aiConfidence: number | null;\n aiReasoning: string | null;\n}\n\nexport interface AIPenaltyCalculation {\n completionRate: number;\n penaltyRate: number;\n estimatedPenalty: number;\n estimatedRedemption: number;\n isEarlyWithdrawal: boolean;\n}\n\nexport interface AIPerformanceChart {\n date: string;\n nav: number;\n dailyPnl: number;\n cumulativePnl: number;\n}\n\nexport const PENALTY_TIERS = [\n { minProgress: 0.75, maxProgress: 1.0, rate: 0.50, label: '50%' },\n { minProgress: 0.50, maxProgress: 0.75, rate: 0.60, label: '60%' },\n { minProgress: 0.25, maxProgress: 0.50, rate: 0.70, label: '70%' },\n { minProgress: 0.00, maxProgress: 0.25, rate: 0.80, label: '80%' },\n] as const;\n\nexport function calculateEarlyWithdrawalPenalty(\n investedAmount: number,\n profit: number,\n lockProgress: number,\n): AIPenaltyCalculation {\n const totalValue = investedAmount + profit;\n const isEarlyWithdrawal = lockProgress < 1.0;\n let penaltyRate = 0;\n if (isEarlyWithdrawal) {\n if (lockProgress >= 0.75) penaltyRate = 0.50;\n else if (lockProgress >= 0.50) penaltyRate = 0.60;\n else if (lockProgress >= 0.25) penaltyRate = 0.70;\n else penaltyRate = 0.80;\n }\n const estimatedPenalty = totalValue * penaltyRate;\n const estimatedRedemption = totalValue - estimatedPenalty;\n return { completionRate: lockProgress, penaltyRate, estimatedPenalty, estimatedRedemption, isEarlyWithdrawal };\n}\n\nexport const STRATEGY_CATEGORIES: Record<StrategyCategory, { labelKey: string; color: string; icon: string }> = {\n conservative: { labelKey: 'ai.category_conservative', color: '#10B981', icon: '\\u{1F6E1}\\u{FE0F}' },\n balanced: { labelKey: 'ai.category_balanced', color: '#3B82F6', icon: '\\u{2696}\\u{FE0F}' },\n aggressive: { labelKey: 'ai.category_aggressive', color: '#EF4444', icon: '\\u{1F680}' },\n hedge: { labelKey: 'ai.category_hedge', color: '#8B5CF6', icon: '\\u{1F512}' },\n arbitrage: { labelKey: 'ai.category_arbitrage', color: '#F59E0B', icon: '\\u{26A1}' },\n trend: { labelKey: 'ai.category_trend', color: '#EC4899', icon: '\\u{1F4C8}' },\n grid: { labelKey: 'ai.category_grid', color: '#6366F1', icon: '\\u{25A6}' },\n dca: { labelKey: 'ai.category_dca', color: '#14B8A6', icon: '\\u{1F4CA}' },\n};\n\nexport const RISK_LEVELS: Record<number, { labelKey: string; color: string; bgColor: string }> = {\n 1: { labelKey: 'ai.risk_very_low', color: '#10B981', bgColor: '#D1FAE5' },\n 2: { labelKey: 'ai.risk_low', color: '#22C55E', bgColor: '#DCFCE7' },\n 3: { labelKey: 'ai.risk_medium', color: '#F59E0B', bgColor: '#FEF3C7' },\n 4: { labelKey: 'ai.risk_high', color: '#F97316', bgColor: '#FFEDD5' },\n 5: { labelKey: 'ai.risk_very_high', color: '#EF4444', bgColor: '#FEE2E2' },\n};\n\nexport const ORDER_STATUS_CONFIG: Record<OrderStatus, { labelKey: string; color: string; bgColor: string }> = {\n pending: { labelKey: 'ai.status_pending', color: '#F59E0B', bgColor: '#FEF3C7' },\n active: { labelKey: 'ai.status_active', color: '#10B981', bgColor: '#D1FAE5' },\n paused: { labelKey: 'ai.status_paused', color: '#6B7280', bgColor: '#F3F4F6' },\n completed: { labelKey: 'ai.status_completed', color: '#3B82F6', bgColor: '#DBEAFE' },\n cancelled: { labelKey: 'ai.status_cancelled', color: '#EF4444', bgColor: '#FEE2E2' },\n pending_redemption: { labelKey: 'ai.status_pending_redemption', color: '#8B5CF6', bgColor: '#EDE9FE' },\n redeemed: { labelKey: 'ai.status_redeemed', color: '#14B8A6', bgColor: '#CCFBF1' },\n};\n","// ══════════════════════════════════════════════════════════════════════════════\n// ONE SDK - Trading Console Types & Constants\n// Shared types for real-time trading console components\n// ══════════════════════════════════════════════════════════════════════════════\n\nimport type { BotLogEntry, BotState, StrategyPersonality } from '../services/forex/BotSimulationEngine';\nimport type { ForexLogEntry, ForexPoolTransaction, ForexLogType } from './forex';\n\n// ── Re-exports for convenience ────────────────────────────────────────────────\n\nexport type { BotLogEntry, BotLogType, BotState, IndicatorSnapshot, StrategyPersonality } from '../services/forex/BotSimulationEngine';\n\n// ── Console Log Types ─────────────────────────────────────────────────────────\n\nexport type AILogType =\n | 'SCAN' | 'THINKING' | 'INDICATOR' | 'ANALYSIS' | 'SIGNAL'\n | 'STRATEGY' | 'DECISION' | 'ORDER' | 'FILLED' | 'PNL'\n | 'RISK' | 'NEWS' | 'SYSTEM';\n\nexport const AI_LOG_COLORS: Record<AILogType, string> = {\n SCAN: '#06B6D4', // Cyan\n THINKING: '#A855F7', // Purple\n INDICATOR: '#3B82F6', // Blue\n ANALYSIS: '#6366F1', // Indigo\n SIGNAL: '#F59E0B', // Amber\n STRATEGY: '#D946EF', // Fuchsia\n DECISION: '#F97316', // Orange\n ORDER: '#EC4899', // Pink\n FILLED: '#10B981', // Green\n PNL: '#22C55E', // Emerald\n RISK: '#EF4444', // Red\n NEWS: '#14B8A6', // Teal\n SYSTEM: '#9CA3AF', // Gray\n};\n\n// Forex log type colors (for ForexSimulationEngine logs)\nexport const FOREX_LOG_COLORS: Record<ForexLogType, string> = {\n RFQ: '#06B6D4', // Cyan\n QUOTE: '#8B5CF6', // Purple\n MATCH: '#10B981', // Green\n SETTLE: '#F59E0B', // Amber\n PVP: '#3B82F6', // Blue\n HEDGE: '#EC4899', // Pink\n CLEAR: '#14B8A6', // Teal\n POSITION: '#6366F1', // Indigo\n PNL: '#22C55E', // Emerald\n SYSTEM: '#9CA3AF', // Gray\n};\n\n// ── AI Position Types ─────────────────────────────────────────────────────────\n\nexport type PositionSide = 'LONG' | 'SHORT';\nexport type PositionStatus = 'open' | 'closed' | 'liquidated' | 'pending';\n\nexport interface AIPosition {\n id: string;\n strategyId: string;\n strategyName: string;\n pair: string;\n side: PositionSide;\n entryPrice: number;\n currentPrice: number;\n size: number;\n leverage: number;\n margin: number;\n pnl: number;\n pnlPercent: number;\n status: PositionStatus;\n stopLoss?: number;\n takeProfit?: number;\n liquidationPrice?: number;\n openTime: number;\n closeTime?: number;\n chain?: string;\n orderId?: string;\n aiConfidence?: number;\n aiReasoning?: string;\n}\n\n// ── AI Decision Types ─────────────────────────────────────────────────────────\n\nexport type DecisionAction = 'OPEN_LONG' | 'OPEN_SHORT' | 'CLOSE_LONG' | 'CLOSE_SHORT' | 'HOLD' | 'SKIP';\n\nexport interface AIDecision {\n id: string;\n timestamp: number;\n strategyId: string;\n strategyName: string;\n pair: string;\n action: DecisionAction;\n confidence: number;\n reasoning: string;\n indicators: {\n rsi?: number;\n macd?: number;\n ema?: string;\n volume?: number;\n bollinger?: string;\n };\n signals: string[];\n executed: boolean;\n positionId?: string;\n price?: number;\n size?: number;\n leverage?: number;\n}\n\n// ── Risk Status Types ─────────────────────────────────────────────────────────\n\nexport type RiskLevel = 'low' | 'medium' | 'high' | 'critical';\nexport type TradingStatus = 'active' | 'paused' | 'stopped' | 'cooldown';\n\nexport interface RiskStatus {\n timestamp: number;\n // Portfolio exposure\n totalExposure: number;\n maxExposure: number;\n exposurePercent: number;\n // Daily limits\n dailyPnl: number;\n dailyPnlLimit: number;\n dailyPnlPercent: number;\n dailyTradeCount: number;\n dailyTradeLimit: number;\n // Drawdown\n currentDrawdown: number;\n maxDrawdown: number;\n drawdownPercent: number;\n // Position limits\n openPositions: number;\n maxPositions: number;\n // Risk assessment\n riskLevel: RiskLevel;\n tradingStatus: TradingStatus;\n warnings: string[];\n // Per-strategy risk\n strategyRisks?: Record<string, {\n exposure: number;\n drawdown: number;\n riskLevel: RiskLevel;\n }>;\n}\n\nexport const RISK_LEVEL_COLORS: Record<RiskLevel, { color: string; bgColor: string }> = {\n low: { color: '#10B981', bgColor: '#D1FAE5' },\n medium: { color: '#F59E0B', bgColor: '#FEF3C7' },\n high: { color: '#F97316', bgColor: '#FFEDD5' },\n critical: { color: '#EF4444', bgColor: '#FEE2E2' },\n};\n\nexport const TRADING_STATUS_COLORS: Record<TradingStatus, { color: string; bgColor: string }> = {\n active: { color: '#10B981', bgColor: '#D1FAE5' },\n paused: { color: '#F59E0B', bgColor: '#FEF3C7' },\n stopped: { color: '#EF4444', bgColor: '#FEE2E2' },\n cooldown: { color: '#6366F1', bgColor: '#E0E7FF' },\n};\n\n// ── Console Metrics Types ─────────────────────────────────────────────────────\n\nexport interface ConsoleMetrics {\n // NAV & Performance\n nav: number;\n navChange24h: number;\n navChangePercent24h: number;\n // P&L\n totalPnl: number;\n realizedPnl: number;\n unrealizedPnl: number;\n pnlToday: number;\n pnl7d: number;\n pnl30d: number;\n // Trading stats\n totalTrades: number;\n tradesToday: number;\n winRate: number;\n winCount: number;\n lossCount: number;\n avgWin: number;\n avgLoss: number;\n profitFactor: number;\n // Position stats\n openPositions: number;\n totalExposure: number;\n avgLeverage: number;\n // By strategy\n strategyMetrics?: Record<string, {\n pnl: number;\n trades: number;\n winRate: number;\n exposure: number;\n }>;\n}\n\n// ── Agent Types ───────────────────────────────────────────────────────────────\n\nexport type AgentStatus = 'active' | 'paused' | 'idle' | 'error' | 'initializing';\n\nexport interface AIAgent {\n id: string;\n strategyId: string;\n name: string;\n shortName: string;\n color: string;\n status: AgentStatus;\n // Performance\n totalPnl: number;\n pnlToday: number;\n winRate: number;\n totalTrades: number;\n tradesToday: number;\n // Current state\n currentPair?: string;\n currentPrice?: number;\n lastSignal?: string;\n lastSignalConfidence?: number;\n lastActivity?: number;\n // Positions\n openPositions: number;\n totalExposure: number;\n // Risk\n riskLevel: RiskLevel;\n drawdown: number;\n // Config\n riskTolerance: 'low' | 'medium' | 'high';\n primaryIndicators: string[];\n preferredPairs: string[];\n leverageRange: [number, number];\n}\n\nexport const AGENT_STATUS_COLORS: Record<AgentStatus, { color: string; bgColor: string; label: string }> = {\n active: { color: '#10B981', bgColor: '#D1FAE5', label: 'Active' },\n paused: { color: '#F59E0B', bgColor: '#FEF3C7', label: 'Paused' },\n idle: { color: '#6B7280', bgColor: '#F3F4F6', label: 'Idle' },\n error: { color: '#EF4444', bgColor: '#FEE2E2', label: 'Error' },\n initializing: { color: '#3B82F6', bgColor: '#DBEAFE', label: 'Starting' },\n};\n\n// ── Combined Console State ────────────────────────────────────────────────────\n\nexport interface CombinedLogEntry {\n id: string;\n timestamp: number;\n source: 'ai' | 'forex';\n strategyId?: string;\n strategyName?: string;\n type: string;\n message: string;\n data?: Record<string, any>;\n importance: 'low' | 'medium' | 'high';\n}\n\nexport interface TradingConsoleState {\n ai: {\n strategies: StrategyPersonality[];\n agents: AIAgent[];\n positions: AIPosition[];\n decisions: AIDecision[];\n riskStatus: RiskStatus | null;\n simulationLogs: BotLogEntry[];\n botStates: Map<string, BotState>;\n };\n forex: {\n logs: ForexLogEntry[];\n poolTransactions: ForexPoolTransaction[];\n stats: {\n totalPnl: number;\n totalTrades: number;\n totalPips: number;\n totalLots: number;\n };\n };\n metrics: ConsoleMetrics;\n combinedLogs: CombinedLogEntry[];\n}\n\n// ── Hook Options ──────────────────────────────────────────────────────────────\n\nexport interface TradingConsoleOptions {\n simulation?: boolean;\n pollInterval?: number;\n maxLogs?: number;\n strategyIds?: string[];\n autoStart?: boolean;\n}\n\nexport interface AIQuantConsoleOptions {\n strategyIds?: string[];\n pollInterval?: number;\n simulation?: boolean;\n maxLogs?: number;\n}\n\nexport interface AgentConsoleOptions {\n strategyId: string;\n pollInterval?: number;\n simulation?: boolean;\n maxLogs?: number;\n}\n\n// ── Default Values ────────────────────────────────────────────────────────────\n\nexport const DEFAULT_CONSOLE_OPTIONS: TradingConsoleOptions = {\n simulation: true,\n pollInterval: 5000,\n maxLogs: 500,\n autoStart: false,\n};\n\nexport const DEFAULT_RISK_STATUS: RiskStatus = {\n timestamp: Date.now(),\n totalExposure: 0,\n maxExposure: 100000,\n exposurePercent: 0,\n dailyPnl: 0,\n dailyPnlLimit: 5000,\n dailyPnlPercent: 0,\n dailyTradeCount: 0,\n dailyTradeLimit: 50,\n currentDrawdown: 0,\n maxDrawdown: 15,\n drawdownPercent: 0,\n openPositions: 0,\n maxPositions: 10,\n riskLevel: 'low',\n tradingStatus: 'active',\n warnings: [],\n};\n\nexport const DEFAULT_CONSOLE_METRICS: ConsoleMetrics = {\n nav: 0,\n navChange24h: 0,\n navChangePercent24h: 0,\n totalPnl: 0,\n realizedPnl: 0,\n unrealizedPnl: 0,\n pnlToday: 0,\n pnl7d: 0,\n pnl30d: 0,\n totalTrades: 0,\n tradesToday: 0,\n winRate: 0,\n winCount: 0,\n lossCount: 0,\n avgWin: 0,\n avgLoss: 0,\n profitFactor: 0,\n openPositions: 0,\n totalExposure: 0,\n avgLeverage: 0,\n};\n\n// ── Utility Functions ─────────────────────────────────────────────────────────\n\nexport function calculateRiskLevel(\n exposurePercent: number,\n drawdownPercent: number,\n dailyPnlPercent: number\n): RiskLevel {\n const worstMetric = Math.max(exposurePercent, drawdownPercent, Math.abs(dailyPnlPercent));\n if (worstMetric >= 90) return 'critical';\n if (worstMetric >= 70) return 'high';\n if (worstMetric >= 40) return 'medium';\n return 'low';\n}\n\nexport function formatPnl(pnl: number): string {\n const sign = pnl >= 0 ? '+' : '';\n if (Math.abs(pnl) >= 1000000) {\n return `${sign}$${(pnl / 1000000).toFixed(2)}M`;\n }\n if (Math.abs(pnl) >= 1000) {\n return `${sign}$${(pnl / 1000).toFixed(2)}K`;\n }\n return `${sign}$${pnl.toFixed(2)}`;\n}\n\nexport function formatPercent(value: number, showSign = true): string {\n const sign = showSign && value >= 0 ? '+' : '';\n return `${sign}${value.toFixed(2)}%`;\n}\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { j as ForexPool, p as ForexInvestment, t as ForexLogEntry, m as ForexPoolTransaction, i as ForexPoolType, n as ForexPoolDailySnapshot, F as FOREX_CAPITAL_SPLIT, v as FOREX_AGENT, h as FOREX_CURRENCY_PAIRS, f as FOREX_CYCLE_OPTIONS, d as computePoolAllocations, x as estimateForexProfit } from './console-BfTMA7ah.mjs';
|
|
2
|
+
|
|
3
|
+
/** Set the access token for authenticated forex API calls */
|
|
4
|
+
declare function setForexAccessToken(token: string): void;
|
|
5
|
+
/** Clear the forex access token */
|
|
6
|
+
declare function clearForexAccessToken(): void;
|
|
7
|
+
/** Configure the engine URL for forex API calls */
|
|
8
|
+
declare function setForexEngineUrl(url: string): void;
|
|
9
|
+
interface UseForexPoolsResult {
|
|
10
|
+
pools: ForexPool[];
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
error: string | null;
|
|
13
|
+
refresh: () => void;
|
|
14
|
+
}
|
|
15
|
+
declare function useForexPools(options?: {
|
|
16
|
+
refreshInterval?: number;
|
|
17
|
+
}): UseForexPoolsResult;
|
|
18
|
+
interface UseForexInvestmentsResult {
|
|
19
|
+
investments: ForexInvestment[];
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
error: string | null;
|
|
22
|
+
createInvestment: (params: {
|
|
23
|
+
amount: number;
|
|
24
|
+
selectedPairs: string[];
|
|
25
|
+
cycleDays: number;
|
|
26
|
+
}) => Promise<ForexInvestment | null>;
|
|
27
|
+
redeemInvestment: (investmentId: string) => Promise<boolean>;
|
|
28
|
+
refresh: () => void;
|
|
29
|
+
portfolioSummary: {
|
|
30
|
+
totalInvested: number;
|
|
31
|
+
totalValue: number;
|
|
32
|
+
totalProfit: number;
|
|
33
|
+
activeCount: number;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
declare function useForexInvestments(options?: {
|
|
37
|
+
refreshInterval?: number;
|
|
38
|
+
}): UseForexInvestmentsResult;
|
|
39
|
+
interface UseForexSimulationResult {
|
|
40
|
+
logs: ForexLogEntry[];
|
|
41
|
+
poolTransactions: ForexPoolTransaction[];
|
|
42
|
+
isRunning: boolean;
|
|
43
|
+
stats: {
|
|
44
|
+
totalPnl: number;
|
|
45
|
+
totalTrades: number;
|
|
46
|
+
totalPips: number;
|
|
47
|
+
totalLots: number;
|
|
48
|
+
};
|
|
49
|
+
start: () => void;
|
|
50
|
+
stop: () => void;
|
|
51
|
+
clearLogs: () => void;
|
|
52
|
+
}
|
|
53
|
+
declare function useForexSimulation(options?: {
|
|
54
|
+
maxLogs?: number;
|
|
55
|
+
}): UseForexSimulationResult;
|
|
56
|
+
interface UseForexPoolDataResult {
|
|
57
|
+
snapshots: Record<ForexPoolType, ForexPoolDailySnapshot[]>;
|
|
58
|
+
transactions: ForexPoolTransaction[];
|
|
59
|
+
isInitialized: boolean;
|
|
60
|
+
initialize: () => void;
|
|
61
|
+
}
|
|
62
|
+
declare function useForexPoolData(): UseForexPoolDataResult;
|
|
63
|
+
interface UseForexTradingResult {
|
|
64
|
+
pools: UseForexPoolsResult;
|
|
65
|
+
investments: UseForexInvestmentsResult;
|
|
66
|
+
simulation: UseForexSimulationResult;
|
|
67
|
+
poolData: UseForexPoolDataResult;
|
|
68
|
+
capitalSplit: typeof FOREX_CAPITAL_SPLIT;
|
|
69
|
+
agent: typeof FOREX_AGENT;
|
|
70
|
+
currencyPairs: typeof FOREX_CURRENCY_PAIRS;
|
|
71
|
+
cycleOptions: typeof FOREX_CYCLE_OPTIONS;
|
|
72
|
+
computePoolAllocations: typeof computePoolAllocations;
|
|
73
|
+
estimateProfit: typeof estimateForexProfit;
|
|
74
|
+
}
|
|
75
|
+
declare function useForexTrading(options?: {
|
|
76
|
+
poolRefreshInterval?: number;
|
|
77
|
+
investmentRefreshInterval?: number;
|
|
78
|
+
}): UseForexTradingResult;
|
|
79
|
+
|
|
80
|
+
export { type UseForexPoolsResult as U, useForexInvestments as a, useForexSimulation as b, useForexPoolData as c, useForexTrading as d, clearForexAccessToken as e, setForexEngineUrl as f, type UseForexInvestmentsResult as g, type UseForexSimulationResult as h, type UseForexPoolDataResult as i, type UseForexTradingResult as j, setForexAccessToken as s, useForexPools as u };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { j as ForexPool, p as ForexInvestment, t as ForexLogEntry, m as ForexPoolTransaction, i as ForexPoolType, n as ForexPoolDailySnapshot, F as FOREX_CAPITAL_SPLIT, v as FOREX_AGENT, h as FOREX_CURRENCY_PAIRS, f as FOREX_CYCLE_OPTIONS, d as computePoolAllocations, x as estimateForexProfit } from './console-BfTMA7ah.js';
|
|
2
|
+
|
|
3
|
+
/** Set the access token for authenticated forex API calls */
|
|
4
|
+
declare function setForexAccessToken(token: string): void;
|
|
5
|
+
/** Clear the forex access token */
|
|
6
|
+
declare function clearForexAccessToken(): void;
|
|
7
|
+
/** Configure the engine URL for forex API calls */
|
|
8
|
+
declare function setForexEngineUrl(url: string): void;
|
|
9
|
+
interface UseForexPoolsResult {
|
|
10
|
+
pools: ForexPool[];
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
error: string | null;
|
|
13
|
+
refresh: () => void;
|
|
14
|
+
}
|
|
15
|
+
declare function useForexPools(options?: {
|
|
16
|
+
refreshInterval?: number;
|
|
17
|
+
}): UseForexPoolsResult;
|
|
18
|
+
interface UseForexInvestmentsResult {
|
|
19
|
+
investments: ForexInvestment[];
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
error: string | null;
|
|
22
|
+
createInvestment: (params: {
|
|
23
|
+
amount: number;
|
|
24
|
+
selectedPairs: string[];
|
|
25
|
+
cycleDays: number;
|
|
26
|
+
}) => Promise<ForexInvestment | null>;
|
|
27
|
+
redeemInvestment: (investmentId: string) => Promise<boolean>;
|
|
28
|
+
refresh: () => void;
|
|
29
|
+
portfolioSummary: {
|
|
30
|
+
totalInvested: number;
|
|
31
|
+
totalValue: number;
|
|
32
|
+
totalProfit: number;
|
|
33
|
+
activeCount: number;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
declare function useForexInvestments(options?: {
|
|
37
|
+
refreshInterval?: number;
|
|
38
|
+
}): UseForexInvestmentsResult;
|
|
39
|
+
interface UseForexSimulationResult {
|
|
40
|
+
logs: ForexLogEntry[];
|
|
41
|
+
poolTransactions: ForexPoolTransaction[];
|
|
42
|
+
isRunning: boolean;
|
|
43
|
+
stats: {
|
|
44
|
+
totalPnl: number;
|
|
45
|
+
totalTrades: number;
|
|
46
|
+
totalPips: number;
|
|
47
|
+
totalLots: number;
|
|
48
|
+
};
|
|
49
|
+
start: () => void;
|
|
50
|
+
stop: () => void;
|
|
51
|
+
clearLogs: () => void;
|
|
52
|
+
}
|
|
53
|
+
declare function useForexSimulation(options?: {
|
|
54
|
+
maxLogs?: number;
|
|
55
|
+
}): UseForexSimulationResult;
|
|
56
|
+
interface UseForexPoolDataResult {
|
|
57
|
+
snapshots: Record<ForexPoolType, ForexPoolDailySnapshot[]>;
|
|
58
|
+
transactions: ForexPoolTransaction[];
|
|
59
|
+
isInitialized: boolean;
|
|
60
|
+
initialize: () => void;
|
|
61
|
+
}
|
|
62
|
+
declare function useForexPoolData(): UseForexPoolDataResult;
|
|
63
|
+
interface UseForexTradingResult {
|
|
64
|
+
pools: UseForexPoolsResult;
|
|
65
|
+
investments: UseForexInvestmentsResult;
|
|
66
|
+
simulation: UseForexSimulationResult;
|
|
67
|
+
poolData: UseForexPoolDataResult;
|
|
68
|
+
capitalSplit: typeof FOREX_CAPITAL_SPLIT;
|
|
69
|
+
agent: typeof FOREX_AGENT;
|
|
70
|
+
currencyPairs: typeof FOREX_CURRENCY_PAIRS;
|
|
71
|
+
cycleOptions: typeof FOREX_CYCLE_OPTIONS;
|
|
72
|
+
computePoolAllocations: typeof computePoolAllocations;
|
|
73
|
+
estimateProfit: typeof estimateForexProfit;
|
|
74
|
+
}
|
|
75
|
+
declare function useForexTrading(options?: {
|
|
76
|
+
poolRefreshInterval?: number;
|
|
77
|
+
investmentRefreshInterval?: number;
|
|
78
|
+
}): UseForexTradingResult;
|
|
79
|
+
|
|
80
|
+
export { type UseForexPoolsResult as U, useForexInvestments as a, useForexSimulation as b, useForexPoolData as c, useForexTrading as d, clearForexAccessToken as e, setForexEngineUrl as f, type UseForexInvestmentsResult as g, type UseForexSimulationResult as h, type UseForexPoolDataResult as i, type UseForexTradingResult as j, setForexAccessToken as s, useForexPools as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@one_deploy/sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "ONE Ecosystem SDK - Shared services, types, utilities, and React providers",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/node": "^22.0.0",
|
|
74
74
|
"@types/react": "^18.3.0",
|
|
75
|
+
"@types/react-native": "^0.72.8",
|
|
75
76
|
"thirdweb": "^5.116.1",
|
|
76
77
|
"tsup": "^8.3.0",
|
|
77
78
|
"typescript": "^5.6.0"
|
|
@@ -92,6 +93,9 @@
|
|
|
92
93
|
"optional": true
|
|
93
94
|
}
|
|
94
95
|
},
|
|
96
|
+
"overrides": {
|
|
97
|
+
"@types/react": "^18.3.0"
|
|
98
|
+
},
|
|
95
99
|
"keywords": [
|
|
96
100
|
"one-ecosystem",
|
|
97
101
|
"web3",
|
|
@@ -99,7 +103,10 @@
|
|
|
99
103
|
"thirdweb",
|
|
100
104
|
"supabase",
|
|
101
105
|
"onramp",
|
|
102
|
-
"swap"
|
|
106
|
+
"swap",
|
|
107
|
+
"forex",
|
|
108
|
+
"stablefx",
|
|
109
|
+
"ai-trading"
|
|
103
110
|
],
|
|
104
111
|
"license": "MIT"
|
|
105
112
|
}
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import { ConnectButton, type ConnectButtonProps } from 'thirdweb/react';
|
|
5
5
|
import { inAppWallet, smartWallet } from 'thirdweb/wallets';
|
|
6
6
|
import { base } from 'thirdweb/chains';
|
|
7
|
-
import { useThirdwebClient } from '../providers
|
|
7
|
+
import { useThirdwebClient } from '../providers';
|
|
8
8
|
|
|
9
9
|
// ===== Types =====
|
|
10
10
|
|
|
@@ -77,6 +77,29 @@ export function OneConnectButton({
|
|
|
77
77
|
}: OneConnectButtonProps) {
|
|
78
78
|
const client = useThirdwebClient();
|
|
79
79
|
|
|
80
|
+
// Show loading state if client is not ready
|
|
81
|
+
if (!client) {
|
|
82
|
+
return (
|
|
83
|
+
<button
|
|
84
|
+
disabled
|
|
85
|
+
className={className}
|
|
86
|
+
style={{
|
|
87
|
+
backgroundColor: ONE_THEME.colors.primaryButtonBg,
|
|
88
|
+
color: ONE_THEME.colors.primaryButtonText,
|
|
89
|
+
fontFamily: ONE_THEME.fontFamily,
|
|
90
|
+
fontWeight: 600,
|
|
91
|
+
borderRadius: '12px',
|
|
92
|
+
padding: '12px 24px',
|
|
93
|
+
opacity: 0.5,
|
|
94
|
+
cursor: 'not-allowed',
|
|
95
|
+
...style,
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
Initializing...
|
|
99
|
+
</button>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
80
103
|
// Build auth methods
|
|
81
104
|
const authMethods: string[] = ['email'];
|
|
82
105
|
if (authOptions.google) authMethods.push('google');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
4
4
|
import { useActiveAccount } from 'thirdweb/react';
|
|
5
5
|
import { MediaRenderer } from 'thirdweb/react';
|
|
6
|
-
import { useThirdwebClient } from '../providers
|
|
6
|
+
import { useThirdwebClient } from '../providers';
|
|
7
7
|
|
|
8
8
|
// ===== Types =====
|
|
9
9
|
|
|
@@ -185,12 +185,14 @@ export function OneNFTGallery({
|
|
|
185
185
|
}}
|
|
186
186
|
>
|
|
187
187
|
<div style={{ ...imageContainerStyle, backgroundColor: isDark ? '#374151' : '#f3f4f6' }}>
|
|
188
|
-
{nft.image ? (
|
|
188
|
+
{nft.image && client ? (
|
|
189
189
|
<MediaRenderer
|
|
190
190
|
client={client}
|
|
191
191
|
src={nft.image}
|
|
192
192
|
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
|
193
193
|
/>
|
|
194
|
+
) : nft.image ? (
|
|
195
|
+
<img src={nft.image} alt={nft.name} style={{ width: '100%', height: '100%', objectFit: 'cover' }} />
|
|
194
196
|
) : (
|
|
195
197
|
<span style={{ color: isDark ? '#6b7280' : '#9ca3af', fontSize: '14px' }}>No Image</span>
|
|
196
198
|
)}
|
|
@@ -249,11 +251,15 @@ export function OneNFTGallery({
|
|
|
249
251
|
onClick={(e) => e.stopPropagation()}
|
|
250
252
|
>
|
|
251
253
|
{selectedNFT.image && (
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
client ? (
|
|
255
|
+
<MediaRenderer
|
|
256
|
+
client={client}
|
|
257
|
+
src={selectedNFT.image}
|
|
258
|
+
style={{ width: '100%', borderRadius: '12px', marginBottom: '16px' }}
|
|
259
|
+
/>
|
|
260
|
+
) : (
|
|
261
|
+
<img src={selectedNFT.image} alt={selectedNFT.name} style={{ width: '100%', borderRadius: '12px', marginBottom: '16px' }} />
|
|
262
|
+
)
|
|
257
263
|
)}
|
|
258
264
|
<h3 style={{ margin: '0 0 8px 0', color: isDark ? '#ffffff' : '#111827' }}>
|
|
259
265
|
{selectedNFT.name || `#${selectedNFT.tokenId}`}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useState, useEffect, useCallback } from 'react';
|
|
4
4
|
import { useActiveAccount, useWalletBalance } from 'thirdweb/react';
|
|
5
5
|
import { base } from 'thirdweb/chains';
|
|
6
|
-
import { useThirdwebClient } from '../providers
|
|
6
|
+
import { useThirdwebClient } from '../providers';
|
|
7
7
|
import { getEngineUrl } from '../config';
|
|
8
8
|
|
|
9
9
|
// ===== Types =====
|
|
@@ -198,10 +198,11 @@ export function OneOfframpWidget({
|
|
|
198
198
|
|
|
199
199
|
// Get balance for selected crypto
|
|
200
200
|
const { data: balanceData } = useWalletBalance({
|
|
201
|
-
client,
|
|
201
|
+
client: client as any,
|
|
202
202
|
chain: base,
|
|
203
203
|
address: walletAddress,
|
|
204
|
-
|
|
204
|
+
enabled: !!client,
|
|
205
|
+
} as any);
|
|
205
206
|
|
|
206
207
|
// Form state
|
|
207
208
|
const [cryptoCurrency, setCryptoCurrency] = useState(defaultCrypto);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { PayEmbed, type PayEmbedProps } from 'thirdweb/react';
|
|
5
5
|
import { base, ethereum, polygon, arbitrum } from 'thirdweb/chains';
|
|
6
|
-
import { useThirdwebClient } from '../providers
|
|
6
|
+
import { useThirdwebClient } from '../providers';
|
|
7
7
|
|
|
8
8
|
// ===== Types =====
|
|
9
9
|
|
|
@@ -81,6 +81,15 @@ export function OnePayWidget({
|
|
|
81
81
|
}: OnePayWidgetProps) {
|
|
82
82
|
const client = useThirdwebClient();
|
|
83
83
|
|
|
84
|
+
// Show loading state if client is not ready
|
|
85
|
+
if (!client) {
|
|
86
|
+
return (
|
|
87
|
+
<div className={className} style={{ ...style, padding: '20px', textAlign: 'center', color: '#9ca3af' }}>
|
|
88
|
+
Initializing payment...
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
84
93
|
// Build pay options based on mode
|
|
85
94
|
let payOptions: PayEmbedProps['payOptions'];
|
|
86
95
|
|
|
@@ -5,7 +5,7 @@ import { useSendTransaction, useActiveAccount } from 'thirdweb/react';
|
|
|
5
5
|
import { prepareTransaction, toWei } from 'thirdweb';
|
|
6
6
|
import type { Chain } from 'thirdweb/chains';
|
|
7
7
|
import { base } from 'thirdweb/chains';
|
|
8
|
-
import { useThirdwebClient } from '../providers
|
|
8
|
+
import { useThirdwebClient } from '../providers';
|
|
9
9
|
|
|
10
10
|
// ===== Types =====
|
|
11
11
|
|
|
@@ -105,10 +105,10 @@ export function OneSendWidget({
|
|
|
105
105
|
const isValidAddress = (address: string) => /^0x[a-fA-F0-9]{40}$/.test(address);
|
|
106
106
|
const isValidAmount = (amt: string) => !isNaN(parseFloat(amt)) && parseFloat(amt) > 0;
|
|
107
107
|
|
|
108
|
-
const canSend = isValidAddress(recipient) && isValidAmount(amount) && !isPending;
|
|
108
|
+
const canSend = !!client && isValidAddress(recipient) && isValidAmount(amount) && !isPending;
|
|
109
109
|
|
|
110
110
|
const handleSend = useCallback(async () => {
|
|
111
|
-
if (!account || !canSend) return;
|
|
111
|
+
if (!account || !canSend || !client) return;
|
|
112
112
|
|
|
113
113
|
setError(null);
|
|
114
114
|
|
|
@@ -5,7 +5,7 @@ import { useActiveAccount, useSendTransaction } from 'thirdweb/react';
|
|
|
5
5
|
import { prepareTransaction } from 'thirdweb';
|
|
6
6
|
import type { Chain } from 'thirdweb/chains';
|
|
7
7
|
import { base, ethereum, polygon, arbitrum, optimism, bsc, avalanche } from 'thirdweb/chains';
|
|
8
|
-
import { useThirdwebClient } from '../providers
|
|
8
|
+
import { useThirdwebClient } from '../providers';
|
|
9
9
|
import { getEngineUrl } from '../config';
|
|
10
10
|
|
|
11
11
|
// ===== Types =====
|
|
@@ -407,7 +407,7 @@ export function OneSwapWidget({
|
|
|
407
407
|
|
|
408
408
|
// Execute swap
|
|
409
409
|
const handleSwap = async () => {
|
|
410
|
-
if (!account || !fromToken || !toToken) return;
|
|
410
|
+
if (!client || !account || !fromToken || !toToken) return;
|
|
411
411
|
|
|
412
412
|
setError(null);
|
|
413
413
|
|
|
@@ -437,7 +437,7 @@ export function OneSwapWidget({
|
|
|
437
437
|
data: data.data.transaction.data,
|
|
438
438
|
value: BigInt(data.data.transaction.value || 0),
|
|
439
439
|
chain: fromChain.chain,
|
|
440
|
-
client,
|
|
440
|
+
client: client,
|
|
441
441
|
});
|
|
442
442
|
|
|
443
443
|
sendTransaction(tx, {
|
|
@@ -462,7 +462,7 @@ export function OneSwapWidget({
|
|
|
462
462
|
}
|
|
463
463
|
};
|
|
464
464
|
|
|
465
|
-
const canSwap = account && fromAmount && parseFloat(fromAmount) > 0 && !isPending && !isLoadingQuote;
|
|
465
|
+
const canSwap = client && account && fromAmount && parseFloat(fromAmount) > 0 && !isPending && !isLoadingQuote;
|
|
466
466
|
|
|
467
467
|
// Theme colors
|
|
468
468
|
const bgColor = isDark ? '#1f2937' : '#ffffff';
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import { TransactionButton, type TransactionButtonProps } from 'thirdweb/react';
|
|
5
5
|
import { prepareTransaction, type PreparedTransaction } from 'thirdweb';
|
|
6
6
|
import type { Chain } from 'thirdweb/chains';
|
|
7
|
-
import { useThirdwebClient } from '../providers
|
|
7
|
+
import { useThirdwebClient } from '../providers';
|
|
8
8
|
|
|
9
9
|
// ===== Types =====
|
|
10
10
|
|
|
@@ -72,14 +72,39 @@ export function OneTransactionButton({
|
|
|
72
72
|
}: OneTransactionButtonProps) {
|
|
73
73
|
const client = useThirdwebClient();
|
|
74
74
|
|
|
75
|
+
// Show loading state if client is not ready
|
|
76
|
+
if (!client && !preparedTx) {
|
|
77
|
+
return (
|
|
78
|
+
<button
|
|
79
|
+
disabled
|
|
80
|
+
className={className}
|
|
81
|
+
style={{ ...ONE_BUTTON_DISABLED_STYLE, ...style, opacity: 0.5 }}
|
|
82
|
+
>
|
|
83
|
+
Initializing...
|
|
84
|
+
</button>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
75
88
|
// Prepare transaction if not already provided
|
|
76
|
-
const transaction = preparedTx || prepareTransaction({
|
|
89
|
+
const transaction = preparedTx || (client ? prepareTransaction({
|
|
77
90
|
to,
|
|
78
91
|
value,
|
|
79
92
|
data,
|
|
80
93
|
chain,
|
|
81
94
|
client,
|
|
82
|
-
});
|
|
95
|
+
}) : null);
|
|
96
|
+
|
|
97
|
+
if (!transaction) {
|
|
98
|
+
return (
|
|
99
|
+
<button
|
|
100
|
+
disabled
|
|
101
|
+
className={className}
|
|
102
|
+
style={{ ...ONE_BUTTON_DISABLED_STYLE, ...style, opacity: 0.5 }}
|
|
103
|
+
>
|
|
104
|
+
Initializing...
|
|
105
|
+
</button>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
83
108
|
|
|
84
109
|
const buttonStyle = disabled
|
|
85
110
|
? { ...ONE_BUTTON_DISABLED_STYLE, ...style }
|
|
@@ -4,7 +4,7 @@ import React, { useState, useEffect, useCallback } from 'react';
|
|
|
4
4
|
import { useActiveAccount, useWalletBalance as useThirdwebBalance } from 'thirdweb/react';
|
|
5
5
|
import type { Chain } from 'thirdweb/chains';
|
|
6
6
|
import { base, ethereum, polygon, arbitrum, optimism } from 'thirdweb/chains';
|
|
7
|
-
import { useThirdwebClient } from '../providers
|
|
7
|
+
import { useThirdwebClient } from '../providers';
|
|
8
8
|
|
|
9
9
|
// ===== Types =====
|
|
10
10
|
|