@gearbox-protocol/sdk 3.0.0-vfour.272 → 3.0.0-vfour.274

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.
@@ -248,7 +248,13 @@ class CreditAccountsService extends import_base.SDKConstruct {
248
248
  creditManager: cm.creditManager,
249
249
  slippage
250
250
  });
251
+ const priceUpdates = await this.getPriceUpdatesForFacade(
252
+ ca.creditManager,
253
+ ca,
254
+ void 0
255
+ );
251
256
  const calls = [
257
+ ...priceUpdates,
252
258
  ...routerCloseResult.calls,
253
259
  ...this.#prepareDisableQuotas(ca),
254
260
  ...this.#prepareDecreaseDebt(ca),
@@ -281,7 +287,13 @@ class CreditAccountsService extends import_base.SDKConstruct {
281
287
  }) {
282
288
  const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
283
289
  const addCollateral = collateralAssets.filter((a) => a.balance > 0);
290
+ const priceUpdates = await this.getPriceUpdatesForFacade(
291
+ ca.creditManager,
292
+ ca,
293
+ void 0
294
+ );
284
295
  const calls = [
296
+ ...priceUpdates,
285
297
  ...this.#prepareAddCollateral(ca.creditFacade, addCollateral, permits),
286
298
  ...this.#prepareDisableQuotas(ca),
287
299
  ...this.#prepareDecreaseDebt(ca),
@@ -634,7 +646,10 @@ class CreditAccountsService extends import_base.SDKConstruct {
634
646
  return market.priceOracle.onDemandPriceUpdates(update);
635
647
  }
636
648
  /**
637
- * Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...)
649
+ * Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...).
650
+ * If there are desiredQuotas and creditAccount update quotaBalance > 0 || (balance > 10n && isEnabled).
651
+ * If there is creditAccount update balance > 10n && isEnabled.
652
+ * If there is desiredQuotas update quotaBalance > 0.
638
653
  * @param acc
639
654
  * @returns
640
655
  */
@@ -238,7 +238,13 @@ class CreditAccountsService extends SDKConstruct {
238
238
  creditManager: cm.creditManager,
239
239
  slippage
240
240
  });
241
+ const priceUpdates = await this.getPriceUpdatesForFacade(
242
+ ca.creditManager,
243
+ ca,
244
+ void 0
245
+ );
241
246
  const calls = [
247
+ ...priceUpdates,
242
248
  ...routerCloseResult.calls,
243
249
  ...this.#prepareDisableQuotas(ca),
244
250
  ...this.#prepareDecreaseDebt(ca),
@@ -271,7 +277,13 @@ class CreditAccountsService extends SDKConstruct {
271
277
  }) {
272
278
  const cm = this.sdk.marketRegister.findCreditManager(ca.creditManager);
273
279
  const addCollateral = collateralAssets.filter((a) => a.balance > 0);
280
+ const priceUpdates = await this.getPriceUpdatesForFacade(
281
+ ca.creditManager,
282
+ ca,
283
+ void 0
284
+ );
274
285
  const calls = [
286
+ ...priceUpdates,
275
287
  ...this.#prepareAddCollateral(ca.creditFacade, addCollateral, permits),
276
288
  ...this.#prepareDisableQuotas(ca),
277
289
  ...this.#prepareDecreaseDebt(ca),
@@ -624,7 +636,10 @@ class CreditAccountsService extends SDKConstruct {
624
636
  return market.priceOracle.onDemandPriceUpdates(update);
625
637
  }
626
638
  /**
627
- * Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...)
639
+ * Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...).
640
+ * If there are desiredQuotas and creditAccount update quotaBalance > 0 || (balance > 10n && isEnabled).
641
+ * If there is creditAccount update balance > 10n && isEnabled.
642
+ * If there is desiredQuotas update quotaBalance > 0.
628
643
  * @param acc
629
644
  * @returns
630
645
  */
@@ -213,7 +213,10 @@ export declare class CreditAccountsService extends SDKConstruct {
213
213
  */
214
214
  getOnDemandPriceUpdates(creditManager: Address, creditAccount: CreditAccountDataSlice | undefined, desiredQuotas: Array<Asset> | undefined): Promise<Array<OnDemandPriceUpdate>>;
215
215
  /**
216
- * Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...)
216
+ * Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...).
217
+ * If there are desiredQuotas and creditAccount update quotaBalance > 0 || (balance > 10n && isEnabled).
218
+ * If there is creditAccount update balance > 10n && isEnabled.
219
+ * If there is desiredQuotas update quotaBalance > 0.
217
220
  * @param acc
218
221
  * @returns
219
222
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-vfour.272",
3
+ "version": "3.0.0-vfour.274",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",