@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
@@ -3,258 +3,398 @@ import { BlockIdentifier, BlockTag, constants, RpcProvider } from "starknet";
3
3
  import React, { ReactNode } from "react";
4
4
 
5
5
  export enum RiskType {
6
- MARKET_RISK = "Market Risk",
7
- // if non-correalted pairs, this is 3 (STRK/USDC)
8
- // if highly correalted pairs, this is 1 (e.g. xSTRK/STRK)
9
- // if correalted pairs, this is 2 (e.g. BTC/SOL)
10
- // If there is added leverage on top, can go till 5
11
- IMPERMANENT_LOSS = "Impermanent Loss Risk",
12
- LIQUIDATION_RISK = "Liquidation Risk",
13
- LOW_LIQUIDITY_RISK = "Low Liquidity Risk",
14
- SMART_CONTRACT_RISK = "Smart Contract Risk",
15
- ORACLE_RISK = "Oracle Risk",
16
- TECHNICAL_RISK = "Technical Risk",
17
- COUNTERPARTY_RISK = "Counterparty Risk", // e.g. bad debt
18
- DEPEG_RISK = "Depeg Risk" // e.g. USDC depeg
6
+ MARKET_RISK = "Market Risk",
7
+ // if non-correalted pairs, this is 3 (STRK/USDC)
8
+ // if highly correalted pairs, this is 1 (e.g. xSTRK/STRK)
9
+ // if correalted pairs, this is 2 (e.g. BTC/SOL)
10
+ // If there is added leverage on top, can go till 5
11
+ IMPERMANENT_LOSS = "Impermanent Loss Risk",
12
+ LIQUIDATION_RISK = "Liquidation Risk",
13
+ LOW_LIQUIDITY_RISK = "Low Liquidity Risk",
14
+ SMART_CONTRACT_RISK = "Smart Contract Risk",
15
+ ORACLE_RISK = "Oracle Risk",
16
+ TECHNICAL_RISK = "Technical Risk",
17
+ COUNTERPARTY_RISK = "Counterparty Risk", // e.g. bad debt
18
+ DEPEG_RISK = "Depeg Risk" // e.g. USDC depeg
19
19
  }
20
20
 
21
21
  export interface RiskFactor {
22
- type: RiskType;
23
- value: number; // 0 to 5
24
- weight: number; // 0 to 100
25
- reason?: string; // optional reason for the risk factor
22
+ type: RiskType;
23
+ value: number; // 0 to 5
24
+ weight: number; // 0 to 100
25
+ reason?: string; // optional reason for the risk factor
26
26
  }
27
27
 
28
28
  export interface TokenInfo {
29
- name: string;
30
- symbol: string;
31
- address: ContractAddr;
32
- decimals: number;
33
- logo: string;
34
- coingeckId?: string;
35
- displayDecimals: number;
36
- priceProxySymbol?: string; // for tokens like illiquid tokens, we use a proxy symbol to get the price
37
- priceCheckAmount?: number; // for tokens like BTC, doing 1BTC price check may not be ideal, esp on illiquid netwrks like sn
29
+ name: string;
30
+ symbol: string;
31
+ address: ContractAddr;
32
+ decimals: number;
33
+ logo: string;
34
+ coingeckId?: string;
35
+ displayDecimals: number;
36
+ priceProxySymbol?: string; // for tokens like illiquid tokens, we use a proxy symbol to get the price
37
+ priceCheckAmount?: number; // for tokens like BTC, doing 1BTC price check may not be ideal, esp on illiquid netwrks like sn
38
38
  }
39
39
 
40
40
  export enum Network {
41
- mainnet = "mainnet",
42
- sepolia = "sepolia",
43
- devnet = "devnet"
41
+ mainnet = "mainnet",
42
+ sepolia = "sepolia",
43
+ devnet = "devnet"
44
44
  }
45
45
 
