@scallop-io/sui-scallop-sdk 1.4.16 → 1.4.17

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/index.mjs CHANGED
@@ -1320,7 +1320,7 @@ var deepMergeObject = (curr, update) => {
1320
1320
  return result;
1321
1321
  };
1322
1322
  var ScallopCache = class {
1323
- constructor(params, instance) {
1323
+ constructor(params = {}, instance) {
1324
1324
  this.tokensPerInterval = DEFAULT_TOKENS_PER_INTERVAL;
1325
1325
  this.interval = DEFAULT_INTERVAL_IN_MS;
1326
1326
  this.params = params;
@@ -3270,11 +3270,11 @@ var getBorrowLimit = async (utils, poolName) => {
3270
3270
  };
3271
3271
 
3272
3272
  // src/queries/objectsQuery.ts
3273
- var queryMultipleObjects = async (cache, objectIds, partitionSize = 50) => {
3274
- const objectIdsPartition = partitionArray(objectIds, partitionSize);
3273
+ var queryMultipleObjects = async (cache, rawObjectIds, partitionSize = 50) => {
3274
+ const objectIdsPartition = partitionArray(rawObjectIds, partitionSize);
3275
3275
  const objects = [];
3276
- for (const objectIds2 of objectIdsPartition) {
3277
- const result = await cache.queryGetObjects(objectIds2);
3276
+ for (const objectIds of objectIdsPartition) {
3277
+ const result = await cache.queryGetObjects(objectIds);
3278
3278
  objects.push(...result);
3279
3279
  }
3280
3280
  return objects;
@@ -4481,7 +4481,10 @@ var getObligationAccount = async (query, obligation, ownerAddress, indexer = fal
4481
4481
  };
4482
4482
  }
4483
4483
  }
4484
- let riskLevel = totalRequiredCollateralValue.isZero() ? BigNumber5(0) : totalBorrowedValueWithWeight.dividedBy(totalRequiredCollateralValue);
4484
+ let riskLevel = totalRequiredCollateralValue.isZero() ? (
4485
+ // Note: when there is no collateral and debt is not zero, then it's a bad-debt situation.
4486
+ totalBorrowedValueWithWeight.isGreaterThan(0) ? BigNumber5(100) : BigNumber5(0)
4487
+ ) : totalBorrowedValueWithWeight.dividedBy(totalRequiredCollateralValue);
4485
4488
  riskLevel = riskLevel.isLessThan(1) ? riskLevel : BigNumber5(1);
4486
4489
  const accountBalanceValue = totalDepositedValue.minus(totalBorrowedValue).isGreaterThan(0) ? totalDepositedValue.minus(totalBorrowedValue) : BigNumber5(0);
4487
4490
  const availableCollateralValue = totalBorrowCapacityValue.minus(totalBorrowedValueWithWeight).isGreaterThan(0) ? totalBorrowCapacityValue.minus(totalBorrowedValueWithWeight) : BigNumber5(0);
@@ -7737,7 +7740,7 @@ var newScallopTxBlock = (builder, initTxBlock) => {
7737
7740
  // src/models/scallopIndexer.ts
7738
7741
  import axios2 from "axios";
7739
7742
  var ScallopIndexer = class {
7740
- constructor(params, instance) {
7743
+ constructor(params = {}, instance) {
7741
7744
  this.params = params;
7742
7745
  this.cache = instance?.cache ?? new ScallopCache(this.params);
7743
7746
  this._requestClient = axios2.create({
@@ -7913,7 +7916,7 @@ var ScallopIndexer = class {
7913
7916
  // src/models/scallopQuery.ts
7914
7917
  import { normalizeSuiAddress } from "@mysten/sui/utils";
7915
7918
  var ScallopQuery = class {
7916
- constructor(params, instance) {
7919
+ constructor(params = {}, instance) {
7917
7920
  this.params = params;
7918
7921
  this.suiKit = instance?.suiKit ?? instance?.utils?.suiKit ?? newSuiKit(params);
7919
7922
  this.walletAddress = normalizeSuiAddress(
@@ -8513,7 +8516,7 @@ var ScallopQuery = class {
8513
8516
 
8514
8517
  // src/models/scallopBuilder.ts
8515
8518
  var ScallopBuilder = class {
8516
- constructor(params, instance) {
8519
+ constructor(params = {}, instance) {
8517
8520
  this.suiKit = instance?.suiKit ?? newSuiKit(params);
8518
8521
  this.params = params;
8519
8522
  this.walletAddress = normalizeSuiAddress2(
@@ -8660,7 +8663,7 @@ var ScallopBuilder = class {
8660
8663
 
8661
8664
  // src/models/scallopClient.ts
8662
8665
  var ScallopClient = class {
8663
- constructor(params, instance) {
8666
+ constructor(params = {}, instance) {
8664
8667
  this.params = params;
8665
8668
  this.suiKit = instance?.suiKit ?? instance?.builder?.suiKit ?? newSuiKit(params);
8666
8669
  this.walletAddress = normalizeSuiAddress3(