@strkfarm/sdk 1.0.54 → 1.0.55
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.browser.global.js +2065 -1
- package/dist/index.browser.mjs +2068 -1
- package/dist/index.d.ts +44 -4
- package/dist/index.js +2180 -109
- package/dist/index.mjs +2069 -1
- package/package.json +3 -3
- package/src/data/sensei.abi.json +1759 -0
- package/src/interfaces/common.tsx +5 -2
- package/src/strategies/base-strategy.ts +27 -0
- package/src/strategies/index.ts +1 -0
- package/src/strategies/sensei.ts +333 -0
- package/src/utils/index.ts +4 -0
package/dist/index.d.ts
CHANGED
|
@@ -50,7 +50,8 @@ declare enum RiskType {
|
|
|
50
50
|
SMART_CONTRACT_RISK = "Smart Contract Risk",
|
|
51
51
|
ORACLE_RISK = "Oracle Risk",
|
|
52
52
|
TECHNICAL_RISK = "Technical Risk",
|
|
53
|
-
COUNTERPARTY_RISK = "Counterparty Risk"
|
|
53
|
+
COUNTERPARTY_RISK = "Counterparty Risk",// e.g. bad debt
|
|
54
|
+
DEPEG_RISK = "Depeg Risk"
|
|
54
55
|
}
|
|
55
56
|
interface RiskFactor {
|
|
56
57
|
type: RiskType;
|
|
@@ -136,8 +137,8 @@ interface IInvestmentFlow {
|
|
|
136
137
|
linkedFlows: IInvestmentFlow[];
|
|
137
138
|
style?: any;
|
|
138
139
|
}
|
|
139
|
-
declare function getMainnetConfig(rpcUrl
|
|
140
|
-
declare const getRiskExplaination: (riskType: RiskType) => "The risk of the market moving against the position." | "The temporary loss of value experienced by liquidity providers in AMMs when asset prices diverge compared to simply holding them." | "The risk of losing funds due to the position being liquidated." | "The risk of low liquidity in the pool, which can lead to high slippages or reduced in-abilities to quickly exit the position." | "The risk of the oracle being manipulated or incorrect." | "The risk of the smart contract being vulnerable to attacks." | "The risk of technical issues e.g. backend failure." | "The risk of the counterparty defaulting e.g. bad debt on lending platforms.";
|
|
140
|
+
declare function getMainnetConfig(rpcUrl: string, blockIdentifier?: BlockIdentifier): IConfig;
|
|
141
|
+
declare const getRiskExplaination: (riskType: RiskType) => "The risk of the market moving against the position." | "The temporary loss of value experienced by liquidity providers in AMMs when asset prices diverge compared to simply holding them." | "The risk of losing funds due to the position being liquidated." | "The risk of low liquidity in the pool, which can lead to high slippages or reduced in-abilities to quickly exit the position." | "The risk of the oracle being manipulated or incorrect." | "The risk of the smart contract being vulnerable to attacks." | "The risk of technical issues e.g. backend failure." | "The risk of the counterparty defaulting e.g. bad debt on lending platforms." | "The risk of a token losing its peg to the underlying asset, leading to potential losses for holders.";
|
|
141
142
|
declare const getRiskColor: (risk: RiskFactor) => "light_green_2" | "yellow" | "red";
|
|
142
143
|
declare const getNoRiskTags: (risks: RiskFactor[]) => RiskType[];
|
|
143
144
|
interface HighlightLink {
|
|
@@ -372,13 +373,22 @@ interface DualTokenInfo {
|
|
|
372
373
|
token0: SingleTokenInfo;
|
|
373
374
|
token1: SingleTokenInfo;
|
|
374
375
|
}
|
|
376
|
+
interface CacheData {
|
|
377
|
+
timestamp: number;
|
|
378
|
+
ttl: number;
|
|
379
|
+
data: any;
|
|
380
|
+
}
|
|
375
381
|
declare class BaseStrategy<TVLInfo, ActionInfo> {
|
|
376
382
|
readonly config: IConfig;
|
|
383
|
+
readonly cache: Map<string, CacheData>;
|
|
377
384
|
constructor(config: IConfig);
|
|
378
385
|
getUserTVL(user: ContractAddr): Promise<TVLInfo>;
|
|
379
386
|
getTVL(): Promise<TVLInfo>;
|
|
380
387
|
depositCall(amountInfo: ActionInfo, receiver: ContractAddr): Promise<Call[]>;
|
|
381
388
|
withdrawCall(amountInfo: ActionInfo, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
|
|
389
|
+
setCache(key: string, data: any, ttl?: number): void;
|
|
390
|
+
getCache(key: string): any | null;
|
|
391
|
+
isCacheValid(key: string): boolean;
|
|
382
392
|
}
|
|
383
393
|
|
|
384
394
|
interface PoolProps {
|
|
@@ -776,6 +786,35 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
|
|
|
776
786
|
*/
|
|
777
787
|
declare const EkuboCLVaultStrategies: IStrategyMetadata<CLVaultStrategySettings>[];
|
|
778
788
|
|
|
789
|
+
interface SenseiVaultSettings {
|
|
790
|
+
mainToken: TokenInfo;
|
|
791
|
+
secondaryToken: TokenInfo;
|
|
792
|
+
targetHfBps: number;
|
|
793
|
+
feeBps: number;
|
|
794
|
+
}
|
|
795
|
+
declare class SenseiVault extends BaseStrategy<SingleTokenInfo, SingleActionAmount> {
|
|
796
|
+
readonly address: ContractAddr;
|
|
797
|
+
readonly metadata: IStrategyMetadata<SenseiVaultSettings>;
|
|
798
|
+
readonly pricer: PricerBase;
|
|
799
|
+
readonly contract: Contract;
|
|
800
|
+
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<SenseiVaultSettings>);
|
|
801
|
+
getUserTVL(user: ContractAddr): Promise<SingleTokenInfo>;
|
|
802
|
+
getTVL(): Promise<SingleTokenInfo>;
|
|
803
|
+
depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]>;
|
|
804
|
+
withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
|
|
805
|
+
getPositionInfo(): Promise<{
|
|
806
|
+
collateralXSTRK: Web3Number;
|
|
807
|
+
collateralUSDValue: Web3Number;
|
|
808
|
+
debtSTRK: Web3Number;
|
|
809
|
+
debtUSDValue: Web3Number;
|
|
810
|
+
xSTRKPrice: number;
|
|
811
|
+
collateralInSTRK: number;
|
|
812
|
+
}>;
|
|
813
|
+
getSecondaryTokenPriceRelativeToMain(retry?: number): Promise<number>;
|
|
814
|
+
getSettings: () => Promise<starknet.Result>;
|
|
815
|
+
}
|
|
816
|
+
declare const SenseiStrategies: IStrategyMetadata<SenseiVaultSettings>[];
|
|
817
|
+
|
|
779
818
|
declare class TelegramNotif {
|
|
780
819
|
private subscribers;
|
|
781
820
|
readonly bot: TelegramBot;
|
|
@@ -804,6 +843,7 @@ type RequiredKeys<T> = {
|
|
|
804
843
|
[K in keyof T]-?: {} extends Pick<T, K> ? never : K;
|
|
805
844
|
}[keyof T];
|
|
806
845
|
declare function assert(condition: boolean, message: string): void;
|
|
846
|
+
declare function getTrovesEndpoint(): string;
|
|
807
847
|
|
|
808
848
|
declare class PricerRedis extends Pricer {
|
|
809
849
|
private redisClient;
|
|
@@ -898,4 +938,4 @@ declare class PasswordJsonCryptoUtil {
|
|
|
898
938
|
decrypt(encryptedData: string, password: string): any;
|
|
899
939
|
}
|
|
900
940
|
|
|
901
|
-
export { type AccountInfo, type AllAccountsStore, AutoCompounderSTRK, AvnuWrapper, BaseStrategy, type CLVaultStrategySettings, ContractAddr, type DualActionAmount, type DualTokenInfo, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, type FAQ, 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, highlightTextWithLinks, logger };
|
|
941
|
+
export { type AccountInfo, type AllAccountsStore, AutoCompounderSTRK, AvnuWrapper, BaseStrategy, type CLVaultStrategySettings, ContractAddr, type DualActionAmount, type DualTokenInfo, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, type FAQ, 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, SenseiStrategies, SenseiVault, type SenseiVaultSettings, 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, getTrovesEndpoint, highlightTextWithLinks, logger };
|