@scallop-io/sui-scallop-sdk 2.1.3 → 2.1.5

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": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -89,7 +89,11 @@ export const isInSubsTable = async (
89
89
  value: veScaKey,
90
90
  },
91
91
  });
92
- return !!resp?.data;
92
+
93
+ if (!resp?.data) return false;
94
+
95
+ const contents = (resp.data.content as any).fields.value.fields.contents;
96
+ return Array.isArray(contents) && contents.length > 0;
93
97
  } catch (e) {
94
98
  console.error(e);
95
99
  return false;
@@ -463,19 +467,19 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
463
467
  },
464
468
  mergeVeScaQuick: async (targetKey: string, sourceKey: string) => {
465
469
  // check targetKey and sourceKey
470
+ const table = builder.address.get('vesca.subsTableId');
466
471
  const [isTargetInSubTable, isSourceInSubTable] = await Promise.all([
467
- isInSubsTable(
468
- builder,
469
- targetKey,
470
- builder.address.get('vesca.subsTableId')
471
- ),
472
- isInSubsTable(
473
- builder,
474
- sourceKey,
475
- builder.address.get('vesca.subsTableId')
476
- ),
472
+ isInSubsTable(builder, targetKey, table),
473
+ isInSubsTable(builder, sourceKey, table),
477
474
  ]);
478
475
 
476
+ console.log({
477
+ targetKey,
478
+ sourceKey,
479
+ isTargetInSubTable,
480
+ isSourceInSubTable,
481
+ });
482
+
479
483
  const unstakeObligationBeforeStake =
480
484
  !!txBlock.txBlock.blockData.transactions.find(
481
485
  (txn) =>
@@ -388,8 +388,7 @@ class ScallopUtils implements ScallopUtilsInterface {
388
388
  });
389
389
 
390
390
  if (assetCoinName) {
391
- const parsedPrice = feed.getEmaPriceUnchecked();
392
-
391
+ const parsedPrice = feed.getPriceUnchecked();
393
392
  return {
394
393
  coinName: assetCoinName,
395
394
  price: parsedPrice.getPriceAsNumberUnchecked(),