46
46
  export interface IConfig {
47
- provider: RpcProvider;
48
- network: Network;
49
- stage: "production" | "staging";
50
- heartbeatUrl?: string;
47
+ provider: RpcProvider;
48
+ network: Network;
49
+ stage: "production" | "staging";
50
+ heartbeatUrl?: string;
51
51
  }
52
52
 
53
53
  export interface IProtocol {
54
- name: string;
55
- logo: string;
54
+ name: string;
55
+ logo: string;
56
+ }
57
+
58
+ // Strategy-level enums
59
+ export enum StrategyCategory {
60
+ ALL = "all",
61
+ BTC = "btc",
62
+ META_VAULTS = "meta-vaults"
63
+ }
64
+
65
+ // Security metadata enums
66
+ export enum AuditStatus {
67
+ AUDITED = "Audited",
68
+ NOT_AUDITED = "Not Audited"
69
+ }
70
+
71
+ export enum SourceCodeType {
72
+ OPEN_SOURCE = "Open Source",
73
+ CLOSED_SOURCE = "Closed Source"
74
+ }
75
+
76
+ export enum AccessControlType {
77
+ MULTISIG_ACCOUNT = "Multisig Account",
78
+ STANDARD_ACCOUNT = "Standard Account"
79
+ }
80
+
81
+ export enum InstantWithdrawalVault {
82
+ YES = "Yes",
83
+ NO = "No"
84
+ }
85
+
86
+ // Security metadata interfaces
87
+ export interface SourceCodeInfo {
88
+ type: SourceCodeType;
89
+ contractLink: string;
90
+ }
91
+
92
+ export interface AccessControlInfo {
93
+ type: AccessControlType;
94
+ addresses: ContractAddr[];
95
+ timeLock: string;
96
+ }
97
+
98
+ export interface SecurityMetadata {
99
+ auditStatus: AuditStatus;
100
+ sourceCode: SourceCodeInfo;
101
+ accessControl: AccessControlInfo;
102
+ }
103
+
104
+ // Redemption metadata interfaces
105
+ export interface RedemptionExpectedTime {
106
+ upto1M: string;
107
+ upto10M: string;
108
+ above10M: string;
109
+ }
110
+
111
+ export interface RedemptionInfo {
112
+ instantWithdrawalVault: InstantWithdrawalVault;
113
+ expectedRedemptionTime?: RedemptionExpectedTime;
56
114
  }
57
115
 
58
116
  export enum FlowChartColors {
59
- Green = "purple",
60
- Blue = "#35484f",
61
- Purple = "#6e53dc"
117
+ Green = "purple",
118
+ Blue = "#35484f",
119
+ Purple = "#6e53dc"
62
120
  }
63
121
 
64
122
  export interface FAQ {
65
- question: string | React.ReactNode;
66
- answer: string | React.ReactNode;
123
+ question: string | React.ReactNode;
124
+ answer: string | React.ReactNode;
125
+ }
126
+
127
+ /**
128
+ * Strategy Live Status - indicates the current state of a strategy
129
+ */
130
+ export enum StrategyLiveStatus {
131
+ ACTIVE = "Active",
132
+ NEW = "New",
133
+ COMING_SOON = "Coming Soon",
134
+ RETIRED = "Retired",
135
+ HOT = "Hot & New 🔥"
136
+ }
137
+
138
+ /**
139
+ * Strategy Tags - used for filtering and categorization
140
+ */
141
+ export enum StrategyTag {
142
+ EKUBO = "Ekubo",
143
+ EVERGREEN = "Evergreen",
144
+ HYPER_LST = "Hyper-LST",
145
+ VESU = "Vesu",
146
+ SENSEI = "Sensei",
147
+ ENDUR = "Endur",
148
+ BTC = "BTC"
149
+ }
150
+
151
+ /**
152
+ * Strategy Alert - informational or warning messages for users
153
+ */
154
+ export interface StrategyAlert {
155
+ type: "warning" | "info";
156
+ text: string | React.ReactNode;
157
+ tab: "all" | "deposit" | "withdraw";
158
+ }
159
+
160
+ /**
161
+ * Strategy Settings - configuration and UI settings for strategies
162
+ */
163
+ export interface StrategySettings {
164
+ maxTVL?: Web3Number;
165
+ liveStatus?: StrategyLiveStatus;
166
+ isPaused?: boolean;
167
+ isInMaintenance?: boolean;
168
+ isAudited: boolean;
169
+ isInstantWithdrawal?: boolean;
170
+ hideHarvestInfo?: boolean;
171
+ is_promoted?: boolean;
172
+ isTransactionHistDisabled?: boolean;
173
+ quoteToken: TokenInfo;
174
+ hideNetEarnings?: boolean;
175
+ showWithdrawalWarningModal?: boolean;
176
+ alerts?: StrategyAlert[];
177
+ tags?: StrategyTag[];
67
178
  }
