@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.
Files changed (83) hide show
  1. package/.turbo/turbo-build.log +0 -0
  2. package/.turbo/turbo-type-check.log +0 -0
  3. package/dist/config/index.d.mts +74 -0
  4. package/dist/config/index.d.ts +74 -0
  5. package/dist/config/index.js +242 -0
  6. package/dist/config/index.js.map +1 -0
  7. package/dist/config/index.mjs +224 -0
  8. package/dist/config/index.mjs.map +1 -0
  9. package/dist/engine-5ndtBaCr.d.ts +1039 -0
  10. package/dist/engine-CrlhH0nw.d.mts +1039 -0
  11. package/dist/hooks/index.d.mts +56 -0
  12. package/dist/hooks/index.d.ts +56 -0
  13. package/dist/hooks/index.js +1360 -0
  14. package/dist/hooks/index.js.map +1 -0
  15. package/dist/hooks/index.mjs +1356 -0
  16. package/dist/hooks/index.mjs.map +1 -0
  17. package/dist/index.d.mts +356 -0
  18. package/dist/index.d.ts +356 -0
  19. package/dist/index.js +5068 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/index.mjs +4949 -0
  22. package/dist/index.mjs.map +1 -0
  23. package/dist/price-CgqXPnT3.d.ts +13 -0
  24. package/dist/price-ClbLHHjv.d.mts +13 -0
  25. package/dist/providers/index.d.mts +121 -0
  26. package/dist/providers/index.d.ts +121 -0
  27. package/dist/providers/index.js +1642 -0
  28. package/dist/providers/index.js.map +1 -0
  29. package/dist/providers/index.mjs +1600 -0
  30. package/dist/providers/index.mjs.map +1 -0
  31. package/dist/react-native.d.mts +120 -0
  32. package/dist/react-native.d.ts +120 -0
  33. package/dist/react-native.js +1792 -0
  34. package/dist/react-native.js.map +1 -0
  35. package/dist/react-native.mjs +1755 -0
  36. package/dist/react-native.mjs.map +1 -0
  37. package/dist/services/index.d.mts +85 -0
  38. package/dist/services/index.d.ts +85 -0
  39. package/dist/services/index.js +1466 -0
  40. package/dist/services/index.js.map +1 -0
  41. package/dist/services/index.mjs +1458 -0
  42. package/dist/services/index.mjs.map +1 -0
  43. package/dist/types/index.d.mts +759 -0
  44. package/dist/types/index.d.ts +759 -0
  45. package/dist/types/index.js +4 -0
  46. package/dist/types/index.js.map +1 -0
  47. package/dist/types/index.mjs +3 -0
  48. package/dist/types/index.mjs.map +1 -0
  49. package/dist/utils/index.d.mts +36 -0
  50. package/dist/utils/index.d.ts +36 -0
  51. package/dist/utils/index.js +164 -0
  52. package/dist/utils/index.js.map +1 -0
  53. package/dist/utils/index.mjs +142 -0
  54. package/dist/utils/index.mjs.map +1 -0
  55. package/package.json +101 -0
  56. package/src/components/OneConnectButton.tsx +143 -0
  57. package/src/components/OneNFTGallery.tsx +324 -0
  58. package/src/components/OneOfframpWidget.tsx +660 -0
  59. package/src/components/OneOnrampWidget.tsx +596 -0
  60. package/src/components/OnePayWidget.tsx +160 -0
  61. package/src/components/OneReceiveWidget.tsx +272 -0
  62. package/src/components/OneSendWidget.tsx +248 -0
  63. package/src/components/OneSwapWidget.tsx +715 -0
  64. package/src/components/OneTransactionButton.tsx +150 -0
  65. package/src/components/OneWalletBalance.tsx +354 -0
  66. package/src/components/index.ts +24 -0
  67. package/src/config/index.ts +299 -0
  68. package/src/hooks/index.ts +2 -0
  69. package/src/hooks/useTokenPrice.ts +162 -0
  70. package/src/hooks/useWalletBalance.ts +98 -0
  71. package/src/index.ts +193 -0
  72. package/src/providers/OneProvider.tsx +452 -0
  73. package/src/providers/ThirdwebProvider.tsx +203 -0
  74. package/src/providers/index.ts +26 -0
  75. package/src/react-native.ts +378 -0
  76. package/src/services/engine.ts +1854 -0
  77. package/src/services/index.ts +30 -0
  78. package/src/services/price.ts +164 -0
  79. package/src/services/supabase.ts +180 -0
  80. package/src/types/index.ts +887 -0
  81. package/src/utils/index.ts +200 -0
  82. package/tsconfig.json +22 -0
  83. package/tsup.config.ts +25 -0
@@ -0,0 +1,13 @@
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 };
@@ -0,0 +1,13 @@
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 };
@@ -0,0 +1,121 @@
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 };
@@ -0,0 +1,121 @@
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 };