@strkfarm/sdk 2.0.0-dev.3 → 2.0.0-dev.30

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 (75) hide show
  1. package/dist/cli.js +190 -36
  2. package/dist/cli.mjs +188 -34
  3. package/dist/index.browser.global.js +78478 -45620
  4. package/dist/index.browser.mjs +19583 -9901
  5. package/dist/index.d.ts +3763 -1424
  6. package/dist/index.js +20980 -11063
  7. package/dist/index.mjs +20948 -11087
  8. package/package.json +1 -1
  9. package/src/data/avnu.abi.json +840 -0
  10. package/src/data/ekubo-price-fethcer.abi.json +265 -0
  11. package/src/dataTypes/_bignumber.ts +13 -4
  12. package/src/dataTypes/bignumber.browser.ts +6 -1
  13. package/src/dataTypes/bignumber.node.ts +5 -1
  14. package/src/dataTypes/index.ts +3 -2
  15. package/src/dataTypes/mynumber.ts +141 -0
  16. package/src/global.ts +76 -41
  17. package/src/index.browser.ts +2 -1
  18. package/src/interfaces/common.tsx +175 -3
  19. package/src/modules/ExtendedWrapperSDk/types.ts +28 -5
  20. package/src/modules/ExtendedWrapperSDk/wrapper.ts +275 -59
  21. package/src/modules/apollo-client-config.ts +28 -0
  22. package/src/modules/avnu.ts +4 -4
  23. package/src/modules/ekubo-pricer.ts +79 -0
  24. package/src/modules/ekubo-quoter.ts +48 -30
  25. package/src/modules/erc20.ts +17 -0
  26. package/src/modules/harvests.ts +43 -29
  27. package/src/modules/pragma.ts +23 -8
  28. package/src/modules/pricer-from-api.ts +156 -15
  29. package/src/modules/pricer-lst.ts +1 -1
  30. package/src/modules/pricer.ts +40 -4
  31. package/src/modules/pricerBase.ts +2 -1
  32. package/src/node/deployer.ts +36 -1
  33. package/src/node/pricer-redis.ts +2 -1
  34. package/src/strategies/base-strategy.ts +78 -10
  35. package/src/strategies/ekubo-cl-vault.tsx +906 -347
  36. package/src/strategies/factory.ts +159 -0
  37. package/src/strategies/index.ts +7 -1
  38. package/src/strategies/registry.ts +239 -0
  39. package/src/strategies/sensei.ts +335 -7
  40. package/src/strategies/svk-strategy.ts +97 -27
  41. package/src/strategies/types.ts +4 -0
  42. package/src/strategies/universal-adapters/adapter-utils.ts +2 -1
  43. package/src/strategies/universal-adapters/avnu-adapter.ts +180 -265
  44. package/src/strategies/universal-adapters/baseAdapter.ts +263 -251
  45. package/src/strategies/universal-adapters/common-adapter.ts +206 -203
  46. package/src/strategies/universal-adapters/extended-adapter.ts +490 -316
  47. package/src/strategies/universal-adapters/index.ts +11 -8
  48. package/src/strategies/universal-adapters/svk-troves-adapter.ts +364 -0
  49. package/src/strategies/universal-adapters/token-transfer-adapter.ts +200 -0
  50. package/src/strategies/universal-adapters/usdc<>usdce-adapter.ts +200 -0
  51. package/src/strategies/universal-adapters/vesu-adapter.ts +120 -82
  52. package/src/strategies/universal-adapters/vesu-modify-position-adapter.ts +476 -0
  53. package/src/strategies/universal-adapters/vesu-multiply-adapter.ts +1067 -704
  54. package/src/strategies/universal-adapters/vesu-position-common.ts +251 -0
  55. package/src/strategies/universal-adapters/vesu-supply-only-adapter.ts +18 -3
  56. package/src/strategies/universal-lst-muliplier-strategy.tsx +397 -204
  57. package/src/strategies/universal-strategy.tsx +1426 -1173
  58. package/src/strategies/vesu-extended-strategy/services/executionService.ts +2233 -0
  59. package/src/strategies/vesu-extended-strategy/services/extended-vesu-state-manager.ts +4087 -0
  60. package/src/strategies/vesu-extended-strategy/services/ltv-imbalance-rebalance-math.ts +783 -0
  61. package/src/strategies/vesu-extended-strategy/services/operationService.ts +38 -16
  62. package/src/strategies/vesu-extended-strategy/types/transaction-metadata.ts +88 -0
  63. package/src/strategies/vesu-extended-strategy/utils/config.runtime.ts +1 -0
  64. package/src/strategies/vesu-extended-strategy/utils/constants.ts +5 -6
  65. package/src/strategies/vesu-extended-strategy/utils/helper.ts +259 -103
  66. package/src/strategies/vesu-extended-strategy/vesu-extended-strategy.tsx +688 -817
  67. package/src/strategies/vesu-rebalance.tsx +255 -152
  68. package/src/utils/cacheClass.ts +11 -2
  69. package/src/utils/health-factor-math.ts +4 -1
  70. package/src/utils/index.ts +3 -1
  71. package/src/utils/logger.browser.ts +22 -4
  72. package/src/utils/logger.node.ts +259 -24
  73. package/src/utils/starknet-call-parser.ts +1036 -0
  74. package/src/utils/strategy-utils.ts +61 -0
  75. package/src/strategies/universal-adapters/unused-balance-adapter.ts +0 -109