68
179
 
69
180
  /**
70
181
  * @property risk.riskFactor.factor - The risk factors that are considered for the strategy.
71
182
  * @property risk.riskFactor.factor - The value of the risk factor from 0 to 10, 0 being the lowest and 10 being the highest.
183
+ * @property security - Security-related metadata including audit status, source code information, and access control details.
184
+ * @property redemptionInfo - Redemption information including instant withdrawal availability and expected redemption times.
72
185
  */
73
186
  export interface IStrategyMetadata<T> {
74
- name: string;
75
- description: string | React.ReactNode;
76
- address: ContractAddr;
77
- launchBlock: number;
78
- type: "ERC4626" | "ERC721" | "Other";
79
- depositTokens: TokenInfo[];
80
- protocols: IProtocol[];
81
- auditUrl?: string;
82
- maxTVL: Web3Number;
83
- risk: {
84
- riskFactor: RiskFactor[];
85
- netRisk: number;
86
- notARisks: RiskType[];
87
- };
88
- apyMethodology?: string;
89
- additionalInfo: T;
90
- contractDetails: {
91
- address: ContractAddr;
187
+ id: string;
92
188
  name: string;
93
- sourceCodeUrl?: string;
94
- }[],
95
- faqs: FAQ[];
96
- points?: {multiplier: number, logo: string, toolTip?: string}[];
97
- docs?: string;
98
- investmentSteps: string[];
99
- curator?: { name: string, logo: string },
100
- isPreview?: boolean
189
+ description: string | React.ReactNode;
190
+ address: ContractAddr;
191
+ launchBlock: number;
192
+ type: "ERC4626" | "ERC721" | "Other";
193
+ depositTokens: TokenInfo[];
194
+ protocols: IProtocol[];
195
+ auditUrl?: string;
196
+ risk: {
197
+ riskFactor: RiskFactor[];
198
+ netRisk: number;
199
+ notARisks: RiskType[];
200
+ };
201
+ apyMethodology?: string;
202
+ additionalInfo: T;
203
+ contractDetails: {
204
+ address: ContractAddr;
205
+ name: string;
206
+ sourceCodeUrl?: string;
207
+ }[];
208
+ faqs: FAQ[];
209
+ points?: { multiplier: number; logo: string; toolTip?: string }[];
210
+ docs?: string;
211
+ investmentSteps: string[];
212
+ curator?: { name: string; logo: string };
213
+ isPreview?: boolean;
214
+ category?: StrategyCategory;
215
+ tags?: StrategyTag[];
216
+ security?: SecurityMetadata;
217
+ redemptionInfo?: RedemptionInfo;
218
+ settings?: StrategySettings;
219
+ // Legacy field for multi-step strategies (deprecated, use investmentFlows instead)
220
+ actions?: Array<{
221
+ name?: string;
222
+ pool?: {
223
+ protocol?: { name: string; logo: string };
224
+ pool?: { name: string; logos?: string[] };
225
+ apr?: number;
226
+ borrow?: { apr?: number };
227
+ };
228
+ amount?: string | number;
229
+ isDeposit?: boolean;
230
+ }>;
101
231
  }
