@scallop-io/sui-scallop-sdk 2.0.13-merge-split-ve-sca-alpha.3 → 2.0.13-merge-split-ve-sca-alpha.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.0.13-merge-split-ve-sca-alpha.3",
3
+ "version": "2.0.13-merge-split-ve-sca-alpha.5",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -176,13 +176,15 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
176
176
  deactivateBoost: (obligation, veScaKey) => {
177
177
  builder.moveCall(
178
178
  txBlock,
179
- `${borrowIncentiveIds.borrowIncentivePkg}::user::deactivate_boost`,
179
+ `${borrowIncentiveIds.borrowIncentivePkg}::user::deactivate_boost_v2`,
180
180
  [
181
181
  borrowIncentiveIds.config,
182
182
  borrowIncentiveIds.incentivePools,
183
183
  borrowIncentiveIds.incentiveAccounts,
184
184
  obligation,
185
185
  veScaKey,
186
+ builder.address.get('vesca.subsTable'),
187
+ builder.address.get('vesca.subsWhitelist'),
186
188
  clockObjectRef,
187
189
  ]
188
190
  );
@@ -224,7 +226,9 @@ const generateBorrowIncentiveQuickMethod: GenerateBorrowIncentiveQuickMethod =
224
226
  (txn.target ===
225
227
  `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` ||
226
228
  txn.target ===
227
- `${builder.address.get('borrowIncentive.id')}::user::unstake_v2`)
229
+ `${builder.address.get('borrowIncentive.id')}::user::unstake_v2` ||
230
+ txn.target ===
231
+ `${builder.address.get('borrowIncentive.id')}::user::unstake`)
228
232
  );
229
233
 
230
234
  if (!obligationLocked || unstakeObligationBeforeStake) {
@@ -254,7 +258,9 @@ const generateBorrowIncentiveQuickMethod: GenerateBorrowIncentiveQuickMethod =
254
258
  (txn.target ===
255
259
  `${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` ||
256
260
  txn.target ===
257
- `${builder.address.get('borrowIncentive.id')}::user::unstake_v2`)
261
+ `${builder.address.get('borrowIncentive.id')}::user::unstake_v2` ||
262
+ txn.target ===
263
+ `${builder.address.get('borrowIncentive.id')}::user::unstake`)
258
264
  );
259
265
 
260
266
  if (!obligationLocked || unstakeObligationBeforeStake) {
@@ -426,7 +426,16 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
426
426
  veScaKey,
427
427
  builder.address.get('vesca.subsTable')
428
428
  );
429
- if (isKeyInSubTable) {
429
+
430
+ const unstakeObligationBeforeStake =
431
+ !!txBlock.txBlock.blockData.transactions.find(
432
+ (txn) =>
433
+ txn.kind === 'MoveCall' &&
434
+ txn.target ===
435
+ `${builder.address.get('borrowIncentive.id')}::user::unstake_v2`
436
+ );
437
+
438
+ if (isKeyInSubTable && !unstakeObligationBeforeStake) {
430
439
  throw new Error(
431
440
  'Key cannot be in the subs table, please call unsubscribe vesca or unstake obligation first'
432
441
  );
@@ -455,9 +464,18 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
455
464
  ),
456
465
  ]);
457
466
 
458
- console.log({ isTargetInSubTable, isSourceInSubTable });
467
+ const unstakeObligationBeforeStake =
468
+ !!txBlock.txBlock.blockData.transactions.find(
469
+ (txn) =>
470
+ txn.kind === 'MoveCall' &&
471
+ txn.target ===
472
+ `${builder.address.get('borrowIncentive.id')}::user::unstake_v2`
473
+ );
459
474
 
460
- if (isTargetInSubTable || isSourceInSubTable) {
475
+ if (
476
+ (isTargetInSubTable || isSourceInSubTable) &&
477
+ !unstakeObligationBeforeStake
478
+ ) {
461
479
  throw new Error(
462
480
  'Both target and source cannot be in the subs table. Please call unsubscribe vesca or unstake obligation first'
463
481
  );