@@ -55,6 +55,68 @@ export interface IProtocol {
55
55
  logo: string;
56
56
  }
57
57
 
58
+ export enum StrategyTag {
59
+ META_VAULT = "Meta Vaults",
60
+ LEVERED = "Maxx",
61
+ AUTOMATED_LP = "Ekubo",
62
+ BTC = "BTC"
63
+ }
64
+
65
+ export enum VaultType {
66
+ LOOPING = "Looping",
67
+ META_VAULT = "Meta Vault",
68
+ DELTA_NEUTRAL = "Delta Neutral",
69
+ AUTOMATED_LP = "Automated LP",
70
+ }
71
+
72
+ // Security metadata enums
73
+ export enum AuditStatus {
74
+ AUDITED = "Audited",
75
+ NOT_AUDITED = "Not Audited",
76
+ }
77
+
78
+ export enum SourceCodeType {
79
+ OPEN_SOURCE = "Open Source",
80
+ CLOSED_SOURCE = "Closed Source",
81
+ }
82
+
83
+ export enum AccessControlType {
84
+ MULTISIG_ACCOUNT = "Multisig Account",
85
+ STANDARD_ACCOUNT = "Standard Account",
86
+ }
87
+
88
+ export enum InstantWithdrawalVault {
89
+ YES = "Yes",
90
+ NO = "No",
91
+ }
92
+
93
+ // Security metadata interfaces
94
+ export interface SourceCodeInfo {
95
+ type: SourceCodeType;
96
+ contractLink: string;
97
+ }
98
+
99
+ export interface AccessControlInfo {
100
+ type: AccessControlType;
101
+ addresses: ContractAddr[];
102
+ timeLock: string;
103
+ }
104
+
105
+ export interface SecurityMetadata {
106
+ auditStatus: AuditStatus;
107
+ sourceCode: SourceCodeInfo;
108
+ accessControl: AccessControlInfo;
109
+ }
110
+
111
+ export interface RedemptionInfo {
112
+ instantWithdrawalVault: InstantWithdrawalVault;
113
+ redemptionsInfo: {
114
+ title: string; // e.g. Upto $1M
115
+ description: string; // e.g. "1-2 hours"
116
+ }[],
117
+ alerts: StrategyAlert[];
118
+ }
119
+
58
120
  export enum FlowChartColors {
59
121
  Green = "purple",
60
122
  Blue = "#35484f",
@@ -66,26 +128,65 @@ export interface FAQ {
66
128
  answer: string | React.ReactNode;
67
129
  }
68
130
 
131
+ export enum StrategyLiveStatus {
132
+ ACTIVE = "Active",
133
+ NEW = "New",
134
+ COMING_SOON = "Coming Soon",
135
+ DEPRECATED = "Deprecated", // active but not recommended
136
+ RETIRED = "Retired", // not active anymore
137
+ HOT = "Hot & New 🔥"
138
+ }
139
+
140
+ export interface StrategyAlert {
141
+ type: "warning" | "info";
142
+ text: string | React.ReactNode;
143
+ tab: "all" | "deposit" | "withdraw";
144
+ }
145
+
146
+ export interface StrategySettings {
147
+ maxTVL?: Web3Number;
148
+ liveStatus?: StrategyLiveStatus;
149
+ isPaused?: boolean;
150
+ isInMaintenance?: boolean;
151
+ isAudited: boolean;
152
+ isInstantWithdrawal?: boolean;
153
+ hideHarvestInfo?: boolean;
154
+ is_promoted?: boolean;
155
+ isTransactionHistDisabled?: boolean;
156
+ quoteToken: TokenInfo;
157
+ hideNetEarnings?: boolean;
158
+ showWithdrawalWarningModal?: boolean;
159
+ alerts?: StrategyAlert[];
160
+ tags?: StrategyTag[];
161
+ }
162
+
69
163
  /**
70
164
  * @property risk.riskFactor.factor - The risk factors that are considered for the strategy.
71
165
  * @property risk.riskFactor.factor - The value of the risk factor from 0 to 10, 0 being the lowest and 10 being the highest.
166
+ * @property security - Security-related metadata including audit status, source code information, and access control details.
167
+ * @property redemptionInfo - Redemption information including instant withdrawal availability and expected redemption times.
72
168
  */
73
169
  export interface IStrategyMetadata<T> {
170
+ id: string;
74
171
  name: string;
75
172
  description: string | React.ReactNode;
76
173
  address: ContractAddr;
77
174
  launchBlock: number;
78
175
  type: "ERC4626" | "ERC721" | "Other";
176
+ vaultType: {
177
+ type: VaultType;
178
+ description: string;
179
+ };
79
180
  depositTokens: TokenInfo[];
80
181
  protocols: IProtocol[];
81
182
  auditUrl?: string;
82
- maxTVL: Web3Number;
83
183
  risk: {
84
184
  riskFactor: RiskFactor[];
85
185
  netRisk: number;
86
186
  notARisks: RiskType[];
87
187
  };
88
188
  apyMethodology?: string;
189
+ realizedAPYMethodology?: string;
89
190
  additionalInfo: T;
90
191
  contractDetails: {
91
192
  address: ContractAddr;
@@ -97,7 +198,30 @@ export interface IStrategyMetadata<T> {
97
198
  docs?: string;
98
199
  investmentSteps: string[];
99
200
  curator?: { name: string, logo: string },
100
- isPreview?: boolean
201
+ isPreview?: boolean;
202
+ tags?: StrategyTag[];
203
+ security: SecurityMetadata;
204
+ redemptionInfo: RedemptionInfo;
205
+ usualTimeToEarnings: null | string; // e.g. "2 weeks" // some strats grow like step functions
206
+ usualTimeToEarningsDescription: null | string; // e.g. "LSTs price on DEX goes up roughly every 2 weeks"
207
+ discontinuationInfo?: {
208
+ date?: Date;
209
+ reason?: React.ReactNode | string;
210
+ info?: React.ReactNode | string;
211
+ };
212
+ settings?: StrategySettings;
213
+ // Legacy field for multi-step strategies (deprecated, use investmentFlows instead)
214
+ actions?: Array<{
215
+ name?: string;
216
+ pool?: {
217
+ protocol?: { name: string; logo: string };
218
+ pool?: { name: string; logos?: string[] };
219
+ apr?: number;
220
+ borrow?: { apr?: number };
221
+ };
222
+ amount?: string | number;
223
+ isDeposit?: boolean;
224
+ }>;
101
225
  }
102
226
 
103
227
  export interface IInvestmentFlow {
@@ -124,6 +248,23 @@ export function getMainnetConfig(
124
248
  };
125
249
  }
126
250
 
251
+ export const getStrategyTagDesciption = (tag: StrategyTag): string => {
252
+ switch (tag) {
253
+ case StrategyTag.META_VAULT:
254
+ return "A meta vault is a vault that auto allocates funds to multiple vaults based on optimal yield opportunities";
255
+ case StrategyTag.LEVERED:
256
+ return "Looping vaults on Endur LSTs with leveraged borrowing of STRK or BTC to increase yield (2-4x higher yield than simply staking)";
257
+ case StrategyTag.AUTOMATED_LP:
258
+ return "Automated LP vaults on Ekubo that rebalance position automatically, ensuring you earn fees efficiently";
259
+ case StrategyTag.BTC:
260
+ return "BTC linked vaults";
261
+ }
262
+ }
263
+
264
+ export const getAllStrategyTags = (): StrategyTag[] => {
265
+ return Object.values(StrategyTag);
266
+ }
267
+
127
268
  export const getRiskExplaination = (riskType: RiskType) => {
128
269
  switch (riskType) {
129
270
  case RiskType.MARKET_RISK:
@@ -215,6 +356,30 @@ export interface VaultPosition {
215
356
  protocol: IProtocol
216
357
  }
217
358
 
359
+ export interface AmountInfo {
360
+ amount: Web3Number;
361
+ usdValue: number;
362
+ tokenInfo: TokenInfo;
363
+ }
364
+
365
+ export interface AmountsInfo {
366
+ usdValue: number;
367
+ amounts: AmountInfo[];
368
+ }
369
+
370
+ /**
371
+ * Strategy capabilities interface
372
+ * Describes what optional methods a strategy instance supports
373
+ */
374
+ export interface StrategyCapabilities {
375
+ hasMatchInputAmounts: boolean;
376
+ hasNetAPY: boolean;
377
+ hasGetInvestmentFlows: boolean;
378
+ hasGetPendingRewards: boolean;
379
+ hasHarvest: boolean;
380
+ hasRebalance: boolean;
381
+ }
382
+
218
383
  const VesuProtocol: IProtocol = {
219
384
  name: "Vesu",
220
385
  logo: "https://static-assets-8zct.onrender.com/integrations/vesu/logo.png"
@@ -249,6 +414,12 @@ const VaultProtocol: IProtocol = {
249
414
  name: "Vault",
250
415
  logo: ""
251
416
  }
417
+
418
+ const TrovesProtocol: IProtocol = {
419
+ name: "Troves",
420
+ logo: "https://app.troves.fi/favicon.ico"
421
+ };
422
+
252
423
  export const Protocols = {
253
424
  NONE: NoneProtocol,
254
425
  VESU: VesuProtocol,
@@ -256,5 +427,6 @@ export const Protocols = {
256
427
  EXTENDED: ExtendedProtocol,
257
428
  EKUBO: EkuboProtocol,
258
429
  AVNU: AvnuProtocol,
259
- VAULT: VaultProtocol
430
+ VAULT: VaultProtocol,
431
+ TROVES: TrovesProtocol
260
432
  }
@@ -79,9 +79,10 @@ export enum AssetOperationType {
79
79
  }
80
80
 
81
81
  export enum AssetOperationStatus {
82
- PENDING = "PENDING",
82
+ CREATED = "CREATED",
83
+ IN_PROGRESS = "IN_PROGRESS",
83
84
  COMPLETED = "COMPLETED",
84
- FAILED = "FAILED",
85
+ REJECTED = "REJECTED",
85
86
  }
86
87
 
87
88
  // Base types
@@ -237,7 +238,7 @@ export interface Market {
237
238
 
238
239
  // Asset operation types
239
240
  export interface AssetOperation {
240
- id: number;
241
+ id: string;
241
242
  type: AssetOperationType;
242
243
  status: AssetOperationStatus;
243
244
  amount: string;
@@ -255,6 +256,7 @@ export interface CreateOrderRequest {
255
256
  price: string;
256
257
  side: OrderSide;
257
258
  post_only?: boolean;
259
+ reduce_only?: boolean;
258
260
  previous_order_id?: number;
259
261
  external_id?: string;
260
262
  time_in_force?: TimeInForce;
@@ -293,7 +295,8 @@ export interface ExtendedApiResponse<T> {
293
295
 
294
296
  // Configuration types
295
297
  export interface ExtendedWrapperConfig {
296
- baseUrl: string;
298
+ readUrl: string;
299
+ writeUrl: string;
297
300
  apiKey?: string;
298
301
  timeout?: number;
299
302
  retries?: number;
@@ -308,4 +311,24 @@ export interface FundingRate {
308
311
  m: string;
309
312
  f:string;
310
313
  t:number;
311
- }
314
+ }
315
+
316
+ export interface FundingPayment {
317
+ id: number;
318
+ accountId?: number;
319
+ account_id?: number;
320
+ market: string;
321
+ positionId?: number;
322
+ position_id?: number;
323
+ side: PositionSide;
324
+ size: string;
325
+ value: string;
326
+ markPrice?: string;
327
+ mark_price?: string;
328
+ fundingFee?: string;
329
+ funding_fee?: string;
330
+ fundingRate?: string;
331
+ funding_rate?: string;
332
+ paidTime?: number;
333
+ paid_time?: number;
334
+ }