@strkfarm/sdk 2.0.0-dev.9 → 2.0.0-staging.2

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 (64) hide show
  1. package/dist/index.browser.global.js +111371 -93151
  2. package/dist/index.browser.mjs +27815 -32690
  3. package/dist/index.d.ts +1095 -2011
  4. package/dist/index.js +27425 -32309
  5. package/dist/index.mjs +27590 -32452
  6. package/package.json +6 -5
  7. package/src/data/ekubo-price-fethcer.abi.json +265 -0
  8. package/src/data/universal-vault.abi.json +20 -135
  9. package/src/dataTypes/address.ts +0 -7
  10. package/src/dataTypes/index.ts +3 -2
  11. package/src/dataTypes/mynumber.ts +141 -0
  12. package/src/global.ts +296 -288
  13. package/src/index.browser.ts +6 -5
  14. package/src/interfaces/common.tsx +324 -184
  15. package/src/modules/apollo-client-config.ts +28 -0
  16. package/src/modules/avnu.ts +4 -17
  17. package/src/modules/ekubo-pricer.ts +79 -0
  18. package/src/modules/ekubo-quoter.ts +11 -88
  19. package/src/modules/erc20.ts +21 -67
  20. package/src/modules/harvests.ts +26 -15
  21. package/src/modules/index.ts +11 -13
  22. package/src/modules/lst-apr.ts +0 -36
  23. package/src/modules/pragma.ts +23 -8
  24. package/src/modules/pricer-from-api.ts +150 -14
  25. package/src/modules/pricer.ts +2 -1
  26. package/src/modules/pricerBase.ts +2 -1
  27. package/src/node/deployer.ts +36 -1
  28. package/src/node/pricer-redis.ts +2 -1
  29. package/src/strategies/autoCompounderStrk.ts +1 -1
  30. package/src/strategies/base-strategy.ts +5 -22
  31. package/src/strategies/ekubo-cl-vault.tsx +2904 -2175
  32. package/src/strategies/factory.ts +165 -0
  33. package/src/strategies/index.ts +10 -11
  34. package/src/strategies/registry.ts +268 -0
  35. package/src/strategies/sensei.ts +416 -292
  36. package/src/strategies/universal-adapters/adapter-utils.ts +1 -5
  37. package/src/strategies/universal-adapters/baseAdapter.ts +153 -181
  38. package/src/strategies/universal-adapters/common-adapter.ts +77 -98
  39. package/src/strategies/universal-adapters/index.ts +1 -5
  40. package/src/strategies/universal-adapters/vesu-adapter.ts +218 -220
  41. package/src/strategies/universal-adapters/vesu-supply-only-adapter.ts +51 -58
  42. package/src/strategies/universal-lst-muliplier-strategy.tsx +1952 -992
  43. package/src/strategies/universal-strategy.tsx +1713 -1150
  44. package/src/strategies/vesu-rebalance.tsx +1189 -986
  45. package/src/utils/health-factor-math.ts +5 -11
  46. package/src/utils/index.ts +8 -9
  47. package/src/utils/strategy-utils.ts +57 -0
  48. package/src/data/extended-deposit.abi.json +0 -3613
  49. package/src/modules/ExtendedWrapperSDk/index.ts +0 -62
  50. package/src/modules/ExtendedWrapperSDk/types.ts +0 -311
  51. package/src/modules/ExtendedWrapperSDk/wrapper.ts +0 -395
  52. package/src/modules/midas.ts +0 -159
  53. package/src/modules/token-market-data.ts +0 -202
  54. package/src/strategies/svk-strategy.ts +0 -247
  55. package/src/strategies/universal-adapters/adapter-optimizer.ts +0 -65
  56. package/src/strategies/universal-adapters/avnu-adapter.ts +0 -413
  57. package/src/strategies/universal-adapters/extended-adapter.ts +0 -972
  58. package/src/strategies/universal-adapters/unused-balance-adapter.ts +0 -109
  59. package/src/strategies/universal-adapters/vesu-multiply-adapter.ts +0 -1306
  60. package/src/strategies/vesu-extended-strategy/services/operationService.ts +0 -34
  61. package/src/strategies/vesu-extended-strategy/utils/config.runtime.ts +0 -77
  62. package/src/strategies/vesu-extended-strategy/utils/constants.ts +0 -49
  63. package/src/strategies/vesu-extended-strategy/utils/helper.ts +0 -370
  64. package/src/strategies/vesu-extended-strategy/vesu-extended-strategy.tsx +0 -1379