102
232
 
103
233
  export interface IInvestmentFlow {
104
- id?: string; // used to link flows
105
- title: string;
106
- subItems: { key: string; value: string }[];
107
- linkedFlows: IInvestmentFlow[];
108
- style?: any;
234
+ id?: string; // used to link flows
235
+ title: string;
236
+ subItems: { key: string; value: string }[];
237
+ linkedFlows: IInvestmentFlow[];
238
+ style?: any;
109
239
  }
110
240
 
111
241
  export function getMainnetConfig(
112
- rpcUrl: string = 'https://starknet-mainnet.public.blastapi.io',
113
- blockIdentifier: BlockIdentifier = BlockTag.LATEST
114
- // specVersion = constants.SupportedRpcVersion.v0_8_1
242
+ rpcUrl: string = "https://starknet-mainnet.public.blastapi.io",
243
+ blockIdentifier: BlockIdentifier = BlockTag.LATEST
244
+ // specVersion = constants.SupportedRpcVersion.v0_8_1
115
245
  ): IConfig {
116
- return {
117
- provider: new RpcProvider({
118
- nodeUrl: rpcUrl,
119
- blockIdentifier: blockIdentifier,
120
- // specVersion
121
- }),
122
- stage: "production",
123
- network: Network.mainnet
124
- };
246
+ return {
247
+ provider: new RpcProvider({
248
+ nodeUrl: rpcUrl,
249
+ blockIdentifier: blockIdentifier
250
+ // specVersion
251
+ }),
252
+ stage: "production",
253
+ network: Network.mainnet
254
+ };
125
255
  }
126
256
 
127
257
  export const getRiskExplaination = (riskType: RiskType) => {
128
- switch (riskType) {
129
- case RiskType.MARKET_RISK:
130
- return "The risk of the market moving against the position.";
131
- case RiskType.IMPERMANENT_LOSS:
132
- return "The temporary loss of value experienced by liquidity providers in AMMs when asset prices diverge compared to simply holding them.";
133
- case RiskType.LIQUIDATION_RISK:
134
- return "The risk of losing funds due to the position being liquidated.";
135
- case RiskType.LOW_LIQUIDITY_RISK:
136
- return "The risk of low liquidity in the pool, which can lead to high slippages or reduced in-abilities to quickly exit the position.";
137
- case RiskType.ORACLE_RISK:
138
- return "The risk of the oracle being manipulated or incorrect.";
139
- case RiskType.SMART_CONTRACT_RISK:
140
- return "The risk of the smart contract being vulnerable to attacks.";
141
- case RiskType.TECHNICAL_RISK:
142
- return "The risk of technical issues e.g. backend failure.";
143
- case RiskType.COUNTERPARTY_RISK:
144
- return "The risk of the counterparty defaulting e.g. bad debt on lending platforms.";
145
- case RiskType.DEPEG_RISK:
146
- return "The risk of a token losing its peg to the underlying asset, leading to potential losses for holders.";
147
- }
258
+ switch (riskType) {
259
+ case RiskType.MARKET_RISK:
260
+ return "The risk of the market moving against the position.";
261
+ case RiskType.IMPERMANENT_LOSS:
262
+ return "The temporary loss of value experienced by liquidity providers in AMMs when asset prices diverge compared to simply holding them.";
263
+ case RiskType.LIQUIDATION_RISK:
264
+ return "The risk of losing funds due to the position being liquidated.";
265
+ case RiskType.LOW_LIQUIDITY_RISK:
266
+ return "The risk of low liquidity in the pool, which can lead to high slippages or reduced in-abilities to quickly exit the position.";
267
+ case RiskType.ORACLE_RISK:
268
+ return "The risk of the oracle being manipulated or incorrect.";
269
+ case RiskType.SMART_CONTRACT_RISK:
270
+ return "The risk of the smart contract being vulnerable to attacks.";
271
+ case RiskType.TECHNICAL_RISK:
272
+ return "The risk of technical issues e.g. backend failure.";
273
+ case RiskType.COUNTERPARTY_RISK:
274
+ return "The risk of the counterparty defaulting e.g. bad debt on lending platforms.";
275
+ case RiskType.DEPEG_RISK:
276
+ return "The risk of a token losing its peg to the underlying asset, leading to potential losses for holders.";
277
+ }
148
278
  };
