@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.
@@ -27,7 +27,7 @@ export declare class ScallopBuilder {
27
27
  utils: ScallopUtils;
28
28
  walletAddress: string;
29
29
  cache: ScallopCache;
30
- constructor(params: ScallopBuilderParams, instance?: ScallopBuilderInstanceParams);
30
+ constructor(params?: ScallopBuilderParams, instance?: ScallopBuilderInstanceParams);
31
31
  /**
32
32
  * Request the scallop API to initialize data.
33
33
  *
@@ -29,7 +29,7 @@ export declare class ScallopCache {
29
29
  private interval;
30
30
  private tokens;
31
31
  private lastRefill;
32
- constructor(params: ScallopCacheParams, instance?: ScallopCacheInstanceParams);
32
+ constructor(params?: ScallopCacheParams, instance?: ScallopCacheInstanceParams);
33
33
  private get client();
34
34
  private refill;
35
35
  private removeTokens;
@@ -29,7 +29,7 @@ export declare class ScallopClient {
29
29
  utils: ScallopUtils;
30
30
  cache: ScallopCache;
31
31
  walletAddress: string;
32
- constructor(params: ScallopClientParams, instance?: ScallopClientInstanceParams);
32
+ constructor(params?: ScallopClientParams, instance?: ScallopClientInstanceParams);
33
33
  /**
34
34
  * Request the scallop API to initialize data.
35
35
  *
@@ -15,7 +15,7 @@ export declare class ScallopIndexer {
15
15
  private readonly cache;
16
16
  readonly params: ScallopQueryParams;
17
17
  private readonly _requestClient;
18
- constructor(params: ScallopParams, instance?: ScallopIndexerInstanceParams);
18
+ constructor(params?: ScallopParams, instance?: ScallopIndexerInstanceParams);
19
19
  /**
20
20
  * Get market index data.
21
21
  *
@@ -26,7 +26,7 @@ export declare class ScallopQuery {
26
26
  indexer: ScallopIndexer;
27
27
  cache: ScallopCache;
28
28
  walletAddress: string;
29
- constructor(params: ScallopQueryParams, instance?: ScallopQueryInstanceParams);
29
+ constructor(params?: ScallopQueryParams, instance?: ScallopQueryInstanceParams);
30
30
  /**
31
31
  * Request the scallop API to initialize data.
32
32
  *
@@ -1,2 +1,2 @@
1
1
  import { ScallopCache } from 'src/models/scallopCache';
2
- export declare const queryMultipleObjects: (cache: ScallopCache, objectIds: string[], partitionSize?: number) => Promise<import("@mysten/sui/dist/cjs/client").SuiObjectData[]>;
2
+ export declare const queryMultipleObjects: (cache: ScallopCache, rawObjectIds: string[], partitionSize?: number) => Promise<import("@mysten/sui/dist/cjs/client").SuiObjectData[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "1.4.16",
3
+ "version": "1.4.17",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -49,7 +49,7 @@ export class ScallopBuilder {
49
49
  public cache: ScallopCache;
50
50
 
51
51
  public constructor(
52
- params: ScallopBuilderParams,
52
+ params: ScallopBuilderParams = {},
53
53
  instance?: ScallopBuilderInstanceParams
54
54
  ) {
55
55
  this.suiKit = instance?.suiKit ?? newSuiKit(params);
@@ -82,7 +82,7 @@ export class ScallopCache {
82
82
  private lastRefill: number;
83
83
 
84
84
  public constructor(
85
- params: ScallopCacheParams,
85
+ params: ScallopCacheParams = {},
86
86
  instance?: ScallopCacheInstanceParams
87
87
  ) {
88
88
  this.params = params;
@@ -57,7 +57,7 @@ export class ScallopClient {
57
57
  public walletAddress: string;
58
58
 
59
59
  public constructor(
60
- params: ScallopClientParams,
60
+ params: ScallopClientParams = {},
61
61
  instance?: ScallopClientInstanceParams
62
62
  ) {
63
63
  this.params = params;
@@ -42,7 +42,7 @@ export class ScallopIndexer {
42
42
  private readonly _requestClient: AxiosInstance;
43
43
 
44
44
  public constructor(
45
- params: ScallopParams,
45
+ params: ScallopParams = {},
46
46
  instance?: ScallopIndexerInstanceParams
47
47
  ) {
48
48
  this.params = params;
@@ -93,7 +93,7 @@ export class ScallopQuery {
93
93
  public walletAddress: string;
94
94
 
95
95
  public constructor(
96
- params: ScallopQueryParams,
96
+ params: ScallopQueryParams = {},
97
97
  instance?: ScallopQueryInstanceParams
98
98
  ) {
99
99
  this.params = params;
@@ -3,10 +3,10 @@ import { partitionArray } from 'src/utils';
3
3
 
4
4
  export const queryMultipleObjects = async (
5
5
  cache: ScallopCache,
6
- objectIds: string[],
6
+ rawObjectIds: string[],
7
7
  partitionSize = 50
8
8
  ) => {
9
- const objectIdsPartition = partitionArray(objectIds, partitionSize);
9
+ const objectIdsPartition = partitionArray(rawObjectIds, partitionSize);
10
10
 
11
11
  const objects = [];
12
12
  for (const objectIds of objectIdsPartition) {
@@ -650,7 +650,10 @@ export const getObligationAccount = async (
650
650
  }
651
651
 
652
652
  let riskLevel = totalRequiredCollateralValue.isZero()
653
- ? BigNumber(0)
653
+ ? // Note: when there is no collateral and debt is not zero, then it's a bad-debt situation.
654
+ totalBorrowedValueWithWeight.isGreaterThan(0)
655
+ ? BigNumber(100)
656
+ : BigNumber(0)
654
657
  : totalBorrowedValueWithWeight.dividedBy(totalRequiredCollateralValue);
655
658
  // Note: 100% represents the safety upper limit. Even if it exceeds 100% before it is liquidated, it will only display 100%.
656
659
  riskLevel = riskLevel.isLessThan(1) ? riskLevel : BigNumber(1);