@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.
Files changed (106) hide show
  1. package/README.md +339 -0
  2. package/dist/ForexPoolDataGenerator--__twRwl.d.mts +76 -0
  3. package/dist/ForexPoolDataGenerator-eUgwsU_B.d.ts +76 -0
  4. package/dist/OneForexTradeHistory-TlKxjbFF.d.ts +250 -0
  5. package/dist/OneForexTradeHistory-iDySMcw0.d.mts +250 -0
  6. package/dist/components/index.d.mts +539 -0
  7. package/dist/components/index.d.ts +539 -0
  8. package/dist/components/index.js +7295 -0
  9. package/dist/components/index.js.map +1 -0
  10. package/dist/components/index.mjs +7243 -0
  11. package/dist/components/index.mjs.map +1 -0
  12. package/dist/config/index.d.mts +1 -0
  13. package/dist/config/index.d.ts +1 -0
  14. package/dist/console-BfTMA7ah.d.mts +504 -0
  15. package/dist/console-BfTMA7ah.d.ts +504 -0
  16. package/dist/hooks/index.d.mts +323 -1
  17. package/dist/hooks/index.d.ts +323 -1
  18. package/dist/hooks/index.js +3223 -0
  19. package/dist/hooks/index.js.map +1 -1
  20. package/dist/hooks/index.mjs +3204 -1
  21. package/dist/hooks/index.mjs.map +1 -1
  22. package/dist/index.d.mts +18 -352
  23. package/dist/index.d.ts +18 -352
  24. package/dist/index.js +8646 -574
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +8449 -432
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/providers/index.d.mts +31 -31
  29. package/dist/providers/index.d.ts +31 -31
  30. package/dist/providers/index.js +140 -153
  31. package/dist/providers/index.js.map +1 -1
  32. package/dist/providers/index.mjs +100 -109
  33. package/dist/providers/index.mjs.map +1 -1
  34. package/dist/react-native.d.mts +8 -144
  35. package/dist/react-native.d.ts +8 -144
  36. package/dist/react-native.js +2640 -689
  37. package/dist/react-native.js.map +1 -1
  38. package/dist/react-native.mjs +2610 -691
  39. package/dist/react-native.mjs.map +1 -1
  40. package/dist/services/index.d.mts +85 -4
  41. package/dist/services/index.d.ts +85 -4
  42. package/dist/services/index.js +1621 -0
  43. package/dist/services/index.js.map +1 -1
  44. package/dist/services/index.mjs +1619 -1
  45. package/dist/services/index.mjs.map +1 -1
  46. package/dist/types/index.d.mts +203 -1
  47. package/dist/types/index.d.ts +203 -1
  48. package/dist/types/index.js +275 -0
  49. package/dist/types/index.js.map +1 -1
  50. package/dist/types/index.mjs +251 -0
  51. package/dist/types/index.mjs.map +1 -1
  52. package/dist/useForexTrading-BleeSor8.d.mts +80 -0
  53. package/dist/useForexTrading-ZgW_G40Q.d.ts +80 -0
  54. package/package.json +9 -2
  55. package/src/components/OneConnectButton.tsx +24 -1
  56. package/src/components/OneNFTGallery.tsx +13 -7
  57. package/src/components/OneOfframpWidget.tsx +4 -3
  58. package/src/components/OnePayWidget.tsx +10 -1
  59. package/src/components/OneSendWidget.tsx +3 -3
  60. package/src/components/OneSwapWidget.tsx +4 -4
  61. package/src/components/OneTransactionButton.tsx +28 -3
  62. package/src/components/OneWalletBalance.tsx +1 -1
  63. package/src/components/ai/OneChainSelector.tsx +63 -336
  64. package/src/components/ai/OneForexCapitalSplit.tsx +112 -0
  65. package/src/components/ai/OneForexConsoleView.tsx +90 -0
  66. package/src/components/ai/OneForexPairSelector.tsx +101 -0
  67. package/src/components/ai/OneForexPoolCard.tsx +105 -0
  68. package/src/components/ai/OneForexTradeHistory.tsx +107 -0
  69. package/src/components/ai/OnePairSelector.tsx +77 -434
  70. package/src/components/ai/console/OneAIQuantConsole.tsx +423 -0
  71. package/src/components/ai/console/OneAgentCard.tsx +383 -0
  72. package/src/components/ai/console/OneAgentConsole.tsx +469 -0
  73. package/src/components/ai/console/OneDecisionTimeline.tsx +433 -0
  74. package/src/components/ai/console/OneMetricsDashboard.tsx +493 -0
  75. package/src/components/ai/console/OnePositionCard.tsx +406 -0
  76. package/src/components/ai/console/OnePositionDetail.tsx +600 -0
  77. package/src/components/ai/console/OneRiskIndicator.tsx +464 -0
  78. package/src/components/ai/console/OneTradingConsole.tsx +660 -0
  79. package/src/components/ai/console/index.ts +17 -0
  80. package/src/components/ai/index.ts +10 -0
  81. package/src/hooks/index.ts +46 -0
  82. package/src/hooks/useAIDecisions.ts +280 -0
  83. package/src/hooks/useAIPositions.ts +349 -0
  84. package/src/hooks/useAIQuantConsole.ts +283 -0
  85. package/src/hooks/useAIRiskStatus.ts +276 -0
  86. package/src/hooks/useAITrading.ts +190 -0
  87. package/src/hooks/useBotSimulation.ts +201 -0
  88. package/src/hooks/useForexTrading.ts +430 -0
  89. package/src/hooks/useTradingConsole.ts +243 -0
  90. package/src/index.ts +123 -5
  91. package/src/providers/OneProvider.tsx +181 -5
  92. package/src/providers/index.ts +22 -8
  93. package/src/react-native.ts +41 -0
  94. package/src/services/forex/BotSimulationEngine.ts +968 -0
  95. package/src/services/forex/ForexPoolDataGenerator.ts +542 -0
  96. package/src/services/forex/ForexSimulationEngine.ts +482 -0
  97. package/src/services/forex/index.ts +21 -0
  98. package/src/services/index.ts +16 -0
  99. package/src/types/aiTrading.ts +151 -0
  100. package/src/types/console.ts +380 -0
  101. package/src/types/forex.ts +282 -0
  102. package/src/types/index.ts +106 -0
  103. package/dist/price-CgqXPnT3.d.ts +0 -13
  104. package/dist/price-ClbLHHjv.d.mts +0 -13
  105. package/dist/supabase-BT0c7q9e.d.mts +0 -82
  106. package/dist/supabase-BT0c7q9e.d.ts +0 -82