@@ -1,62 +0,0 @@
1
- /**
2
- * Extended Exchange TypeScript SDK
3
- *
4
- * A comprehensive TypeScript wrapper for the Extended Exchange trading API.
5
- * Provides type-safe access to all trading operations including orders, positions,
6
- * balances, markets, and asset operations.
7
- *
8
- * @example
9
- * ```typescript
10
- * import { ExtendedWrapper } from './ts';
11
- *
12
- * const client = new ExtendedWrapper({
13
- * baseUrl: 'http://localhost:8000',
14
- * apiKey: 'your-api-key'
15
- * });
16
- *
17
- * // Create a buy order
18
- * const order = await client.createBuyOrder('BTC-USD', '0.1', '50000');
19
- *
20
- * // Get positions
21
- * const positions = await client.getPositions();
22
- *
23
- * // Get balance
24
- * const balance = await client.getHoldings();
25
- * ```
26
- */
27
-
28
- export { ExtendedWrapper } from "./wrapper";
29
- export { default } from "./wrapper";
30
-
31
- // Export all types
32
- export * from "./types";
33
-
34
- // Re-export commonly used types for convenience
35
- export type {
36
- CreateOrderRequest,
37
- WithdrawRequest,
38
- SignedWithdrawRequest,
39
- CancelOrderRequest,
40
- PlacedOrder,
41
- OpenOrder,
42
- Position,
43
- Balance,
44
- Market,
45
- MarketStats,
46
- AssetOperation,
47
- ExtendedApiResponse,
48
- ExtendedWrapperConfig,
49
- } from "./types";
50
-
51
- // Re-export enums for convenience
52
- export {
53
- OrderSide,
54
- TimeInForce,
55
- OrderType,
56
- OrderStatus,
57
- OrderStatusReason,
58
- PositionSide,
59
- ExitType,
60
- AssetOperationType,
61
- AssetOperationStatus,
62
- } from "./types";
@@ -1,311 +0,0 @@
1
- /**
2
- * TypeScript type definitions for Extended Exchange API
3
- * Based on Python SDK models from x10.perpetual
4
- */
5
-
6
- // Enums
7
- export enum OrderSide {
8
- BUY = "BUY",
9
- SELL = "SELL",
10
- }
11
-
12
- export enum TimeInForce {
13
- GTT = "GTT",
14
- IOC = "IOC",
15
- FOK = "FOK",
16
- }
17
-
18
- export enum OrderType {
19
- LIMIT = "LIMIT",
20
- CONDITIONAL = "CONDITIONAL",
21
- MARKET = "MARKET",
22
- TPSL = "TPSL",
23
- }
24
-
25
- export enum OrderStatus {
26
- UNKNOWN = "UNKNOWN",
27
- NEW = "NEW",
28
- UNTRIGGERED = "UNTRIGGERED",
29
- PARTIALLY_FILLED = "PARTIALLY_FILLED",
30
- FILLED = "FILLED",
31
- CANCELLED = "CANCELLED",
32
- EXPIRED = "EXPIRED",
33
- REJECTED = "REJECTED",
34
- }
35
-
36
- export enum OrderStatusReason {
37
- UNKNOWN = "UNKNOWN",
38
- NONE = "NONE",
39
- UNKNOWN_MARKET = "UNKNOWN_MARKET",
40
- DISABLED_MARKET = "DISABLED_MARKET",
41
- NOT_ENOUGH_FUNDS = "NOT_ENOUGH_FUNDS",
42
- NO_LIQUIDITY = "NO_LIQUIDITY",
43
- INVALID_FEE = "INVALID_FEE",
44
- INVALID_QTY = "INVALID_QTY",
45
- INVALID_PRICE = "INVALID_PRICE",
46
- INVALID_VALUE = "INVALID_VALUE",
47
- UNKNOWN_ACCOUNT = "UNKNOWN_ACCOUNT",
48
- SELF_TRADE_PROTECTION = "SELF_TRADE_PROTECTION",
49
- POST_ONLY_FAILED = "POST_ONLY_FAILED",
50
- REDUCE_ONLY_FAILED = "REDUCE_ONLY_FAILED",
51
- INVALID_EXPIRE_TIME = "INVALID_EXPIRE_TIME",
52
- POSITION_TPSL_CONFLICT = "POSITION_TPSL_CONFLICT",
53
- INVALID_LEVERAGE = "INVALID_LEVERAGE",
54
- PREV_ORDER_NOT_FOUND = "PREV_ORDER_NOT_FOUND",
55
- PREV_ORDER_TRIGGERED = "PREV_ORDER_TRIGGERED",
56
- TPSL_OTHER_SIDE_FILLED = "TPSL_OTHER_SIDE_FILLED",
57
- PREV_ORDER_CONFLICT = "PREV_ORDER_CONFLICT",
58
- ORDER_REPLACED = "ORDER_REPLACED",
59
- POST_ONLY_MODE = "POST_ONLY_MODE",
60
- REDUCE_ONLY_MODE = "REDUCE_ONLY_MODE",
61
- TRADING_OFF_MODE = "TRADING_OFF_MODE",
62
- }
63
-
64
- export enum PositionSide {
65
- LONG = "LONG",
66
- SHORT = "SHORT",
67
- }
68
-
69
- export enum ExitType {
70
- TRADE = "TRADE",
71
- LIQUIDATION = "LIQUIDATION",
72
- ADL = "ADL",
73
- }
74
-
75
- export enum AssetOperationType {
76
- DEPOSIT = "DEPOSIT",
77
- WITHDRAWAL = "WITHDRAWAL",
78
- TRANSFER = "TRANSFER",
79
- }
80
-
81
- export enum AssetOperationStatus {
82
- PENDING = "PENDING",
83
- COMPLETED = "COMPLETED",
84
- FAILED = "FAILED",
85
- }
86
-
87
- // Base types
88
- export interface SettlementSignature {
89
- r: string;
90
- s: string;
91
- }
92
-
93
- export interface StarkSettlement {
94
- signature: SettlementSignature;
95
- stark_key: string;
96
- collateral_position: string;
97
- }
98
-
99
- export interface StarkDebuggingOrderAmounts {
100
- collateral_amount: string;
101
- fee_amount: string;
102
- synthetic_amount: string;
103
- }
104
-
105
- // Order types
106
- export interface PlacedOrder {
107
- id: number;
108
- external_id: string;
109
- }
110
-
111
- export interface OpenOrder {
112
- id: number;
113
- account_id: number;
114
- external_id: string;
115
- market: string;
116
- type: OrderType;
117
- side: OrderSide;
118
- status: OrderStatus;
119
- status_reason?: OrderStatusReason;
120
- price: string;
121
- average_price?: string;
122
- qty: string;
123
- filled_qty?: string;
124
- reduce_only: boolean;
125
- post_only: boolean;
126
- payed_fee?: string;
127
- created_time: number;
128
- updated_time: number;
129
- expiry_time?: number;
130
- }
131
-
132
- // Position types
133
- export interface Position {
134
- id: number;
135
- accountId: number;
136
- market: string;
137
- side: PositionSide;
138
- leverage: string;
139
- size: string;
140
- value: string;
141
- openPrice: string;
142
- markPrice: string;
143
- liquidationPrice?: string;
144
- unrealisedPnl: string;
145
- realisedPnl: string;
146
- tpPrice?: string;
147
- slPrice?: string;
148
- adl?: number;
149
- createdAt: number;
150
- updatedAt: number;
151
- }
152
-
153
- export interface PositionHistory {
154
- id: number;
155
- account_id: number;
156
- market: string;
157
- side: PositionSide;
158
- leverage: string;
159
- size: string;
160
- open_price: string;
161
- exit_type?: ExitType;
162
- exit_price?: string;
163
- realised_pnl: string;
164
- created_time: number;
165
- closed_time?: number;
166
- }
167
-
168
- // Balance types
169
- export interface Balance {
170
- collateral_name: string;
171
- balance: string;
172
- equity: string;
173
- availableForTrade: string;
174
- availableForWithdrawal: string;
175
- unrealisedPnl: string;
176
- initialMargin: string;
177
- marginRatio: string;
178
- updatedTime: number;
179
- }
180
-
181
- // Market types
182
- export interface RiskFactorConfig {
183
- upper_bound: string;
184
- risk_factor: string;
185
- }
186
-
187
- export interface MarketStats {
188
- daily_volume: string;
189
- daily_volume_base: string;
190
- daily_price_change: string;
191
- daily_low: string;
192
- daily_high: string;
193
- last_price: string;
194
- ask_price: string;
195
- bid_price: string;
196
- mark_price: string;
197
- index_price: string;
198
- funding_rate: string;
199
- next_funding_rate: number;
200
- open_interest: string;
201
- open_interest_base: string;
202
- }
203
-
204
- export interface TradingConfig {
205
- min_order_size: string;
206
- min_order_size_change: string;
207
- min_price_change: string;
208
- max_market_order_value: string;
209
- max_limit_order_value: string;
210
- max_position_value: string;
211
- max_leverage: string;
212
- max_num_orders: number;
213
- limit_price_cap: string;
214
- limit_price_floor: string;
215
- risk_factor_config: RiskFactorConfig[];
216
- }
217
-
218
- export interface L2Config {
219
- type: string;
220
- collateral_id: string;
221
- collateral_resolution: number;
222
- synthetic_id: string;
223
- synthetic_resolution: number;
224
- }
225
-
226
- export interface Market {
227
- name: string;
228
- asset_name: string;
229
- asset_precision: number;
230
- collateral_asset_name: string;
231
- collateral_asset_precision: number;
232
- active: boolean;
233
- market_stats: MarketStats;
234
- trading_config: TradingConfig;
235
- l2_config: L2Config;
236
- }
237
-
238
- // Asset operation types
239
- export interface AssetOperation {
240
- id: number;
241
- type: AssetOperationType;
242
- status: AssetOperationStatus;
243
- amount: string;
244
- asset: string;
245
- created_time: number;
246
- updated_time: number;
247
- description?: string;
248
- transactionHash?:string;
249
- }
250
-
251
- // Request types
252
- export interface CreateOrderRequest {
253
- market_name: string;
254
- amount: string;
255
- price: string;
256
- side: OrderSide;
257
- post_only?: boolean;
258
- previous_order_id?: number;
259
- external_id?: string;
260
- time_in_force?: TimeInForce;
261
- }
262
-
263
- export interface WithdrawRequest {
264
- amount: string;
265
- asset?: string;
266
- }
267
-
268
- export interface SignedWithdrawRequest {
269
- recipient: string;
270
- position_id: number;
271
- amount: number;
272
- expiration: number;
273
- salt: number;
274
- }
275
-
276
- export interface CancelOrderRequest {
277
- order_id: number;
278
- }
279
-
280
- // Response wrapper type
281
- export interface ApiResponse<T> {
282
- success: boolean;
283
- message: string;
284
- data: T;
285
- }
286
-
287
- // Extended API response wrapper (matches Python WrappedApiResponse)
288
- export interface ExtendedApiResponse<T> {
289
- status: 'OK' | 'ERROR';
290
- message: string;
291
- data: T;
292
- }
293
-
294
- // Configuration types
295
- export interface ExtendedWrapperConfig {
296
- baseUrl: string;
297
- apiKey?: string;
298
- timeout?: number;
299
- retries?: number;
300
- }
301
-
302
- export interface UpdateLeverageRequest {
303
- leverage: string;
304
- market: string;
305
- }
306
-
307
- export interface FundingRate {
308
- m: string;
309
- f:string;
310
- t:number;
311
- }