@scallop-io/sui-scallop-sdk 2.0.13-merge-split-ve-sca-alpha.1 → 2.0.13-merge-split-ve-sca-alpha.2

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.0.13-merge-split-ve-sca-alpha.1",
3
+ "version": "2.0.13-merge-split-ve-sca-alpha.2",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -75,14 +75,14 @@ export const isInSubsTable = async (
75
75
  ) => {
76
76
  const [builder, veScaKey, tableId] = params;
77
77
  try {
78
- const _resp = await builder.cache.queryGetDynamicFieldObject({
78
+ const resp = await builder.cache.queryGetDynamicFieldObject({
79
79
  parentId: tableId,
80
80
  name: {
81
81
  type: '0x2::object::ID',
82
82
  value: veScaKey,
83
83
  },
84
84
  });
85
- return true;
85
+ return !!resp?.data;
86
86
  } catch (e) {
87
87
  console.error(e);
88
88
  return false;
@@ -433,9 +433,8 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
433
433
  }
434
434
 
435
435
  const newVeScaKey = txBlock.splitVeSca(veScaKey, splitAmount);
436
- // txBlock.addMergeSplitSub(newVeScaKey);
437
436
  if (transferVeScaKey) {
438
- txBlock.transferObjects(newVeScaKey, requireSender(txBlock));
437
+ txBlock.transferObjects([newVeScaKey], requireSender(txBlock));
439
438
  return;
440
439
  } else {
441
440
  return newVeScaKey as QuickMethodReturnType<S>;
@@ -447,15 +446,17 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
447
446
  isInSubsTable(
448
447
  builder,
449
448
  targetKey,
450
- builder.address.get('vesca.subsTable')
449
+ builder.address.get('vesca.subsTableId')
451
450
  ),
452
451
  isInSubsTable(
453
452
  builder,
454
453
  sourceKey,
455
- builder.address.get('vesca.subsTable')
454
+ builder.address.get('vesca.subsTableId')
456
455
  ),
457
456
  ]);
458
457
 
458
+ console.log({ isTargetInSubTable, isSourceInSubTable });
459
+
459
460
  if (isTargetInSubTable || isSourceInSubTable) {
460
461
  throw new Error(
461
462
  'Both target and source cannot be in the subs table. Please call unsubscribe vesca or unstake obligation first'