149
279
 
150
280
  export const getRiskColor = (risk: RiskFactor) => {
151
- const value = risk.value;
152
- if (value <= 2) return "light_green_2";
153
- if (value < 3) return "yellow";
154
- return "red";
281
+ const value = risk.value;
282
+ if (value <= 2) return "light_green_2";
283
+ if (value < 3) return "yellow";
284
+ return "red";
155
285
  };
156
286
 
157
287
  export const getNoRiskTags = (risks: RiskFactor[]) => {
158
- const noRisks1 = risks
159
- .filter((risk) => risk.value === 0)
160
- .map((risk) => risk.type);
288
+ const noRisks1 = risks
289
+ .filter((risk) => risk.value === 0)
290
+ .map((risk) => risk.type);
161
291
 
162
- // const risks not present
163
- const noRisks2 = Object.values(RiskType).filter(
164
- (risk) => !risks.map((risk) => risk.type).includes(risk)
165
- );
292
+ // const risks not present
293
+ const noRisks2 = Object.values(RiskType).filter(
294
+ (risk) => !risks.map((risk) => risk.type).includes(risk)
295
+ );
166
296
 
167
- const mergedUnique = [...new Set([...noRisks1, ...noRisks2])];
297
+ const mergedUnique = [...new Set([...noRisks1, ...noRisks2])];
168
298
 
169
- // add `No` to the start of each risk
170
- return mergedUnique
299
+ // add `No` to the start of each risk
300
+ return mergedUnique;
171
301
  };
172
302
 
173
303
  interface HighlightLink {
174
- highlight: string;
175
- link: string;
304
+ highlight: string;
305
+ link: string;
176
306
  }
177
307
 
178
308
  export function highlightTextWithLinks(
179
- put: string,
180
- highlights: HighlightLink[],
309
+ put: string,
310
+ highlights: HighlightLink[]
181
311
  ): ReactNode {
182
- // Escape RegExp special characters in highlight strings
183
- const escapeRegExp = (text: string) =>
184
- text.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
185
-
186
- // Create a single regex for all highlight terms
187
- const pattern = new RegExp(
188
- `(${highlights.map(m => escapeRegExp(m.highlight)).join('|')})`,
189
- 'gi'
190
- );
191
-
192
- const parts = put.split(pattern);
193
-
194
- return (
195
- <>
196
- {parts.map((part, i) => {
197
- const match = highlights.find(m => m.highlight.toLowerCase() === part.toLowerCase());
198
- return match ? (
199
- <a key={i} href={match.link} target="_blank" style={{ color: 'var(--chakra-colors-white)', background: 'var(--chakra-colors-highlight)' }}>
200
- {part}
201
- </a>
202
- ) : (
203
- <span key={i}>{part}</span>
204
- );
205
- })}
206
- </>
207
- );
312
+ // Escape RegExp special characters in highlight strings
313
+ const escapeRegExp = (text: string) =>
314
+ text.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
315
+
316
+ // Create a single regex for all highlight terms
317
+ const pattern = new RegExp(
318
+ `(${highlights.map((m) => escapeRegExp(m.highlight)).join("|")})`,
319
+ "gi"
320
+ );
321
+
322
+ const parts = put.split(pattern);
323
+
324
+ return (
325
+ <>
326
+ {parts.map((part, i) => {
327
+ const match = highlights.find(
328
+ (m) => m.highlight.toLowerCase() === part.toLowerCase()
329
+ );
330
+ return match ? (
331
+ <a
332
+ key={i}
333
+ href={match.link}
334
+ target="_blank"
335
+ style={{
336
+ color: "var(--chakra-colors-white)",
337
+ background: "var(--chakra-colors-highlight)"
338
+ }}
339
+ >
340
+ {part}
341
+ </a>
342
+ ) : (
343
+ <span key={i}>{part}</span>
344
+ );
345
+ })}
346
+ </>
347
+ );
208
348
  }
