@one_deploy/sdk 1.0.2 → 1.0.4

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 (70) hide show
  1. package/package.json +1 -1
  2. package/src/components/OneSwapWidget.tsx +1 -1
  3. package/src/components/ai/OneChainSelector.tsx +183 -0
  4. package/src/components/ai/OneCycleSelector.tsx +187 -0
  5. package/src/components/ai/OnePairSelector.tsx +181 -0
  6. package/src/components/ai/OneTierSelector.tsx +187 -0
  7. package/src/components/ai/index.ts +17 -0
  8. package/src/components/index.ts +3 -0
  9. package/src/config/index.ts +1 -1
  10. package/src/hooks/index.ts +20 -0
  11. package/src/hooks/useAITrading.ts +444 -0
  12. package/src/index.ts +20 -0
  13. package/src/react-native.ts +23 -0
  14. package/src/services/engine.ts +184 -0
  15. package/src/services/index.ts +16 -0
  16. package/src/services/usage.ts +249 -0
  17. package/.turbo/turbo-build.log +0 -0
  18. package/.turbo/turbo-type-check.log +0 -0
  19. package/dist/config/index.d.mts +0 -74
  20. package/dist/config/index.d.ts +0 -74
  21. package/dist/config/index.js +0 -244
  22. package/dist/config/index.js.map +0 -1
  23. package/dist/config/index.mjs +0 -226
  24. package/dist/config/index.mjs.map +0 -1
  25. package/dist/engine-5ndtBaCr.d.ts +0 -1039
  26. package/dist/engine-CrlhH0nw.d.mts +0 -1039
  27. package/dist/hooks/index.d.mts +0 -56
  28. package/dist/hooks/index.d.ts +0 -56
  29. package/dist/hooks/index.js +0 -1360
  30. package/dist/hooks/index.js.map +0 -1
  31. package/dist/hooks/index.mjs +0 -1356
  32. package/dist/hooks/index.mjs.map +0 -1
  33. package/dist/index.d.mts +0 -356
  34. package/dist/index.d.ts +0 -356
  35. package/dist/index.js +0 -5069
  36. package/dist/index.js.map +0 -1
  37. package/dist/index.mjs +0 -4950
  38. package/dist/index.mjs.map +0 -1
  39. package/dist/price-CgqXPnT3.d.ts +0 -13
  40. package/dist/price-ClbLHHjv.d.mts +0 -13
  41. package/dist/providers/index.d.mts +0 -121
  42. package/dist/providers/index.d.ts +0 -121
  43. package/dist/providers/index.js +0 -1643
  44. package/dist/providers/index.js.map +0 -1
  45. package/dist/providers/index.mjs +0 -1601
  46. package/dist/providers/index.mjs.map +0 -1
  47. package/dist/react-native.d.mts +0 -120
  48. package/dist/react-native.d.ts +0 -120
  49. package/dist/react-native.js +0 -1794
  50. package/dist/react-native.js.map +0 -1
  51. package/dist/react-native.mjs +0 -1757
  52. package/dist/react-native.mjs.map +0 -1
  53. package/dist/services/index.d.mts +0 -85
  54. package/dist/services/index.d.ts +0 -85
  55. package/dist/services/index.js +0 -1466
  56. package/dist/services/index.js.map +0 -1
  57. package/dist/services/index.mjs +0 -1458
  58. package/dist/services/index.mjs.map +0 -1
  59. package/dist/types/index.d.mts +0 -759
  60. package/dist/types/index.d.ts +0 -759
  61. package/dist/types/index.js +0 -4
  62. package/dist/types/index.js.map +0 -1
  63. package/dist/types/index.mjs +0 -3
  64. package/dist/types/index.mjs.map +0 -1
  65. package/dist/utils/index.d.mts +0 -36
  66. package/dist/utils/index.d.ts +0 -36
  67. package/dist/utils/index.js +0 -164
  68. package/dist/utils/index.js.map +0 -1
  69. package/dist/utils/index.mjs +0 -142
  70. package/dist/utils/index.mjs.map +0 -1
