@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 +13 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -10
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopBuilder.d.ts +1 -1
- package/dist/models/scallopCache.d.ts +1 -1
- package/dist/models/scallopClient.d.ts +1 -1
- package/dist/models/scallopIndexer.d.ts +1 -1
- package/dist/models/scallopQuery.d.ts +1 -1
- package/dist/queries/objectsQuery.d.ts +1 -1
- package/package.json +1 -1
- package/src/models/scallopBuilder.ts +1 -1
- package/src/models/scallopCache.ts +1 -1
- package/src/models/scallopClient.ts +1 -1
- package/src/models/scallopIndexer.ts +1 -1
- package/src/models/scallopQuery.ts +1 -1
- package/src/queries/objectsQuery.ts +2 -2
- package/src/queries/portfolioQuery.ts +4 -1
|
@@ -27,7 +27,7 @@ export declare class ScallopBuilder {
|
|
|
27
27
|
utils: ScallopUtils;
|
|
28
28
|
walletAddress: string;
|
|
29
29
|
cache: ScallopCache;
|
|
30
|
-
constructor(params
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
2
|
+
export declare const queryMultipleObjects: (cache: ScallopCache, rawObjectIds: string[], partitionSize?: number) => Promise<import("@mysten/sui/dist/cjs/client").SuiObjectData[]>;
|
package/package.json
CHANGED
|
@@ -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);
|
|
@@ -3,10 +3,10 @@ import { partitionArray } from 'src/utils';
|
|
|
3
3
|
|
|
4
4
|
export const queryMultipleObjects = async (
|
|
5
5
|
cache: ScallopCache,
|
|
6
|
-
|
|
6
|
+
rawObjectIds: string[],
|
|
7
7
|
partitionSize = 50
|
|
8
8
|
) => {
|
|
9
|
-
const objectIdsPartition = partitionArray(
|
|
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
|
-
?
|
|
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);
|