@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/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/src/builders/vescaBuilder.ts +22 -0
package/package.json
CHANGED
|
@@ -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
|
};
|