@gearbox-protocol/sdk 8.12.2 → 8.12.4
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/cjs/sdk/sdk-gov-legacy/tokens/normal.js +5 -0
- package/dist/cjs/sdk/sdk-gov-legacy/tokens/token.js +1 -0
- package/dist/cjs/sdk/sdk-legacy/index.js +0 -2
- package/dist/cjs/sdk/sdk-legacy/tokens/tokenData.js +2 -1
- package/dist/esm/sdk/sdk-gov-legacy/tokens/normal.js +5 -0
- package/dist/esm/sdk/sdk-gov-legacy/tokens/token.js +1 -0
- package/dist/esm/sdk/sdk-legacy/index.js +0 -1
- package/dist/esm/sdk/sdk-legacy/tokens/tokenData.js +2 -1
- package/dist/types/sdk/sdk-gov-legacy/tokens/normal.d.ts +1 -1
- package/dist/types/sdk/sdk-legacy/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/cjs/sdk/sdk-legacy/core/strategy.js +0 -70
- package/dist/esm/sdk/sdk-legacy/core/strategy.js +0 -46
- package/dist/types/sdk/sdk-legacy/core/strategy.d.ts +0 -17
|
@@ -546,6 +546,11 @@ const normalTokens = {
|
|
|
546
546
|
symbol: "PT_sUSDf_25SEP2025",
|
|
547
547
|
type: { AllNetworks: import_tokenType.TokenType.NORMAL_TOKEN }
|
|
548
548
|
},
|
|
549
|
+
PT_USDf_29JAN2026: {
|
|
550
|
+
name: "Pendle PT USDf 29 January 2026 expiry",
|
|
551
|
+
symbol: "PT_USDf_29JAN2026",
|
|
552
|
+
type: { AllNetworks: import_tokenType.TokenType.NORMAL_TOKEN }
|
|
553
|
+
},
|
|
549
554
|
stkcvxUSDCUSDf: {
|
|
550
555
|
name: "Convex stkcvxUSDCUSDf",
|
|
551
556
|
symbol: "stkcvxUSDCUSDf",
|
|
@@ -354,6 +354,7 @@ const tokenDataByNetwork = {
|
|
|
354
354
|
bfBTC: import_constants.NOT_DEPLOYED,
|
|
355
355
|
PT_sUSDf_25SEP2025: "0xAB365C0879024481E4ad3b47bd6FeA9c10014FbC",
|
|
356
356
|
sUSDf: "0xc8CF6D7991f15525488b2A83Df53468D682Ba4B0",
|
|
357
|
+
PT_USDf_29JAN2026: "0xeC3b5e45dD278d5AB9CDB31754B54DB314e9D52a",
|
|
357
358
|
stkcvxUSDCUSDf: "0xa327D7f665AFE9Ecb0963B5561C84C48C7EC71AB"
|
|
358
359
|
},
|
|
359
360
|
///
|
|
@@ -22,7 +22,6 @@ __reExport(sdk_legacy_exports, require("./core/creditSession.js"), module.export
|
|
|
22
22
|
__reExport(sdk_legacy_exports, require("./core/endpoint.js"), module.exports);
|
|
23
23
|
__reExport(sdk_legacy_exports, require("./core/eventOrTx.js"), module.exports);
|
|
24
24
|
__reExport(sdk_legacy_exports, require("./core/pool.js"), module.exports);
|
|
25
|
-
__reExport(sdk_legacy_exports, require("./core/strategy.js"), module.exports);
|
|
26
25
|
__reExport(sdk_legacy_exports, require("./core/transactions.js"), module.exports);
|
|
27
26
|
__reExport(sdk_legacy_exports, require("./gearboxRewards/index.js"), module.exports);
|
|
28
27
|
__reExport(sdk_legacy_exports, require("./payload/creditAccount.js"), module.exports);
|
|
@@ -42,7 +41,6 @@ __reExport(sdk_legacy_exports, require("./utils/index.js"), module.exports);
|
|
|
42
41
|
...require("./core/endpoint.js"),
|
|
43
42
|
...require("./core/eventOrTx.js"),
|
|
44
43
|
...require("./core/pool.js"),
|
|
45
|
-
...require("./core/strategy.js"),
|
|
46
44
|
...require("./core/transactions.js"),
|
|
47
45
|
...require("./gearboxRewards/index.js"),
|
|
48
46
|
...require("./payload/creditAccount.js"),
|
|
@@ -41,7 +41,8 @@ const ALIASES = {
|
|
|
41
41
|
PT_beraSTONE_10APR2025: "p.beraSTONE(10.04.25)",
|
|
42
42
|
PT_uptBTC_14AUG2025: "p.uptBTC(14.08.25)",
|
|
43
43
|
PT_sUSDX_1SEP2025: "p.sUSDX(1.09.25)",
|
|
44
|
-
PT_sUSDf_25SEP2025: "p.sUSDf(1.09.25)"
|
|
44
|
+
PT_sUSDf_25SEP2025: "p.sUSDf(1.09.25)",
|
|
45
|
+
PT_USDf_29JAN2026: "p.USDf(29.01.26)"
|
|
45
46
|
};
|
|
46
47
|
class TokenData {
|
|
47
48
|
address;
|
|
@@ -522,6 +522,11 @@ const normalTokens = {
|
|
|
522
522
|
symbol: "PT_sUSDf_25SEP2025",
|
|
523
523
|
type: { AllNetworks: TokenType.NORMAL_TOKEN }
|
|
524
524
|
},
|
|
525
|
+
PT_USDf_29JAN2026: {
|
|
526
|
+
name: "Pendle PT USDf 29 January 2026 expiry",
|
|
527
|
+
symbol: "PT_USDf_29JAN2026",
|
|
528
|
+
type: { AllNetworks: TokenType.NORMAL_TOKEN }
|
|
529
|
+
},
|
|
525
530
|
stkcvxUSDCUSDf: {
|
|
526
531
|
name: "Convex stkcvxUSDCUSDf",
|
|
527
532
|
symbol: "stkcvxUSDCUSDf",
|
|
@@ -327,6 +327,7 @@ const tokenDataByNetwork = {
|
|
|
327
327
|
bfBTC: NOT_DEPLOYED,
|
|
328
328
|
PT_sUSDf_25SEP2025: "0xAB365C0879024481E4ad3b47bd6FeA9c10014FbC",
|
|
329
329
|
sUSDf: "0xc8CF6D7991f15525488b2A83Df53468D682Ba4B0",
|
|
330
|
+
PT_USDf_29JAN2026: "0xeC3b5e45dD278d5AB9CDB31754B54DB314e9D52a",
|
|
330
331
|
stkcvxUSDCUSDf: "0xa327D7f665AFE9Ecb0963B5561C84C48C7EC71AB"
|
|
331
332
|
},
|
|
332
333
|
///
|
|
@@ -5,7 +5,6 @@ export * from "./core/creditSession.js";
|
|
|
5
5
|
export * from "./core/endpoint.js";
|
|
6
6
|
export * from "./core/eventOrTx.js";
|
|
7
7
|
export * from "./core/pool.js";
|
|
8
|
-
export * from "./core/strategy.js";
|
|
9
8
|
export * from "./core/transactions.js";
|
|
10
9
|
export * from "./gearboxRewards/index.js";
|
|
11
10
|
export * from "./payload/creditAccount.js";
|
|
@@ -18,7 +18,8 @@ const ALIASES = {
|
|
|
18
18
|
PT_beraSTONE_10APR2025: "p.beraSTONE(10.04.25)",
|
|
19
19
|
PT_uptBTC_14AUG2025: "p.uptBTC(14.08.25)",
|
|
20
20
|
PT_sUSDX_1SEP2025: "p.sUSDX(1.09.25)",
|
|
21
|
-
PT_sUSDf_25SEP2025: "p.sUSDf(1.09.25)"
|
|
21
|
+
PT_sUSDf_25SEP2025: "p.sUSDf(1.09.25)",
|
|
22
|
+
PT_USDf_29JAN2026: "p.USDf(29.01.26)"
|
|
22
23
|
};
|
|
23
24
|
class TokenData {
|
|
24
25
|
address;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TokenBase } from "./token.js";
|
|
2
2
|
import type { TokenNetwork } from "./tokenType.js";
|
|
3
3
|
import { TokenType } from "./tokenType.js";
|
|
4
|
-
export type NormalToken = "1INCH" | "AAVE" | "CRV" | "LINK" | "SNX" | "UNI" | "USDT" | "DOLA" | "USDC" | "USDC_e" | "DAI" | "WETH" | "WBTC" | "tBTC" | "YFI" | "WLD" | "OP" | "STETH" | "CVX" | "FRAX" | "FXS" | "LDO" | "LUSD" | "sUSD" | "GUSD" | "LQTY" | "GMX" | "ARB" | "BAL" | "ARB" | "MKR" | "RPL" | "APE" | "rETH" | "AURA" | "LBTC" | "eBTC" | "solvBTC" | "pumpBTC" | "osETH" | "weETH" | "SWISE" | "ezETH" | "rsETH" | "PENDLE" | "frxETH" | "cbETH" | "rswETH" | "USDe" | "GHO" | "pufETH" | "wstETH" | "USDS" | "SKY" | "beraSTONE" | "wS" | "stS" | "scUSD" | "T" | "tETH" | "USDL" | "wUSDL" | "csUSDL" | "RLUSD" | "MORPHO" | "steakLRT" | "Re7LRT" | "amphrETH" | "rstETH" | "pzETH" | "DVstETH" | "waEthLidowstETH" | "PT_rsETH_26SEP2024" | "PT_sUSDe_26DEC2024" | "PT_eETH_26DEC2024" | "PT_ezETH_26DEC2024" | "PT_eBTC_26DEC2024" | "PT_LBTC_27MAR2025" | "PT_corn_solvBTC_BBN_26DEC2024" | "PT_corn_pumpBTC_26DEC2024" | "PT_cornLBTC_26DEC2024" | "PT_corn_eBTC_27MAR2025" | "PT_sUSDe_27MAR2025" | "PT_sUSDe_29MAY2025" | "PT_beraSTONE_10APR2025" | "PT_sUSDX_1SEP2025" | "rstETH_Lido_wstETH" | "DVstETH_Prime_wstETH" | "SHIB" | "crvUSD" | "WBNB" | "BTCB" | "USD1" | "USDX" | "cp0xLRT" | "uptBTC" | "PT_uptBTC_14AUG2025" | "WXTZ" | "mTBILL" | "mBASIS" | "lskETH" | "hemiBTC" | "bfBTC" | "sUSDf" | "PT_sUSDf_25SEP2025" | "stkcvxUSDCUSDf";
|
|
4
|
+
export type NormalToken = "1INCH" | "AAVE" | "CRV" | "LINK" | "SNX" | "UNI" | "USDT" | "DOLA" | "USDC" | "USDC_e" | "DAI" | "WETH" | "WBTC" | "tBTC" | "YFI" | "WLD" | "OP" | "STETH" | "CVX" | "FRAX" | "FXS" | "LDO" | "LUSD" | "sUSD" | "GUSD" | "LQTY" | "GMX" | "ARB" | "BAL" | "ARB" | "MKR" | "RPL" | "APE" | "rETH" | "AURA" | "LBTC" | "eBTC" | "solvBTC" | "pumpBTC" | "osETH" | "weETH" | "SWISE" | "ezETH" | "rsETH" | "PENDLE" | "frxETH" | "cbETH" | "rswETH" | "USDe" | "GHO" | "pufETH" | "wstETH" | "USDS" | "SKY" | "beraSTONE" | "wS" | "stS" | "scUSD" | "T" | "tETH" | "USDL" | "wUSDL" | "csUSDL" | "RLUSD" | "MORPHO" | "steakLRT" | "Re7LRT" | "amphrETH" | "rstETH" | "pzETH" | "DVstETH" | "waEthLidowstETH" | "PT_rsETH_26SEP2024" | "PT_sUSDe_26DEC2024" | "PT_eETH_26DEC2024" | "PT_ezETH_26DEC2024" | "PT_eBTC_26DEC2024" | "PT_LBTC_27MAR2025" | "PT_corn_solvBTC_BBN_26DEC2024" | "PT_corn_pumpBTC_26DEC2024" | "PT_cornLBTC_26DEC2024" | "PT_corn_eBTC_27MAR2025" | "PT_sUSDe_27MAR2025" | "PT_sUSDe_29MAY2025" | "PT_beraSTONE_10APR2025" | "PT_sUSDX_1SEP2025" | "rstETH_Lido_wstETH" | "DVstETH_Prime_wstETH" | "SHIB" | "crvUSD" | "WBNB" | "BTCB" | "USD1" | "USDX" | "cp0xLRT" | "uptBTC" | "PT_uptBTC_14AUG2025" | "WXTZ" | "mTBILL" | "mBASIS" | "lskETH" | "hemiBTC" | "bfBTC" | "sUSDf" | "PT_sUSDf_25SEP2025" | "stkcvxUSDCUSDf" | "PT_USDf_29JAN2026";
|
|
5
5
|
export type NormalTokenData = {
|
|
6
6
|
symbol: NormalToken;
|
|
7
7
|
type: Partial<Record<TokenNetwork, TokenType.NORMAL_TOKEN>>;
|
|
@@ -5,7 +5,6 @@ export * from "./core/creditSession.js";
|
|
|
5
5
|
export * from "./core/endpoint.js";
|
|
6
6
|
export * from "./core/eventOrTx.js";
|
|
7
7
|
export * from "./core/pool.js";
|
|
8
|
-
export * from "./core/strategy.js";
|
|
9
8
|
export * from "./core/transactions.js";
|
|
10
9
|
export * from "./gearboxRewards/index.js";
|
|
11
10
|
export * from "./payload/creditAccount.js";
|
package/package.json
CHANGED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var strategy_exports = {};
|
|
20
|
-
__export(strategy_exports, {
|
|
21
|
-
PositionUtils: () => PositionUtils
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(strategy_exports);
|
|
24
|
-
var import_constants = require("../../constants/index.js");
|
|
25
|
-
class PositionUtils {
|
|
26
|
-
static maxLeverage(lpToken, cms) {
|
|
27
|
-
const [maxThreshold] = PositionUtils.maxLeverageThreshold(lpToken, cms);
|
|
28
|
-
const maxLeverage = import_constants.PERCENTAGE_FACTOR * import_constants.LEVERAGE_DECIMALS / (import_constants.PERCENTAGE_FACTOR - maxThreshold);
|
|
29
|
-
return Number(maxLeverage - import_constants.LEVERAGE_DECIMALS);
|
|
30
|
-
}
|
|
31
|
-
// [apy - quotaRate * (1 + feeInterest)] +
|
|
32
|
-
// [
|
|
33
|
-
// apy - baseRateWithFee - quotaRate * (1 + feeInterest)
|
|
34
|
-
// ] * (leverage - 1)
|
|
35
|
-
static maxAPY({
|
|
36
|
-
apy,
|
|
37
|
-
leverage,
|
|
38
|
-
baseRateWithFee,
|
|
39
|
-
quotaRateWithFee
|
|
40
|
-
}) {
|
|
41
|
-
const collateralTerm = apy - quotaRateWithFee;
|
|
42
|
-
const debtTerm = (apy - baseRateWithFee - quotaRateWithFee) * (leverage - Number(import_constants.LEVERAGE_DECIMALS)) / Number(import_constants.LEVERAGE_DECIMALS);
|
|
43
|
-
return collateralTerm + Math.floor(debtTerm);
|
|
44
|
-
}
|
|
45
|
-
static maxLeverageThreshold(lpToken, cms) {
|
|
46
|
-
const lpTokenLC = lpToken.toLowerCase();
|
|
47
|
-
const ltByCM = cms.map((cm2) => {
|
|
48
|
-
const lt2 = cm2.liquidationThresholds[lpTokenLC] || 0n;
|
|
49
|
-
return [cm2.address, lt2];
|
|
50
|
-
});
|
|
51
|
-
const sorted = ltByCM.sort(([, ltA], [, ltB]) => {
|
|
52
|
-
if (ltA > ltB) return -1;
|
|
53
|
-
if (ltB > ltA) return 1;
|
|
54
|
-
return 0;
|
|
55
|
-
});
|
|
56
|
-
const [cm = "", lt = 0n] = sorted[0] || [];
|
|
57
|
-
return [lt, cm];
|
|
58
|
-
}
|
|
59
|
-
static isStrategyReleased(releaseAt, currentTimestamp, chainId) {
|
|
60
|
-
if (releaseAt === void 0) return true;
|
|
61
|
-
if (typeof releaseAt === "number") return currentTimestamp > releaseAt;
|
|
62
|
-
const releaseAtNetwork = releaseAt[chainId];
|
|
63
|
-
if (releaseAtNetwork === void 0) return true;
|
|
64
|
-
return currentTimestamp > releaseAtNetwork;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
-
0 && (module.exports = {
|
|
69
|
-
PositionUtils
|
|
70
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { LEVERAGE_DECIMALS, PERCENTAGE_FACTOR } from "../../constants/index.js";
|
|
2
|
-
class PositionUtils {
|
|
3
|
-
static maxLeverage(lpToken, cms) {
|
|
4
|
-
const [maxThreshold] = PositionUtils.maxLeverageThreshold(lpToken, cms);
|
|
5
|
-
const maxLeverage = PERCENTAGE_FACTOR * LEVERAGE_DECIMALS / (PERCENTAGE_FACTOR - maxThreshold);
|
|
6
|
-
return Number(maxLeverage - LEVERAGE_DECIMALS);
|
|
7
|
-
}
|
|
8
|
-
// [apy - quotaRate * (1 + feeInterest)] +
|
|
9
|
-
// [
|
|
10
|
-
// apy - baseRateWithFee - quotaRate * (1 + feeInterest)
|
|
11
|
-
// ] * (leverage - 1)
|
|
12
|
-
static maxAPY({
|
|
13
|
-
apy,
|
|
14
|
-
leverage,
|
|
15
|
-
baseRateWithFee,
|
|
16
|
-
quotaRateWithFee
|
|
17
|
-
}) {
|
|
18
|
-
const collateralTerm = apy - quotaRateWithFee;
|
|
19
|
-
const debtTerm = (apy - baseRateWithFee - quotaRateWithFee) * (leverage - Number(LEVERAGE_DECIMALS)) / Number(LEVERAGE_DECIMALS);
|
|
20
|
-
return collateralTerm + Math.floor(debtTerm);
|
|
21
|
-
}
|
|
22
|
-
static maxLeverageThreshold(lpToken, cms) {
|
|
23
|
-
const lpTokenLC = lpToken.toLowerCase();
|
|
24
|
-
const ltByCM = cms.map((cm2) => {
|
|
25
|
-
const lt2 = cm2.liquidationThresholds[lpTokenLC] || 0n;
|
|
26
|
-
return [cm2.address, lt2];
|
|
27
|
-
});
|
|
28
|
-
const sorted = ltByCM.sort(([, ltA], [, ltB]) => {
|
|
29
|
-
if (ltA > ltB) return -1;
|
|
30
|
-
if (ltB > ltA) return 1;
|
|
31
|
-
return 0;
|
|
32
|
-
});
|
|
33
|
-
const [cm = "", lt = 0n] = sorted[0] || [];
|
|
34
|
-
return [lt, cm];
|
|
35
|
-
}
|
|
36
|
-
static isStrategyReleased(releaseAt, currentTimestamp, chainId) {
|
|
37
|
-
if (releaseAt === void 0) return true;
|
|
38
|
-
if (typeof releaseAt === "number") return currentTimestamp > releaseAt;
|
|
39
|
-
const releaseAtNetwork = releaseAt[chainId];
|
|
40
|
-
if (releaseAtNetwork === void 0) return true;
|
|
41
|
-
return currentTimestamp > releaseAtNetwork;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
PositionUtils
|
|
46
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Address } from "viem";
|
|
2
|
-
import type { CreditManagerData_Legacy } from "./creditManager.js";
|
|
3
|
-
export type ReleaseAt = undefined | number | Record<number, number>;
|
|
4
|
-
interface CalculateMaxAPYProps {
|
|
5
|
-
apy: number;
|
|
6
|
-
leverage: number;
|
|
7
|
-
baseRateWithFee: number;
|
|
8
|
-
quotaRateWithFee: number;
|
|
9
|
-
}
|
|
10
|
-
export declare class PositionUtils {
|
|
11
|
-
static maxLeverage(lpToken: Address, cms: Array<PartialCM>): number;
|
|
12
|
-
static maxAPY({ apy, leverage, baseRateWithFee, quotaRateWithFee, }: CalculateMaxAPYProps): number;
|
|
13
|
-
protected static maxLeverageThreshold(lpToken: Address, cms: Array<PartialCM>): readonly [bigint, "" | `0x${string}`];
|
|
14
|
-
static isStrategyReleased(releaseAt: ReleaseAt, currentTimestamp: number, chainId: number): boolean;
|
|
15
|
-
}
|
|
16
|
-
type PartialCM = Pick<CreditManagerData_Legacy, "liquidationThresholds" | "address">;
|
|
17
|
-
export {};
|