@strkfarm/sdk 2.0.0-dev.40 → 2.0.0-dev.41

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
@@ -112,6 +112,7 @@ interface TokenInfo {
112
112
  displayDecimals: number;
113
113
  priceProxySymbol?: string;
114
114
  priceCheckAmount?: number;
115
+ dontPrice?: boolean;
115
116
  }
116
117
  declare enum Network {
117
118
  mainnet = "mainnet",
@@ -226,6 +227,9 @@ interface StrategyApyHistoryUIConfig {
226
227
  showApyHistory?: boolean;
227
228
  noApyHistoryMessage?: string;
228
229
  }
230
+ interface FeeBps {
231
+ performanceFeeBps: number;
232
+ }
229
233
  /**
230
234
  * @property risk.riskFactor.factor - The risk factors that are considered for the strategy.
231
235
  * @property risk.riskFactor.factor - The value of the risk factor from 0 to 10, 0 being the lowest and 10 being the highest.
@@ -266,6 +270,7 @@ interface IStrategyMetadata<T> {
266
270
  };
267
271
  apyMethodology?: string;
268
272
  realizedApyMethodology?: string;
273
+ feeBps?: FeeBps;
269
274
  additionalInfo: T;
270
275
  contractDetails: {
271
276
  address: ContractAddr;
@@ -429,18 +434,41 @@ declare abstract class Initializable {
429
434
  waitForInitilisation(): Promise<void>;
430
435
  }
431
436
 
437
+ /**
438
+ * Polls Avnu impulse tokens API and keeps USD prices in memory for configured tokens.
439
+ * Price timestamp is set when each poll request completes.
440
+ */
441
+ declare class PricerAvnuApi extends PricerBase {
442
+ protected prices: {
443
+ [key: string]: PriceInfo;
444
+ };
445
+ readonly refreshInterval = 15000;
446
+ readonly staleTime: number;
447
+ private pollTimer;
448
+ private loading;
449
+ constructor(config: IConfig, tokens: TokenInfo[]);
450
+ start(): void;
451
+ stop(): void;
452
+ isStale(timestamp: Date): boolean;
453
+ hasPrice(tokenSymbol: string): boolean;
454
+ getPrice(tokenSymbol: string): Promise<PriceInfo>;
455
+ protected _loadPrices(): Promise<void>;
456
+ }
457
+
432
458
  interface PriceInfo {
433
459
  price: number;
434
460
  timestamp: Date;
435
461
  }
462
+ type PriceMethod = 'AvnuApi' | 'Coinbase' | 'Coinmarketcap' | 'Ekubo' | 'Avnu';
436
463
  declare class Pricer extends PricerBase {
437
464
  protected prices: {
438
465
  [key: string]: PriceInfo;
439
466
  };
440
467
  refreshInterval: number;
441
468
  staleTime: number;
469
+ protected readonly avnuApiPricer: PricerAvnuApi;
442
470
  protected methodToUse: {
443
- [tokenSymbol: string]: 'Ekubo' | 'Coinbase' | 'Coinmarketcap' | 'Avnu';
471
+ [tokenSymbol: string]: PriceMethod;
444
472
  };
445
473
  /**
446
474
  * TOKENA and TOKENB are the two token names to get price of TokenA in terms of TokenB
@@ -455,7 +483,9 @@ declare class Pricer extends PricerBase {
455
483
  assertNotStale(timestamp: Date, tokenName: string): void;
456
484
  getPrice(tokenSymbol: string, blockNumber?: BlockIdentifier): Promise<PriceInfo>;
457
485
  protected _loadPrices(onUpdate?: (tokenSymbol: string) => void): void;
458
- _getPrice(token: TokenInfo, defaultMethod?: string): Promise<number>;
486
+ _getPrice(token: TokenInfo): Promise<number>;
487
+ protected _tryPriceMethod(token: TokenInfo, method: PriceMethod): Promise<number>;
488
+ _getPriceAvnuApi(token: TokenInfo): Promise<number>;
459
489
  _getPriceCoinbase(token: TokenInfo): Promise<number>;
460
490
  _getPriceCoinMarketCap(token: TokenInfo): Promise<number>;
461
491
  _getAvnuPrice(token: TokenInfo, amountIn?: Web3Number, retry?: number): Promise<number>;
@@ -2365,6 +2395,7 @@ declare abstract class SVKStrategy<S extends UniversalStrategySettings> extends
2365
2395
  asset(): TokenInfo;
2366
2396
  depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]>;
2367
2397
  withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
2398
+ getUserTVL(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<SingleTokenInfo>;
2368
2399
  /**
2369
2400
  * Returns the unused balance in the vault allocator.
2370
2401
  * Note: This function is common for any SVK strategy.
@@ -2433,6 +2464,8 @@ declare abstract class SVKStrategy<S extends UniversalStrategySettings> extends
2433
2464
  }[];
2434
2465
  }>;
2435
2466
  getTVL(): Promise<SingleTokenInfo>;
2467
+ getUserRealizedAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number): Promise<number>;
2468
+ getUserPositionCards(input: UserPositionCardsInput): Promise<UserPositionCard[]>;
2436
2469
  getPrevAUM(): Promise<Web3Number>;
2437
2470
  maxDepositables(): Promise<PositionInfo[]>;
2438
2471
  maxWithdrawables(): Promise<PositionInfo[]>;
@@ -2479,11 +2512,6 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends SVK
2479
2512
  asset(): TokenInfo;
2480
2513
  depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]>;
2481
2514
  withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
2482
- getUserTVL(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<{
2483
- tokenInfo: TokenInfo;
2484
- amount: Web3Number;
2485
- usdValue: number;
2486
- }>;
2487
2515
  getVesuAPYs(): Promise<{
2488
2516
  baseAPYs: number[];
2489
2517
  rewardAPYs: number[];
@@ -2512,12 +2540,6 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends SVK
2512
2540
  weight: number;
2513
2541
  }>;
2514
2542
  private computeAPY;
2515
- /**
2516
- * Calculates user realized APY based on trueSharesBasedAPY method.
2517
- * Returns the APY as a number.
2518
- */
2519
- getUserRealizedAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number): Promise<number>;
2520
- getUserPositionCards(input: UserPositionCardsInput): Promise<UserPositionCard[]>;
2521
2543
  /**
2522
2544
  * Calculates the total TVL of the strategy.
2523
2545
  * @returns Object containing the total amount in token units and USD value
@@ -2687,6 +2709,7 @@ declare class UniversalLstMultiplierStrategy<S extends HyperLSTStrategySettings>
2687
2709
  userShare: number;
2688
2710
  tokenInfo: TokenInfo;
2689
2711
  }>;
2712
+ getUserPositionCards(input: UserPositionCardsInput): Promise<UserPositionCard[]>;
2690
2713
  }
2691
2714
  declare const AUDIT_URL = "https://docs.troves.fi/p/security#starknet-vault-kit";
2692
2715
  declare function getFAQs(lstSymbol: string, underlyingSymbol: string, isLST: boolean): FAQ[];
@@ -2764,6 +2787,7 @@ declare class BoostedxSTRKCarryStrategy<S extends BoostedxSTRKCarryStrategySetti
2764
2787
  amount: Web3Number;
2765
2788
  usdValue: number;
2766
2789
  }>;
2790
+ getUserPositionCards(input: UserPositionCardsInput): Promise<UserPositionCard[]>;
2767
2791
  getAUM(): Promise<{
2768
2792
  net: SingleTokenInfo;
2769
2793
  prevAum: Web3Number;
@@ -3292,4 +3316,4 @@ declare class PasswordJsonCryptoUtil {
3292
3316
  decrypt(encryptedData: string, password: string): any;
3293
3317
  }
3294
3318
 
3295
- export { type APYInfo, APYType, AUDIT_URL, AUMTypes, AVNU_EXCHANGE, AVNU_EXCHANGE_FOR_LEGACY_USDC, AVNU_LEGACY_SANITIZER, AVNU_MIDDLEWARE, AVNU_QUOTE_URL, type AccessControlInfo, AccessControlType, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type AmountInfo, type AmountsInfo, type ApproveCallParams, AuditStatus, AutoCompounderSTRK, AvnuAdapter, type AvnuAdapterConfig, type AvnuDepositParams, type AvnuSwapCallParams, type AvnuWithdrawParams, AvnuWrapper, BaseAdapter, type BaseAdapterConfig, BaseStrategy, BoostedxSTRKCarryStrategies, BoostedxSTRKCarryStrategy, type BoostedxSTRKCarryStrategySettings, type CLVaultStrategySettings, CommonAdapter, type CommonAdapterConfig, ContractAddr, DEFAULT_TROVES_STRATEGIES_API, type DecreaseLeverParams, Deployer, type DepositParams, type DualActionAmount, type DualTokenInfo, ERC20, EXTENDED_CONTRACT, EXTENDED_SANITIZER, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, EkuboPricer, type EkuboQuote, EkuboQuoter, type EkuboRouteNode, type EkuboSplit, type FAQ, FactoryStrategyType, FatalError, type FilterOption, type FlashloanCallParams, FlowChartColors, type GenerateCallFn, Global, HealthFactorMath, HyperLSTStrategies, type HyperLSTStrategySettings, type IConfig, type ICurator, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, type InputModeFromAction, InstantWithdrawalVault, LSTAPRService, LSTPriceType, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type LoggerConfig, type LoggerLevel, type ManageCall, MarginType, Midas, MyNumber, type NetAPYDetails, type NetAPYSplit, Network, PRICE_ROUTER, type ParsedStarknetCall, PasswordJsonCryptoUtil, type PositionAPY, type PositionAmount, type PositionInfo, PositionTypeAvnuExtended, Pragma, type PriceInfo, Pricer, PricerBase, PricerFromApi, PricerLST, PricerRedis, Protocols, type RedemptionInfo, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, SVK_SIMPLE_SANITIZER, type SecurityMetadata, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, type SourceCodeInfo, SourceCodeType, StandardMerkleTree, type StandardMerkleTreeData, StarknetCallParser, type StarknetCallParserOptions, Store, type StoreConfig, type StrategyAlert, type StrategyApyHistoryUIConfig, type StrategyCapabilities, type StrategyFilterMetadata, type StrategyInputMode, StrategyLiveStatus, type StrategyMetadata, type StrategyRegistryEntry, type StrategySettings, StrategyTag, StrategyType, type SupportedPosition, SvkTrovesAdapter, type SvkTrovesAdapterConfig, type Swap, type SwapInfo, type SwapPriceInfo, TRANSFER_SANITIZER, TelegramGroupNotif, TelegramNotif, type TokenAmount, type TokenInfo, TokenMarketData, TokenTransferAdapter, type TokenTransferAdapterConfig, UNIVERSAL_ADAPTER_IDS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, UnwrapLabsCurator, type UserPositionCard, type UserPositionCardSubValueColor, type UserPositionCardsInput, type UserYoloInfo, VESU_SINGLETON, VESU_V2_MODIFY_POSITION_SANITIZER, type VaultPosition, VaultType, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, type VesuDefiSpringRewardsCallParams, type VesuDepositParams, type VesuModifyDelegationCallParams, VesuModifyPositionAdapter, type VesuModifyPositionAdapterConfig, type VesuModifyPositionCallParams, type VesuModifyPositionDepositParams, type VesuModifyPositionWithdrawParams, VesuMultiplyAdapter, type VesuMultiplyAdapterConfig, type VesuMultiplyCallParams, VesuPoolMetadata, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, VesuSupplyOnlyAdapter, type VesuSupplyOnlyAdapterConfig, type VesuWithdrawParams, Web3Number, type WithdrawParams, YoLoVault, type YoloSettings, type YoloSpendingLevel, type YoloVaultSettings, type YoloVaultStatus, YoloVaultStrategies, ZkLend, _riskFactor, assert, buildStrategyRegistry, configureLogger, createBoostedXSTRKCarryStrategy, createEkuboCLStrategy, createHyperLSTStrategy, createSenseiStrategy, createStrategy, createUniversalStrategy, createVesuRebalanceStrategy, createYoloVaultStrategy, detectCapabilities, extensionMap, getAPIUsingHeadlessBrowser, getAllStrategyMetadata, getAllStrategyTags, getContractDetails, getDefaultStoreConfig, getFAQs, getFilterMetadata, getInvestmentSteps, getLiveStrategies, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getStrategiesByType, getStrategyTagDesciption, getStrategyTypeFromMetadata, getTrovesEndpoint, getVesuSingletonAddress, highlightTextWithLinks, type i257, isDualTokenStrategy, logger, toAmountsInfo, toBigInt };
3319
+ export { type APYInfo, APYType, AUDIT_URL, AUMTypes, AVNU_EXCHANGE, AVNU_EXCHANGE_FOR_LEGACY_USDC, AVNU_LEGACY_SANITIZER, AVNU_MIDDLEWARE, AVNU_QUOTE_URL, type AccessControlInfo, AccessControlType, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type AmountInfo, type AmountsInfo, type ApproveCallParams, AuditStatus, AutoCompounderSTRK, AvnuAdapter, type AvnuAdapterConfig, type AvnuDepositParams, type AvnuSwapCallParams, type AvnuWithdrawParams, AvnuWrapper, BaseAdapter, type BaseAdapterConfig, BaseStrategy, BoostedxSTRKCarryStrategies, BoostedxSTRKCarryStrategy, type BoostedxSTRKCarryStrategySettings, type CLVaultStrategySettings, CommonAdapter, type CommonAdapterConfig, ContractAddr, DEFAULT_TROVES_STRATEGIES_API, type DecreaseLeverParams, Deployer, type DepositParams, type DualActionAmount, type DualTokenInfo, ERC20, EXTENDED_CONTRACT, EXTENDED_SANITIZER, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, EkuboPricer, type EkuboQuote, EkuboQuoter, type EkuboRouteNode, type EkuboSplit, type FAQ, FactoryStrategyType, FatalError, type FeeBps, type FilterOption, type FlashloanCallParams, FlowChartColors, type GenerateCallFn, Global, HealthFactorMath, HyperLSTStrategies, type HyperLSTStrategySettings, type IConfig, type ICurator, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, type InputModeFromAction, InstantWithdrawalVault, LSTAPRService, LSTPriceType, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type LoggerConfig, type LoggerLevel, type ManageCall, MarginType, Midas, MyNumber, type NetAPYDetails, type NetAPYSplit, Network, PRICE_ROUTER, type ParsedStarknetCall, PasswordJsonCryptoUtil, type PositionAPY, type PositionAmount, type PositionInfo, PositionTypeAvnuExtended, Pragma, type PriceInfo, Pricer, PricerAvnuApi, PricerBase, PricerFromApi, PricerLST, PricerRedis, Protocols, type RedemptionInfo, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, SVK_SIMPLE_SANITIZER, type SecurityMetadata, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, type SourceCodeInfo, SourceCodeType, StandardMerkleTree, type StandardMerkleTreeData, StarknetCallParser, type StarknetCallParserOptions, Store, type StoreConfig, type StrategyAlert, type StrategyApyHistoryUIConfig, type StrategyCapabilities, type StrategyFilterMetadata, type StrategyInputMode, StrategyLiveStatus, type StrategyMetadata, type StrategyRegistryEntry, type StrategySettings, StrategyTag, StrategyType, type SupportedPosition, SvkTrovesAdapter, type SvkTrovesAdapterConfig, type Swap, type SwapInfo, type SwapPriceInfo, TRANSFER_SANITIZER, TelegramGroupNotif, TelegramNotif, type TokenAmount, type TokenInfo, TokenMarketData, TokenTransferAdapter, type TokenTransferAdapterConfig, UNIVERSAL_ADAPTER_IDS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, UnwrapLabsCurator, type UserPositionCard, type UserPositionCardSubValueColor, type UserPositionCardsInput, type UserYoloInfo, VESU_SINGLETON, VESU_V2_MODIFY_POSITION_SANITIZER, type VaultPosition, VaultType, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, type VesuDefiSpringRewardsCallParams, type VesuDepositParams, type VesuModifyDelegationCallParams, VesuModifyPositionAdapter, type VesuModifyPositionAdapterConfig, type VesuModifyPositionCallParams, type VesuModifyPositionDepositParams, type VesuModifyPositionWithdrawParams, VesuMultiplyAdapter, type VesuMultiplyAdapterConfig, type VesuMultiplyCallParams, VesuPoolMetadata, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, VesuSupplyOnlyAdapter, type VesuSupplyOnlyAdapterConfig, type VesuWithdrawParams, Web3Number, type WithdrawParams, YoLoVault, type YoloSettings, type YoloSpendingLevel, type YoloVaultSettings, type YoloVaultStatus, YoloVaultStrategies, ZkLend, _riskFactor, assert, buildStrategyRegistry, configureLogger, createBoostedXSTRKCarryStrategy, createEkuboCLStrategy, createHyperLSTStrategy, createSenseiStrategy, createStrategy, createUniversalStrategy, createVesuRebalanceStrategy, createYoloVaultStrategy, detectCapabilities, extensionMap, getAPIUsingHeadlessBrowser, getAllStrategyMetadata, getAllStrategyTags, getContractDetails, getDefaultStoreConfig, getFAQs, getFilterMetadata, getInvestmentSteps, getLiveStrategies, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getStrategiesByType, getStrategyTagDesciption, getStrategyTypeFromMetadata, getTrovesEndpoint, getVesuSingletonAddress, highlightTextWithLinks, type i257, isDualTokenStrategy, logger, toAmountsInfo, toBigInt };