@@ -1,11 +1,11 @@
1
- import React2, { createContext, useMemo, useState, useCallback, useEffect, useContext } from 'react';
2
- import { jsx } from 'react/jsx-runtime';
1
+ import { createContext, useMemo, useState, useEffect, useCallback, useContext } from 'react';
3
2
  import { createThirdwebClient } from 'thirdweb';
4
3
  import { ThirdwebProvider } from 'thirdweb/react';
5
4
  import { inAppWallet, smartWallet } from 'thirdweb/wallets';
6
5
  export { inAppWallet, smartWallet } from 'thirdweb/wallets';
7
6
  import { base } from 'thirdweb/chains';
8
7
  export { arbitrum, base, ethereum, optimism, polygon } from 'thirdweb/chains';
8
+ import { jsx } from 'react/jsx-runtime';
9
9
 
10
10
  // src/config/index.ts
11
11
  var DEFAULT_ENGINE_URL = "https://api.one23.io";
@@ -1306,9 +1306,48 @@ function createOneEngineClient(options) {
1306
1306
  return new OneEngineClient(options);
1307
1307
  }
1308
1308
  var OneContext = createContext(null);
1309
+ var DEFAULT_AUTH_OPTIONS = {
1310
+ email: true,
1311
+ phone: false,
1312
+ google: true,
1313
+ apple: true,
1314
+ facebook: false,
1315
+ discord: false,
1316
+ passkey: true,
1317
+ guest: false
1318
+ };
1319
+ function createWalletConfig(config2) {
1320
+ const authOptions = { ...DEFAULT_AUTH_OPTIONS, ...config2.authOptions };
1321
+ const authMethods = [];
1322
+ if (authOptions.google) authMethods.push("google");
1323
+ if (authOptions.apple) authMethods.push("apple");
1324
+ if (authOptions.facebook) authMethods.push("facebook");
1325
+ if (authOptions.discord) authMethods.push("discord");
1326
+ if (authOptions.passkey) authMethods.push("passkey");
1327
+ const inApp = inAppWallet({
1328
+ auth: {
1329
+ options: authMethods
1330
+ },
1331
+ metadata: config2.appName ? {
1332
+ name: config2.appName,
1333
+ image: config2.appIcon ? { src: config2.appIcon, width: 100, height: 100 } : void 0
1334
+ } : void 0
1335
+ });
1336
+ if (config2.sponsorGas) {
1337
+ const chain = config2.defaultChain || base;
1338
+ return [
1339
+ smartWallet({
1340
+ chain,
1341
+ sponsorGas: true
1342
+ })
1343
+ ];
1344
+ }
1345
+ return [inApp];
1346
+ }
1309
1347
  function OneProvider({
1310
1348
  children,
1311
1349
  config: config2,
1350
+ thirdweb: thirdwebConfig = {},
1312
1351
  autoFetchBalance = true
1313
1352
  }) {
1314
1353
  useMemo(() => {
@@ -1320,6 +1359,51 @@ function OneProvider({
1320
1359
  clientId: config2.oneClientId,
1321
1360
  secretKey: config2.oneSecretKey
1322
1361
  }), [config2]);
1362
+ const [thirdwebClientId, setThirdwebClientId] = useState(null);
1363
+ const [thirdwebLoading, setThirdwebLoading] = useState(true);
1364
+ const [thirdwebError, setThirdwebError] = useState(null);
1365
+ useEffect(() => {
1366
+ const fetchClientConfig = async () => {
1367
+ try {
1368
+ const response = await fetch(`${config2.oneEngineUrl}/v1/config/thirdweb`);
1369
+ if (response.ok) {
1370
+ const data = await response.json();
1371
+ if (data.success && data.data?.clientId) {
1372
+ setThirdwebClientId(data.data.clientId);
1373
+ } else {
1374
+ const envClientId = typeof window !== "undefined" ? window.__NEXT_PUBLIC_THIRDWEB_CLIENT_ID : process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID;
1375
+ if (envClientId) {
1376
+ setThirdwebClientId(envClientId);
1377
+ } else {
1378
+ setThirdwebError("Failed to load wallet configuration");
1379
+ }
1380
+ }
1381
+ } else {
1382
+ const envClientId = process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID;
1383
+ if (envClientId) {
1384
+ setThirdwebClientId(envClientId);
1385
+ } else {
1386
+ setThirdwebError("Wallet service unavailable");
1387
+ }
1388
+ }
1389
+ } catch (err) {
1390
+ const envClientId = process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID;
1391
+ if (envClientId) {
1392
+ setThirdwebClientId(envClientId);
1393
+ } else {
1394
+ console.warn("Failed to fetch thirdweb config:", err);
1395
+ }
1396
+ } finally {
1397
+ setThirdwebLoading(false);
1398
+ }
1399
+ };
1400
+ fetchClientConfig();
1401
+ }, [config2.oneEngineUrl]);
1402
+ const thirdwebClient = useMemo(() => {
1403
+ if (!thirdwebClientId) return null;
1404
+ return createThirdwebClient({ clientId: thirdwebClientId });
1405
+ }, [thirdwebClientId]);
1406
+ useMemo(() => createWalletConfig(thirdwebConfig), [thirdwebConfig]);
1323
1407
  const [user, setUser] = useState(null);
1324
1408
  const [accessToken, setAccessToken] = useState(null);
1325
1409
  const [authLoading, setAuthLoading] = useState(true);
@@ -1473,6 +1557,7 @@ function OneProvider({
1473
1557
  isInitialized,
1474
1558
  config: isInitialized ? config2 : null,
1475
1559
  engine,
1560
+ thirdwebClient,
1476
1561
  auth: {
1477
1562
  user,
1478
1563
  isAuthenticated: !!user,
@@ -1492,7 +1577,9 @@ function OneProvider({
1492
1577
  error: walletError,
1493
1578
  setAddress: setWalletAddress,
1494
1579
  fetchBalance,
1495
- refreshBalance
1580
+ refreshBalance,
1581
+ thirdwebClient,
1582
+ isThirdwebReady: !thirdwebLoading && !!thirdwebClient
1496
1583
  },
1497
1584
  onramp: {
1498
1585
  isOpen: onrampOpen,
@@ -1522,6 +1609,8 @@ function OneProvider({
1522
1609
  isInitialized,
1523
1610
  config2,
1524
1611
  engine,
1612
+ thirdwebClient,
1613
+ thirdwebLoading,
1525
1614
  user,
1526
1615
  authLoading,
1527
1616
  accessToken,
@@ -1554,7 +1643,11 @@ function OneProvider({
1554
1643
  fetchPortfolio,
1555
1644
  createOrder
1556
1645
  ]);
1557
- return /* @__PURE__ */ jsx(OneContext.Provider, { value: contextValue, children });
1646
+ const content = /* @__PURE__ */ jsx(OneContext.Provider, { value: contextValue, children });
1647
+ if (thirdwebClient) {
1648
+ return /* @__PURE__ */ jsx(ThirdwebProvider, { children: content });
1649
+ }
1650
+ return content;
1558
1651
  }
1559
1652
  function useOne() {
1560
1653
  const context = useContext(OneContext);
@@ -1587,113 +1680,11 @@ function useOneEngine() {
1587
1680
  const { engine } = useOne();
1588
1681
  return engine;
1589
1682
  }
1590
- var DEFAULT_AUTH_OPTIONS = {
1591
- email: true,
1592
- phone: false,
1593
- google: true,
1594
- apple: true,
1595
- facebook: false,
1596
- discord: false,
1597
- passkey: true,
1598
- guest: false
1599
- };
1600
- var ThirdwebClientContext = React2.createContext(null);
1601
1683
  function useThirdwebClient() {
1602
- const client = React2.useContext(ThirdwebClientContext);
1603
- if (!client) {
1604
- throw new Error("useThirdwebClient must be used within OneThirdwebProvider");
1605
- }
1606
- return client;
1607
- }
1608
- function createWalletConfig(config2) {
1609
- const authOptions = { ...DEFAULT_AUTH_OPTIONS, ...config2.authOptions };
1610
- const authMethods = [];
1611
- if (authOptions.google) authMethods.push("google");
1612
- if (authOptions.apple) authMethods.push("apple");
1613
- if (authOptions.facebook) authMethods.push("facebook");
1614
- if (authOptions.discord) authMethods.push("discord");
1615
- if (authOptions.passkey) authMethods.push("passkey");
1616
- const inApp = inAppWallet({
1617
- auth: {
1618
- options: authMethods
1619
- },
1620
- metadata: config2.appName ? {
1621
- name: config2.appName,
1622
- image: config2.appIcon ? { src: config2.appIcon, width: 100, height: 100 } : void 0
1623
- } : void 0
1624
- });
1625
- if (config2.sponsorGas) {
1626
- const chain = config2.defaultChain || base;
1627
- return [
1628
- smartWallet({
1629
- chain,
1630
- sponsorGas: true
1631
- })
1632
- ];
1633
- }
1634
- return [inApp];
1635
- }
1636
- var DEFAULT_ENGINE_URL2 = process.env.NEXT_PUBLIC_ONE_ENGINE_URL || "/api";
1637
- function OneThirdwebProvider({
1638
- children,
1639
- config: config2 = {}
1640
- }) {
1641
- const [clientId, setClientId] = useState(null);
1642
- const [isLoading, setIsLoading] = useState(true);
1643
- const [error, setError] = useState(null);
1644
- useEffect(() => {
1645
- const fetchClientConfig = async () => {
1646
- try {
1647
- const engineUrl = config2.engineUrl || DEFAULT_ENGINE_URL2;
1648
- const response = await fetch(`${engineUrl}/v1/config/thirdweb`);
1649
- if (response.ok) {
1650
- const data = await response.json();
1651
- if (data.success && data.data?.clientId) {
1652
- setClientId(data.data.clientId);
1653
- } else {
1654
- const envClientId = process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID;
1655
- if (envClientId) {
1656
- setClientId(envClientId);
1657
- } else {
1658
- setError("Failed to load wallet configuration");
1659
- }
1660
- }
1661
- } else {
1662
- const envClientId = process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID;
1663
- if (envClientId) {
1664
- setClientId(envClientId);
1665
- } else {
1666
- setError("Wallet service unavailable");
1667
- }
1668
- }
1669
- } catch (err) {
1670
- const envClientId = process.env.NEXT_PUBLIC_THIRDWEB_CLIENT_ID;
1671
- if (envClientId) {
1672
- setClientId(envClientId);
1673
- } else {
1674
- console.error("Failed to fetch thirdweb config:", err);
1675
- setError("Failed to initialize wallet");
1676
- }
1677
- } finally {
1678
- setIsLoading(false);
1679
- }
1680
- };
1681
- fetchClientConfig();
1682
- }, [config2.engineUrl]);
1683
- const client = useMemo(() => {
1684
- if (!clientId) return null;
1685
- return createThirdwebClient({ clientId });
1686
- }, [clientId]);
1687
- useMemo(() => createWalletConfig(config2), [config2]);
1688
- if (isLoading) {
1689
- return /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", minHeight: "100px" }, children: /* @__PURE__ */ jsx("span", { style: { color: "#9ca3af" }, children: "Initializing wallet..." }) });
1690
- }
1691
- if (error || !client) {
1692
- return /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", minHeight: "100px" }, children: /* @__PURE__ */ jsx("span", { style: { color: "#ef4444" }, children: error || "Wallet initialization failed" }) });
1693
- }
1694
- return /* @__PURE__ */ jsx(ThirdwebClientContext.Provider, { value: client, children: /* @__PURE__ */ jsx(ThirdwebProvider, { children }) });
1684
+ const { thirdwebClient } = useOne();
1685
+ return thirdwebClient;
1695
1686
  }
1696
1687
 
1697
- export { OneContext, OneProvider, OneThirdwebProvider, useOne, useOneAuth, useOneEngine, useOneOnramp, useOneSwap, useOneTrading, useOneWallet, useThirdwebClient };
1688
+ export { OneContext, OneProvider, OneProvider as OneThirdwebProvider, useOne, useOneAuth, useOneEngine, useOneOnramp, useOneSwap, useOneTrading, useOneWallet, useThirdwebClient };
1698
1689
  //# sourceMappingURL=index.mjs.map
1699
1690
  //# sourceMappingURL=index.mjs.map