@gearbox-protocol/sdk 13.0.0-beta.7 → 13.0.0-beta.8

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.
@@ -18,13 +18,11 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var versions_exports = {};
20
20
  __export(versions_exports, {
21
- VERSION_RANGE_300: () => VERSION_RANGE_300,
22
21
  VERSION_RANGE_310: () => VERSION_RANGE_310,
23
22
  isV310: () => isV310,
24
23
  isVersionRange: () => isVersionRange
25
24
  });
26
25
  module.exports = __toCommonJS(versions_exports);
27
- const VERSION_RANGE_300 = [300, 309];
28
26
  const VERSION_RANGE_310 = [310, 319];
29
27
  function isV310(version) {
30
28
  return isVersionRange(version, VERSION_RANGE_310);
@@ -34,7 +32,6 @@ function isVersionRange(version, range) {
34
32
  }
35
33
  // Annotate the CommonJS export names for ESM import in node:
36
34
  0 && (module.exports = {
37
- VERSION_RANGE_300,
38
35
  VERSION_RANGE_310,
39
36
  isV310,
40
37
  isVersionRange
@@ -1,4 +1,3 @@
1
- const VERSION_RANGE_300 = [300, 309];
2
1
  const VERSION_RANGE_310 = [310, 319];
3
2
  function isV310(version) {
4
3
  return isVersionRange(version, VERSION_RANGE_310);
@@ -7,7 +6,6 @@ function isVersionRange(version, range) {
7
6
  return Number(version) >= range[0] && Number(version) <= range[1];
8
7
  }
9
8
  export {
10
- VERSION_RANGE_300,
11
9
  VERSION_RANGE_310,
12
10
  isV310,
13
11
  isVersionRange
@@ -2,7 +2,7 @@ import type { Address } from "viem";
2
2
  import type { CreditAccountData } from "../base/index.js";
3
3
  import { SDKConstruct } from "../base/index.js";
4
4
  import type { GearboxSDK } from "../GearboxSDK.js";
5
- import type { OnDemandPriceUpdates, PriceUpdateV310, UpdatePriceFeedsResult } from "../market/index.js";
5
+ import type { OnDemandPriceUpdates, UpdatePriceFeedsResult } from "../market/index.js";
6
6
  import { type Asset, type RouterCASlice } from "../router/index.js";
7
7
  import type { MultiCall } from "../types/index.js";
8
8
  import type { AccountToCheck, AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, OpenCAProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewDelayedWithdrawalResult, PriceUpdatesOptions, Rewards, StartDelayedWithdrawalProps, UpdateQuotasProps } from "./types.js";
@@ -191,7 +191,7 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
191
191
  * @param options
192
192
  * @returns
193
193
  */
194
- getOnDemandPriceUpdates(options: PriceUpdatesOptions): Promise<OnDemandPriceUpdates<PriceUpdateV310>>;
194
+ getOnDemandPriceUpdates(options: PriceUpdatesOptions): Promise<OnDemandPriceUpdates>;
195
195
  /**
196
196
  * Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...).
197
197
  * - If there are desiredQuotas and creditAccount update quotaBalance > 0 || (balance > 10n && isEnabled). Is used when account has both: balances and quota buys.
@@ -3,7 +3,7 @@ import type { creditAccountCompressorAbi } from "../../abi/compressors/creditAcc
3
3
  import type { iWithdrawalCompressorV310Abi } from "../../abi/IWithdrawalCompressorV310.js";
4
4
  import type { ConnectedBotData, Construct, CreditAccountData } from "../base/index.js";
5
5
  import type { GearboxSDK } from "../GearboxSDK.js";
6
- import type { CreditSuite, OnDemandPriceUpdates, PriceUpdateV310, UpdatePriceFeedsResult } from "../market/index.js";
6
+ import type { CreditSuite, OnDemandPriceUpdates, UpdatePriceFeedsResult } from "../market/index.js";
7
7
  import type { Asset, CreditAccountTokensSlice, RouterCASlice, RouterCloseResult } from "../router/index.js";
8
8
  import type { MultiCall, RawTx } from "../types/index.js";
9
9
  export type GetCreditAccountsArgs = ContractFunctionArgs<typeof creditAccountCompressorAbi, "pure" | "view", "getCreditAccounts">;
@@ -315,10 +315,6 @@ export interface FullyLiquidateProps {
315
315
  * Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
316
316
  */
317
317
  slippage?: bigint;
318
- /**
319
- * TODO: legacy v3 option to remove
320
- */
321
- force?: boolean;
322
318
  /**
323
319
  * List of assets to keep on account after liquidation
324
320
  */
@@ -459,7 +455,7 @@ export interface ICreditAccountsService extends Construct {
459
455
  additionalBots: Array<Omit<NonNullable<GetConnectedMigrationBotsResult>, "botAddress">>;
460
456
  }>;
461
457
  /**
462
- * V3.1 method, throws in V3. Connects/disables a bot and updates prices
458
+ * Connects/disables a bot and updates prices
463
459
  * @param props - {@link SetBotProps}
464
460
  * @return All necessary data to execute the transaction (call, credit facade)
465
461
  */
@@ -569,7 +565,7 @@ export interface ICreditAccountsService extends Construct {
569
565
  * @param options
570
566
  * @returns
571
567
  */
572
- getOnDemandPriceUpdates(options: PriceUpdatesOptions): Promise<OnDemandPriceUpdates<PriceUpdateV310>>;
568
+ getOnDemandPriceUpdates(options: PriceUpdatesOptions): Promise<OnDemandPriceUpdates>;
573
569
  /**
574
570
  * Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...).
575
571
  * @param options
@@ -588,8 +584,6 @@ export interface ICreditAccountsService extends Construct {
588
584
  * Fully repays credit account or repays credit account and keeps it open with zero debt
589
585
  * - Repays in the following order: price update -> add collateral to cover the debt ->
590
586
  * -> disable quotas for all tokens -> decrease debt -> disable tokens all tokens -> withdraw all tokens
591
- * - V3.0 claims rewards for tokens which are specified in legacy SDK
592
- * - V3.1 claims rewards for all tokens IF router is also V3.1
593
587
  * @param props - {@link RepayCreditAccountProps}
594
588
  * @return All necessary data to execute the transaction (call, credit facade)
595
589
  */
@@ -598,18 +592,14 @@ export interface ICreditAccountsService extends Construct {
598
592
  * Fully repays liquidatable account
599
593
  * - Repay and liquidate is executed in the following order: price update -> add collateral to cover the debt ->
600
594
  * withdraw all tokens from credit account
601
- * - V3.0 claims rewards for tokens which are specified in legacy SDK
602
- * - V3.1 claims rewards for all tokens IF router is also V3.1
603
595
  * @param props - {@link RepayAndLiquidateCreditAccountProps}
604
596
  * @return All necessary data to execute the transaction (call, credit facade)
605
597
  */
606
598
  repayAndLiquidateCreditAccount(props: RepayAndLiquidateCreditAccountProps): Promise<CreditAccountOperationResult>;
607
599
  /**
608
- * Executes swap specified by given calls, update quotas of affected tokens
600
+ * Claims farm rewards and optionally updates quotas
609
601
  * - Claim rewards is executed in the following order: price update -> execute claim calls ->
610
- * -> (optionally: disable reward tokens) -> (optionally: update quotas)
611
- * - V3.0 claims rewards for tokens which are specified in legacy SDK
612
- * - V3.1 claims rewards for all tokens IF router is also V3.1 and falls back to legacy calls if router is not v3.0
602
+ * -> (optionally: update quotas)
613
603
  * @param props - {@link ClaimFarmRewardsProps}
614
604
  * @return All necessary data to execute the transaction (call, credit facade)
615
605
  */
@@ -2,7 +2,6 @@
2
2
  * Version range, inclusive of both ends
3
3
  */
4
4
  export type VersionRange = [number, number];
5
- export declare const VERSION_RANGE_300: VersionRange;
6
5
  export declare const VERSION_RANGE_310: VersionRange;
7
6
  export declare function isV310(version: number | bigint | string): boolean;
8
7
  export declare function isVersionRange(version: number | bigint | string, range: VersionRange): boolean;
@@ -5,7 +5,7 @@ import { BaseContract } from "../../base/index.js";
5
5
  import type { GearboxSDK } from "../../GearboxSDK.js";
6
6
  import type { PriceOracleStateHuman } from "../../types/index.js";
7
7
  import { AddressMap } from "../../utils/index.js";
8
- import type { IPriceFeedContract, PriceUpdateV310, UpdatePriceFeedsResult } from "../pricefeeds/index.js";
8
+ import type { IPriceFeedContract, UpdatePriceFeedsResult } from "../pricefeeds/index.js";
9
9
  import { PriceFeedRef } from "../pricefeeds/index.js";
10
10
  import PriceFeedAnswerMap from "./PriceFeedAnswerMap.js";
11
11
  import type { DelegatedOracleMulticall, IPriceOracleContract, OnDemandPriceUpdates, PriceFeedsForTokensOptions } from "./types.js";
@@ -36,7 +36,7 @@ export declare abstract class PriceOracleBaseContract<abi extends Abi | readonly
36
36
  * @returns
37
37
  */
38
38
  priceFeedsForTokens(tokens: Address[], opts?: PriceFeedsForTokensOptions): IPriceFeedContract[];
39
- abstract onDemandPriceUpdates(creditFacade: Address, updates?: UpdatePriceFeedsResult): OnDemandPriceUpdates<PriceUpdateV310>;
39
+ abstract onDemandPriceUpdates(creditFacade: Address, updates?: UpdatePriceFeedsResult): OnDemandPriceUpdates;
40
40
  /**
41
41
  * Gets main price for given token
42
42
  * Throws if token price feed is not found or answer is not successful
@@ -1,7 +1,7 @@
1
1
  import { type Address, type ContractEventName, type Log } from "viem";
2
2
  import type { PriceOracleData } from "../../base/index.js";
3
3
  import type { GearboxSDK } from "../../GearboxSDK.js";
4
- import { type PriceUpdateV310, type UpdatePriceFeedsResult } from "../pricefeeds/index.js";
4
+ import { type UpdatePriceFeedsResult } from "../pricefeeds/index.js";
5
5
  import { PriceOracleBaseContract } from "./PriceOracleBaseContract.js";
6
6
  import type { OnDemandPriceUpdates } from "./types.js";
7
7
  declare const abi: readonly [{
@@ -348,7 +348,7 @@ export declare class PriceOracleV310Contract extends PriceOracleBaseContract<abi
348
348
  * @param updates
349
349
  * @returns
350
350
  */
351
- onDemandPriceUpdates(creditFacade: Address, updates?: UpdatePriceFeedsResult): OnDemandPriceUpdates<PriceUpdateV310>;
351
+ onDemandPriceUpdates(creditFacade: Address, updates?: UpdatePriceFeedsResult): OnDemandPriceUpdates;
352
352
  processLog(log: Log<bigint, number, false, undefined, undefined, abi, ContractEventName<abi>>): void;
353
353
  }
354
354
  export {};
@@ -10,13 +10,11 @@ export interface PriceFeedsForTokensOptions {
10
10
  reserve?: boolean;
11
11
  }
12
12
  /**
13
- * Abstraction that represents on demand price updates acceptable by both credit facade multicall and
14
- * as raw PriceUpdate in liquidator calls
15
- * T is (priceFeed, data)
16
- * TODO: should be removed after v310 migration
13
+ * On demand price updates acceptable by both credit facade multicall and
14
+ * as raw PriceUpdate in liquidator calls.
17
15
  */
18
- export interface OnDemandPriceUpdates<T = unknown> {
19
- raw: T[];
16
+ export interface OnDemandPriceUpdates {
17
+ raw: PriceUpdateV310[];
20
18
  multicall: MultiCall[];
21
19
  }
22
20
  export interface IPriceOracleContract extends IBaseContract {
@@ -78,7 +76,7 @@ export interface IPriceOracleContract extends IBaseContract {
78
76
  * @param updates
79
77
  * @returns
80
78
  */
81
- onDemandPriceUpdates: (creditFacade: Address, updates?: UpdatePriceFeedsResult) => OnDemandPriceUpdates<PriceUpdateV310>;
79
+ onDemandPriceUpdates: (creditFacade: Address, updates?: UpdatePriceFeedsResult) => OnDemandPriceUpdates;
82
80
  /**
83
81
  * Tries to convert amount of from one token to another, using latest known prices
84
82
  * @param from
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "13.0.0-beta.7",
3
+ "version": "13.0.0-beta.8",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",
@@ -80,22 +80,22 @@
80
80
  "zod": "^4.3.6"
81
81
  },
82
82
  "devDependencies": {
83
- "@biomejs/biome": "^2.4.6",
84
- "@commitlint/cli": "^20.4.3",
85
- "@commitlint/config-conventional": "^20.4.3",
86
- "@gearbox-protocol/biome-config": "^1.0.22",
83
+ "@biomejs/biome": "^2.4.9",
84
+ "@commitlint/cli": "^20.5.0",
85
+ "@commitlint/config-conventional": "^20.5.0",
86
+ "@gearbox-protocol/biome-config": "^1.0.24",
87
87
  "@types/cross-spawn": "^6.0.6",
88
88
  "axios": "^1.13.6",
89
89
  "cross-spawn": "^7.0.6",
90
90
  "husky": "^9.1.7",
91
- "lint-staged": "^16.3.3",
91
+ "lint-staged": "^16.4.0",
92
92
  "pino": "^10.3.1",
93
93
  "pino-pretty": "^13.1.3",
94
94
  "tsup": "^8.5.1",
95
95
  "tsx": "^4.21.0",
96
96
  "typescript": "^5.9.3",
97
97
  "viem-deal": "^2.0.4",
98
- "vitest": "^4.0.18"
98
+ "vitest": "^4.1.1"
99
99
  },
100
100
  "peerDependencies": {
101
101
  "axios": "^1.0.0",