@gearbox-protocol/sdk 14.7.0-next.2 → 14.7.0

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.
@@ -21,14 +21,14 @@ __export(is_strategy_eligible_exports, {
21
21
  isStrategyEligible: () => isStrategyEligible
22
22
  });
23
23
  module.exports = __toCommonJS(is_strategy_eligible_exports);
24
- var import_types = require("../types.js");
24
+ const EMPTY_ADDRESS = "";
25
25
  function isStrategyEligible(s, allowedChains, showHiddenStrategies, sdkStateByChain, curatorFilter) {
26
26
  const network = s?.chainId !== void 0 ? allowedChains[s.chainId] : void 0;
27
27
  const isNetworkCorrect = !!network && network === s.network;
28
28
  const isHidden = !showHiddenStrategies && s.hideInProd;
29
29
  const networkConditionMet = isNetworkCorrect && !isHidden;
30
30
  const tokensList = sdkStateByChain?.[s.chainId]?.tokens?.tokenDataList;
31
- const targetToken = tokensList?.[s?.tokenOutAddress || import_types.EMPTY_ADDRESS];
31
+ const targetToken = tokensList?.[s?.tokenOutAddress || EMPTY_ADDRESS];
32
32
  const isTokensCorrect = !!targetToken;
33
33
  const showInMainApp = s.showInMainApp ?? true;
34
34
  const showCondition = curatorFilter || showInMainApp;
@@ -22,12 +22,12 @@ __export(get_strategy_points_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(get_strategy_points_exports);
24
24
  var import_leverage = require("../leverage/index.js");
25
- var import_types = require("../types.js");
26
25
  var import_get_complex_points_list = require("./get-complex-points-list.js");
27
26
  var import_get_points_info = require("./get-points-info.js");
28
27
  var import_get_points_rates = require("./get-points-rates.js");
29
28
  const EMPTY_CHAIN_ID = 0;
30
29
  const EMPTY_ARRAY = [];
30
+ const EMPTY_ADDRESS = "";
31
31
  function getStrategyPoints({
32
32
  strategy,
33
33
  info,
@@ -40,7 +40,7 @@ function getStrategyPoints({
40
40
  const cmPointsList = (0, import_get_complex_points_list.getComplexPointsList)(
41
41
  apySnapshotForChain?.pointsList,
42
42
  apySnapshotForChain?.extraCollateralPointsList,
43
- minCreditManager?.pool ?? import_types.EMPTY_ADDRESS
43
+ minCreditManager?.pool ?? EMPTY_ADDRESS
44
44
  );
45
45
  const pointsInfo = (0, import_get_points_info.getPointsInfo)({
46
46
  chainId,
@@ -51,7 +51,7 @@ function getStrategyPoints({
51
51
  const debtPointsList = (0, import_get_complex_points_list.getComplexPointsList)(
52
52
  apySnapshotForChain?.pointsList,
53
53
  apySnapshotForChain?.extraCollateralPointsList,
54
- import_types.EMPTY_ADDRESS
54
+ EMPTY_ADDRESS
55
55
  );
56
56
  const pointsInfoDebt = (0, import_get_points_info.getPointsInfo)({
57
57
  chainId,
@@ -24,6 +24,7 @@ module.exports = __toCommonJS(get_strategy_info_core_exports);
24
24
  var import__ = require("../../index.js");
25
25
  var import_price_math = require("../../price-math.js");
26
26
  var import_leverage = require("../leverage/index.js");
27
+ var import_get_strategy_points = require("../points/get-strategy-points.js");
27
28
  var import_sort_strategy_cms_by_availability = require("../sort-strategy-cms-by-availability/index.js");
28
29
  var import_get_strategy_max_apy = require("./get-strategy-max-apy.js");
29
30
  var import_is_strategy_cm_disabled = require("./is-strategy-cm-disabled.js");
@@ -100,6 +101,18 @@ function getStrategyInfoCore({
100
101
  }
101
102
  }
102
103
  });
104
+ const points = (0, import_get_strategy_points.getStrategyPoints)({
105
+ strategy: {
106
+ chainId: strategy.chainId,
107
+ tokenOutAddress: targetTokenAddress
108
+ },
109
+ info: {
110
+ maxLeverage,
111
+ minCreditManager
112
+ },
113
+ strategyCreditManagers: creditManagers ?? {},
114
+ apyListByNetwork
115
+ });
103
116
  return {
104
117
  maxLeverage,
105
118
  maxAPY: totalMaxApy,
@@ -107,7 +120,8 @@ function getStrategyInfoCore({
107
120
  totalBorrowRate,
108
121
  baseQuotaRateWithFee,
109
122
  availableToBorrowMoney,
110
- minCreditManager
123
+ minCreditManager,
124
+ points
111
125
  };
112
126
  }
113
127
  // Annotate the CommonJS export names for ESM import in node:
@@ -16,7 +16,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  var types_exports = {};
17
17
  module.exports = __toCommonJS(types_exports);
18
18
  __reExport(types_exports, require("./chains.js"), module.exports);
19
- __reExport(types_exports, require("./constants.js"), module.exports);
20
19
  __reExport(types_exports, require("./credit-manager-data-legacy.js"), module.exports);
21
20
  __reExport(types_exports, require("./curator-filter.js"), module.exports);
22
21
  __reExport(types_exports, require("./legacy-strategy-data-source.js"), module.exports);
@@ -29,7 +28,6 @@ __reExport(types_exports, require("./targetable.js"), module.exports);
29
28
  // Annotate the CommonJS export names for ESM import in node:
30
29
  0 && (module.exports = {
31
30
  ...require("./chains.js"),
32
- ...require("./constants.js"),
33
31
  ...require("./credit-manager-data-legacy.js"),
34
32
  ...require("./curator-filter.js"),
35
33
  ...require("./legacy-strategy-data-source.js"),
@@ -1,4 +1,4 @@
1
- import { EMPTY_ADDRESS } from "../types.js";
1
+ const EMPTY_ADDRESS = "";
2
2
  function isStrategyEligible(s, allowedChains, showHiddenStrategies, sdkStateByChain, curatorFilter) {
3
3
  const network = s?.chainId !== void 0 ? allowedChains[s.chainId] : void 0;
4
4
  const isNetworkCorrect = !!network && network === s.network;
@@ -1,10 +1,10 @@
1
1
  import { getFactorFromLeverage } from "../leverage/index.js";
2
- import { EMPTY_ADDRESS } from "../types.js";
3
2
  import { getComplexPointsList } from "./get-complex-points-list.js";
4
3
  import { getPointsInfo } from "./get-points-info.js";
5
4
  import { getPointsRates } from "./get-points-rates.js";
6
5
  const EMPTY_CHAIN_ID = 0;
7
6
  const EMPTY_ARRAY = [];
7
+ const EMPTY_ADDRESS = "";
8
8
  function getStrategyPoints({
9
9
  strategy,
10
10
  info,
@@ -1,6 +1,7 @@
1
1
  import { getSingleQuotaBorrowRate } from "../../index.js";
2
2
  import { PriceUtils } from "../../price-math.js";
3
3
  import { getFactorFromLeverage } from "../leverage/index.js";
4
+ import { getStrategyPoints } from "../points/get-strategy-points.js";
4
5
  import { sortStrategyCMsByAvailability } from "../sort-strategy-cms-by-availability/index.js";
5
6
  import { getStrategyMaxAPY } from "./get-strategy-max-apy.js";
6
7
  import { isStrategyCMDisabled } from "./is-strategy-cm-disabled.js";
@@ -77,6 +78,18 @@ function getStrategyInfoCore({
77
78
  }
78
79
  }
79
80
  });
81
+ const points = getStrategyPoints({
82
+ strategy: {
83
+ chainId: strategy.chainId,
84
+ tokenOutAddress: targetTokenAddress
85
+ },
86
+ info: {
87
+ maxLeverage,
88
+ minCreditManager
89
+ },
90
+ strategyCreditManagers: creditManagers ?? {},
91
+ apyListByNetwork
92
+ });
80
93
  return {
81
94
  maxLeverage,
82
95
  maxAPY: totalMaxApy,
@@ -84,7 +97,8 @@ function getStrategyInfoCore({
84
97
  totalBorrowRate,
85
98
  baseQuotaRateWithFee,
86
99
  availableToBorrowMoney,
87
- minCreditManager
100
+ minCreditManager,
101
+ points
88
102
  };
89
103
  }
90
104
  export {
@@ -1,5 +1,4 @@
1
1
  export * from "./chains.js";
2
- export * from "./constants.js";
3
2
  export * from "./credit-manager-data-legacy.js";
4
3
  export * from "./curator-filter.js";
5
4
  export * from "./legacy-strategy-data-source.js";
@@ -1,7 +1,11 @@
1
1
  import type { Address } from "viem";
2
- import type { APYListByNetwork, Strategy, StrategyCreditManagerLike, StrategyInfoLike } from "../types.js";
2
+ import type { APYListByNetwork, StrategyCreditManagerLike, StrategyInfoLike } from "../types.js";
3
+ export interface StrategyLike {
4
+ chainId: number;
5
+ tokenOutAddress: Address;
6
+ }
3
7
  export interface GetStrategyPointsProps {
4
- readonly strategy: Strategy;
8
+ readonly strategy: StrategyLike;
5
9
  readonly info: StrategyInfoLike | undefined;
6
10
  readonly strategyCreditManagers: Record<Address, StrategyCreditManagerLike>;
7
11
  readonly apyListByNetwork: APYListByNetwork | undefined;
@@ -14,3 +18,4 @@ export declare function getStrategyPoints({ strategy, info, strategyCreditManage
14
18
  rewardRates: (bigint | "soon")[];
15
19
  debtRewardRates: (bigint | "soon")[];
16
20
  };
21
+ export type StrategyPointsResult = ReturnType<typeof getStrategyPoints>;
@@ -1,11 +1,15 @@
1
1
  import type { Address } from "viem";
2
2
  import type { StrategyDataSource } from "../types/index.js";
3
+ import type { BasePointsList, ExtraCollateralPointsList } from "../types.js";
3
4
  import type { APYListSlice, CreditManagerSlice, StrategyInfoResult, StrategySlice } from "./types.js";
4
5
  export interface GetStrategyInfoCoreArgs<ID extends string | number, CM extends CreditManagerSlice> {
5
6
  strategy: StrategySlice<ID>;
6
7
  creditManagers: Record<Address, CM> | undefined;
7
8
  source: StrategyDataSource;
8
- apyListByNetwork: Record<number, APYListSlice | undefined> | undefined;
9
+ apyListByNetwork: Record<number, (APYListSlice & {
10
+ pointsList?: BasePointsList;
11
+ extraCollateralPointsList?: ExtraCollateralPointsList;
12
+ }) | undefined> | undefined;
9
13
  quotaReserve: number;
10
14
  slippage: number;
11
15
  }
@@ -1,5 +1,6 @@
1
1
  import type { Address } from "viem";
2
2
  import type { PartialRecord } from "../../../../sdk/index.js";
3
+ import type { StrategyPointsResult } from "../points/get-strategy-points.js";
3
4
  export interface QuotaSlice {
4
5
  token: Address;
5
6
  rate: bigint;
@@ -64,6 +65,7 @@ export interface StrategyInfoResult<CM extends CreditManagerSlice = CreditManage
64
65
  availableToBorrowMoney: bigint;
65
66
  minCreditManager: CM;
66
67
  baseQuotaRateWithFee: bigint;
68
+ points?: StrategyPointsResult;
67
69
  }
68
70
  export interface GetStrategyInfoArgs<ID extends string | number, CM extends CreditManagerSlice> {
69
71
  strategy: StrategySlice<ID>;
@@ -1,6 +1,5 @@
1
1
  export type { QuotaSlice as QuotaInfo } from "../strategy-info/types.js";
2
2
  export * from "./chains.js";
3
- export * from "./constants.js";
4
3
  export * from "./credit-manager-data-legacy.js";
5
4
  export * from "./curator-filter.js";
6
5
  export * from "./legacy-strategy-data-source.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "14.7.0-next.2",
3
+ "version": "14.7.0",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",
@@ -1,28 +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 constants_exports = {};
20
- __export(constants_exports, {
21
- EMPTY_ADDRESS: () => EMPTY_ADDRESS
22
- });
23
- module.exports = __toCommonJS(constants_exports);
24
- const EMPTY_ADDRESS = "";
25
- // Annotate the CommonJS export names for ESM import in node:
26
- 0 && (module.exports = {
27
- EMPTY_ADDRESS
28
- });
@@ -1,4 +0,0 @@
1
- const EMPTY_ADDRESS = "";
2
- export {
3
- EMPTY_ADDRESS
4
- };
@@ -1,2 +0,0 @@
1
- import type { Address } from "viem";
2
- export declare const EMPTY_ADDRESS: Address;