209
349
 
210
350
  export interface VaultPosition {
211
- amount: Web3Number,
212
- usdValue: number,
213
- token: TokenInfo,
214
- remarks: string,
215
- protocol: IProtocol
351
+ amount: Web3Number;
352
+ usdValue: number;
353
+ token: TokenInfo;
354
+ remarks: string;
216
355
  }
217
356
 
218
- const VesuProtocol: IProtocol = {
219
- name: "Vesu",
220
- logo: "https://static-assets-8zct.onrender.com/integrations/vesu/logo.png"
221
- };
357
+ export interface AmountInfo {
358
+ amount: Web3Number;
359
+ usdValue: number;
360
+ tokenInfo: TokenInfo;
361
+ }
222
362
 
223
- const AvnuProtocol: IProtocol = {
224
- name: "Avnu",
225
- logo: "https://static-assets-8zct.onrender.com/integrations/avnu/logo.png"
363
+ export interface AmountsInfo {
364
+ usdValue: number;
365
+ amounts: AmountInfo[];
226
366
  }
227
367
 
228
- const EndurProtocol: IProtocol = {
229
- name: "Endur",
230
- logo: "http://endur.fi/logo.png"
368
+ /**
369
+ * Strategy capabilities interface
370
+ * Describes what optional methods a strategy instance supports
371
+ */
372
+ export interface StrategyCapabilities {
373
+ hasMatchInputAmounts: boolean;
374
+ hasNetAPY: boolean;
375
+ hasGetInvestmentFlows: boolean;
376
+ hasGetPendingRewards: boolean;
377
+ hasHarvest: boolean;
378
+ hasRebalance: boolean;
231
379
  }
232
380
 
233
- const ExtendedProtocol: IProtocol = {
234
- name: "Extended",
235
- logo: "https://static-assets-8zct.onrender.com/integrations/extended/extended.svg"
381
+ const VesuProtocol: IProtocol = {
382
+ name: "Vesu",
383
+ logo: "https://static-assets-8zct.onrender.com/integrations/vesu/logo.png"
236
384
  };
237
385
 
238
- const EkuboProtocol: IProtocol = {
239
- name: "Ekubo",
240
- logo: "https://app.ekubo.org/favicon.ico"
386
+ const EndurProtocol: IProtocol = {
387
+ name: "Endur",
388
+ logo: "http://endur.fi/logo.png"
241
389
  };
242
390
 
243
- const NoneProtocol: IProtocol = {
244
- name: "-",
245
- logo: ""
246
- }
391
+ const ExtendedProtocol: IProtocol = {
392
+ name: "Extended",
393
+ logo: "https://static-assets-8zct.onrender.com/integrations/extended/extended.svg"
394
+ };
247
395
 
248
- const VaultProtocol: IProtocol = {
249
- name: "Vault",
250
- logo: ""
251
- }
252
396
  export const Protocols = {
253
- NONE: NoneProtocol,
254
- VESU: VesuProtocol,
255
- ENDUR: EndurProtocol,
256
- EXTENDED: ExtendedProtocol,
257
- EKUBO: EkuboProtocol,
258
- AVNU: AvnuProtocol,
259
- VAULT: VaultProtocol
260
- }
397
+ VESU: VesuProtocol,
398
+ ENDUR: EndurProtocol,
399
+ EXTENDED: ExtendedProtocol
400
+ };
@@ -0,0 +1,28 @@
1
+ import { ApolloClient, InMemoryCache } from '@apollo/client';
2
+ import { IConfig } from '@/interfaces';
3
+
4
+ /**
5
+ * Creates an Apollo Client instance configured for the appropriate environment
6
+ * @param config - The application config containing network and stage information
7
+ * @returns Configured Apollo Client instance
8
+ */
9
+ export function createApolloClient(config: IConfig) {
10
+ // Determine the URI based on the environment
11
+ const uri = config.stage === 'production'
12
+ ? 'https://api.troves.fi/'
13
+ : 'http://localhost:4000';
14
+
15
+ return new ApolloClient({
16
+ uri,
17
+ cache: new InMemoryCache(),
18
+ });
19
+ }
20
+
21
+ // Default client for backward compatibility
22
+ const apolloClient = new ApolloClient({
23
+ uri: 'https://api.troves.fi/',
24
+ cache: new InMemoryCache(),
25
+ });
26
+
27
+ export default apolloClient;
28
+
@@ -37,7 +37,7 @@ export class AvnuWrapper {
37
37
  excludeSources = ['Haiko(Solvers)']
38
38
  ): Promise<Quote> {
39
39
  const MAX_RETRY = 5;
40
- logger.verbose(`${AvnuWrapper.name}: getQuotes => Getting quotes for ${fromToken} -> ${toToken}, amount: ${amountWei}, taker: ${taker}, retry: ${retry}`);
40
+ // logger.verbose(`${AvnuWrapper.name}: getQuotes => Getting quotes for ${fromToken} -> ${toToken}, amount: ${amountWei}, taker: ${taker}, retry: ${retry}`);
41
41
  const params: any = {
42
42
  sellTokenAddress: fromToken,
43
43
  buyTokenAddress: toToken,
@@ -100,9 +100,9 @@ export class AvnuWrapper {
100
100
  // swapInfo as expected by the strategy
101
101
  // fallback, max 1% slippage
102
102
  const _minAmount = minAmount || (quote.buyAmount * 95n / 100n).toString();
103
- logger.verbose(`${AvnuWrapper.name}: getSwapInfo => sellToken: ${quote.sellTokenAddress}, sellAmount: ${quote.sellAmount}`);
104
- logger.verbose(`${AvnuWrapper.name}: getSwapInfo => buyToken: ${quote.buyTokenAddress}`);
105
- logger.verbose(`${AvnuWrapper.name}: getSwapInfo => buyAmount: ${quote.buyAmount}, minAmount: ${_minAmount}`);
103
+ // logger.verbose(`${AvnuWrapper.name}: getSwapInfo => sellToken: ${quote.sellTokenAddress}, sellAmount: ${quote.sellAmount}`);
104
+ // logger.verbose(`${AvnuWrapper.name}: getSwapInfo => buyToken: ${quote.buyTokenAddress}`);
105
+ // logger.verbose(`${AvnuWrapper.name}: getSwapInfo => buyAmount: ${quote.buyAmount}, minAmount: ${_minAmount}`);
106
106
  const swapInfo: SwapInfo = {
107
107
  token_from_address: quote.sellTokenAddress,
108
108
  token_from_amount: uint256.bnToUint256(quote.sellAmount),
@@ -135,17 +135,4 @@ export class AvnuWrapper {
135
135
  routes: [],
136
136
  };
137
137
  }
138
-
139
-
140
- async getSwapCallData(
141
- quote: Pick<Quote, 'quoteId' | 'buyTokenAddress' | 'buyAmount' | 'sellTokenAddress' | 'sellAmount'>,
142
- taker: string,
143
- ) {
144
- const calldata = await fetchBuildExecuteTransaction(quote.quoteId, taker, undefined, false);
145
- const result = calldata.calls.map((call: Call) => {
146
- const data = call.calldata as string[];
147
- return data.map(x => BigInt(x));
148
- });
149
- return result;
150
- }
151
138
  }