@scallop-io/sui-scallop-sdk 0.46.38 → 0.46.39

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "0.46.38",
3
+ "version": "0.46.39",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -232,7 +232,7 @@ export const getMarketPools = async (
232
232
  return marketPools;
233
233
  }
234
234
 
235
- Promise.allSettled(
235
+ await Promise.allSettled(
236
236
  poolCoinNames.map(async (poolCoinName) => {
237
237
  const marketPool = await getMarketPool(
238
238
  query,
@@ -268,19 +268,6 @@ export const getMarketPool = async (
268
268
  marketObject?: SuiObjectData | null,
269
269
  coinPrice?: number
270
270
  ) => {
271
- const marketId = query.address.get('core.market');
272
- marketObject =
273
- marketObject ||
274
- (
275
- await query.cache.queryGetObject(marketId, {
276
- showContent: true,
277
- })
278
- ).data;
279
-
280
- coinPrice =
281
- coinPrice ||
282
- (await query.utils.getCoinPrices([poolCoinName]))?.[poolCoinName];
283
-
284
271
  let marketPool: MarketPool | undefined;
285
272
  let balanceSheet: BalanceSheet | undefined;
286
273
  let borrowIndex: BorrowIndex | undefined;
@@ -297,6 +284,19 @@ export const getMarketPool = async (
297
284
  return marketPoolIndexer;
298
285
  }
299
286
 
287
+ const marketId = query.address.get('core.market');
288
+ marketObject =
289
+ marketObject ||
290
+ (
291
+ await query.cache.queryGetObject(marketId, {
292
+ showContent: true,
293
+ })
294
+ ).data;
295
+
296
+ coinPrice =
297
+ coinPrice ||
298
+ (await query.utils.getCoinPrices([poolCoinName]))?.[poolCoinName];
299
+
300
300
  if (marketObject) {
301
301
  if (marketObject.content && 'fields' in marketObject.content) {
302
302
  const fields = marketObject.content.fields as any;
@@ -840,7 +840,7 @@ export const getMarketCoinAmounts = async (
840
840
  const owner = ownerAddress || query.suiKit.currentAddress();
841
841
  const marketCoins = {} as OptionalKeys<Record<SupportMarketCoins, number>>;
842
842
 
843
- Promise.allSettled(
843
+ await Promise.allSettled(
844
844
  marketCoinNames.map(async (marketCoinName) => {
845
845
  const marketCoin = await getMarketCoinAmount(
846
846
  query,
@@ -28,15 +28,13 @@ export const getVescaKeys = async (
28
28
  let hasNextPage = false;
29
29
  let nextCursor: string | null | undefined = null;
30
30
  do {
31
- const paginatedKeyObjectsResponse = await query.suiKit
32
- .client()
33
- .getOwnedObjects({
34
- owner,
35
- filter: {
36
- StructType: veScaKeyType,
37
- },
38
- cursor: nextCursor,
39
- });
31
+ const paginatedKeyObjectsResponse = await query.cache.queryGetOwnedObjects({
32
+ owner,
33
+ filter: {
34
+ StructType: veScaKeyType,
35
+ },
36
+ cursor: nextCursor,
37
+ });
40
38
  keyObjectsResponse.push(...paginatedKeyObjectsResponse.data);
41
39
  if (
42
40
  paginatedKeyObjectsResponse.hasNextPage &&