@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.js CHANGED
@@ -1406,7 +1406,7 @@ var deepMergeObject = (curr, update) => {
1406
1406
  return result;
1407
1407
  };
1408
1408
  var ScallopCache = class {
1409
- constructor(params, instance) {
1409
+ constructor(params = {}, instance) {
1410
1410
  this.tokensPerInterval = DEFAULT_TOKENS_PER_INTERVAL;
1411
1411
  this.interval = DEFAULT_INTERVAL_IN_MS;
1412
1412
  this.params = params;
@@ -3356,11 +3356,11 @@ var getBorrowLimit = async (utils, poolName) => {
3356
3356
  };
3357
3357
 
3358
3358
  // src/queries/objectsQuery.ts
3359
- var queryMultipleObjects = async (cache, objectIds, partitionSize = 50) => {
3360
- const objectIdsPartition = partitionArray(objectIds, partitionSize);
3359
+ var queryMultipleObjects = async (cache, rawObjectIds, partitionSize = 50) => {
3360
+ const objectIdsPartition = partitionArray(rawObjectIds, partitionSize);
3361
3361
  const objects = [];
3362
- for (const objectIds2 of objectIdsPartition) {
3363
- const result = await cache.queryGetObjects(objectIds2);
3362
+ for (const objectIds of objectIdsPartition) {
3363
+ const result = await cache.queryGetObjects(objectIds);
3364
3364
  objects.push(...result);
3365
3365
  }
3366
3366
  return objects;
@@ -4567,7 +4567,10 @@ var getObligationAccount = async (query, obligation, ownerAddress, indexer = fal
4567
4567
  };
4568
4568
  }
4569
4569
  }
4570
- let riskLevel = totalRequiredCollateralValue.isZero() ? (0, import_bignumber5.default)(0) : totalBorrowedValueWithWeight.dividedBy(totalRequiredCollateralValue);
4570
+ let riskLevel = totalRequiredCollateralValue.isZero() ? (
4571
+ // Note: when there is no collateral and debt is not zero, then it's a bad-debt situation.
4572
+ totalBorrowedValueWithWeight.isGreaterThan(0) ? (0, import_bignumber5.default)(100) : (0, import_bignumber5.default)(0)
4573
+ ) : totalBorrowedValueWithWeight.dividedBy(totalRequiredCollateralValue);
4571
4574
  riskLevel = riskLevel.isLessThan(1) ? riskLevel : (0, import_bignumber5.default)(1);
4572
4575
  const accountBalanceValue = totalDepositedValue.minus(totalBorrowedValue).isGreaterThan(0) ? totalDepositedValue.minus(totalBorrowedValue) : (0, import_bignumber5.default)(0);
4573
4576
  const availableCollateralValue = totalBorrowCapacityValue.minus(totalBorrowedValueWithWeight).isGreaterThan(0) ? totalBorrowCapacityValue.minus(totalBorrowedValueWithWeight) : (0, import_bignumber5.default)(0);
@@ -7812,7 +7815,7 @@ var newScallopTxBlock = (builder, initTxBlock) => {
7812
7815
  // src/models/scallopIndexer.ts
7813
7816
  var import_axios2 = __toESM(require("axios"));
7814
7817
  var ScallopIndexer = class {
7815
- constructor(params, instance) {
7818
+ constructor(params = {}, instance) {
7816
7819
  this.params = params;
7817
7820
  this.cache = instance?.cache ?? new ScallopCache(this.params);
7818
7821
  this._requestClient = import_axios2.default.create({
@@ -7988,7 +7991,7 @@ var ScallopIndexer = class {
7988
7991
  // src/models/scallopQuery.ts
7989
7992
  var import_utils23 = require("@mysten/sui/utils");
7990
7993
  var ScallopQuery = class {
7991
- constructor(params, instance) {
7994
+ constructor(params = {}, instance) {
7992
7995
  this.params = params;
7993
7996
  this.suiKit = instance?.suiKit ?? instance?.utils?.suiKit ?? newSuiKit(params);
7994
7997
  this.walletAddress = (0, import_utils23.normalizeSuiAddress)(
@@ -8588,7 +8591,7 @@ var ScallopQuery = class {
8588
8591
 
8589
8592
  // src/models/scallopBuilder.ts
8590
8593
  var ScallopBuilder = class {
8591
- constructor(params, instance) {
8594
+ constructor(params = {}, instance) {
8592
8595
  this.suiKit = instance?.suiKit ?? newSuiKit(params);
8593
8596
  this.params = params;
8594
8597
  this.walletAddress = (0, import_utils24.normalizeSuiAddress)(
@@ -8735,7 +8738,7 @@ var ScallopBuilder = class {
8735
8738
 
8736
8739
  // src/models/scallopClient.ts
8737
8740
  var ScallopClient = class {
8738
- constructor(params, instance) {
8741
+ constructor(params = {}, instance) {
8739
8742
  this.params = params;
8740
8743
  this.suiKit = instance?.suiKit ?? instance?.builder?.suiKit ?? newSuiKit(params);
8741
8744
  this.walletAddress = (0, import_utils25.normalizeSuiAddress)(