@orderly.network/vaults 2.6.1-alpha.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 +277 -0
- package/dist/index.d.mts +274 -0
- package/dist/index.d.ts +274 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +16 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +51 -0
package/README.md
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Vaults Package
|
|
2
|
+
|
|
3
|
+
## Request API
|
|
4
|
+
|
|
5
|
+
This package provides a robust and feature-rich HTTP client for making API requests. The optimized request module includes advanced features like retry logic, timeout handling, request/response interceptors, and comprehensive error handling.
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- 🔄 **Automatic Retry Logic**: Configurable retry attempts with exponential backoff
|
|
10
|
+
- ⏱️ **Timeout Support**: Request timeout with automatic cancellation
|
|
11
|
+
- 🔧 **Request/Response Interceptors**: Middleware for request and response processing
|
|
12
|
+
- 🎯 **Type Safety**: Full TypeScript support with generic types
|
|
13
|
+
- 🚨 **Enhanced Error Handling**: Structured error responses with codes and status
|
|
14
|
+
- 📦 **Multiple HTTP Methods**: GET, POST, PUT, DELETE, PATCH convenience methods
|
|
15
|
+
- 🔗 **Base URL Support**: Automatic URL construction with base URL
|
|
16
|
+
- 📊 **Response Validation**: Configurable status code validation
|
|
17
|
+
- 🔍 **Smart Query Parameters**: Automatic query string building with undefined value filtering
|
|
18
|
+
|
|
19
|
+
### Basic Usage
|
|
20
|
+
|
|
21
|
+
All methods now use a **single configuration object** for maximum simplicity and consistency:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { request, RequestClient } from "./api/request";
|
|
25
|
+
import client from "./api/request";
|
|
26
|
+
|
|
27
|
+
// Simple GET request
|
|
28
|
+
const user = await client.get<User>("/api/users/1");
|
|
29
|
+
|
|
30
|
+
// GET with query parameters
|
|
31
|
+
const users = await client.get<User[]>("/api/users", {
|
|
32
|
+
params: { page: 1, limit: 10, status: "active" },
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// POST with data
|
|
36
|
+
const newUser = await client.post<User>("/api/users", {
|
|
37
|
+
data: { name: "John Doe", email: "john@example.com" },
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// PUT with data and custom config
|
|
41
|
+
const updatedUser = await client.put<User>("/api/users/1", {
|
|
42
|
+
data: { name: "Jane Doe" },
|
|
43
|
+
timeout: 8000,
|
|
44
|
+
retry: 1,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// DELETE with config
|
|
48
|
+
await client.delete("/api/users/1", {
|
|
49
|
+
timeout: 5000,
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Complete Configuration Example
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
// All options in a single, clear object
|
|
57
|
+
const data = await client.get<UserData[]>("/api/users", {
|
|
58
|
+
baseURL: "https://api.example.com",
|
|
59
|
+
params: {
|
|
60
|
+
page: 1,
|
|
61
|
+
limit: 10,
|
|
62
|
+
status: "active",
|
|
63
|
+
search: undefined, // Automatically filtered out
|
|
64
|
+
},
|
|
65
|
+
timeout: 10000,
|
|
66
|
+
retry: 2,
|
|
67
|
+
headers: {
|
|
68
|
+
Authorization: "Bearer token123",
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Configuration Object Structure
|
|
74
|
+
|
|
75
|
+
The simplified API uses a single configuration object with these fields:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
interface SimpleRequestConfig {
|
|
79
|
+
// Request data (for POST/PUT/PATCH)
|
|
80
|
+
data?: any;
|
|
81
|
+
|
|
82
|
+
// Query parameters (flexible - accepts any object with string keys)
|
|
83
|
+
params?: Record<string, unknown>;
|
|
84
|
+
|
|
85
|
+
// API configuration
|
|
86
|
+
baseURL?: string;
|
|
87
|
+
timeout?: number;
|
|
88
|
+
retry?: number;
|
|
89
|
+
retryDelay?: number;
|
|
90
|
+
|
|
91
|
+
// Standard fetch options
|
|
92
|
+
headers?: HeadersInit;
|
|
93
|
+
signal?: AbortSignal;
|
|
94
|
+
cache?: RequestCache;
|
|
95
|
+
credentials?: RequestCredentials;
|
|
96
|
+
// ... other standard RequestInit options
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Parameter Handling
|
|
101
|
+
|
|
102
|
+
The `params` field is flexible and can accept:
|
|
103
|
+
|
|
104
|
+
- Simple key-value objects: `{ page: 1, status: 'active' }`
|
|
105
|
+
- Typed parameter objects: `{ vault_id: 'abc', time_range: '30d' }`
|
|
106
|
+
- Mixed types: `{ id: 123, enabled: true, name: 'test' }`
|
|
107
|
+
- Objects will be automatically flattened and undefined values filtered out
|
|
108
|
+
|
|
109
|
+
**Always use the `params` field for query parameters** - never mix them with config options!
|
|
110
|
+
|
|
111
|
+
### Advanced Configuration
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { RequestClient } from "./api/request";
|
|
115
|
+
|
|
116
|
+
// Create a custom client instance
|
|
117
|
+
const apiClient = new RequestClient();
|
|
118
|
+
|
|
119
|
+
// Configure default settings
|
|
120
|
+
const data = await apiClient.request<ApiResponse>("/api/data", {
|
|
121
|
+
timeout: 5000, // 5 second timeout
|
|
122
|
+
retry: 2, // Retry 2 times on failure
|
|
123
|
+
retryDelay: 2000, // Wait 2 seconds between retries
|
|
124
|
+
baseURL: "https://api.example.com",
|
|
125
|
+
headers: {
|
|
126
|
+
Authorization: "Bearer token123",
|
|
127
|
+
"X-Custom-Header": "value",
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Request Interceptors
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
// Add authentication header automatically
|
|
136
|
+
apiClient.addRequestInterceptor(async (config) => {
|
|
137
|
+
const token = await getAuthToken();
|
|
138
|
+
return {
|
|
139
|
+
...config,
|
|
140
|
+
headers: {
|
|
141
|
+
...config.headers,
|
|
142
|
+
Authorization: `Bearer ${token}`,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Add request logging
|
|
148
|
+
apiClient.addRequestInterceptor((config) => {
|
|
149
|
+
console.log("Making request to:", config.url);
|
|
150
|
+
return config;
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Response Interceptors
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
// Transform response data
|
|
158
|
+
apiClient.addResponseInterceptor(async (response, data) => {
|
|
159
|
+
// Add timestamp to all responses
|
|
160
|
+
return {
|
|
161
|
+
...data,
|
|
162
|
+
timestamp: Date.now(),
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Handle global error logging
|
|
167
|
+
apiClient.addResponseInterceptor(async (response, data) => {
|
|
168
|
+
if (!response.ok) {
|
|
169
|
+
console.error("Request failed:", response.status, data);
|
|
170
|
+
}
|
|
171
|
+
return data;
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Error Handling
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
import { VaultsApiError } from "./api/request";
|
|
179
|
+
|
|
180
|
+
try {
|
|
181
|
+
const data = await client.get("/api/data");
|
|
182
|
+
} catch (error) {
|
|
183
|
+
if (error instanceof VaultsApiError) {
|
|
184
|
+
console.error("API Error:", {
|
|
185
|
+
message: error.message,
|
|
186
|
+
code: error.code,
|
|
187
|
+
status: error.status,
|
|
188
|
+
response: error.response,
|
|
189
|
+
});
|
|
190
|
+
} else {
|
|
191
|
+
console.error("Network or other error:", error);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Custom Validation
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
// Only accept 2xx status codes
|
|
200
|
+
const data = await client.request("/api/data", {
|
|
201
|
+
validateStatus: (status) => status >= 200 && status < 300,
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// Accept 404 as valid (useful for optional resources)
|
|
205
|
+
const optionalData = await client.request("/api/optional-data", {
|
|
206
|
+
validateStatus: (status) => (status >= 200 && status < 300) || status === 404,
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Working with Different Response Formats
|
|
211
|
+
|
|
212
|
+
The client automatically handles the standard `{ success: boolean, data: any, message?: string }` format used by Orderly APIs, but also works with any JSON response format.
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
// Standard Orderly API response
|
|
216
|
+
interface StandardResponse {
|
|
217
|
+
success: boolean;
|
|
218
|
+
data: UserData;
|
|
219
|
+
message?: string;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// The client will automatically extract the 'data' field
|
|
223
|
+
const userData = await client.get<UserData>("/api/users/1");
|
|
224
|
+
|
|
225
|
+
// For non-standard responses, the full response is returned
|
|
226
|
+
const customResponse = await client.get<CustomApiResponse>("/api/custom");
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Integration with Existing Hooks
|
|
230
|
+
|
|
231
|
+
This request client is designed to work seamlessly with the existing `useApiUrl` hook:
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
import client from "../api/request";
|
|
235
|
+
import { useApiUrl } from "../hooks/useApiUrl";
|
|
236
|
+
|
|
237
|
+
function useVaultsData() {
|
|
238
|
+
const apiUrl = useApiUrl();
|
|
239
|
+
|
|
240
|
+
const fetchVaults = async () => {
|
|
241
|
+
return client.get("/api/vaults", {
|
|
242
|
+
baseURL: apiUrl,
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
return { fetchVaults };
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Migration from Old Request Function
|
|
251
|
+
|
|
252
|
+
The new implementation is backward compatible. If you were using:
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
// Old usage
|
|
256
|
+
const data = await request<UserData>("/api/users", { method: "GET" });
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
This will continue to work exactly as before. For new code, consider using the enhanced features:
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
// New enhanced usage
|
|
263
|
+
const data = await client.get<UserData>("/api/users", {
|
|
264
|
+
timeout: 5000,
|
|
265
|
+
retry: 2,
|
|
266
|
+
});
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Best Practices
|
|
270
|
+
|
|
271
|
+
1. **Use the default client** for simple requests
|
|
272
|
+
2. **Create custom client instances** for different APIs or when you need different default configurations
|
|
273
|
+
3. **Add interceptors** at the application level for cross-cutting concerns like authentication
|
|
274
|
+
4. **Handle VaultsApiError specifically** for better error UX
|
|
275
|
+
5. **Set appropriate timeouts** based on your API's expected response times
|
|
276
|
+
6. **Use retry sparingly** - only for idempotent operations
|
|
277
|
+
7. **Leverage TypeScript** for better development experience and runtime safety
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import * as zustand from 'zustand';
|
|
4
|
+
|
|
5
|
+
interface VaultSupportedChain {
|
|
6
|
+
chain_id: string;
|
|
7
|
+
chain_name: string;
|
|
8
|
+
}
|
|
9
|
+
type VaultTimeRange = "24h" | "7d" | "30d" | "all_time";
|
|
10
|
+
interface VaultInfo {
|
|
11
|
+
vault_id: string;
|
|
12
|
+
vault_address: string;
|
|
13
|
+
vault_type: string;
|
|
14
|
+
performance_fee_rate: number;
|
|
15
|
+
supported_chains: VaultSupportedChain[];
|
|
16
|
+
tvl: number;
|
|
17
|
+
apr30_d: number;
|
|
18
|
+
vault_lifetime_net_pnl: number;
|
|
19
|
+
lp_counts: number;
|
|
20
|
+
total_main_shares: number;
|
|
21
|
+
est_main_share_price: number;
|
|
22
|
+
gate_threshold_pct: number;
|
|
23
|
+
gate_triggered: boolean;
|
|
24
|
+
lock_duration: number;
|
|
25
|
+
broker_id: string;
|
|
26
|
+
"30d_apr": number;
|
|
27
|
+
"30d_apy": number;
|
|
28
|
+
}
|
|
29
|
+
interface VaultLpPerformance {
|
|
30
|
+
time_range: VaultTimeRange;
|
|
31
|
+
tvl_max_drawdown: number;
|
|
32
|
+
incremental_net_pnl: number;
|
|
33
|
+
pnl_max_drawdown: number;
|
|
34
|
+
}
|
|
35
|
+
interface VaultLpInfo {
|
|
36
|
+
vault_id: string;
|
|
37
|
+
lp_nav: number;
|
|
38
|
+
lp_tvl: number;
|
|
39
|
+
total_main_shares: number;
|
|
40
|
+
available_main_shares: number;
|
|
41
|
+
potential_pnl: number;
|
|
42
|
+
}
|
|
43
|
+
interface VaultOperation {
|
|
44
|
+
type: OperationType;
|
|
45
|
+
vault_id: string;
|
|
46
|
+
amount_change: number;
|
|
47
|
+
created_time: string;
|
|
48
|
+
status: string;
|
|
49
|
+
}
|
|
50
|
+
declare enum RoleType {
|
|
51
|
+
LP = "lp",
|
|
52
|
+
SP = "sp"
|
|
53
|
+
}
|
|
54
|
+
declare enum OperationType {
|
|
55
|
+
DEPOSIT = "deposit",
|
|
56
|
+
WITHDRAWAL = "withdrawal"
|
|
57
|
+
}
|
|
58
|
+
type VaultsPageConfig = {
|
|
59
|
+
headerImage?: string | React.ReactNode;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
type VaultsPageProps = {
|
|
63
|
+
className?: string;
|
|
64
|
+
config?: VaultsPageConfig;
|
|
65
|
+
};
|
|
66
|
+
declare const VaultsPage: FC<VaultsPageProps>;
|
|
67
|
+
|
|
68
|
+
interface VaultInfoResponse {
|
|
69
|
+
rows: VaultInfo[];
|
|
70
|
+
}
|
|
71
|
+
interface VaultLpPerformanceResponse {
|
|
72
|
+
rows: VaultLpPerformance[];
|
|
73
|
+
}
|
|
74
|
+
interface VaultLpInfoResponse {
|
|
75
|
+
rows: VaultLpInfo[];
|
|
76
|
+
}
|
|
77
|
+
interface VaultPerformanceParams {
|
|
78
|
+
vault_id: string;
|
|
79
|
+
time_range?: VaultTimeRange;
|
|
80
|
+
}
|
|
81
|
+
interface VaultLpInfoParams {
|
|
82
|
+
vault_id: string;
|
|
83
|
+
wallet_address: string;
|
|
84
|
+
}
|
|
85
|
+
interface VaultOperationMessage {
|
|
86
|
+
payloadType: string;
|
|
87
|
+
nonce: string;
|
|
88
|
+
receiver: string;
|
|
89
|
+
amount: string;
|
|
90
|
+
vaultId: string;
|
|
91
|
+
token: string;
|
|
92
|
+
dexBrokerId: string;
|
|
93
|
+
chainId?: string;
|
|
94
|
+
chainType?: string;
|
|
95
|
+
}
|
|
96
|
+
type VaultOperationRequest = {
|
|
97
|
+
message: VaultOperationMessage;
|
|
98
|
+
signature: string;
|
|
99
|
+
userAddress: string;
|
|
100
|
+
verifyingContract: string;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Get vault information
|
|
104
|
+
* @param baseUrl - The base URL for the API endpoints
|
|
105
|
+
* @returns Promise<VaultInfoResponse> - Array of vault information
|
|
106
|
+
*/
|
|
107
|
+
declare function getVaultInfo(baseUrl: string): Promise<VaultInfoResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* Get vault LP performance data
|
|
110
|
+
* @param baseUrl - The base URL for the API endpoints
|
|
111
|
+
* @param params - Parameters including vault_id and time_range
|
|
112
|
+
* @returns Promise<VaultLpPerformanceResponse> - Array of vault LP performance data
|
|
113
|
+
*/
|
|
114
|
+
declare function getVaultLpPerformance(baseUrl: string, params: VaultPerformanceParams): Promise<VaultLpPerformanceResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Get vault LP information
|
|
117
|
+
* @param baseUrl - The base URL for the API endpoints
|
|
118
|
+
* @param params - Parameters including vault_id and wallet_address
|
|
119
|
+
* @returns Promise<VaultLpInfoResponse> - Array of vault LP information
|
|
120
|
+
*/
|
|
121
|
+
declare function getVaultLpInfo(baseUrl: string, params: VaultLpInfoParams): Promise<VaultLpInfoResponse>;
|
|
122
|
+
|
|
123
|
+
interface VaultsState {
|
|
124
|
+
baseUrl: string;
|
|
125
|
+
vaultInfo: {
|
|
126
|
+
data: VaultInfo[];
|
|
127
|
+
loading: boolean;
|
|
128
|
+
error: string | null;
|
|
129
|
+
lastUpdated: number | null;
|
|
130
|
+
};
|
|
131
|
+
vaultLpPerformance: {
|
|
132
|
+
data: Record<string, VaultLpPerformance[]>;
|
|
133
|
+
loading: boolean;
|
|
134
|
+
error: string | null;
|
|
135
|
+
lastUpdated: number | null;
|
|
136
|
+
params: VaultPerformanceParams | null;
|
|
137
|
+
};
|
|
138
|
+
vaultLpInfo: {
|
|
139
|
+
data: Record<string, VaultLpInfo[]>;
|
|
140
|
+
loading: boolean;
|
|
141
|
+
error: string | null;
|
|
142
|
+
lastUpdated: number | null;
|
|
143
|
+
params: VaultLpInfoParams | null;
|
|
144
|
+
};
|
|
145
|
+
vaultsPageConfig: VaultsPageConfig | null;
|
|
146
|
+
setBaseUrl: (baseUrl: string) => void;
|
|
147
|
+
fetchVaultInfo: (baseUrl?: string) => Promise<void>;
|
|
148
|
+
refreshVaultInfo: () => Promise<void>;
|
|
149
|
+
fetchVaultLpPerformance: (params: VaultPerformanceParams, baseUrl?: string) => Promise<void>;
|
|
150
|
+
refreshVaultLpPerformance: () => Promise<void>;
|
|
151
|
+
fetchVaultLpInfo: (params: VaultLpInfoParams, baseUrl?: string) => Promise<void>;
|
|
152
|
+
refreshVaultLpInfo: () => Promise<void>;
|
|
153
|
+
setVaultsPageConfig: (config: VaultsPageConfig) => void;
|
|
154
|
+
}
|
|
155
|
+
declare const useVaultsStore: zustand.UseBoundStore<zustand.StoreApi<VaultsState>>;
|
|
156
|
+
declare const useVaultInfoState: () => {
|
|
157
|
+
data: VaultInfo[];
|
|
158
|
+
loading: boolean;
|
|
159
|
+
error: string | null;
|
|
160
|
+
lastUpdated: number | null;
|
|
161
|
+
};
|
|
162
|
+
declare const useVaultLpPerformanceState: () => {
|
|
163
|
+
data: Record<string, VaultLpPerformance[]>;
|
|
164
|
+
loading: boolean;
|
|
165
|
+
error: string | null;
|
|
166
|
+
lastUpdated: number | null;
|
|
167
|
+
params: VaultPerformanceParams | null;
|
|
168
|
+
};
|
|
169
|
+
declare const useVaultLpInfoState: () => {
|
|
170
|
+
data: Record<string, VaultLpInfo[]>;
|
|
171
|
+
loading: boolean;
|
|
172
|
+
error: string | null;
|
|
173
|
+
lastUpdated: number | null;
|
|
174
|
+
params: VaultLpInfoParams | null;
|
|
175
|
+
};
|
|
176
|
+
declare const useVaultInfoActions: () => {
|
|
177
|
+
fetchVaultInfo: (baseUrl?: string) => Promise<void>;
|
|
178
|
+
refreshVaultInfo: () => Promise<void>;
|
|
179
|
+
};
|
|
180
|
+
declare const useVaultLpPerformanceActions: () => {
|
|
181
|
+
fetchVaultLpPerformance: (params: VaultPerformanceParams, baseUrl?: string) => Promise<void>;
|
|
182
|
+
refreshVaultLpPerformance: () => Promise<void>;
|
|
183
|
+
};
|
|
184
|
+
declare const useVaultLpInfoActions: () => {
|
|
185
|
+
fetchVaultLpInfo: (params: VaultLpInfoParams, baseUrl?: string) => Promise<void>;
|
|
186
|
+
refreshVaultLpInfo: () => Promise<void>;
|
|
187
|
+
};
|
|
188
|
+
declare const useVaultLpPerformanceById: (vaultId: string) => VaultLpPerformance[];
|
|
189
|
+
declare const useVaultLpInfoById: (vaultId: string) => VaultLpInfo[];
|
|
190
|
+
declare const useVaultLpPerformanceIds: () => string[];
|
|
191
|
+
declare const useVaultLpInfoIds: () => string[];
|
|
192
|
+
declare const useVaultLpPerformanceArray: () => VaultLpPerformance[];
|
|
193
|
+
declare const useVaultLpInfoArray: () => VaultLpInfo[];
|
|
194
|
+
|
|
195
|
+
declare const AllVaultsWidget: FC;
|
|
196
|
+
|
|
197
|
+
declare const AllVaultsDesktop: FC<{
|
|
198
|
+
vaults: VaultInfo[];
|
|
199
|
+
}>;
|
|
200
|
+
|
|
201
|
+
type VaultCardWidgetProps = {
|
|
202
|
+
vault: VaultInfo;
|
|
203
|
+
};
|
|
204
|
+
declare const VaultCardWidget: FC<VaultCardWidgetProps>;
|
|
205
|
+
|
|
206
|
+
declare const useVaultCardScript: (vault: VaultInfo) => {
|
|
207
|
+
title: string;
|
|
208
|
+
description: string;
|
|
209
|
+
icon: string;
|
|
210
|
+
vaultInfo: VaultInfo;
|
|
211
|
+
lpInfo: {
|
|
212
|
+
deposits: string;
|
|
213
|
+
earnings: string;
|
|
214
|
+
} | {
|
|
215
|
+
deposits: number;
|
|
216
|
+
earnings: number;
|
|
217
|
+
};
|
|
218
|
+
isEVMConnected: boolean;
|
|
219
|
+
openDepositAndWithdraw: (activeTab: "deposit" | "withdraw") => void;
|
|
220
|
+
availableBalance: number;
|
|
221
|
+
openVaultWebsite: () => void;
|
|
222
|
+
isWrongNetwork: boolean;
|
|
223
|
+
};
|
|
224
|
+
type VaultCardScript = ReturnType<typeof useVaultCardScript>;
|
|
225
|
+
|
|
226
|
+
declare const VaultCard: FC<VaultCardScript>;
|
|
227
|
+
|
|
228
|
+
declare const ORDERLY_ICON = "https://oss.orderly.network/static/symbol_logo/ORDER.png";
|
|
229
|
+
declare const ORDERLY_VAULT_TITLE = "Orderly OmniVault";
|
|
230
|
+
declare const ORDERLY_VAULT_DESCRIPTION = "Earn passive yields effortlessly, no trading expertise required. OmniVault deploys market-making strategies, taking on liquidations, and accrue platform fees.";
|
|
231
|
+
|
|
232
|
+
declare const VaultsHeaderWidget: FC;
|
|
233
|
+
|
|
234
|
+
declare const useVaultsHeaderScript: () => {
|
|
235
|
+
supportVaults: VaultSupportedChain[];
|
|
236
|
+
headerImage: react.ReactNode;
|
|
237
|
+
};
|
|
238
|
+
type VaultsHeaderScript = ReturnType<typeof useVaultsHeaderScript>;
|
|
239
|
+
|
|
240
|
+
declare const VaultsHeaderDesktop: FC<VaultsHeaderScript>;
|
|
241
|
+
|
|
242
|
+
declare const VaultsIntroductionWidget: FC;
|
|
243
|
+
|
|
244
|
+
declare const VaultDepositAndWithdrawWithDialogId = "VaultDepositAndWithdrawWithDialogId";
|
|
245
|
+
declare const VaultDepositAndWithdrawWithSheetId = "VaultDepositAndWithdrawWithSheetId";
|
|
246
|
+
type VaultDepositAndWithdrawProps = {
|
|
247
|
+
activeTab?: "deposit" | "withdraw";
|
|
248
|
+
close?: () => void;
|
|
249
|
+
vaultId: string;
|
|
250
|
+
};
|
|
251
|
+
declare const VaultDepositAndWithdraw: FC<VaultDepositAndWithdrawProps>;
|
|
252
|
+
|
|
253
|
+
type VaultDepositWidgetProps = {
|
|
254
|
+
vaultId: string;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
declare const VaultDepositWidget: FC<VaultDepositWidgetProps>;
|
|
258
|
+
|
|
259
|
+
type VaultWithdrawWidgetProps = {
|
|
260
|
+
vaultId: string;
|
|
261
|
+
};
|
|
262
|
+
declare const VaultWithdrawWidget: FC<VaultWithdrawWidgetProps>;
|
|
263
|
+
|
|
264
|
+
type LatestDepositWidgetProps = {
|
|
265
|
+
vaultId: string;
|
|
266
|
+
};
|
|
267
|
+
declare const LatestDepositWidget: FC<LatestDepositWidgetProps>;
|
|
268
|
+
|
|
269
|
+
type LatestWithdrawWidgetProps = {
|
|
270
|
+
vaultId: string;
|
|
271
|
+
};
|
|
272
|
+
declare const LatestWithdrawWidget: FC<LatestWithdrawWidgetProps>;
|
|
273
|
+
|
|
274
|
+
export { AllVaultsDesktop, AllVaultsWidget, LatestDepositWidget, type LatestDepositWidgetProps, LatestWithdrawWidget, type LatestWithdrawWidgetProps, ORDERLY_ICON, ORDERLY_VAULT_DESCRIPTION, ORDERLY_VAULT_TITLE, OperationType, RoleType, VaultCard, type VaultCardScript, VaultCardWidget, type VaultCardWidgetProps, VaultDepositAndWithdraw, type VaultDepositAndWithdrawProps, VaultDepositAndWithdrawWithDialogId, VaultDepositAndWithdrawWithSheetId, VaultDepositWidget, type VaultInfo, type VaultInfoResponse, type VaultLpInfo, type VaultLpInfoParams, type VaultLpInfoResponse, type VaultLpPerformance, type VaultLpPerformanceResponse, type VaultOperation, type VaultOperationMessage, type VaultOperationRequest, type VaultPerformanceParams, type VaultSupportedChain, type VaultTimeRange, VaultWithdrawWidget, type VaultWithdrawWidgetProps, VaultsHeaderDesktop, type VaultsHeaderScript, VaultsHeaderWidget, VaultsIntroductionWidget, VaultsPage, type VaultsPageConfig, type VaultsPageProps, getVaultInfo, getVaultLpInfo, getVaultLpPerformance, useVaultCardScript, useVaultInfoActions, useVaultInfoState, useVaultLpInfoActions, useVaultLpInfoArray, useVaultLpInfoById, useVaultLpInfoIds, useVaultLpInfoState, useVaultLpPerformanceActions, useVaultLpPerformanceArray, useVaultLpPerformanceById, useVaultLpPerformanceIds, useVaultLpPerformanceState, useVaultsHeaderScript, useVaultsStore };
|