@scallop-io/sui-scallop-sdk 2.1.7 → 2.1.8

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.7",
3
+ "version": "2.1.8",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -490,6 +490,28 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
490
490
  );
491
491
  }
492
492
 
493
+ const [sourceVesca, targetVesca] = await Promise.all([
494
+ getVeSca(builder.utils, sourceKey),
495
+ getVeSca(builder.utils, targetKey),
496
+ ]);
497
+
498
+ if (!sourceVesca || !targetVesca) {
499
+ throw new Error('Source or target veSCA not found');
500
+ }
501
+
502
+ // Extend lock period to the max of both veSca
503
+ if (sourceVesca.unlockAt < targetVesca.unlockAt) {
504
+ txBlock.extendLockPeriod(
505
+ sourceVesca.keyId,
506
+ targetVesca.unlockAt / 1000
507
+ );
508
+ } else if (sourceVesca.unlockAt > targetVesca.unlockAt) {
509
+ txBlock.extendLockPeriod(
510
+ targetVesca.keyId,
511
+ sourceVesca.unlockAt / 1000
512
+ );
513
+ }
514
+
493
515
  return txBlock.mergeVeSca(targetKey, sourceKey);
494
516
  },
495
517
  };