@strkfarm/sdk 1.0.37 → 1.0.39
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/cli.js +38 -588
- package/dist/cli.mjs +37 -587
- package/dist/index.browser.global.js +962 -329
- package/dist/index.browser.mjs +962 -325
- package/dist/index.d.ts +28 -54
- package/dist/index.js +985 -322
- package/dist/index.mjs +990 -323
- package/package.json +3 -3
- package/src/dataTypes/_bignumber.ts +49 -47
- package/src/global.ts +1 -33
- package/src/interfaces/common.ts +112 -98
- package/src/interfaces/lending.ts +1 -2
- package/src/modules/avnu.ts +1 -1
- package/src/modules/erc20.ts +6 -0
- package/src/modules/harvests.ts +1 -1
- package/src/modules/pragma.ts +1 -1
- package/src/modules/pricer-from-api.ts +3 -3
- package/src/modules/pricer.ts +2 -1
- package/src/modules/zkLend.ts +2 -1
- package/src/node/pricer-redis.ts +2 -1
- package/src/notifs/telegram.ts +1 -1
- package/src/strategies/ekubo-cl-vault.tsx +1503 -920
- package/src/strategies/vesu-rebalance.tsx +943 -611
- package/src/utils/index.ts +2 -0
- package/src/utils/logger.browser.ts +20 -0
- package/src/utils/logger.node.ts +35 -0
- package/src/utils/logger.ts +1 -0
- package/src/utils/store.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import * as starknet from 'starknet';
|
|
|
3
3
|
import { RpcProvider, BlockIdentifier, Contract, Uint256, Call, Account } from 'starknet';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { Quote } from '@avnu/avnu-sdk';
|
|
6
|
-
import * as util from 'util';
|
|
7
6
|
import TelegramBot from 'node-telegram-bot-api';
|
|
8
7
|
|
|
9
8
|
declare class _Web3Number<T extends _Web3Number<T>> extends BigNumber {
|
|
@@ -15,7 +14,7 @@ declare class _Web3Number<T extends _Web3Number<T>> extends BigNumber {
|
|
|
15
14
|
plus(value: string | number | T): T;
|
|
16
15
|
minus(n: number | string | T, base?: number): T;
|
|
17
16
|
protected construct(value: string | number, decimals: number): T;
|
|
18
|
-
toString(
|
|
17
|
+
toString(): string;
|
|
19
18
|
toJSON(): string;
|
|
20
19
|
valueOf(): string;
|
|
21
20
|
private maxToFixedDecimals;
|
|
@@ -73,7 +72,7 @@ declare enum Network {
|
|
|
73
72
|
interface IConfig {
|
|
74
73
|
provider: RpcProvider;
|
|
75
74
|
network: Network;
|
|
76
|
-
stage:
|
|
75
|
+
stage: "production" | "staging";
|
|
77
76
|
heartbeatUrl?: string;
|
|
78
77
|
}
|
|
79
78
|
interface IProtocol {
|
|
@@ -85,6 +84,10 @@ declare enum FlowChartColors {
|
|
|
85
84
|
Blue = "#35484f",
|
|
86
85
|
Purple = "#6e53dc"
|
|
87
86
|
}
|
|
87
|
+
interface FAQ {
|
|
88
|
+
question: string | React.ReactNode;
|
|
89
|
+
answer: string | React.ReactNode;
|
|
90
|
+
}
|
|
88
91
|
/**
|
|
89
92
|
* @property risk.riskFactor.factor - The risk factors that are considered for the strategy.
|
|
90
93
|
* @property risk.riskFactor.factor - The value of the risk factor from 0 to 10, 0 being the lowest and 10 being the highest.
|
|
@@ -93,7 +96,8 @@ interface IStrategyMetadata<T> {
|
|
|
93
96
|
name: string;
|
|
94
97
|
description: string | React.ReactNode;
|
|
95
98
|
address: ContractAddr;
|
|
96
|
-
|
|
99
|
+
launchBlock: number;
|
|
100
|
+
type: "ERC4626" | "ERC721" | "Other";
|
|
97
101
|
depositTokens: TokenInfo[];
|
|
98
102
|
protocols: IProtocol[];
|
|
99
103
|
auditUrl?: string;
|
|
@@ -105,6 +109,7 @@ interface IStrategyMetadata<T> {
|
|
|
105
109
|
};
|
|
106
110
|
apyMethodology?: string;
|
|
107
111
|
additionalInfo: T;
|
|
112
|
+
faqs: FAQ[];
|
|
108
113
|
}
|
|
109
114
|
interface IInvestmentFlow {
|
|
110
115
|
id?: string;
|
|
@@ -260,6 +265,7 @@ declare class ERC20 {
|
|
|
260
265
|
constructor(config: IConfig);
|
|
261
266
|
contract(addr: string | ContractAddr): Contract;
|
|
262
267
|
balanceOf(token: string | ContractAddr, address: string | ContractAddr, tokenDecimals: number): Promise<Web3Number>;
|
|
268
|
+
allowance(token: string | ContractAddr, owner: string | ContractAddr, spender: string | ContractAddr, tokenDecimals: number): Promise<Web3Number>;
|
|
263
269
|
}
|
|
264
270
|
|
|
265
271
|
interface Route {
|
|
@@ -285,52 +291,6 @@ declare class AvnuWrapper {
|
|
|
285
291
|
getSwapInfo(quote: Quote, taker: string, integratorFeeBps: number, integratorFeeRecipient: string, minAmount?: string): Promise<SwapInfo>;
|
|
286
292
|
}
|
|
287
293
|
|
|
288
|
-
declare const logger: {
|
|
289
|
-
verbose(message: string): void;
|
|
290
|
-
assert(condition?: boolean, ...data: any[]): void;
|
|
291
|
-
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
292
|
-
clear(): void;
|
|
293
|
-
clear(): void;
|
|
294
|
-
count(label?: string): void;
|
|
295
|
-
count(label?: string): void;
|
|
296
|
-
countReset(label?: string): void;
|
|
297
|
-
countReset(label?: string): void;
|
|
298
|
-
debug(...data: any[]): void;
|
|
299
|
-
debug(message?: any, ...optionalParams: any[]): void;
|
|
300
|
-
dir(item?: any, options?: any): void;
|
|
301
|
-
dir(obj: any, options?: util.InspectOptions): void;
|
|
302
|
-
dirxml(...data: any[]): void;
|
|
303
|
-
dirxml(...data: any[]): void;
|
|
304
|
-
error(...data: any[]): void;
|
|
305
|
-
error(message?: any, ...optionalParams: any[]): void;
|
|
306
|
-
group(...data: any[]): void;
|
|
307
|
-
group(...label: any[]): void;
|
|
308
|
-
groupCollapsed(...data: any[]): void;
|
|
309
|
-
groupCollapsed(...label: any[]): void;
|
|
310
|
-
groupEnd(): void;
|
|
311
|
-
groupEnd(): void;
|
|
312
|
-
info(...data: any[]): void;
|
|
313
|
-
info(message?: any, ...optionalParams: any[]): void;
|
|
314
|
-
log(...data: any[]): void;
|
|
315
|
-
log(message?: any, ...optionalParams: any[]): void;
|
|
316
|
-
table(tabularData?: any, properties?: string[]): void;
|
|
317
|
-
table(tabularData: any, properties?: readonly string[]): void;
|
|
318
|
-
time(label?: string): void;
|
|
319
|
-
time(label?: string): void;
|
|
320
|
-
timeEnd(label?: string): void;
|
|
321
|
-
timeEnd(label?: string): void;
|
|
322
|
-
timeLog(label?: string, ...data: any[]): void;
|
|
323
|
-
timeLog(label?: string, ...data: any[]): void;
|
|
324
|
-
timeStamp(label?: string): void;
|
|
325
|
-
timeStamp(label?: string): void;
|
|
326
|
-
trace(...data: any[]): void;
|
|
327
|
-
trace(message?: any, ...optionalParams: any[]): void;
|
|
328
|
-
warn(...data: any[]): void;
|
|
329
|
-
warn(message?: any, ...optionalParams: any[]): void;
|
|
330
|
-
Console: console.ConsoleConstructor;
|
|
331
|
-
profile(label?: string): void;
|
|
332
|
-
profileEnd(label?: string): void;
|
|
333
|
-
};
|
|
334
294
|
declare class FatalError extends Error {
|
|
335
295
|
constructor(message: string, err?: Error);
|
|
336
296
|
}
|
|
@@ -594,7 +554,7 @@ declare class VesuRebalance extends BaseStrategy<SingleTokenInfo, SingleActionAm
|
|
|
594
554
|
* @param pools - Array of pool information including IDs, weights, amounts, APYs and utilization
|
|
595
555
|
* @returns Populated contract call for rebalance
|
|
596
556
|
*/
|
|
597
|
-
getRebalanceCall(pools: Awaited<ReturnType<typeof this.getRebalancedPositions>>[
|
|
557
|
+
getRebalanceCall(pools: Awaited<ReturnType<typeof this.getRebalancedPositions>>["changes"], isOverWeightAdjustment: boolean): Promise<starknet.Call | null>;
|
|
598
558
|
getInvestmentFlows(pools: PoolInfoFull[]): Promise<IInvestmentFlow[]>;
|
|
599
559
|
harvest(acc: Account): Promise<starknet.Call[]>;
|
|
600
560
|
/**
|
|
@@ -635,7 +595,8 @@ interface CLVaultStrategySettings {
|
|
|
635
595
|
lower: number;
|
|
636
596
|
upper: number;
|
|
637
597
|
};
|
|
638
|
-
lstContract
|
|
598
|
+
lstContract?: ContractAddr;
|
|
599
|
+
truePrice?: number;
|
|
639
600
|
feeBps: number;
|
|
640
601
|
}
|
|
641
602
|
declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount> {
|
|
@@ -650,7 +611,7 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
|
|
|
650
611
|
readonly BASE_WEIGHT = 10000;
|
|
651
612
|
readonly ekuboPositionsContract: Contract;
|
|
652
613
|
readonly ekuboMathContract: Contract;
|
|
653
|
-
readonly lstContract: Contract;
|
|
614
|
+
readonly lstContract: Contract | null;
|
|
654
615
|
poolKey: EkuboPoolKey | undefined;
|
|
655
616
|
readonly avnu: AvnuWrapper;
|
|
656
617
|
/**
|
|
@@ -761,6 +722,19 @@ declare class TelegramNotif {
|
|
|
761
722
|
sendMessage(msg: string): void;
|
|
762
723
|
}
|
|
763
724
|
|
|
725
|
+
interface LeveledLogMethod {
|
|
726
|
+
(message: string, ...meta: any[]): void;
|
|
727
|
+
(message: any): void;
|
|
728
|
+
}
|
|
729
|
+
interface MyLogger {
|
|
730
|
+
error: LeveledLogMethod;
|
|
731
|
+
warn: LeveledLogMethod;
|
|
732
|
+
info: LeveledLogMethod;
|
|
733
|
+
verbose: LeveledLogMethod;
|
|
734
|
+
debug: LeveledLogMethod;
|
|
735
|
+
}
|
|
736
|
+
declare const logger: MyLogger;
|
|
737
|
+
|
|
764
738
|
type RequiredFields<T> = {
|
|
765
739
|
[K in keyof T]-?: T[K];
|
|
766
740
|
};
|
|
@@ -862,4 +836,4 @@ declare class PasswordJsonCryptoUtil {
|
|
|
862
836
|
decrypt(encryptedData: string, password: string): any;
|
|
863
837
|
}
|
|
864
838
|
|
|
865
|
-
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 };
|
|
839
|
+
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, logger };
|