@@ -1,13 +0,0 @@
1
- import { TokenPrice } from './types/index.js';
2
-
3
- declare class PriceService {
4
- private cache;
5
- private cacheTTL;
6
- getPrice(symbol: string): Promise<TokenPrice>;
7
- getPrices(symbols: string[]): Promise<Record<string, TokenPrice>>;
8
- private getFallbackPrice;
9
- clearCache(): void;
10
- }
11
- declare const priceService: PriceService;
12
-
13
- export { PriceService as P, priceService as p };
@@ -1,13 +0,0 @@
1
- import { TokenPrice } from './types/index.mjs';
2
-
3
- declare class PriceService {
4
- private cache;
5
- private cacheTTL;
6
- getPrice(symbol: string): Promise<TokenPrice>;
7
- getPrices(symbols: string[]): Promise<Record<string, TokenPrice>>;
8
- private getFallbackPrice;
9
- clearCache(): void;
10
- }
11
- declare const priceService: PriceService;
12
-
13
- export { PriceService as P, priceService as p };
@@ -1,121 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React, { ReactNode } from 'react';
3
- import { OneConfig } from '../config/index.mjs';
4
- import { O as OneEngineClient, a as EngineWalletBalance, e as OnrampSessionRequest, S as SwapQuoteRequest, i as SwapQuote } from '../engine-CrlhH0nw.mjs';
5
- import { User, Token, AIStrategy, AIOrder } from '../types/index.mjs';
6
- import { ThirdwebClient } from 'thirdweb';
7
- import { Chain } from 'thirdweb/chains';
8
- export { arbitrum, base, ethereum, optimism, polygon } from 'thirdweb/chains';
9
- export { inAppWallet, smartWallet } from 'thirdweb/wallets';
10
-
11
- interface AuthContextValue {
12
- user: User | null;
13
- isAuthenticated: boolean;
14
- isLoading: boolean;
15
- accessToken: string | null;
16
- sendOtp: (email: string) => Promise<{
17
- success: boolean;
18
- error?: string;
19
- }>;
20
- verifyOtp: (email: string, otp: string) => Promise<{
21
- success: boolean;
22
- error?: string;
23
- }>;
24
- signOut: () => Promise<void>;
25
- refreshUser: () => Promise<void>;
26
- }
27
- interface WalletContextValue {
28
- address: string | null;
29
- balance: EngineWalletBalance | null;
30
- tokens: Token[];
31
- totalUsd: number;
32
- isLoading: boolean;
33
- error: string | null;
34
- setAddress: (address: string | null) => void;
35
- fetchBalance: (chains?: number[]) => Promise<void>;
36
- refreshBalance: () => Promise<void>;
37
- }
38
- interface OnrampContextValue {
39
- isOpen: boolean;
40
- widgetUrl: string | null;
41
- sessionId: string | null;
42
- openOnramp: (options?: Partial<OnrampSessionRequest>) => Promise<void>;
43
- closeOnramp: () => void;
44
- getQuote: (fiatCurrency: string, fiatAmount: number, cryptoCurrency: string) => Promise<any>;
45
- }
46
- interface SwapContextValue {
47
- getQuote: (request: SwapQuoteRequest) => Promise<SwapQuote | null>;
48
- executeSwap: (quoteId: string) => Promise<any>;
49
- getSupportedTokens: (chainId?: number) => Promise<Token[]>;
50
- getSupportedChains: () => Promise<{
51
- id: number;
52
- name: string;
53
- }[]>;
54
- }
55
- interface TradingContextValue {
56
- strategies: AIStrategy[];
57
- orders: AIOrder[];
58
- portfolioStats: {
59
- totalInvested: number;
60
- totalValue: number;
61
- totalPnl: number;
62
- totalPnlPercent: number;
63
- activePositions: number;
64
- } | null;
65
- isLoading: boolean;
66
- fetchStrategies: () => Promise<void>;
67
- fetchOrders: () => Promise<void>;
68
- fetchPortfolio: () => Promise<void>;
69
- createOrder: (strategyId: string, amount: number, currency: string) => Promise<any>;
70
- }
71
- interface OneContextValue {
72
- isInitialized: boolean;
73
- config: OneConfig | null;
74
- engine: OneEngineClient;
75
- auth: AuthContextValue;
76
- wallet: WalletContextValue;
77
- onramp: OnrampContextValue;
78
- swap: SwapContextValue;
79
- trading: TradingContextValue;
80
- }
81
- declare const OneContext: React.Context<OneContextValue | null>;
82
- interface OneProviderProps {
83
- children: ReactNode;
84
- config: OneConfig;
85
- autoFetchBalance?: boolean;
86
- }
87
- declare function OneProvider({ children, config, autoFetchBalance, }: OneProviderProps): react_jsx_runtime.JSX.Element;
88
- declare function useOne(): OneContextValue;
89
- declare function useOneAuth(): AuthContextValue;
90
- declare function useOneWallet(): WalletContextValue;
91
- declare function useOneOnramp(): OnrampContextValue;
92
- declare function useOneSwap(): SwapContextValue;
93
- declare function useOneTrading(): TradingContextValue;
94
- declare function useOneEngine(): OneEngineClient;
95
-
96
- interface OneThirdwebConfig {
97
- engineUrl?: string;
98
- appName?: string;
99
- appIcon?: string;
100
- defaultChain?: Chain;
101
- supportedChains?: Chain[];
102
- sponsorGas?: boolean;
103
- authOptions?: {
104
- email?: boolean;
105
- phone?: boolean;
106
- google?: boolean;
107
- apple?: boolean;
108
- facebook?: boolean;
109
- discord?: boolean;
110
- passkey?: boolean;
111
- guest?: boolean;
112
- };
113
- }
114
- interface OneThirdwebProviderProps {
115
- children: ReactNode;
116
- config?: OneThirdwebConfig;
117
- }
118
- declare function useThirdwebClient(): ThirdwebClient;
119
- declare function OneThirdwebProvider({ children, config, }: OneThirdwebProviderProps): react_jsx_runtime.JSX.Element;
120
-
121
- export { OneContext, OneProvider, type OneThirdwebConfig, OneThirdwebProvider, type OneThirdwebProviderProps, useOne, useOneAuth, useOneEngine, useOneOnramp, useOneSwap, useOneTrading, useOneWallet, useThirdwebClient };
@@ -1,121 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React, { ReactNode } from 'react';
3
- import { OneConfig } from '../config/index.js';
4
- import { O as OneEngineClient, a as EngineWalletBalance, e as OnrampSessionRequest, S as SwapQuoteRequest, i as SwapQuote } from '../engine-5ndtBaCr.js';
5
- import { User, Token, AIStrategy, AIOrder } from '../types/index.js';
6
- import { ThirdwebClient } from 'thirdweb';
7
- import { Chain } from 'thirdweb/chains';
8
- export { arbitrum, base, ethereum, optimism, polygon } from 'thirdweb/chains';
9
- export { inAppWallet, smartWallet } from 'thirdweb/wallets';
10
-
11
- interface AuthContextValue {
12
- user: User | null;
13
- isAuthenticated: boolean;
14
- isLoading: boolean;
15
- accessToken: string | null;
16
- sendOtp: (email: string) => Promise<{
17
- success: boolean;
18
- error?: string;
19
- }>;
20
- verifyOtp: (email: string, otp: string) => Promise<{
21
- success: boolean;
22
- error?: string;
23
- }>;
24
- signOut: () => Promise<void>;
25
- refreshUser: () => Promise<void>;
26
- }
27
- interface WalletContextValue {
28
- address: string | null;
29
- balance: EngineWalletBalance | null;
30
- tokens: Token[];
31
- totalUsd: number;
32
- isLoading: boolean;
33
- error: string | null;
34
- setAddress: (address: string | null) => void;
35
- fetchBalance: (chains?: number[]) => Promise<void>;
36
- refreshBalance: () => Promise<void>;
37
- }
38
- interface OnrampContextValue {
39
- isOpen: boolean;
40
- widgetUrl: string | null;
41
- sessionId: string | null;
42
- openOnramp: (options?: Partial<OnrampSessionRequest>) => Promise<void>;
43
- closeOnramp: () => void;
44
- getQuote: (fiatCurrency: string, fiatAmount: number, cryptoCurrency: string) => Promise<any>;
45
- }
46
- interface SwapContextValue {
47
- getQuote: (request: SwapQuoteRequest) => Promise<SwapQuote | null>;
48
- executeSwap: (quoteId: string) => Promise<any>;
49
- getSupportedTokens: (chainId?: number) => Promise<Token[]>;
50
- getSupportedChains: () => Promise<{
51
- id: number;
52
- name: string;
53
- }[]>;
54
- }
55
- interface TradingContextValue {
56
- strategies: AIStrategy[];
57
- orders: AIOrder[];
58
- portfolioStats: {
59
- totalInvested: number;
60
- totalValue: number;
61
- totalPnl: number;
62
- totalPnlPercent: number;
63
- activePositions: number;
64
- } | null;
65
- isLoading: boolean;
66
- fetchStrategies: () => Promise<void>;
67
- fetchOrders: () => Promise<void>;
68
- fetchPortfolio: () => Promise<void>;
69
- createOrder: (strategyId: string, amount: number, currency: string) => Promise<any>;
70
- }
71
- interface OneContextValue {
72
- isInitialized: boolean;
73
- config: OneConfig | null;
74
- engine: OneEngineClient;
75
- auth: AuthContextValue;
76
- wallet: WalletContextValue;
77
- onramp: OnrampContextValue;
78
- swap: SwapContextValue;
79
- trading: TradingContextValue;
80
- }
81
- declare const OneContext: React.Context<OneContextValue | null>;
82
- interface OneProviderProps {
83
- children: ReactNode;
84
- config: OneConfig;
85
- autoFetchBalance?: boolean;
86
- }
87
- declare function OneProvider({ children, config, autoFetchBalance, }: OneProviderProps): react_jsx_runtime.JSX.Element;
88
- declare function useOne(): OneContextValue;
89
- declare function useOneAuth(): AuthContextValue;
90
- declare function useOneWallet(): WalletContextValue;
91
- declare function useOneOnramp(): OnrampContextValue;
92
- declare function useOneSwap(): SwapContextValue;
93
- declare function useOneTrading(): TradingContextValue;
94
- declare function useOneEngine(): OneEngineClient;
95
-
96
- interface OneThirdwebConfig {
97
- engineUrl?: string;
98
- appName?: string;
99
- appIcon?: string;
100
- defaultChain?: Chain;
101
- supportedChains?: Chain[];
102
- sponsorGas?: boolean;
103
- authOptions?: {
104
- email?: boolean;
105
- phone?: boolean;
106
- google?: boolean;
107
- apple?: boolean;
108
- facebook?: boolean;
109
- discord?: boolean;
110
- passkey?: boolean;
111
- guest?: boolean;
112
- };
113
- }
114
- interface OneThirdwebProviderProps {
115
- children: ReactNode;
116
- config?: OneThirdwebConfig;
117
- }
118
- declare function useThirdwebClient(): ThirdwebClient;
119
- declare function OneThirdwebProvider({ children, config, }: OneThirdwebProviderProps): react_jsx_runtime.JSX.Element;
120
-
121
- export { OneContext, OneProvider, type OneThirdwebConfig, OneThirdwebProvider, type OneThirdwebProviderProps, useOne, useOneAuth, useOneEngine, useOneOnramp, useOneSwap, useOneTrading, useOneWallet, useThirdwebClient };