@scallop-io/sui-scallop-sdk 2.0.13-merge-split-ve-sca-alpha.1 → 2.0.13-merge-split-ve-sca-alpha.3
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
|
@@ -122,7 +122,7 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
|
|
|
122
122
|
stakeObligationWithVesca: (obligationId, obligationKey, veScaKey) => {
|
|
123
123
|
builder.moveCall(
|
|
124
124
|
txBlock,
|
|
125
|
-
`${borrowIncentiveIds.borrowIncentivePkg}::user::
|
|
125
|
+
`${borrowIncentiveIds.borrowIncentivePkg}::user::stake_with_ve_sca_v2`,
|
|
126
126
|
[
|
|
127
127
|
borrowIncentiveIds.config,
|
|
128
128
|
borrowIncentiveIds.incentivePools,
|
|
@@ -134,6 +134,8 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
|
|
|
134
134
|
veScaIds.treasury,
|
|
135
135
|
veScaIds.table,
|
|
136
136
|
veScaKey,
|
|
137
|
+
builder.address.get('vesca.subsTable'),
|
|
138
|
+
builder.address.get('vesca.subsWhitelist'),
|
|
137
139
|
clockObjectRef,
|
|
138
140
|
],
|
|
139
141
|
[]
|
|
@@ -142,13 +144,15 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
|
|
|
142
144
|
unstakeObligation: (obligationId, obligationKey) => {
|
|
143
145
|
builder.moveCall(
|
|
144
146
|
txBlock,
|
|
145
|
-
`${borrowIncentiveIds.borrowIncentivePkg}::user::
|
|
147
|
+
`${borrowIncentiveIds.borrowIncentivePkg}::user::unstake_v2`,
|
|
146
148
|
[
|
|
147
149
|
borrowIncentiveIds.config,
|
|
148
150
|
borrowIncentiveIds.incentivePools,
|
|
149
151
|
borrowIncentiveIds.incentiveAccounts,
|
|
150
152
|
obligationKey,
|
|
151
153
|
obligationId,
|
|
154
|
+
builder.address.get('vesca.subsTable'),
|
|
155
|
+
builder.address.get('vesca.subsWhitelist'),
|
|
152
156
|
clockObjectRef,
|
|
153
157
|
]
|
|
154
158
|
);
|
|
@@ -220,7 +224,7 @@ const generateBorrowIncentiveQuickMethod: GenerateBorrowIncentiveQuickMethod =
|
|
|
220
224
|
(txn.target ===
|
|
221
225
|
`${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` ||
|
|
222
226
|
txn.target ===
|
|
223
|
-
`${builder.address.get('borrowIncentive.id')}::user::
|
|
227
|
+
`${builder.address.get('borrowIncentive.id')}::user::unstake_v2`)
|
|
224
228
|
);
|
|
225
229
|
|
|
226
230
|
if (!obligationLocked || unstakeObligationBeforeStake) {
|
|
@@ -250,7 +254,7 @@ const generateBorrowIncentiveQuickMethod: GenerateBorrowIncentiveQuickMethod =
|
|
|
250
254
|
(txn.target ===
|
|
251
255
|
`${OLD_BORROW_INCENTIVE_PROTOCOL_ID}::user::unstake` ||
|
|
252
256
|
txn.target ===
|
|
253
|
-
`${builder.address.get('borrowIncentive.id')}::user::
|
|
257
|
+
`${builder.address.get('borrowIncentive.id')}::user::unstake_v2`)
|
|
254
258
|
);
|
|
255
259
|
|
|
256
260
|
if (!obligationLocked || unstakeObligationBeforeStake) {
|
|
@@ -75,14 +75,14 @@ export const isInSubsTable = async (
|
|
|
75
75
|
) => {
|
|
76
76
|
const [builder, veScaKey, tableId] = params;
|
|
77
77
|
try {
|
|
78
|
-
const
|
|
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
|
|
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.
|
|
449
|
+
builder.address.get('vesca.subsTableId')
|
|
451
450
|
),
|
|
452
451
|
isInSubsTable(
|
|
453
452
|
builder,
|
|
454
453
|
sourceKey,
|
|
455
|
-
builder.address.get('vesca.
|
|
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'
|