@strkfarm/sdk 1.0.28 → 1.0.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.
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ declare class _Web3Number<T extends _Web3Number<T>> extends BigNumber {
18
18
  toJSON(): string;
19
19
  valueOf(): string;
20
20
  private maxToFixedDecimals;
21
+ private getStandardString;
21
22
  }
22
23
 
23
24
  declare class Web3Number extends _Web3Number<Web3Number> {
@@ -61,6 +62,7 @@ interface TokenInfo {
61
62
  decimals: number;
62
63
  logo: string;
63
64
  coingeckId?: string;
65
+ displayDecimals: number;
64
66
  }
65
67
  declare enum Network {
66
68
  mainnet = "mainnet",
@@ -100,9 +102,11 @@ interface IStrategyMetadata<T> {
100
102
  netRisk: number;
101
103
  notARisks: string[];
102
104
  };
105
+ apyMethodology?: string;
103
106
  additionalInfo: T;
104
107
  }
105
108
  interface IInvestmentFlow {
109
+ id?: string;
106
110
  title: string;
107
111
  subItems: {
108
112
  key: string;
@@ -276,8 +280,8 @@ interface SwapInfo {
276
280
  routes: Route[];
277
281
  }
278
282
  declare class AvnuWrapper {
279
- getQuotes(fromToken: string, toToken: string, amountWei: string, taker: string): Promise<Quote>;
280
- getSwapInfo(quote: Quote, taker: string, integratorFeeBps: number, integratorFeeRecipient: string, minAmount: string): Promise<SwapInfo>;
283
+ getQuotes(fromToken: string, toToken: string, amountWei: string, taker: string, retry?: number): Promise<Quote>;
284
+ getSwapInfo(quote: Quote, taker: string, integratorFeeBps: number, integratorFeeRecipient: string, minAmount?: string): Promise<SwapInfo>;
281
285
  }
282
286
 
283
287
  declare const logger: {
@@ -382,7 +386,7 @@ interface DualActionAmount {
382
386
  token1: SingleActionAmount;
383
387
  }
384
388
  interface DualTokenInfo {
385
- netUsdValue: number;
389
+ usdValue: number;
386
390
  token0: SingleTokenInfo;
387
391
  token1: SingleTokenInfo;
388
392
  }
@@ -391,8 +395,8 @@ declare class BaseStrategy<TVLInfo, ActionInfo> {
391
395
  constructor(config: IConfig);
392
396
  getUserTVL(user: ContractAddr): Promise<TVLInfo>;
393
397
  getTVL(): Promise<TVLInfo>;
394
- depositCall(amountInfo: ActionInfo, receiver: ContractAddr): Call[];
395
- withdrawCall(amountInfo: ActionInfo, receiver: ContractAddr, owner: ContractAddr): Call[];
398
+ depositCall(amountInfo: ActionInfo, receiver: ContractAddr): Promise<Call[]>;
399
+ withdrawCall(amountInfo: ActionInfo, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
396
400
  }
397
401
 
398
402
  interface PoolProps {
@@ -454,7 +458,7 @@ declare class VesuRebalance extends BaseStrategy<SingleTokenInfo, SingleActionAm
454
458
  * @param receiver - Address that will receive the strategy tokens
455
459
  * @returns Populated contract call for deposit
456
460
  */
457
- depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): starknet.Call[];
461
+ depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<starknet.Call[]>;
458
462
  /**
459
463
  * Creates a withdrawal call to the strategy contract.
460
464
  * @param assets - Amount of assets to withdraw
@@ -462,7 +466,7 @@ declare class VesuRebalance extends BaseStrategy<SingleTokenInfo, SingleActionAm
462
466
  * @param owner - Address that owns the strategy tokens
463
467
  * @returns Populated contract call for withdrawal
464
468
  */
465
- withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): starknet.Call[];
469
+ withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<starknet.Call[]>;
466
470
  /**
467
471
  * Returns the underlying asset token of the strategy.
468
472
  * @returns The deposit token supported by this strategy
@@ -543,6 +547,10 @@ declare class VesuRebalance extends BaseStrategy<SingleTokenInfo, SingleActionAm
543
547
  isErrorPoolsAPI: boolean;
544
548
  isError: boolean;
545
549
  }>;
550
+ getVesuPools(retry?: number): Promise<{
551
+ pools: any[];
552
+ isErrorPoolsAPI: boolean;
553
+ }>;
546
554
  /**
547
555
  * Calculates the weighted average APY across all pools based on USD value.
548
556
  * @returns {Promise<number>} The weighted average APY across all pools
@@ -587,6 +595,7 @@ declare class VesuRebalance extends BaseStrategy<SingleTokenInfo, SingleActionAm
587
595
  */
588
596
  getRebalanceCall(pools: Awaited<ReturnType<typeof this.getRebalancedPositions>>['changes'], isOverWeightAdjustment: boolean): Promise<starknet.Call | null>;
589
597
  getInvestmentFlows(pools: PoolInfoFull[]): Promise<IInvestmentFlow[]>;
598
+ harvest(acc: Account): Promise<starknet.Call[]>;
590
599
  }
591
600
  /**
592
601
  * Represents the Vesu Rebalance Strategies.
@@ -617,6 +626,7 @@ interface CLVaultStrategySettings {
617
626
  upper: number;
618
627
  };
619
628
  lstContract: ContractAddr;
629
+ feeBps: number;
620
630
  }
621
631
  declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount> {
622
632
  /** Contract address of the strategy */
@@ -641,28 +651,46 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
641
651
  * @throws {Error} If more than one deposit token is specified
642
652
  */
643
653
  constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<CLVaultStrategySettings>);
644
- depositCall(amountInfo: DualActionAmount, receiver: ContractAddr): Call[];
645
- withdrawCall(amountInfo: DualActionAmount, receiver: ContractAddr, owner: ContractAddr): Call[];
654
+ matchInputAmounts(amountInfo: DualActionAmount): Promise<DualActionAmount>;
655
+ /** Returns minimum amounts give given two amounts based on what can be added for liq */
656
+ getMinDepositAmounts(amountInfo: DualActionAmount): Promise<DualActionAmount>;
657
+ depositCall(amountInfo: DualActionAmount, receiver: ContractAddr): Promise<Call[]>;
658
+ tokensToShares(amountInfo: DualActionAmount): Promise<Web3Number>;
659
+ withdrawCall(amountInfo: DualActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
646
660
  rebalanceCall(newBounds: EkuboBounds, swapParams: SwapInfo): Call[];
647
661
  handleUnusedCall(swapParams: SwapInfo): Call[];
648
662
  handleFeesCall(): Call[];
649
- getUserTVL(user: ContractAddr): Promise<DualTokenInfo>;
650
- getTVL(): Promise<DualTokenInfo>;
663
+ /**
664
+ * Calculates assets before and now in a given token of TVL per share to observe growth
665
+ * @returns {Promise<number>} The weighted average APY across all pools
666
+ */
667
+ netAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number): Promise<number>;
668
+ getHarvestRewardShares(fromBlock: number, toBlock: number): Promise<Web3Number>;
669
+ balanceOf(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<Web3Number>;
670
+ getUserTVL(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<DualTokenInfo>;
671
+ _getTVL(blockIdentifier?: BlockIdentifier): Promise<{
672
+ amount0: Web3Number;
673
+ amount1: Web3Number;
674
+ }>;
675
+ totalSupply(blockIdentifier?: BlockIdentifier): Promise<Web3Number>;
676
+ assertValidDepositTokens(poolKey: EkuboPoolKey): void;
677
+ getTVL(blockIdentifier?: BlockIdentifier): Promise<DualTokenInfo>;
651
678
  getUncollectedFees(): Promise<DualTokenInfo>;
652
679
  getCurrentNFTID(): Promise<number>;
653
680
  truePrice(): Promise<number>;
654
- getCurrentPrice(): Promise<{
681
+ getCurrentPrice(blockIdentifier?: BlockIdentifier): Promise<{
655
682
  price: number;
656
683
  tick: number;
684
+ sqrtRatio: any;
657
685
  }>;
658
686
  private _getCurrentPrice;
659
- getCurrentBounds(): Promise<EkuboBounds>;
687
+ getCurrentBounds(blockIdentifier?: BlockIdentifier): Promise<EkuboBounds>;
660
688
  static div2Power128(num: BigInt): number;
661
689
  static priceToTick(price: number, isRoundDown: boolean, tickSpacing: number): {
662
690
  mag: number;
663
691
  sign: number;
664
692
  };
665
- getPoolKey(): Promise<EkuboPoolKey>;
693
+ getPoolKey(blockIdentifier?: BlockIdentifier): Promise<EkuboPoolKey>;
666
694
  getNewBounds(): Promise<EkuboBounds>;
667
695
  /**
668
696
  * Computes the expected amounts to fully utilize amount in
@@ -674,6 +702,21 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
674
702
  private _getExpectedAmountsForLiquidity;
675
703
  private _solveExpectedAmountsEq;
676
704
  getSwapInfoToHandleUnused(considerRebalance?: boolean): Promise<SwapInfo>;
705
+ getSwapInfoGivenAmounts(poolKey: EkuboPoolKey, token0Bal: Web3Number, token1Bal: Web3Number, bounds: EkuboBounds): Promise<SwapInfo>;
706
+ /**
707
+ * Attempts to rebalance the vault by iteratively adjusting swap amounts if initial attempt fails.
708
+ * Uses binary search approach to find optimal swap amount.
709
+ *
710
+ * @param newBounds - The new tick bounds to rebalance to
711
+ * @param swapInfo - Initial swap parameters for rebalancing
712
+ * @param acc - Account to estimate gas fees with
713
+ * @param retry - Current retry attempt number (default 0)
714
+ * @param adjustmentFactor - Percentage to adjust swap amount by (default 1)
715
+ * @param isToken0Deficit - Whether token0 balance needs increasing (default true)
716
+ * @returns Array of contract calls needed for rebalancing
717
+ * @throws Error if max retries reached without successful rebalance
718
+ */
719
+ rebalanceIter(swapInfo: SwapInfo, acc: Account, estimateCall: (swapInfo: SwapInfo) => Promise<Call[]>, retry?: number, adjustmentFactor?: number, isToken0Deficit?: boolean): Promise<Call[]>;
677
720
  static tickToi129(tick: number): {
678
721
  mag: number;
679
722
  sign: number;
@@ -684,10 +727,16 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
684
727
  sign: number;
685
728
  }): bigint;
686
729
  static tickToPrice(tick: bigint): number;
687
- getLiquidityToAmounts(liquidity: Web3Number, bounds: EkuboBounds): Promise<{
730
+ getLiquidityToAmounts(liquidity: Web3Number, bounds: EkuboBounds, blockIdentifier?: BlockIdentifier, _poolKey?: EkuboPoolKey | null, _currentPrice?: {
731
+ price: number;
732
+ tick: number;
733
+ sqrtRatio: string;
734
+ } | null): Promise<{
688
735
  amount0: Web3Number;
689
736
  amount1: Web3Number;
690
737
  }>;
738
+ harvest(acc: Account): Promise<Call[]>;
739
+ getInvestmentFlows(): Promise<IInvestmentFlow[]>;
691
740
  }
692
741
  /**
693
742
  * Represents the Vesu Rebalance Strategies.
@@ -803,4 +852,4 @@ declare class PasswordJsonCryptoUtil {
803
852
  decrypt(encryptedData: string, password: string): any;
804
853
  }
805
854
 
806
- export { type AccountInfo, type AllAccountsStore, AutoCompounderSTRK, AvnuWrapper, type CLVaultStrategySettings, ContractAddr, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, FatalError, FlowChartColors, Global, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, Initializable, type LendingToken, MarginType, Network, PasswordJsonCryptoUtil, Pragma, type PriceInfo, Pricer, PricerFromApi, PricerRedis, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, Store, type StoreConfig, type SwapInfo, TelegramNotif, type TokenInfo, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, Web3Number, ZkLend, assert, getAPIUsingHeadlessBrowser, getDefaultStoreConfig, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, logger };
855
+ export { type AccountInfo, type AllAccountsStore, AutoCompounderSTRK, AvnuWrapper, BaseStrategy, type CLVaultStrategySettings, ContractAddr, type DualActionAmount, type DualTokenInfo, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, FatalError, FlowChartColors, Global, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, Initializable, type LendingToken, MarginType, Network, PasswordJsonCryptoUtil, Pragma, type PriceInfo, Pricer, PricerFromApi, PricerRedis, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type SingleActionAmount, type SingleTokenInfo, Store, type StoreConfig, type SwapInfo, TelegramNotif, type TokenInfo, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, Web3Number, ZkLend, assert, getAPIUsingHeadlessBrowser, getDefaultStoreConfig, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, logger };